Platform: Code4rena
Start Date: 04/01/2022
Pot Size: $75,000 USDC
Total HM: 17
Participants: 33
Period: 7 days
Judge: 0xean
Total Solo HM: 14
Id: 74
League: ETH
Rank: 26/33
Findings: 1
Award: $54.10
🌟 Selected for report: 1
🚀 Solo Findings: 0
41.8864 USDC - $41.89
gzeon
Result of BlockNumber.get()
can be cached before the for loop.
for (uint256 i; i < ids.length; i++) { Due storage due = dues[ids[i]]; require(due.startBlock != BlockNumber.get(), 'E207');
to
uint32 bn32 = BlockNumber.get(); for (uint256 i; i < ids.length; i++) { Due storage due = dues[ids[i]]; require(due.startBlock != bn32, 'E207');
#0 - Mathepreneur
2022-01-18T10:49:11Z
We get stack too deep error.
#1 - 0xean
2022-01-26T00:21:25Z
ditto previous comments....
To prove the point to the sponsor this compiles currently by scoping in brackets.
Due[] storage dues = pool.dues[owner]; { uint32 bn32 = BlockNumber.get(); for (uint256 i; i < ids.length; i++) { Due storage due = dues[ids[i]]; require(due.startBlock != bn32, 'E207'); if (owner != msg.sender) require(collateralsOut[i] == 0, 'E213'); PayMath.checkProportional(assetsIn[i], collateralsOut[i], due); due.debt -= assetsIn[i]; due.collateral -= collateralsOut[i]; assetIn += assetsIn[i]; collateralOut += collateralsOut[i]; } } if (assetIn > 0) Callback.pay(asset, assetIn, data);
🌟 Selected for report: WatchPug
Also found by: Dravee, PPrieditis, csanuragjain, gzeon
12.2141 USDC - $12.21
gzeon
if (pool.state.totalLiquidity == 0) { uint256 liquidityTotal = MintMath.getLiquidityTotal(xIncrease); liquidityOut = MintMath.getLiquidity(maturity, liquidityTotal, protocolFee); pool.state.totalLiquidity += liquidityTotal; pool.liquidities[factory.owner()] += liquidityTotal - liquidityOut; } else { uint256 liquidityTotal = MintMath.getLiquidityTotal(pool.state, xIncrease, yIncrease, zIncrease); liquidityOut = MintMath.getLiquidity(maturity, liquidityTotal, protocolFee); pool.state.totalLiquidity += liquidityTotal; pool.liquidities[factory.owner()] += liquidityTotal - liquidityOut; }
to
uint256 liquidityTotal; if (pool.state.totalLiquidity == 0) { liquidityTotal = MintMath.getLiquidityTotal(xIncrease); } else { liquidityTotal = MintMath.getLiquidityTotal(pool.state, xIncrease, yIncrease, zIncrease); } liquidityOut = MintMath.getLiquidity(maturity, liquidityTotal, protocolFee); pool.state.totalLiquidity += liquidityTotal; pool.liquidities[factory.owner()] += liquidityTotal - liquidityOut;
#0 - Mathepreneur
2022-01-18T10:03:58Z
Duplicate of #155