JPEG'd contest - Cityscape's results

Bridging the gap between DeFi and NFTs.

General Information

Platform: Code4rena

Start Date: 07/04/2022

Pot Size: $100,000 USDC

Total HM: 20

Participants: 62

Period: 7 days

Judge: LSDan

Total Solo HM: 11

Id: 107

League: ETH

JPEG'd

Findings Distribution

Researcher Performance

Rank: 35/62

Findings: 2

Award: $233.96

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

151.5077 USDC - $151.51

Labels

bug
QA (Quality Assurance)
sponsor acknowledged

External Links

https://github.com/code-423n4/2022-04-jpegd/blob/main/contracts/vaults/NFTVault.sol#L129 contract is mispelled as "contrat"

/// @param _nftContract The NFT contrat address. It could also be the address of an helper contract

Proposed Change:

/// @param _nftContract The NFT contract address. It could also be the address of an helper contract

Awards

82.4497 USDC - $82.45

Labels

bug
G (Gas Optimization)
sponsor acknowledged

External Links

No Need to initialize variables with default values

https://github.com/code-423n4/2022-04-jpegd/blob/main/contracts/vaults/FungibleAssetVaultForDAO.sol#L45

address internal constant ETH = address(0);

could be changed to just

address internal constant ETH;

https://github.com/code-423n4/2022-04-jpegd/blob/main/contracts/vaults/NFTVault.sol#L181

for (uint256 i = 0; i < _typeInitializers.length; i++) {
    NFTCategoryInitializer memory initializer = _typeInitializers[i];
    nftTypeValueETH[initializer.hash] = initializer.valueETH;
    for (uint256 j = 0; j < initializer.nfts.length; j++) {
        nftTypes[initializer.nfts[j]] = initializer.hash;
    }
}

Could be changed to

for (uint256 i; i < _typeInitializers.length; i++) {
    NFTCategoryInitializer memory initializer = _typeInitializers[i];
    nftTypeValueETH[initializer.hash] = initializer.valueETH;
    for (uint256 j; j < initializer.nfts.length; j++) {
        nftTypes[initializer.nfts[j]] = initializer.hash;
    }
}

Use pre-increment

https://github.com/code-423n4/2022-04-jpegd/blob/main/contracts/vaults/NFTVault.sol#L181

for (uint256 i = 0; i < _typeInitializers.length; i++) {
    NFTCategoryInitializer memory initializer = _typeInitializers[i];
    nftTypeValueETH[initializer.hash] = initializer.valueETH;
    for (uint256 j = 0; j < initializer.nfts.length; j++) {
        nftTypes[initializer.nfts[j]] = initializer.hash;
    }
}

could be changed to

for (uint256 i = 0; i < _typeInitializers.length; ++i) {
    NFTCategoryInitializer memory initializer = _typeInitializers[i];
    nftTypeValueETH[initializer.hash] = initializer.valueETH;
    for (uint256 j = 0; j < initializer.nfts.length; ++j) {
        nftTypes[initializer.nfts[j]] = initializer.hash;
    }
}

Caching array length

https://github.com/code-423n4/2022-04-jpegd/blob/main/contracts/vaults/NFTVault.sol#L181

for (uint256 i = 0; i < _typeInitializers.length; i++) {
    NFTCategoryInitializer memory initializer = _typeInitializers[i];
    nftTypeValueETH[initializer.hash] = initializer.valueETH;
    for (uint256 j = 0; j < initializer.nfts.length; j++) {
        nftTypes[initializer.nfts[j]] = initializer.hash;
    }
}

Could be changed to

uint typeInitlength = _typeInitializers.length;
for (uint256 i = 0; i < typeInitlength; i++) {
    NFTCategoryInitializer memory initializer = _typeInitializers[i];
    nftTypeValueETH[initializer.hash] = initializer.valueETH;
    for (uint256 j = 0; j < initializer.nfts.length; j++) {
        nftTypes[initializer.nfts[j]] = initializer.hash;
    }
}
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