Skip to content

Error: Returned error: sender doesn't have enough funds to send tx. The upfront cost is: 134439500000000000 and the sender's account only has: 0 #1047

@yann-nshare

Description

@yann-nshare

i have a problem with a transfer my code
i using ganache with fork of avalanche mainnet and truffle

code of my erc20.js ->
const BN = require("bn.js");
const {WETH, USDT, USDT_WHALE, USDC_WHALE} = require("./config");

const IERC20 = artifacts.require("IERC20");

contract("IERC20", (accounts) => {
const TOKEN = "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7";
const WHALE = "0xDFE521292EcE2A4f44242efBcD66Bc594CA9714B";

let token;
beforeEach(async () => {
token = await IERC20.at(TOKEN);
});

it("should pass", async () => {
const bal = await token.balanceOf(accounts[0]);
console.log(ballance of whale: ${bal});
});

it("should transfer", async () => {
const bal = await token.balanceOf(WHALE);
const bal_r = await token.balanceOf("0x2DE261DAd2609f435d98De04AF6a9A58D8B023ac");
await token.transfer("0x2DE261DAd2609f435d98De04AF6a9A58D8B023ac", 1, { from: WHALE });
console.log(bal of spender: ${bal});
console.log(bal of recipied: ${bal_r});
});
});

ganache commande line for fork -> ganache-cli --fork https://api.avax.network/ext/bc/C/rpc -u 0x5754284f345afc66a98fbB0a0Afe71e0F007B949 -u 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7 -u 0xDFE521292EcE2A4f44242efBcD66Bc594CA9714B --networkId *

my truffle config ->
const HDWalletProvider = require('@truffle/hdwallet-provider');
const fs = require('fs');
const { mnemonic, BSCSCANAPIKEY} = require('./env.json');
//75501080-47e0-4ccc-8c44-63bb33b3d595
module.exports = {
plugins: [
'truffle-plugin-verify'
],
api_keys: {
bscscan: BSCSCANAPIKEY
},
networks: {
mainnet_fork: {
host: '127.0.0.1',
port: 8545,
network_id: "*",
//gas: 3000000,
//gasPrice: 225000000000,
},
ethereum: {
from: "0x2DE261DAd2609f435d98De04AF6a9A58D8B023ac",
provider: () => new HDWalletProvider(mnemonic, 'https://mainnet.infura.io/v3/a820afbf0ce840e197b44ec90cf4d69c'),
network_id: 1,
confirmations: 10,
timeoutBlocks: 200,
skipDryRun: true
},
bscTestnet: {
from: "0x2DE261DAd2609f435d98De04AF6a9A58D8B023ac",
provider: () => new HDWalletProvider(mnemonic, 'https://data-seed-prebsc-1-s1.binance.org:8545'),
network_id: 97,
confirmations: 10,
timeoutBlocks: 200,
skipDryRun: true
},
bsc: {
from: "0x2DE261DAd2609f435d98De04AF6a9A58D8B023ac",
provider: () => new HDWalletProvider(mnemonic, 'https://bsc-dataseed1.binance.org'),
network_id: 56,
confirmations: 10,
timeoutBlocks: 200,
skipDryRun: true
},
},
mocha: {
timeout: 100000
},
compilers: {
solc: {
version: "0.8.4",
//settings: { // See the solidity docs for advice about optimization and evmVersion
// optimizer: {
// enabled: false,
// runs: 200
// },
// evmVersion: "byzantium"
//}
}
}
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions