Astaria contest - ReyAdmirado's results

On a mission is to build a highly liquid NFT lending market.

General Information

Platform: Code4rena

Start Date: 05/01/2023

Pot Size: $90,500 USDC

Total HM: 55

Participants: 103

Period: 14 days

Judge: Picodes

Total Solo HM: 18

Id: 202

League: ETH

Astaria

Findings Distribution

Researcher Performance

Rank: 95/103

Findings: 1

Award: $36.79

Gas:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

36.79 USDC - $36.79

Labels

bug
G (Gas Optimization)
grade-b
G-06

External Links

1. expressions for constant values such as a call to keccak256(), should use immutable rather than constant

2. <x> += <y> costs more gas than <x> = <x> + <y> for state variables

Using the addition operator instead of plus-equals saves gas

3. can make the variable outside the loop to save gas

make the variables outside and only give them value inside

what

data

payout

j

auctionStack

owed

payee

spent

oldLength

4. splitting require() statements that use && saves gas

this will have a large deployment gas cost but with enough runtime calls the split require version will be 3 gas cheaper

5. switch the sides of or operation to possibly avoid using more gas

There is a chance that the first part will be true so the second part doesn’t need to be checked, so it is better to use the part that we have instead of the part that needs to be called.

switch the sides because we already have liquidator

we have recovered so switch

6. internal functions only called once can be inlined to save gas

Not inlining costs 20 to 40 gas because of two extra JUMP instructions and additional stack operations needed for function calls.

_execute

_generateValidOrderParameters

_listUnderlyingOnSeaport

_settleAuction

_increaseOpenLiens

_handleStrategistInterestReward

_executeCommitment

_transferAndDepositAssetIfAble

7. public functions not called by the contract should be declared external instead

Contracts are allowed to override their parents’ functions and change the visibility from external to public and can save gas by doing so.

ROUTER()

IMPL_TYPE()

safeBatchTransferFrom()

getFinalAuctionEnd

getWithdrawRatio()

getWithdrawRatio()

file()

getConduitKey

8. pre calculate state vars

pre calculate type casts and operations and only give the result to variables instead of doing it at the start of the contracts every time the contract is made

pre calculate the uint256(keccak256("some string")) - 1 and give the answer to the constant

pre calculate keccak256()

#0 - c4-judge

2023-01-25T23:32:30Z

Picodes marked the issue as grade-b

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