Badger Citadel contest - 0xAsm0d3us's results

Bringing BTC to DeFi

General Information

Platform: Code4rena

Start Date: 14/04/2022

Pot Size: $75,000 USDC

Total HM: 8

Participants: 72

Period: 7 days

Judge: Jack the Pug

Total Solo HM: 2

Id: 110

League: ETH

BadgerDAO

Findings Distribution

Researcher Performance

Rank: 67/72

Findings: 1

Award: $54.33

🌟 Selected for report: 0

🚀 Solo Findings: 0

Few Gas optimizations

1- Use != 0 instead of > 0 for unsigned integer comparison

Context: Funding.sol#L170, Funding.sol#L209, Funding.sol#L322, Funding.sol#L340 (Same goes for other contracts in /src/*) Description: When dealing with unsigned integer types, comparisons with != 0 are cheaper then with > 0. Recommendation: Change the code in the following way:

- require(_assetAmountIn > 0, "_assetAmountIn must not be 0");
+ require(_assetAmountIn != 0, "_assetAmountIn must not be 0");

https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/CitadelMinter.sol#L266

2- Use nested if and, avoid multiple check combinations

Context: CitadelMinter.sol#L266 Description: Using nested is cheaper than using && multiple check combinations. There are more advantages, such as easier to read code and better coverage reports. Recommendation: Use nested If statement.

3- ++i is cheaper than i++;

Context: CitadelMinter.sol#L152 Description: i++ is costlier than ++i, it is better to replace it with ++i Recommendation:

- for (uint256 i = 0; i < numPools; i++)
+ for (uint256 i = 0; i < numPools; ++i)

4- There is no need to initialize variables with default values

Context: SupplySchedule.sol#L103, SupplySchedule.sol#L192, Description: If the variable is not set/initialized, it is assumed to have a default value (0, false, 0x0, etc., depending on the data type). If you explicitly initialize it with its default value, you are just wasting gas. Recommendation: Change the code in the following way:

- uint256 mintable = 0;
+ uint256 mintable;
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