Function Call Error – Troubleshooting Deployed Contract Function Calls

contract-deploymenterc-20functiongas-estimatetransactions

Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
execution reverted: ERC20: insufficient allowance
{
"originalError": {
"code": 3,
"data": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001d45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000",
"message": "execution reverted: ERC20: insufficient allowance"
}
}

I found a repository on github that I am trying to experiment with at this link https://github.com/filipdujmusic/pontoon-contracts-poc . I compiled and deployed all three smart contracts there using remix IDE. I'm now trying to call the createBuyOrder function from the deployed OrderBook contract, but I'm getting the aforementioned error. Would highly appreciate if someone could assist with helping me see how I can fix this.

Best Answer

I think you need to increase the allowance. The smart contract is probably trying to use some of your tokens for some reasons and can't do that since you haven't allowed the smart contract to use some of your tokens.

So you should call the allowance function of the erc20 with, as parameters, the address of that smart contract and how many token you allow it to use.

What function are you trying to call when you are getting this error?

Related Topic