-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Massive USDT Approval costs #133
Comments
Hi there, the problem you're experiencing is due to USDT that is not fully compliant with ERC20. Here's a sneak peek of USDT's contract code (hint: solution in the comment): Alternatively here is a popular article: https://forum.openzeppelin.com/t/can-not-call-the-function-approve-of-the-usdt-contract/2130 In a nutshell, if you approved a certain address to spend a certain amount X in the past and spender didn't consume all the allowance (< X), you have to first reset allowance by calling |
Hi @mwamedacen, You are totally right on this one. The address of the paraswap transferrer contract has already been approved with an amount X, which led to the high gas consumption on approving USDT. On checking my dapp why the approving call is made while the contract is already approved I found the root of this problem. The API call for getting token allowance is not working for me on the Ethereum Mainchain. On polygon everything is running fine and i get correct allowance values for several different tokens. On Ethereum I get a "Not found" response. I finally did a workaround by getting the transferrer address and checking it by myself with a direct contract call for the token allowance, but the getAllowance function is not working for me on Ethereum. Maybe you can proof this issue. paraswap.setWeb3Provider(web3.library);
const allowanceRes: any = await paraswap.getAllowance(
web3.account,
from.address
); Is always returning "not found" on Ethereum with different tokens.
|
Hi @laraschke, What did you use to connect wallet. |
Hey everyone,
i integrated the paraswap api into my dapp. Everything is looking good and running fine. I can approve and exchange various ERC20 tokens on Ethereum as well as Polygon with "normal" expected gas costs.
I am facing an unexpected problem by approving the paraswap api for USDT access. The fees for an approval transaction is 300 - 1000 times higher than for other tokens.
The function call looks like this:
To find the root of the problem i tried to fire the approve transaction separately on Etherscan. Weirdly, approving any random address has expectable gas cost except of the paraswap transferrer contract. By calling the approve function on USDT contract with paraswap contract as spender (0x216B4B4Ba9F3e719726886d34a177484278Bfcae) the gas costs are just exploding.
Hopefully anybody can help me out.
The text was updated successfully, but these errors were encountered: