Platform: Code4rena
Start Date: 31/01/2023
Pot Size: $90,500 USDC
Total HM: 47
Participants: 169
Period: 7 days
Judge: LSDan
Total Solo HM: 9
Id: 211
League: ETH
Rank: 116/169
Findings: 1
Award: $35.48
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: IllIllI
Also found by: 0x3b, 0xAgro, 0xBeirao, 0xMirce, 0xNineDec, 0xRobocop, 0xSmartContract, 0xTraub, 0xWeiss, 2997ms, 41i3xn, Awesome, Aymen0909, Bauer, Bnke0x0, Breeje, Cryptor, DadeKuma, Deathstore, Deekshith99, DevABDee, DevTimSch, Dewaxindo, Diana, Ermaniwe, Guild_3, H0, IceBear, Inspectah, JDeryl, Kaiziron, Kaysoft, Kenshin, Mukund, Praise, RaymondFam, Rickard, Rolezn, Ruhum, Sathish9098, SkyWalkerMan, SleepingBugs, UdarTeam, Udsen, Walter, aashar, adeolu, apvlki, arialblack14, ast3ros, btk, chaduke, chandkommanaboyina, chrisdior4, climber2002, codetilda, cryptonue, cryptostellar5, csanuragjain, ddimitrov22, descharre, dharma09, doublesharp, eccentricexit, ethernomad, fs0c, georgits, halden, hansfriese, hashminer0725, immeas, lukris02, luxartvinsec, matrix_0wl, merlin, mookimgo, mrpathfindr, nadin, olegthegoat, pavankv, rbserver, rebase, savi0ur, sayan, scokaf, seeu, shark, simon135, tnevler, tsvetanovv, ulqiorra, ustas, waldenyan20, y1cunhui, yongskiws, yosuke
35.4779 USDC - $35.48
In general, it is a good practice to keep lines of source code within 80 characters in length. Although, some flexibility is allowed and it is reasonable to let lines be up to 120 characters in some instances.
On modern screens, it is even possible to go beyond this limit. However, it is recommended to split lines when they reach a length of 164 characters or more, as this is the point at which GitHub will introduce a scroll bar to view the code.
This can help to make the code more readable and easier to work with.
Affected line of code:
delete
operator to clear variables, rather than assigning a value of false
.To clear variables, consider using the delete
operator rather than assigning to false
, because this conveys the intention more clearly and is more idiomatic.
As an example on line 186 you can refactor the code like so:
Line 186: delete accruedRewards[user][_rewardTokens[i]];
Affected line of code:
Open TODOs can point to architecture or programming issues that still need to be resolved. Consider resolving them before deploying.
Affected line of code:
1e18
) rather than exponential (10**18
)Improves readability.
Affected line of code:
It is generally not recommended to use floating pragmas (i.e. pragmas that do not specify a specific compiler version) in contracts that are not intended to be used as libraries.
This is because using floating pragmas in application contracts can pose a security risk.
For example, a known vulnerable compiler version may be selected by mistake, or security tools might revert to an older compiler version that produces a different EVM compilation than the one intended to be deployed on the blockchain.
To avoid these potential issues, consider specifying a specific compiler version in your pragmas.
So instead of using a floating pragma like pragma solidity ^0.8.0;
, it is better to use a concrete compiler version like pragma solidity 0.8.4;
.
More information can be found in the following links:
Affected line of code:
#0 - c4-judge
2023-02-28T15:09:05Z
dmvt marked the issue as grade-b