PartyDAO contest - peanuts's results

A protocol for buying, using, and selling NFTs as a group.

General Information

Platform: Code4rena

Start Date: 12/09/2022

Pot Size: $75,000 USDC

Total HM: 19

Participants: 110

Period: 7 days

Judge: HardlyDifficult

Total Solo HM: 9

Id: 160

League: ETH

PartyDAO

Findings Distribution

Researcher Performance

Rank: 108/110

Findings: 1

Award: $35.35

🌟 Selected for report: 0

🚀 Solo Findings: 0

TABLE OF CONTENTS

  • [G-01] No need to explicitly initialize variables with default value
  • [G-02] Using abi.encode() is less efficient than abi.encodePacked()

[G-01] No need to explicitly initialize variables with default value

If a variable is not set/initialized, it is assumed to have the default value (0 for uint, false for bool, address(0) for address…). Explicitly initializing it with its default value is an anti-pattern and wastes gas. In the similar code above, the initialization of uint256 i = 0 can be simplified to uint256 i

File: ListOnOpenseaProposal.sol Line 291 ArbitraryCallsProposal.sol Line 52 Line 61 Line 78

for (uint256 i = 0; i < fees.length; ++i) { cons = orderParams.consideration[1 + i]; cons.itemType = IOpenseaExchange.ItemType.NATIVE; cons.token = address(0); cons.identifierOrCriteria = 0; cons.startAmount = cons.endAmount = fees[i]; cons.recipient = feeRecipients[i]; }

can become

for (uint i; i < fees.length; ++i) { cons = orderParams.consideration[1 + i]; cons.itemType = IOpenseaExchange.ItemType.NATIVE; cons.token = address(0); cons.identifierOrCriteria = 0; cons.startAmount = cons.endAmount = fees[i]; cons.recipient = feeRecipients[i]; }

[G-02] Using abi.encode() is less efficient than abi.encodePacked()

https://ethereum.stackexchange.com/questions/119583/when-to-use-abi-encode-abi-encodepacked-or-abi-encodewithsignature-in-solidity

File: ListOnZoraProposal.sol Line 115 File: ListOnOpenseaProposal.sol Line 164, Line 219

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