Platform: Code4rena
Start Date: 29/03/2022
Pot Size: $50,000 USDC
Total HM: 16
Participants: 42
Period: 5 days
Judge: 0xean
Total Solo HM: 9
Id: 105
League: ETH
Rank: 37/42
Findings: 1
Award: $87.50
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: TerrierLover
Also found by: 0v3rf10w, 0xDjango, 0xNazgul, 0xkatana, 0xmint, Cityscape, Czar102, Dravee, Funen, IllIllI, Tomio, antonttc, defsec, gzeon, hake, kenta, minhquanym, pmerkleplant, rayn, rfa, robee, saian, securerodd, teryanarmen
87.4951 USDC - $87.50
When a variable is created it is initialized with default values, explicitly initializing it wasted gas
!=
is more efficient than >
for unsigned integers!=
consumes less gas than >
in require statements with optimizer enabled
Repeated storage reads in a block can be cached in a temporary variable to save gas
userLocks[msg.sender].length
in
https://github.com/code-423n4/2022-03-paladin/blob/9c26ec8556298fb1dc3cf71f471aadad3a5c74a0/contracts/HolyPaladinToken.sol#L270-L272
claimableRewards[msg.sender]
in
https://github.com/code-423n4/2022-03-paladin/blob/9c26ec8556298fb1dc3cf71f471aadad3a5c74a0/contracts/HolyPaladinToken.sol#L388
Storage read in if statements in while loop
https://github.com/code-423n4/2022-03-paladin/blob/ 9c26ec8556298fb1dc3cf71f471aadad3a5c74a0/contracts/HolyPaladinToken.sol#L520-L523
currentDropPerSecond
in
https://github.com/code-423n4/2022-03-paladin/blob/9c26ec8556298fb1dc3cf71f471aadad3a5c74a0/contracts/HolyPaladinToken.sol#L736
currentTotalLocked
in
https://github.com/code-423n4/2022-03-paladin/blob/9c26ec8556298fb1dc3cf71f471aadad3a5c74a0/contracts/HolyPaladinToken.sol#L1165-1169
unchecked
to save gasAdding unchecked to expressions that wont underflow/overflow can avoid default underflow/overflow checks and save gas
claimAmount will be less than or equal to claimRewards
unchecked
can be added to the statement
In HolyPaladinToken:_updateDropPerSecond
dropDecreasePerMonth calculation uses constant and immutable values and after dropDecreaseDuration only if block is executed, so dropDecreasePerMonth can be changed to immutable
dropDecreaseDuration
can be change to immutable and set in constructor
#0 - Kogaroshi
2022-04-02T15:44:07Z
QA & gas optimizations changes are done in the PR: https://github.com/PaladinFinance/Paladin-Tokenomics/pull/6 (some changes/tips were implemented, others are noted but won't be applied)