The GmxProxy::createOrder function is incompatible with USDT due to its non-standard “approve-reset” pattern, leading to transaction reverts when USDT is used as a collateral token.
USDT implements a non-standard approve function that requires resetting the approval to 0 before setting a new allowance.
The relevant code from the USDT contract:
https://etherscan.io/address/0xdac17f958d2ee523a2206206994597c13d831ec7
According to PerpetualVault.sol,
collateralToken
can be ETH, WETH, BTC, LINK, UNI, USDC, USDT, DAI, FRAX.
The GmxProxy::createOrder function does not account for this special requirement, causing transactions to fail when USDT is used as the collateral token.
Additionally, OpenZeppelin’s safeApprove function does not handle this “approve-reset” pattern, making it ineffective for USDT approvals.
Any attempt to use USDT in GmxProxy::createOrder results in a revert
N/A
Modify the GmxProxy::createOrder to first set approval to 0 before setting the new allowance.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.