Troubleshooting Errors

Debugging transactions on mainnet / Ropsten / Kovan

If your contracts are successfully deployed on a public network, then you can use the very useful service Tenderly.

Tenderly allows you to debug transactions, just like you would on a local instance, using their powerful tools. If your transaction has reverted, try using their debugger to find the line of code where your transaction failed.

Debugging transactions in Truffle

If you have an instance of Truffle running (e.g. console or develop), then you can debug specific transactions using debug YOUR_TX_HASH into your Truffle instance. For more information, see the ez-flashloan starter template README.MD.

EVM revert SafeERC20: low-level call failed

This error indicates that a call to the SafeERC20 implementation of a function has failed. In production, you want to keep using these SafeERC20 implementations.

However in testing, you may want more precise EVM error messages by removing the SafeERC20 implementations. You can do this by replacing the SafeERC20 calls with standard ERC20 calls. For example, in the ez-flashloan starter template, replace the following:

IERC20(_reserve).safeTransfer(_destination, _amount);

with:

IERC20(_reserve).transfer(_destination, _amount);

You will then receive standard EVM error messages if it reverts on this line, which can sometimes be more helpful for debugging purposes.

Web3 error: nonce too low

This error is usually due to the nonce that is being used by your web3 wallet, when creating a transaction to send. It means that the nonce being used is not correct, as the Ethereum node your wallet is communicating with indicates that there is a more recent transaction (with a higher nonce). Here is a good overview of nonces in Ethereum transactions.

Some potential solutions:

  • If using a web3 wallet such as MetaMask: Go to your MetaMask settings --> Advanced --> Reset Account. This will reset the transaction history stored in your local browser cache, including the nonce count. The next transaction you send will use the most recent nonce from the Ethereum node your wallet is connected to.

  • If the error is not coming from your web3 wallet, then it may be due to the Ethereum node it is connected to. For services such as Infura, their network consist of many servers, where a previously submitted transaction may not be present on the server you are currently connected to. In these cases, wait a few minutes, then try again.

Last updated