DeFiFoundry
50,000 USDC
View results
Submission Details
Severity: medium
Invalid

USDT's non-standard approve behavior can cause deposits to fail

Description:

The PerpetualVault contract supports USDT as a collateral token

/**
* @notice
* `collateralToken` can be ETH, WETH, BTC, LINK, UNI, USDC, USDT, DAI, FRAX.
*/

but doesn't account for USDT's non-standard approve/transferFrom implementation:

// In PerpetualVault.sol:
function deposit(uint256 amount) external payable nonReentrant {
// ...
collateralToken.safeTransferFrom(msg.sender, address(this), amount);
// ...
}

USDT has specific requirements:

  • Requires allowance to exactly match the transfer amount

  • Requires setting allowance to 0 before setting a new allowance

  • Will revert if allowance > transfer amount

This behavior is different from standard ERC20 tokens and can lead to failed deposits.

Impact:

  • Causes failed transactions and wasted gas fees

  • Affects protocol adoption due to USDT being a major stablecoin

Recommended Mitigation:

Add allowance validation check

Updates

Lead Judging Commences

n0kto Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Out of scope
n0kto Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Out of scope

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.