Platform: Code4rena
Start Date: 07/04/2022
Pot Size: $100,000 USDC
Total HM: 20
Participants: 62
Period: 7 days
Judge: LSDan
Total Solo HM: 11
Id: 107
League: ETH
Rank: 19/62
Findings: 3
Award: $705.31
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: hickuphh3
Also found by: 0x1f8b, AuditsAreUS, Foundation, Kthere, Meta0xNull, WatchPug, rayn
If the owner incorrectly uses the lockFor method and calls it twice with the same _nftIndex
, it will overwrite the record and the deposited jpeg
can never be retrieved.
lockFor(Alice,0,100);
lockFor(Bob,0,100);
It's mandatory to check that the position does not exist, or return the _nftIndex
as a counter in this method.
#0 - spaghettieth
2022-04-12T20:04:25Z
Duplicate of #10
🌟 Selected for report: Dravee
Also found by: 0x1f8b, 0xDjango, 0xkatana, AuditsAreUS, Cityscape, Foundation, Funen, Hawkeye, IllIllI, JC, JMukesh, Jujic, Kthere, PPrieditis, Picodes, Ruhum, TerrierLover, TrungOre, WatchPug, berndartmueller, catchup, cccz, cmichel, delfin454000, dy, ellahi, hickuphh3, horsefacts, hubble, hyh, ilan, jayjonah8, kebabsec, kenta, minhquanym, pauliax, rayn, reassor, rfa, robee, samruna
151.5077 USDC - $151.51
transfer
or transferFrom
without checking the boolean result, ERC20 standard specify that the token can return false if this call was not made, so it's mandatory to check the result of approve methods.#0 - spaghettieth
2022-04-14T14:11:31Z
Fixed first point in https://github.com/jpegd/core/pull/1
🌟 Selected for report: Dravee
Also found by: 0v3rf10w, 0x1f8b, 0xDjango, 0xNazgul, 0xkatana, Cityscape, Cr4ckM3, FSchmoede, Foundation, Funen, Hawkeye, IllIllI, JMukesh, Meta0xNull, PPrieditis, Picodes, TerrierLover, Tomio, WatchPug, berndartmueller, catchup, delfin454000, dirk_y, ellahi, hickuphh3, ilan, kebabsec, kenta, nahnah, rayn, rfa, robee, rokinot, saian, securerodd, slywaters, sorrynotsorry
82.4497 USDC - $82.45
i++
to ++i
in order to save some opcodes:false
or 0
)== true
or == false
, instead of using the boolean value, or NOT
opcode, it's cheaper to use NOT
when the value it's false, or just the value without == true
, when it's true, because it will use less opcode inside the VM.struct PositionPreview { address owner; uint256 nftIndex; bytes32 nftType; uint256 nftValueUSD; VaultSettings vaultSettings; uint256 creditLimit; uint256 debtPrincipal; uint256 debtInterest; BorrowType borrowType; // move this two at the end, close to liquidator bool liquidatable; // move this two at the end, close to liquidator uint256 liquidatedAt; address liquidator; }