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
Rank: 68/96
Findings: 1
Award: $28.70
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: IllIllI
Also found by: 0x1f8b, 0x29A, 0x52, 0xNazgul, 0xNineDec, 0xc0ffEE, 0xf15ers, 0xkatana, BowTiedWardens, Chom, ElKu, Funen, GalloDaSballo, JC, JMukesh, JohnSmith, Lambda, Limbooo, MadWookie, MiloTruck, Nethermind, Noah3o6, Nyamcil, Picodes, PwnedNoMore, Randyyy, RoiEvenHaim, SmartSek, StErMi, Tadashi, TerrierLover, TomJ, Tomio, Treasure-Seeker, UnusualTurtle, Varun_Verma, Wayne, Waze, _Adam, apostle0x01, asutorufos, berndartmueller, c3phas, catchup, cccz, cloudjunky, codexploder, cryptphi, defsec, delfin454000, dipp, ellahi, exd0tpy, fatherOfBlocks, hansfriese, hyh, joestakey, kebabsec, kenta, masterchief, minhquanym, naps62, oyc_109, pashov, peritoflores, reassor, rfa, robee, sach1r0, saian, sashik_eth, shenwilly, simon135, slywaters, sorrynotsorry, sseefried, unforgiven, xiaoming90, ych18, zuhaibmohd, zzzitron
28.6989 USDC - $28.70
getBasketAddress
could return inaccurate value if basketImplementation
changesIt is possible that the basketImplementation
gets upgraded to a new address. If an integrator relies on getBasketAddress
to deterministically determine the address of a basket that has been deployed using the old implementation, it will return the incorrect address.
Consider adding an extra parameter _implementation
or overload the function with the extra parameter:
function getBasketAddress(address _curator, string memory _mix, address _basketImplementation) public override view returns(address _basket) { bytes32 newsalt = keccak256(abi.encodePacked(_curator, _mix)); bytes memory code = abi.encodePacked(type(ProxyBasket).creationCode, uint256(uint160(_basketImplementation))); bytes32 hash = keccak256(abi.encodePacked(bytes1(0xff), address(this), newsalt, keccak256(code))); _basket = address(uint160(uint256(hash))); }
_minBuyoutTime
When creating a vault, a faulty deployment payload could set minBuyoutTime
to a very high value, virtually disabling the buyout function.
Consider adding a sanity check to make sure it's set within a reasonable value:
require(_minBuyoutTime <= 52 weeks, "NibblVault: minBuyoutTime must not be longer than one year");
_feeAdmin
instead of _adminFeeAmt
When charging fee in _chargeFee
and _chargeFeeSecondaryCurve
, there's a check to ensure _adminFeeAmt
is larger than zero before transferring the funds to feeAdmin
.
It is possible for _adminFeeAmt
to be higher than zero yet _feeAdmin
returns zero because of rounding. Therefore, it will be more accurate to use _feeAdmin
instead.
uint256 _feeAdmin = (_amount * _adminFeeAmt) / SCALE ;
When _amount * _adminFeeAmt
is lower than SCALE
, _feeAdmin
will have the value of 0
.
Check that _feeAdmin
is larger than 0
instead:
if(_feeAdmin > 0) { safeTransferETH(_factory, _feeAdmin); //Transfers admin fee to the factory contract }
https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVault.sol#L227 https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVault.sol#L243
When creating a basket, the basket name and symbol is fixed to "NFT Basket" and "NFTB" respectively. It would be hard for users to distinguish one basket from another when seen through etherscan or wallets.
Consider adding an extra parameter so basket creator can append a unique identifier for the baskets. For instance, when making a basket containing CryptoPunks, the name and symbol would be:
NFT Basket - Punks NFTB-PUNKS
https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVaultFactory.sol#L82 https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/Basket.sol#L13
#0 - mundhrakeshav
2022-06-26T06:56:55Z
if(_feeAdmin > 0) { safeTransferETH(_factory, _feeAdmin); //Transfers admin fee to the factory contract }
#1 - HardlyDifficult
2022-07-04T19:06:27Z
Good suggestions, targeting the specific project well