Platform: Code4rena
Start Date: 01/07/2021
Pot Size: $100,000 USDC
Total HM: 10
Participants: 7
Period: 7 days
Judge: ghoulsol
Total Solo HM: 4
Id: 17
League: ETH
Rank: 7/7
Findings: 2
Award: $249.11
🌟 Selected for report: 1
🚀 Solo Findings: 0
🌟 Selected for report: a_delamo
Also found by: 0xRajeev, GalloDaSballo, shw
38.4024 USDC - $38.40
GalloDaSballo
Detailed description of the impact of this finding.
_stableToLp in Buoy3Pool.sol: https://github.com/code-423n4/2021-06-gro/blob/091660467fc8d13741f8aafcec80f1e8cf129a33/contracts/pools/oracle/Buoy3Pool.sol#L184
Receives a list of N_COINS, as such there's no need to loop again to essentially re-declare the same variable
You can refactor to:
function _stableToLp(uint256[N_COINS] memory tokenAmounts, bool deposit) internal view returns (uint256) { require(tokenAmounts.length == N_COINS, "deposit: !length"); return curvePool.calc_token_amount(tokenAmounts, deposit); }
#0 - kitty-the-kat
2021-07-14T20:46:34Z
#27
#1 - ghoul-sol
2021-07-26T03:21:47Z
Duplicate of #27
🌟 Selected for report: GalloDaSballo
210.7126 USDC - $210.71
GalloDaSballo
Detailed description of the impact of this finding.
The variables amount
and bigFishAbsoluteThreshold
are know before having to fetch
(uint256 gvtAssets, uint256 pwrdAssets) = IPnL(pnl).calcPnL();
uint256 assets = pwrdAssets.add(gvtAssets);
You could have a earlier check to save gas for small fishes
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
You can reorder the return false statement, saving gas for small fishes
function isValidBigFish( bool pwrd, bool deposit, uint256 amount ) external view override returns (bool) { if (deposit && pwrd) { require(validGTokenIncrease(amount), "isBigFish: !validGTokenIncrease"); } else if (!pwrd && !deposit) { require(validGTokenDecrease(amount), "isBigFish: !validGTokenDecrease"); } if (amount < bigFishAbsoluteThreshold) { return false; } (uint256 gvtAssets, uint256 pwrdAssets) = IPnL(pnl).calcPnL(); uint256 assets = pwrdAssets.add(gvtAssets); if (amount > assets) { return true; } else { return amount > assets.mul(bigFishThreshold).div(PERCENTAGE_DECIMAL_FACTOR); } }