Forked Mainnet `INSUFFICIENT_OUTPUT_AMOUNT` on a transaction

I am currently using ganache and forked mainnet to test if a transaction in advance will fail or not. I get error INSUFFICIENT_INPUT_AMOUNT on ganache while the tx success on mainnet and observed that this occur if the sender eth balance is less than their input also if they use different token as input. How do I make it relative to the input value to avoid the error?

The snippet:

const localTx =
    {
      from: tx.from,
      to: tx.to,
      value: tx.value,
      gasPrice: tx.gasPrice,
      gasLimit: tx.gas,
      input: tx.input,
    };

    await localWeb3.eth.sendTransaction(localTx)
    .on('error', (err) => { console.log(err) })
1 Like

Hi @jmarrr,

I am not sure what you mean. Are you able to create a simple example to reproduce?

I didn’t see input as part of sendTransaction: https://web3js.readthedocs.io/en/v1.3.0/web3-eth.html#eth-sendtransaction

That exact snippet can be used to reproduce the issue, need to connect to a forked mainnet then grab the pending transactions and insert the data to localTx variable, the input is coming from the pending transaction.

1 Like

Hi @jmarrr,

Sorry this isn’t something I have played with, so don’t have anything to suggest. You could try asking the Truffle community as you are using Ganache.