Neo Tokyo contest - R-Nemes's results

A staking contract for the crypto gaming illuminati.

General Information

Platform: Code4rena

Start Date: 08/03/2023

Pot Size: $60,500 USDC

Total HM: 2

Participants: 123

Period: 7 days

Judge: hansfriese

Id: 220

League: ETH

Neo Tokyo

Findings Distribution

Researcher Performance

Rank: 123/123

Findings: 1

Award: $19.30

Gas:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Gas optimisations

[G1] Multiply by 100 then divide by 100

  • NeoTokyoStaker.sol#L1022

    _DIVISOR = 100.
    citizenStatus.points = 100 * timelockMultiplier / _DIVISOR; Make the following change and save 729 gas on average for calling stake citizenStatus.points = timelockMultiplier;

  • NeoTokyoStaker.sol#L1155 uint256 points = amount * 100 / 1e18 * timelockMultiplier / _DIVISOR; Make the following change and save 729 gas on average for calling withdrawer uint256 points = amount * timelockMultiplier / 1e18;

[G2] Cache stakerLPPosition[msg.sender] to save upto 2301 gas

NeoTokyoStaker.sol#L1157-L1161

LPPosition storage position = stakerLPPosition[msg.sender]; // Update the caller's LP token stake. position.timelockEndTime = block.timestamp + timelockDuration; position.amount += amount; position.points += points;

#0 - c4-judge

2023-03-17T04:34:47Z

hansfriese 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