Putty contest - StyxRave's results

An order-book based american options market for NFTs and ERC20s.

General Information

Platform: Code4rena

Start Date: 29/06/2022

Pot Size: $50,000 USDC

Total HM: 20

Participants: 133

Period: 5 days

Judge: hickuphh3

Total Solo HM: 1

Id: 142

League: ETH

Putty

Findings Distribution

Researcher Performance

Rank: 115/133

Findings: 1

Award: $21.17

🌟 Selected for report: 0

🚀 Solo Findings: 0

Gas optimizations

  • When checking if uint are equal to zero, using uint != 0 is cheaper than uint > 0. Applicable in lines 293, 327, 351, 427, 498, 598, 599

  • Loops (lines 556, 594, 611, 627, 637, 647, 658, 670, 728, 742)

    • Cache loop length in stack instead of reading from memory every iteration. Replace for (...; i < arr.length; ...) { ... } with uint cachedLength = arr.length; for (...; i < cachedLength; ...) { ... }.
    • Use ++i for increments if the resulting value is not immediately needed. It costs less gas compared to i++ or i+=1 - as no temporary variable needs to exist in order to return the unincremented value.
    • Use unchecked arithmetic in counters, Solidity 0.8.x checks for overflow/underflow by default, which is not needed in this case. Replace for (...; ... ; ++i) { ... } with for (...; ...; ) { ... unchecked { ++i; } }
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