Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12231

"ERC20: transfer amount exceeds balance"

$
0
0

I try to send VivaFTN from wallet 1 to wallet 2, but it shows the following error:

Preparing to transfer VIVAFTN to 0xea078983f6Ae89bB5e2fAE5e531cE11B1B845292Error: execution reverted: "ERC20: transfer amount exceeds balance" (action="estimateGas", data="0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002645524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63650000000000000000000000000000000000000000000000000000", reason="ERC20: transfer amount exceeds balance", transaction={ "data": "0xa9059cbb000000000000000000000000ea078983f6ae89bb5e2fae5e531ce11b1b8452920000000000000000000000000000000000000000000000adb18ad80e7d980000", "from": "0x50352A5B2Ab9254Ab49870F1D671616F8791171b", "to": "0xf93D24c03344B5e697ad83D59cAa1c5817973365" }, invocation=null, revert={ "args": [ "ERC20: transfer amount exceeds balance" ], "name": "Error", "signature": "Error(string)" }, code=CALL_EXCEPTION, version=6.13.0)

My wallet has enough VivaFTN balance for the gas fee and the transaction.

This is my transferVivaFtn function:

async function transferVivaFtn(privateKey, receiverAddress, amount) {    const wallet = new Wallet(privateKey, (await provider));    const contractWithSigner = contract.connect(wallet);    const gasPrice = await getGasPrice();    const tx = await contractWithSigner.transfer(receiverAddress, amount, {        gasPrice: gasPrice    });    return tx.hash;}

And this is the getGasPrice function:

async function getGasPrice() {    let feeData = (await provider.getFeeData())    const gasPrice = feeData.gasPrice.toString()    return gasPrice}

Viewing all articles
Browse latest Browse all 12231

Trending Articles