Platform: Code4rena
Start Date: 16/09/2021
Pot Size: $50,000 USDC
Total HM: 26
Participants: 30
Period: 7 days
Judge: GalloDaSballo
Total Solo HM: 17
Id: 36
League: ETH
Rank: 19/30
Findings: 1
Award: $484.27
🌟 Selected for report: 1
🚀 Solo Findings: 0
🌟 Selected for report: defsec
333.9773 USDC - $333.98
defsec
During the manual code review, It has been observed that zero value has not been checked on that "ibRatio" variable. That can cause miscalculation of the liquidity.
""" ibRatio = newRatio; """
""" function pushUnderlying(uint256 amount, address to) private { for (uint256 i = 0; i < weights.length; i++) { uint256 tokenAmount = amount * weights[i] * ibRatio / BASE / BASE; IERC20(tokens[i]).safeTransfer(to, tokenAmount); } } """
None
Validate to ibRatio variable is more than zero.
""" require(ibRation > 0 , "ibRatio should be more than zero"); """
#0 - GalloDaSballo
2021-12-04T17:46:14Z
Agree that a check would help
150.2898 USDC - $150.29
defsec
This is probably an oversight since SafeERC20 was imported and safeTransfer() was used for ERC20 token transfers. Nevertheless, note that approve() will fail for certain token implementations that do not return a boolean value (). Hence it is recommend to use safeApprove().
Manual Code Review
Update to _token.safeApprove(spender, type(uint256).max) in approveUnderlying().
#0 - frank-beard
2021-10-19T17:43:26Z
#1 - GalloDaSballo
2021-12-19T15:54:53Z
Duplicate of #114