DittoETH

Ditto
DeFiFoundryOracle
55,000 USDC
View results
Submission Details
Severity: medium
Invalid

Large transfers may not work with some ERC20 tokens

Summary

Certain IERC20 tokens , such as UNI and COMP, may not handle large transfers (values larger than uint96) correctly due to limitations in their implementations. This limitation could affect users attempting to perform large transfers with these tokens.Both of the above tokens have special case logic in approve that sets allowance to type(uint96).max if the approval amount is uint256(-1), which may cause issues with systems that expect the value passed to approve to be reflected in the allowances mapping.

Vulnerability Details

function depositAsset(address asset, uint104 amount)// @audit revert some IERC20 amount is greater then uint96
external
onlyValidAsset(asset)
isNotFrozen(asset)
nonReentrant
{
if (amount == 0) revert Errors.PriceOrAmountIs0();
IERC20(asset).burnFrom(msg.sender, amount);// @audit revert some IERC20 amount is greater then uint96
s.assetUser[asset][msg.sender].ercEscrowed += amount;
}
function withdrawAsset(address asset, uint104 amount) // @audit revert some IERC20 amount is greater then uint96
external
onlyValidAsset(asset)
nonReentrant
{
if (amount == 0) revert Errors.PriceOrAmountIs0();
STypes.AssetUser storage AssetUser = s.assetUser[asset][msg.sender];
if (amount > AssetUser.ercEscrowed) revert Errors.InsufficientERCEscrowed();
AssetUser.ercEscrowed -= amount;
IERC20(asset).mint(msg.sender, amount);// @audit revert some IERC20 amount is greater then uint96
}

Impact

Users attempting to transfer or approve values larger than uint96 may experience failed transactions when interacting with tokens that have this limitation
In some cases, users may unintentionally lose funds if the transaction fails or behaves unexpectedly.

Tools Used

Manual Review

Updates

Lead Judging Commences

0xnevi Lead Judge
almost 2 years ago
0xnevi Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

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