Ethena Labs - Imlazy0ne's results

Enabling The Internet Bond

General Information

Platform: Code4rena

Start Date: 24/10/2023

Pot Size: $36,500 USDC

Total HM: 4

Participants: 147

Period: 6 days

Judge: 0xDjango

Id: 299

League: ETH

Ethena Labs

Findings Distribution

Researcher Performance

Rank: 111/147

Findings: 1

Award: $4.52

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Delete getUnvestedAmount() to save gas

Description

There is a redundant function call to getUnvestedAmount() in the transferInRewards() function of the StakedUSDe.sol contract. The getUnvestedAmount() is equal to zero at uint256 newVestingAmount = amount + getUnvestedAmount(); because transferInRewards() will always revert if getUnvestedAmount() > 0.

  function transferInRewards(uint256 amount) external nonReentrant onlyRole(REWARDER_ROLE) notZero(amount) {
    if (getUnvestedAmount() > 0) revert StillVesting();
    uint256 newVestingAmount = amount + getUnvestedAmount();

    vestingAmount = newVestingAmount;
    ...
  }

Impact

Wasting gas.

  • Using uint256 newVestingAmount = amount; instead of uint256 newVestingAmount = amount + getUnvestedAmount();

#0 - c4-pre-sort

2023-11-02T02:22:08Z

raymondfam marked the issue as low quality report

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