Yield Witch v2 contest - robee's results

Fixed-rate borrowing and lending on Ethereum

General Information

Platform: Code4rena

Start Date: 14/07/2022

Pot Size: $25,000 USDC

Total HM: 2

Participants: 63

Period: 3 days

Judge: PierrickGT

Total Solo HM: 1

Id: 147

League: ETH

Yield

Findings Distribution

Researcher Performance

Rank: 52/63

Findings: 1

Award: $16.99

🌟 Selected for report: 0

🚀 Solo Findings: 0

-------- gas ---------

Unnecessary default assignment

Unnecessary default assignments, you can just declare and it will save gas and have the same meaning.

Code instance:

Witch.sol (L#63) : uint128 public auctioneerReward = 0.01e18;

Use != 0 instead of > 0

Using != 0 is slightly cheaper than > 0. (see https://github.com/code-423n4/2021-12-maple-findings/issues/75 for similar issue)

Code instances:

Witch.sol, 393: change 'liquidatorCut > 0' to 'liquidatorCut != 0' Witch.sol, 398: change 'auctioneerCut > 0' to 'auctioneerCut != 0'

Unnecessary cast

Code instance:

uint256 Witch.sol._calcPayout - unnecessary casting uint256(artIn)

Inline one time use functions

The following functions are used exactly once. Therefore you can inline them and save gas and improve code clearness.

Code instance:

Witch.sol, _auctionStarted

Cache powers of 10 used several times

You calculate the power of 10 every time you use it instead of caching it once as a constant variable and using it instead. Fix the following code lines:

Code instances:

Witch.sol, 232 : You should cache the used power of 10 as constant state variable since it's used several times (2): if (art < debt.min * (10**debt.dec)) art = balances.art;

Witch.sol, 437 : You should cache the used power of 10 as constant state variable since it's used several times (2): auction_.art - artIn >= debt.min * (10**debt.dec),

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