Platform: Code4rena
Start Date: 07/07/2022
Pot Size: $75,000 USDC
Total HM: 32
Participants: 141
Period: 7 days
Judge: HardlyDifficult
Total Solo HM: 4
Id: 144
League: ETH
Rank: 87/141
Findings: 2
Award: $99.41
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: xiaoming90
Also found by: 0x1f8b, 0x29A, 0x52, 0xA5DF, 0xDjango, 0xNazgul, 0xNineDec, 0xf15ers, 0xsanson, 0xsolstars, 242, 8olidity, Amithuddar, Aymen0909, Bnke0x0, BowTiedWardens, David_, Deivitto, ElKu, Funen, Hawkeye, IllIllI, JC, Kaiziron, Keen_Sheen, Kthere, Kulk0, Kumpa, Lambda, MEP, ReyAdmirado, Rohan16, Ruhum, Sm4rty, TomJ, Tomio, Treasure-Seeker, TrungOre, Tutturu, Viksaa39, Waze, _Adam, __141345__, ak1, apostle0x01, asutorufos, async, ayeslick, aysha, bbrho, benbaessler, berndartmueller, c3phas, cccz, chatch, cloudjunky, codexploder, cryptphi, delfin454000, dipp, durianSausage, dy, exd0tpy, fatherOfBlocks, hake, hansfriese, horsefacts, hubble, joestakey, jonatascm, kebabsec, kenzo, kyteg, mektigboy, neumo, oyc_109, pashov, pedr02b2, peritoflores, rajatbeladiya, rbserver, robee, rokinot, s3cunda, sach1r0, sahar, sashik_eth, scaraven, shenwilly, simon135, sorrynotsorry, sseefried, svskaushik, unforgiven, z3s, zzzitron
61.9385 USDC - $61.94
Vault.sol
IBaseVault.sol
IERC20.sol
IERC721.sol
IERC1155.sol
IMmigration.sol
IMinter.sol
IProtoform.sol
Migration.sol
L4/5/6/7/12 - Auction, IERC20, IERC721, IERC1155, Permission imports are performed and are never used.
L37/39/53 - The variables in storage buyout and registry are only set in the constructor and have no setter, so gas could be saved by making the variables immutable.
L520/537 - Inputs are requested in one order and then used completely in another order, it makes more sense that they are requested in the order they are used within the function.
L527/528 - It should be validated that the _lastTotalSupply input is not zero, otherwise it would revert.
Minter.sol
L14 - The variable in storage supply is only set in the constructor and does not have a setter, therefore gas could be saved, making the variable immutable.
L24/32 - The IMinter interface exists, but it only has one function, therefore the getLeafNodes() and getPermissions() functions, which are not in the interface, return arrays with a single internal value. This could be modified and that they directly return the value, generating less gas expenses and actually fulfilling what the code does.
BaseVault.sol
Supply.sol
Transfer.sol
#0 - HardlyDifficult
2022-08-07T15:40:38Z
Merging with #175, #176
🌟 Selected for report: joestakey
Also found by: 0x1f8b, 0x29A, 0xA5DF, 0xKitsune, 0xNazgul, 0xNineDec, 0xalpharush, 0xkatana, 0xsanson, 0xsolstars, 8olidity, Avci, Bnke0x0, BowTiedWardens, Chom, Deivitto, ElKu, Fitraldys, Funen, IllIllI, JC, Kaiziron, Lambda, Limbooo, MEP, NoamYakov, PwnedNoMore, RedOneN, ReyAdmirado, Rohan16, Ruhum, Saintcode_, Sm4rty, TomJ, Tomio, TrungOre, Tutturu, Waze, _Adam, __141345__, ajtra, apostle0x01, asutorufos, benbaessler, brgltd, c3phas, codexploder, cryptphi, delfin454000, dharma09, djxploit, durianSausage, fatherOfBlocks, giovannidisiena, gogo, horsefacts, hrishibhat, hyh, ignacio, jocxyen, jonatascm, karanctf, kebabsec, kyteg, m_Rassska, mektigboy, oyc_109, pedr02b2, rbserver, robee, rokinot, sach1r0, sashik_eth, simon135, slywaters
37.4743 USDC - $37.47
FERC1155.sol
L37/45 - Gas can be saved if instead of using a modifier a private view function is used.
L246/247 - You could save gas by creating a variable in memory of royaltyAddress[_id] and use it in the definition of receiver and royaltyAmount.
L263/275/297 - require can be replaced by ifs and custom errors.
L339/363 - Less gas costs are generated if one makes ++variable, instead of variable++
Vault.sol
L39/40 - If a variable in memory is only going to be used once, the least expensive thing is to directly use it where it is needed.
L62/63 - It is less expensive to validate first than the owner != msg.sender, since if there are two premises that must be correct, the least expensive one is always validated first, since if it is false, the most expensive one would not be executed .
L78/104 - It is not necessary to create a variable and define its default value, since it generates an extra cost and already has that value.
L78/104 - It is less expensive to make ++variable, instead of variable++.
VaultFactory.sol
L38/47/68/69 - If a variable in memory is only going to be used once, the least expensive thing is to directly use it where it is needed.
L77 - It is less expensive to make ++variable, instead of variable + 1.
Migration.sol
L232/233 - If a variable in memory is only going to be used once, the least expensive thing is to directly use it where it is needed.
L508 - Less gas costs are generated if one makes ++variable, instead of variable++
Minter.sol
MerkleBase.sol
L51 - It is not necessary to set a variable with its default value, this generates extra expenses.
L51/62/63/78/80/89/93/110 - In the for loop, gas could be saved by creating a variable in memory of _modules.length, since this would save in each iteration having to consult the length of an array .
L92/97/137/138/147/148 - It is less expensive to do --variable or ++variable than for example: variable + 1 or variable--
BaseVault.sol
L64/83/107 - It is not necessary to set a variable with its default value, this generates extra costs.
L130 - In the for loop, gas could be saved by creating a variable in memory of _modules.length, since this would save in each iteration having to consult the length of an array.