The GmxProxy contract uses an unsafe token approval pattern in the createOrder function that could lead to failed transactions with certain ERC20 tokens like USDT that require allowance to be set to 0 before updating to a new value.
The safeApprove() function is called directly with a new allowance value without first resetting it to zero. Some ERC20 tokens (notably USDT) implement strict requirements where:
If current allowance is not zero, you must first set it to zero
Only then can you set it to a new non-zero value
This implementation pattern can cause transactions to revert when:
There's an existing non-zero allowance
The token implements strict allowance checks
Multiple orders are created with different allowance amounts
Severity: High
Likelihood: High for tokens like USDT
Impact: Critical as it can block core protocol functionality
The issue could:
Cause order creation to fail
Block users from opening positions
Require manual intervention to reset approvals
Manual code review
Solidity visual developer
Historical examples of similar issues with USDT
Implement a safe approval pattern that works with all ERC20 tokens:
Alternatively, consider using OpenZeppelin's safeIncreaseAllowance():
USDT or other unusual ERC20 tokens: out of scope. For the other reports: No proof that the allowance won't be consumed by the receiver.
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.