Platform: Code4rena
Start Date: 21/11/2022
Pot Size: $90,500 USDC
Total HM: 18
Participants: 101
Period: 7 days
Judge: Picodes
Total Solo HM: 4
Id: 183
League: ETH
Rank: 87/101
Findings: 1
Award: $39.65
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: gzeon
Also found by: 0xPanda, 0xSmartContract, B2, Deivitto, Diana, JohnSmith, PaludoX0, Rahoz, RaymondFam, ReyAdmirado, Rolezn, Schlagatron, Secureverse, Tomio, __141345__, adriro, ajtra, aphak5010, c3phas, chaduke, codeislight, cryptonue, datapunk, dharma09, halden, karanctf, keccak123, oyc_109, pavankv, sakshamguruji, saneryee, unforgiven
39.6537 USDC - $39.65
- Declare vairable outside of loop in functions as it gets relocated and consume more gas
- Remove
block.timestamp
andblock.number
as they are added toevent
information by default so adding them manually wastes gas.
src/vaults/PxGmxReward.sol:61: emit GlobalAccrue(block.timestamp, totalSupply, rewards); src/vaults/PxGmxReward.sol:83: emit UserAccrue(user, block.timestamp, balance, rewards); src/PirexRewards.sol:297: emit UserAccrue(producerToken, user, block.timestamp, balance, rewards);
- Use immutable rather than constant for keccak256() calls
src/PxERC20.sol:9: bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); src/PxERC20.sol:10: bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
- Declare
p
andr
outside for loop
src/PirexRewards.sol-351- for (uint256 i; i < pLen; ++i) { src/PirexRewards.sol:352: ERC20 p = _producerTokens[i]; src/PirexRewards.sol-353- uint256 r = rewardAmounts[i];
- use unchecked in ++i in for loops
#0 - c4-judge
2022-12-05T11:16:36Z
Picodes marked the issue as grade-b
#1 - drahrealm
2022-12-09T07:02:48Z
First finding considered for implementation
#2 - c4-sponsor
2022-12-09T07:02:53Z
drahrealm marked the issue as sponsor confirmed