Tadle is supposed to be compatible with all the tokens that follow the ERC20 standard but the approve()function of CapitalPool.sol is not compatible with all the tokens.
Some tokens (e.g. UNI, COMP) revert if the value passed to approve or transfer is larger than uint96. But in the approve()function of CapitalPool.sol:
It directly approves to type(uint256.max).
UNI, COMP tokens are not compatible with the protocol and will revert when approve() function is called to approve these tokens to tokenManager.
For more reference: https://github.com/d-xo/weird-erc20?tab=readme-ov-file#revert-on-large-approvals--transfers
Manual Analysis
Modify the approve function to allow the user to approve any amount they want.
Thanks for flagging, indeed since uint(-1) is representative of max uint256 value, when entering the `if` statement, it will be converted to uint96 max amout, so it will not revert as described. In issue #361, the mockToken utilized does not correctly reflect the below approval behavior. ```Solidity function approve(address spender, uint rawAmount) external returns (bool) { uint96 amount; if (rawAmount == uint(-1)) { amount = uint96(-1); } else { amount = safe96(rawAmount, "Comp::approve: amount exceeds 96 bits"); } ```
Thanks for flagging, indeed since uint(-1) is representative of max uint256 value, when entering the `if` statement, it will be converted to uint96 max amout, so it will not revert as described. In issue #361, the mockToken utilized does not correctly reflect the below approval behavior. ```Solidity function approve(address spender, uint rawAmount) external returns (bool) { uint96 amount; if (rawAmount == uint(-1)) { amount = uint96(-1); } else { amount = safe96(rawAmount, "Comp::approve: amount exceeds 96 bits"); } ```
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.