Platform: Code4rena
Start Date: 17/03/2022
Pot Size: $30,000 USDC
Total HM: 8
Participants: 43
Period: 3 days
Judge: gzeon
Total Solo HM: 5
Id: 100
League: ETH
Rank: 23/43
Findings: 2
Award: $81.24
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: defsec
Also found by: 0x1f8b, 0xDjango, 0xNazgul, 0xkatana, 0xwags, CertoraInc, Funen, GeekyLumberjack, GreyArt, IllIllI, Kenshin, Ruhum, TerrierLover, WatchPug, berndartmueller, bugwriter001, cccz, cmichel, csanuragjain, hake, kenta, kirk-baird, leastwood, minhquanym, oyc_109, peritoflores, rayn, remora, rfa, robee, saian, samruna, sorrynotsorry, wuwe1
51.8842 USDC - $51.88
SingleStrategyController:totalValue()
return value can be changedtokens can be directly transfered to the controller address, which will increase the return value of totalValue which is used in collateral withdraw function chaging the owed value Collateral:deposit can be called to deposit this amount into the strategy
totalValue can be changed to return strategy totalValue
Input variables are not checked for 0 values
zero value checks can be added
ReentrancyGuard imported in LongShortToken.sol is not used
import statement can be removed
#0 - ramenforbreakfast
2022-03-24T02:56:56Z
First claim is duplicate of #27. Second claim regarding 0 value checks does not explain why it is necessary add these checks. I do not consider this valid. Third claim is a duplicate of #5
29.3575 USDC - $29.36
Storage read SLOAD costs ~100 (excluding first call), caching the value and re-using it can save gas
Function arguments can be used instead of read from storage
https://github.com/code-423n4/2022-03-prepo/blob/f63584133a0329781609e3f14c3004c1ca293e71/contracts/core/Collateral.sol#L192 https://github.com/code-423n4/2022-03-prepo/blob/f63584133a0329781609e3f14c3004c1ca293e71/contracts/core/Collateral.sol#L201 https://github.com/code-423n4/2022-03-prepo/blob/f63584133a0329781609e3f14c3004c1ca293e71/contracts/core/Collateral.sol#L211 https://github.com/code-423n4/2022-03-prepo/blob/f63584133a0329781609e3f14c3004c1ca293e71/contracts/core/Collateral.sol#L221 https://github.com/code-423n4/2022-03-prepo/blob/f63584133a0329781609e3f14c3004c1ca293e71/contracts/core/Collateral.sol#L230 https://github.com/code-423n4/2022-03-prepo/blob/f63584133a0329781609e3f14c3004c1ca293e71/contracts/core/Collateral.sol#L239 https://github.com/code-423n4/2022-03-prepo/blob/f63584133a0329781609e3f14c3004c1ca293e71/contracts/core/CollateralDepositRecord.sol#L64
allowedAccountsIndex and _blockedAccountsIndex can be cached and re-used instead of reading it inside for loops
_finalLongPrice can be stored locally and re-used
unchecked
can save gasFor arithmetic operations that will not overflow/underflow adding unchecked can avoid underflows/overflows checks which will save gas
Function return values can be cached and re-used which will save gas instead of calling the function again
totalSupply() can be cached and re-used
#0 - ramenforbreakfast
2022-03-23T01:06:56Z
Duplicate of #18 and #41, regarding caching values and postfix/prefix. Those submissions are also higher quality imo.