Putty contest - RedOneN'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: 104/133

Findings: 1

Award: $21.59

🌟 Selected for report: 0

🚀 Solo Findings: 0

[G-01] - Use custom errors rather than revert()/require() strings Custom errors are ABI encoded. Consequently, they can be decoded using ABI decoders. This makes it more gas efficient than « revert string ».

File : puttyV2.sol - puttyV2.sol:214 puttyV2.sol:241 puttyV2.sol:278 puttyV2.sol:281 puttyV2.sol:284 puttyV2.sol:287 puttyV2.sol:290 puttyV2.sol:293 puttyV2.sol:297 puttyV2.sol:298 puttyV2.sol:329 puttyV2.sol:353 puttyV2.sol:395 puttyV2.sol:398 puttyV2.sol:401 puttyV2.sol:430 puttyV2.sol:470 puttyV2.sol:475 puttyV2.sol:481 puttyV2.sol:551 puttyV2.sol:552 puttyV2.sol:598 puttyV2.sol:599 puttyV2.sol:765

File: puttyV2Nft.sol - puttyV2Nft.sol:12 puttyV2Nft.sol:13 puttyV2Nft.sol:26 puttyV2Nft.sol:27 puttyV2Nft.sol:28 puttyV2Nft.sol:41

[G-02] - Duplicated Require()/Revert() checks should be refactored to a modifier or function This would reduce the deployment costs.

File: puttyV2.sol -

  1. Not owner requirement : puttyV2.sol:395 puttyV2.sol:475
  2. Incorrect ETH amount requirement : puttyV2.sol:329 puttyV2.sol:353 puttyV2.sol:429

[G-03] - Expressions for constant values such as a call to KECCAK256() should use immutable rather than constant A constant declared as KECCAK256() is re-calculated each time it is in use.

File: puttyV2.sol - puttyV2.sol:89 puttyV2.sol:95 puttyV2.sol:101

[G04] - Using >0 costs more gas than != 0 when used on a uint in a require() statement.

File: puttyV2.sol - puttyV2.sol:598 puttyV2.sol:599 puttyV2.sol:611

[G05] - It costs more gas to initialize variables to zero than to let the default of zero be applied.

File: puttyV2.sol - puttyV2.sol:556 puttyV2.sol:594 puttyV2.sol:611 puttyV2.sol:624 puttyV2.sol:637 puttyV2.sol:647 puttyV2.sol:658 puttyV2.sol:670 puttyV2.sol:728 puttyV2.sol:742

[G06] - Pre-increments (++i) cost less gas than post-increment (i++), especially inside for loops.

File: puttyV2.sol - puttyV2.sol:556 puttyV2.sol:594 puttyV2.sol:611 puttyV2.sol:624 puttyV2.sol:637 puttyV2.sol:647 puttyV2.sol:658 puttyV2.sol:670 puttyV2.sol:728 puttyV2.sol:742

[G07] ++i should be unchecked{++I} when it is not possible for them to overflow (ie. In a for loop).

File: puttyV2.sol - puttyV2.sol:556 puttyV2.sol:594 puttyV2.sol:624 puttyV2.sol:637 puttyV2.sol:647 puttyV2.sol:658 puttyV2.sol:670 puttyV2.sol:728 puttyV2.sol:742

[G08] Using private rather than public for constants saves gas.

File: puttyV2.sol - puttyV2.sol:89 puttyV2.sol:95 puttyV2.sol:101

[G09] External functions are less expensive than public All the functions (except those related to « transfer ») are set to public. Consider turning those that are only called outside the contract as « external » to save gas.

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