Usdt approve transaction keeps failing

hello, i am creating a dapp that requires users to approve usdt for transfer but whenever metamask pops up for usdt approval the transaction keeps on failing after i click the approve button.

i imported the usdt address and abi from the etherscan website and stored them in a json file which was imported into my react component for use.

after importing the json file i then use it like this

const usdt = new ethers.Contract(Usdt.address, Usdt.abi, signer)

then i call the approve function like this

await usdt.approve(Greeter.address, usdtBalance, {gasLimit:23600})

please what am i doing wrong?

1 Like

For me it looks like everything is fine.
It may just be the wrong address, abi.
Maybe the gasLimit is too low, so try to remove this.

I already increased the gas limit to 100000 but it still didn’t work. It worked the very first time I tried it but from the second time to now it keeps failing.

Hey @Nuel can you show the error?

Thanks, if you can please share the tx here

I reset my Metamask account so i currently do not have the transaction on there anymore.

you just sent it here. Just copy the link of bscscan

I think your gas limit is a little low.

I’ve used 100000 in a previous transaction and the same thing happened

The transaction goes through once (the first time) for every account and after that if you try to approve again with the same account it shows transaction failed

@Skyge I’ve used 100000 in a previous transaction and the same thing happened

@FreezyEx https://etherscan.io/tx/0x09a7576caef154785c5f0ecb092bd6148bd1745df5917abee29aa9b7388d70ec

As described in Tether code:

To change the approve amount you first have to reduce the addresses allowance to 0 calling
approve(spender, 0)

1 Like

@FreezyEx thank you so much for your help.

Let me go and try it out.

@FreezyEx does this also apply to bnb and hex?

Bnb on Bsc is native token so you don't have to approve it.
For others BEP20 /ERC20 you should check the code.

I hope you got the problem fixed now? I read through the post

Hello, were you able to solve this? Because the same thing happens to me and I can't solve it.

I read that it is because the gas to be used cannot be calculated because a third-party contract is used.