Platform: Code4rena
Start Date: 05/05/2022
Pot Size: $125,000 DAI
Total HM: 17
Participants: 62
Period: 14 days
Judge: leastwood
Total Solo HM: 15
Id: 120
League: ETH
Rank: 28/62
Findings: 2
Award: $278.33
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: IllIllI
Also found by: 0x1f8b, 0x4non, 0xDjango, 0xNazgul, 0xkatana, 0xsomeone, AuditsAreUS, BouSalman, BowTiedWardens, Cityscape, Funen, GimelSec, Hawkeye, JC, MaratCerby, MiloTruck, Picodes, Ruhum, TerrierLover, WatchPug, Waze, bobirichman, catchup, cccz, cryptphi, csanuragjain, delfin454000, ellahi, fatherOfBlocks, hake, horsefacts, hyh, jayjonah8, joestakey, kebabsec, kenta, mics, oyc_109, robee, samruna, shenwilly, sikorico, simon135, throttle, tintin
188.8964 DAI - $188.90
[1] These two mappings can be combined into a single mapping(address => WhitelistStatus) Where WhitelistStatus is a struct combining paused and whitelisted booleans. Affected code:
[2] Consider moving this line closer to the usage. Affected code:
[3] Success variable is unused, consider removing it. Affected code:
[4] Consider using the Checks-Effects-Interactions pattern. Emitting event should be after the deposit. Affected code:
[5] The value of 'activeBalance' is effectively zero.
Consider using return 0;
instead.
Affected code:
[6] Should not these functions retun zero if total shares are zero? Affected code:
[7] This function is not needed and should be removed. There is not much sense wrapping addition or substraction. Affected code:
[8] The type of 'newTransmuter' argument should be ITransmuterV2 interface. Affected code:
[9] The type of '_alchemist' argument should be IAlchemistV2 interface. Affected code:
[10] Consider removing 'nonReentrant' because re-entrancy attack vector is not applicable here. Affected code:
[11] Consider to use a single power i.e. 10**(18-decimals). Affected code:
[12] Magic number, consider using named constant instead. Affected code:
[13] Consider using "_" separate digit capacity i.e "100000" could be replaced to "100_000". This increases code readability.
Affected code:
[14] Consider using IERC20 type instead of address. Or IERC20[] type instead of address[].
Affected code:
[15] Uint8-256 / Int8-256 is assigned to zero by default, additional reassignment to zero is unnecessary.
Affected code:
[16] It is recommended to explicitly specify uint256 type instead of uint type for better readability.
Affected code:
#0 - 0xleastwood
2022-06-09T22:42:32Z
I believe most if not all of these are non-critical
🌟 Selected for report: IllIllI
Also found by: 0v3rf10w, 0x1f8b, 0x4non, 0xDjango, 0xNazgul, 0xf15ers, 0xkatana, 0xsomeone, AlleyCat, BowTiedWardens, Cityscape, Fitraldys, Funen, GimelSec, Hawkeye, JC, MaratCerby, MiloTruck, Randyyy, TerrierLover, Tomio, UnusualTurtle, WatchPug, Waze, _Adam, augustg, bobirichman, catchup, csanuragjain, ellahi, fatherOfBlocks, hake, hansfriese, horsefacts, ignacio, joestakey, kenta, mics, oyc_109, robee, samruna, sashik_eth, sikorico, simon135, throttle
89.4325 DAI - $89.43
[1] Consider using optimized for-loop and apply the following optimizations:
Affected code:
[2] Using x != 0 uses 6 less gas than x > 0. Consider changing all "greater than zero" comparisons to "not equal to zero".
Affected code:
[3] The power of 10 numbers such as "10**18" could be rendered as "1e18".
Affected code:
[4] As per 0.8.4 solidity version it supports new custom errors. Custom errors are reducing 38 gas if condition is met and 22 gas otherwise. Also reduces contract size and deployment costs.
Affected code:
[5] Storage keyword is recommended to be used whenever possible. It can save up-to 2k gas per each variable with memory keyword (if updating storage up-to 5-10k). Memory keyword is supposed to be used when temporary data is being updated and calculated regularly. Also recommending reduce IF nesting. Affected code:
https://geeksforgeeks.org/storage-vs-memory-in-solidity
[6] Consider simplifying struct by combining several mappings into a single one. mapping(address => TokenSettings) This could save at least numOfMappings x 25k gas on each unique record stored. Affected code:
[7] Storage is being updated on each iteration. Consider using temp variable to store total weights and update after the loop. This may save gas 5000 * numberOfIterations. Affected code:
https://geeksforgeeks.org/storage-vs-memory-in-solidity
[8] Consider using '_alchemist' to save gas by not reading storage every time. Affected code:
[9] Consider reducing IF nesting by having revert first and the rest without else clause.
Affected code: