Categories
Mastering Development

How to read updated data in a stored procedure called multiple times simultaneously

There are 2 tables: Wallets; Transactions. There is a stored procedure that handles (I think with ACID operation): updating on Wallet table inserting one row into Transactions table every time it is called. The issue occurs when there are many calls to the SP at same time, infact the value of PreviousBalance is not correct […]

Categories
Ask Engineering Software Engineering

Document containing relevant data in meta-data

I find myself working with documents that need to be displayed to a user and at the same time, I need the information that they bear. For example, you have a generated PDF document (or other "visible" format) that represents an invoice. I need to have the document to display it to the user and […]

Categories
Cryptocurrency Ethereum Mastering Development

Can’t estimate gas on Infura using web3 or axios

I’m trying to estimate gas required to transfer usdt using Infura node but always receive gas required exceeds allowance (12451164) or always failing transaction error. I have tried both using web3 and post (via axios) and both return same error. Axios attempt: export const estimateUsdtGas: EstimateGasType = async ({ web3 }, to, amount, wallet) => […]

Categories
Database Development

Why is PostgreSQL Not Using My Index?

I have the following query: SELECT "account_transactions"."subsidiary_id" FROM "account_transactions" WHERE (transaction_type = ‘loan_payment’ AND amount > 0 AND status = ‘approved’) AND (DATE(transacted_at) >= ‘2020-08-01’ AND DATE(transacted_at) <= ‘2020-08-31’ AND subsidiary_type = ‘Loan’) ORDER BY transacted_at ASC I identified that it was considered a slow query so I’m trying to optimize it by applying an […]

Categories
Cryptocurrency Ethereum Mastering Development

How can i call function from contract deposit() with send but without open modal window?

Code: var getbalance = await window.tronWeb.trx.getBalance(); var amount = $("#txtAmount").val() * 1e6; var balance = getbalance; if (amount <= balance) { var obj = setInterval(async () => { if (window.tronWeb && window.tronWeb.defaultAddress.base58) { clearInterval(obj) var tronweb = window.tronWeb var tx = await tronweb.transactionBuilder.sendTrx(‘……….’, amount, window.tronWeb.defaultAddress.base58) var signedTx = await tronweb.trx.sign(tx) var broastTx = await tronweb.trx.sendRawTransaction(signedTx) […]

Categories
Mastering Development

Call stored procedures with codeigniter

I have read a lot to manage stored procedures with Codeigniter but it didn’t work. Here is my issue: I have to import 2 files in my SQL database. The 1st one contains main datas for table A. The 2nd one have some datas to calcultate with rates and to import (insert into select) into […]

Categories
Cryptocurrency Ethereum Mastering Development

Gas Estimation Failing in Remix on Mint

When I run the mint function with the following code, minting fails: import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.0/contracts/token/ERC20/ERC20.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.0/contracts/access/AccessControl.sol"; contract TOKEN is ERC20, AccessControl { bytes32 public constant MINTER_ROLE = keccak256("MINTER"); uint256 public constant mint_cap = 100000; constructor (string memory ABraCaDabra, string memory ABCD) ERC20(ABraCaDabra, ABCD) public { _setupDecimals(2); _mint(msg.sender, 1000 * 10 ** 2); _mint(address, 1000 * […]

Categories
Cryptocurrency Ethereum Mastering Development

How to retrieve transaction information?

I’m trying to retrieve information after a send() function My Code; export const depositEther = (dispatch, exchange, web3, amount, account) => { exchange.methods.depositEther().send({ from: account, value: web3.utils.toWei(amount, ‘ether’)}) .on(‘transcationHash’, (hash) => { dispatch(balancesLoading()) alert(hash) }) .on(‘error’, (error) => { console.log(error) window.alert(‘There was an error depositing Ether’) }) } Even if the transaction is executed I […]

Categories
Mastering Development

How to insert variable values in between a string in PHP?

I am trying to build a MySQL Query, and I want my final query to look like this – INSERT INTO table1 (‘txnid’, ‘date’, ‘amount’, ‘name’, ’email’, ‘mobile’, ‘city’) VALUES (‘$txnid‘, ‘$date‘, ‘$amount‘, ‘$name‘, ‘$email‘, ‘$mobile‘, ‘$city‘) I have all the required variables ready, I just don’t know how to pass their values in between […]

Categories
Cryptocurrency Ethereum Mastering Development

Out of stack DUP2 1/1024 when adding string to parameter

The below function was working fine until I added a string parameter and saved the string to a mapping. Now when I call it it fails with an ‘out of stack’ exception. Is there something I’m doing wrong related to strings? What would cause an out of stack exception in this case? function launch(uint256 amount, […]