Nibbl contest - fatherOfBlocks's results

NFT fractionalization protocol with guaranteed liquidity and price based buyout.

General Information

Platform: Code4rena

Start Date: 21/06/2022

Pot Size: $30,000 USDC

Total HM: 12

Participants: 96

Period: 3 days

Judge: HardlyDifficult

Total Solo HM: 5

Id: 140

League: ETH

Nibbl

Findings Distribution

Researcher Performance

Rank: 54/96

Findings: 2

Award: $45.51

🌟 Selected for report: 0

🚀 Solo Findings: 0

NibblVaultFactory.sol

  • L5/6/9 - There are imports that are never used like: IERC20, IERC1155, SafeMath.

Basket.sol

  • L7 - There are imports that are never used like: ERC165.

NibblVault.sol

  • L126/128 - Instead of using the values ​​1 and 2 as manual reentrancy guard, true and false could be used, generating less gas cost.

  • L335/347 - The functions _sellPrimaryCurve() and _sellSecondaryCurve() have the structure: uint256 _amount, uint256 _totalSupply, but inside the functions they are used exactly the other way around, therefore it is better that the order is reversed: uint256 _totalSupply, uint256 _amount.

  • L321/382/405 - There is a commented code that should not be there.

  • L495 - In the constructor the inputs are passed in this order: uint256 _assetID, address _to and in the code they are used exactly in the opposite way, so it would be better to use them like this: address _assetAddress, address _to, uint256 _assetID.

  • L504/545 - It is not validated that the inputs address[] memory _assetAddresses, uint256[] memory _assetIDs have the same size, this can cause it to reverse if _assets.length > _assetIDs.length and if it is the other way around, _assetIDs would remain without being transferred .

#0 - HardlyDifficult

2022-07-04T15:58:32Z

Fair points, mostly NC.

NibblVaultFactory.sol

  • L48/49/107/114/131/141/149/166 - Instead of using a require, you can use custom Errors with ifs, this way you could generate less gas cost.

  • L48/107/131/141/149/166 - If the strings exceed 32 bytes they generate a higher expense than with <= 32 bytes, we recommend abbreviating the texts.

Basket.sol

  • L36/42/53/62/69/79/86/92 - Instead of using a require, you can use custom Errors with ifs.

  • L43/70/93 - It is not necessary to create a variable and set it to its default value, this generates an unnecessary extra gas cost.

  • L43/70/93 - Instead of doing i++, you can save gas by using unchecked{++i;}

Twav.sol

  • L29/36/37/39 - Instead of variable + 1 or variable - 1 it is less expensive ++variable or --variable.

NibblVault.sol

  • L129/139/146/147/154/184/185/325/351/387/399/400/404/444/475/486/496/505/516/524/536/546/561/564/570 - Instead of using a require, you can use custom Errors with ifs.

  • L128/138/145/153 - Modifiers generate a very high gas cost, which can be replaced by private view functions.

  • L227/243 - It is less expensive to validate "variable != 0" than "variable > 0"

  • L506/525/547 - It is not necessary to set the variables to their default value, since they generate an unnecessary gas expense.

  • L506/525/547 - Instead of doing i++, you can save gas by using unchecked{++i;}

  • L562 - Instead of nonces[owner]++, ++nonces[owner] is less expensive.

  • L506/525/547 - Instead of directly using the variable.length in the for loop, you could create a variable in memory to be used inside the for loop.

#0 - mundhrakeshav

2022-06-30T14:00:32Z

#3, #6, #7, #8, #9, #10, #11, #15

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter