Platform: Code4rena
Start Date: 29/04/2022
Pot Size: $22,000 USDC
Total HM: 6
Participants: 40
Period: 3 days
Judge: Justin Goro
Total Solo HM: 2
Id: 114
League: ETH
Rank: 37/40
Findings: 1
Award: $28.35
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: IllIllI
Also found by: 0v3rf10w, 0x1f8b, 0x4non, 0xDjango, 0xf15ers, 0xkatana, 242, Dravee, GimelSec, MaratCerby, Tadashi, TrungOre, WatchPug, defsec, fatherOfBlocks, gzeon, hake, horsefacts, joestakey, miguelmtzinf, pauliax, pedroais, peritoflores, rotcivegaf, simon135, slywaters, tabish, throttle, z3s
28.3489 USDC - $28.35
As you are using the version 0.8 of solidity compiler there is no need to use OZ SafeMath library.
The built-in checks of overflow/underflow in the compiler is much cheaper.
https://issueantenna.com/repo/code-423n4/2022-01-insure-findings/issues/38
Make the following changes
#L14
[-] import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol";
#L26
[-] using SafeMath for uint256;
#L262
[-] uint256 _balanceDiff = _afterBalance.sub(_beforeBalance); [+] uint256 _balanceDiff = _afterBalance-_beforeBalance;
#L361
[-] return _supply == 0 ? _tokens : _tokens.mul(_supply).div(aToken.balanceOf(address(this))); [+] return _supply == 0 ? _tokens : _tokens*_supply/aToken.balanceOf(address(this));
#L373
[-] return _supply == 0 ? _shares : _shares.mul(aToken.balanceOf(address(this))).div(_supply); [+] return _supply == 0 ? _shares : _shares*(aToken.balanceOf(address(this))/_supply;
#0 - PierrickGT
2022-05-04T19:46:20Z