As per ReadMe.md file this protocol is compatible with any ERC20 tokens which follows ERC20 standard, if so then in CapitalPool::approve()
the approval of type(uint256).max
will not work for all ERC20 tokens, such tokens reverts on max approval.
The CapitalPool::approve()
gives approval to TokenManager contract to spend type(uint256).max
amount of token for all kind of token address which is passed to it as argument. However, not all ERC20 tokens allows approval of type(uint256).max
, for ex- UNI, COMP. As reference on it these - 1 & 2 will work perfectly.
The related code block is this:
Max approval will revert for some ERC20 tokens.
Manual review
Protocol should allow certain tokens which is compatible with type(uint256).max approval.
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.