In CaptitalPool, some ERC20 tokens do not support type(uint256).max approval. This will cause tokenManager has no allowance to transfer tokens in CaptitalPool and anyone cannot withdraw tokens.
In readme, we notice that the tadle protocol will be compatible with any EVM, any ERC20 Tokens that follow ERC20 standard.
In EIP20 standard(https://github.com/ethereum/ercs/blob/master/ERCS/erc-20.md), we define the approve function :
function approve(address _spender, uint256 _value) public returns (bool success). However, the standard does not mention that the ERC20 token must support type(uint256).max approval.
Actually, some ERC20 tokens don't support type(uint256).max approval, such as UNI, COMP, the approve() will be reverted if the approved value is larger than uint96.
When users want to withdraw funds via TokenManager, TokenManager will transfer funds from CapitalPool to users. This operation can be done if we can call CapitalPool::approve() correctly. However, just like what I mention above, if the token is UNI or COMP, the approve() will be reverted, and users cannot withdraw funds via TokenManager.
If the token is UNI or COMP, users cannot withdraw funds via TokenManager.
Manual
One easy way is not including UNI or COMP into the whitelist. If we want to be more flexible, we can add another onlyOwner approve(token_address, amount) version. Owners can configure correctly according to different ERC20 Token's characteristic.
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.