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: 77/101
Findings: 1
Award: $53.49
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0xSmartContract
Also found by: 0xAgro, 0xNazgul, 0xPanda, 0xbepresent, 0xfuje, Awesome, B2, Bnke0x0, Deivitto, Diana, Funen, Jeiwan, JohnSmith, Josiah, R2, RaymondFam, Rolezn, Sathish9098, Waze, adriro, aphak5010, brgltd, btk, carrotsmuggler, ch0bu, chaduke, codeislight, codexploder, cryptostellar5, csanuragjain, danyams, datapunk, delfin454000, deliriusz, eierina, erictee, fatherOfBlocks, gz627, gzeon, hansfriese, hihen, jadezti, joestakey, keccak123, martin, nameruse, oyc_109, pedr02b2, perseverancesuccess, rbserver, rotcivegaf, rvierdiiev, sakshamguruji, shark, simon135, subtle77, unforgiven, xiaoming90, yixxas
53.4851 USDC - $53.49
distributeFees()
distributeFees()
is an external function that can be called by anyone who inputs a token
, but there is no data validation to check if token
are non-zero. So user can continuously call distributeFees(
)` with an input of a non-zero value
Affected line of code: Line 100-116
delete
to clear variablesrather than using a zero assignment a better way of signifying the intent is to use delete
.
There are 2 instances where this can be implemented:
File: vaults/PxGmxReward.sol Line 118: userRewardStates[msg.sender].rewards = 0; File: src/PirexRewards.sol Line 391: p.userStates[user].rewards = 0;
Could be refactored to as
File: vaults/PxGmxReward.sol Line 118: delete userRewardStates[msg.sender].rewards = 0; File: src/PirexRewards.sol Line 391: delete p.userStates[user].rewards = 0;
Consider providing NatSpec as it is good for readability, debugging, further development etc.
Consider following the official NatSpec comment guidelines to make the contract more readable. https://docs.soliditylang.org/en/develop/natspec-format.html
Affected contracts:
interfaces/IPirexRewards.sol, interfaces/IProducer.sol, interfaces/IAutoPxGlp.sol, src/Common.sol
#0 - c4-judge
2022-12-04T20:28:00Z
Picodes marked the issue as grade-b