Platform: Code4rena
Start Date: 07/01/2022
Pot Size: $80,000 USDC
Total HM: 21
Participants: 37
Period: 7 days
Judge: 0xean
Total Solo HM: 14
Id: 71
League: ETH
Rank: 15/37
Findings: 4
Award: $987.75
🌟 Selected for report: 2
🚀 Solo Findings: 0
1025.8688 INSURE - $359.05
622.8489 USDC - $622.85
loop
The function unlock()
in PoolTemplate has a typo where it compares insurances[_id].status
to false
rather than setting it to false
. If the conditions are met to unlock the funds for an id, the user should be able to call the unlock()
function once for that id as insurances[_id].amount
is subtracted from lockedAmount
. However, since insurances[_id].status
does not get set to false
, a user can call unlock()
multiple times for the same id, resulting in lockedAmount
being way smaller than it should be since insurances[_id].amount
is subtracted multiple times.
lockedAmount
is used to calculate the amount of underlying tokens available for withdrawals. If lockedAmount
is lower than it should be users are able to withdraw more underlying tokens than available for withdrawals.
Typo in unlock()
:
Calculation of underlying tokens available for withdrawal:
Change insurances[_id].status == false;
to insurances[_id].status = false;
#0 - oishun1112
2022-01-27T06:53:24Z
#1 - 0xean
2022-01-27T21:32:25Z
upgrading to sev-3 based on assets being compromised.
🌟 Selected for report: Dravee
Also found by: 0x1f8b, Jujic, TomFrenchBlockchain, csanuragjain, defsec, gzeon, loop, robee
2.9784 INSURE - $1.04
1.5637 USDC - $1.56
loop
The variables token
, registry
and ownership
in Vault are only set in the constructor and can thus be immutable.
Immutable variables have lower gas cost during deployment and use of the variable.
#0 - oishun1112
2022-01-13T14:27:26Z
3.723 INSURE - $1.30
1.9546 USDC - $1.95
loop
When checking boolean values in a require or if statement it's an unnecessary operation to compare them to true
, as it's already checked whether the condition is true
. For comparison to false
, it is cheaper to use the !
operator rather than compare the value.
Lines where boolean comparison is used:
Remove the == true
part from boolean comparisons and change _variableName == false
to !_variableName
to save some gas.
#0 - oishun1112
2022-01-27T06:52:24Z