Nested Finance contest - ElKu's results

The one-stop Defi app to build, manage and monetize your portfolio.

General Information

Platform: Code4rena

Start Date: 15/06/2022

Pot Size: $35,000 USDC

Total HM: 1

Participants: 36

Period: 3 days

Judge: Jack the Pug

Total Solo HM: 1

Id: 137

League: ETH

Nested Finance

Findings Distribution

Researcher Performance

Rank: 23/36

Findings: 1

Award: $83.14

๐ŸŒŸ Selected for report: 0

๐Ÿš€ Solo Findings: 0

Awards

83.1436 USDC - $83.14

Labels

bug
G (Gas Optimization)
sponsor confirmed
valid

External Links

  1. The require statements could be put at the beginning part of a block of statements if it doesnโ€™t affect the logic to save gas. a. require(_orders.length != 0, "NF: INVALID_ORDERS");

  2. Initializing i to 0 inside a for loop is redundant. As its initialized to 0 by default. Also i++ or ++I in the for loops can be put inside an unchecked block to save gas.

a. for (uint256 i = 0; i < operatorsCache.length; i++) b. for (uint256 i = 0; i < operatorsLength; i++) c. for (uint256 i = 0; i < batchedOrdersLength; i++) d. for (uint256 i = 0; i < tokensLength; i++) e. for (uint256 i = 0; i < batchedOrdersLength; i++) f. for (uint256 i = 0; i < batchedOrdersLength; i++) g. for (uint256 i = 0; i < batchLength; i++) h. for (uint256 i = 0; i < batchLength; i++) i. for (uint256 i = 0; i < _batchedOrders.length; i++) j. for (uint256 i = 0; i < namesLength; i++) k. for (uint256 i = 0; i < names.length; i++) l. for (uint256 i = 0; i < destinations.length; i++) m. for (uint256 i = 0; i < requiredOperators.length; i++) n. for (uint256 i = 0; i < requiredOperators.length; i++) o. for (uint256 i = 0; i < targets.length; ++i) p. for (uint256 i = 0; i < targets.length; ++i)

  1. Unless it was introduced for readability saving memory to memory is redundant. address token = tokens[i];

  2. These arithmetic operations can be unchecked. a. uint256 halfInvestment = investmentA / 2; b. uint256 halfInvestment = investmentA / 2;

  3. This line could be pre-computed and defined as a constant to save gas. a. bytes4(keccak256(bytes("remove_liquidity_one_coin(uint256,int128,uint256)"))) b. bytes4(keccak256(bytes("remove_liquidity_one_coin(uint256,uint256,uint256)")))

#0 - Yashiru

2022-06-22T15:58:02Z

1. The require statements could be put at the beginning part of a block [...] (Confirmed)

Gas optimization confirmed

#1 - Yashiru

2022-06-22T16:00:58Z

3. Unless it was introduced for readability saving memory to memory is redundant (Confirmed)

Gas optimization confirmed

#2 - maximebrugel

2022-06-24T13:03:48Z

4. These arithmetic operations can be unchecked (Confirmed)

Gas optimization confirmed

#3 - Yashiru

2022-06-24T15:43:39Z

2. Initializing i to 0 inside a for loop is redundant. As its initialized to 0 by default (Duplicated)

Duplicated of #2 at For loop optimizaion

#4 - obatirou

2022-06-27T09:47:02Z

5. This line could be pre-computed and defined as a constant to save gas. (confirmed)

Gas optimization confirmed

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