Yieldy contest - slywaters's results

A protocol for gaining single side yields on various tokens.

General Information

Platform: Code4rena

Start Date: 21/06/2022

Pot Size: $50,000 USDC

Total HM: 31

Participants: 99

Period: 5 days

Judges: moose-code, JasoonS, denhampreen

Total Solo HM: 17

Id: 139

League: ETH

Yieldy

Findings Distribution

Researcher Performance

Rank: 94/99

Findings: 1

Award: $26.57

🌟 Selected for report: 0

🚀 Solo Findings: 0

Gas Report

Replace postfix increment (var++) with prefix increment (++var)

Using ++i costs less gas than using i++. In the context of a for-loop, gas is saved on each iteration.

The following line of code is affected:

2022-06-yieldy/src/contracts/Staking.sol:708: epoch.number++;

Use strict less-than/greather-than comparisons rather than less-than-or-equal/greater-than-or-equal

When compiled, Solidity code using the >= or <= comparison operators in fact executes two separate checks: one for 'is-equal-to' and a second for 'is-greater-than/is-less-than'. By contrast, using > or < performs only one check. Therefore code that is written to use strict comparison operators is more gas-efficient.

If this change is applied, be sure to update the relevant variables being evaluated. For clarity, it is also advised to rename the variables to make this change explicit, e.g. renaming a variable from MINIMUM to MINIMUM_PLUS_ONE.

The following lines are affected:

2022-06-yieldy/src/contracts/LiquidityReserve.sol:163: require(_amount <= balanceOf(msg.sender), "Not enough lr tokens"); 2022-06-yieldy/src/contracts/LiquidityReserve.sol:171: IERC20Upgradeable(stakingToken).balanceOf(address(this)) >= 2022-06-yieldy/src/contracts/LiquidityReserve.sol:69: stakingTokenBalance >= MINIMUM_LIQUIDITY, 2022-06-yieldy/src/contracts/LiquidityReserve.sol:94: require(_fee <= BASIS_POINTS, "Out of range"); 2022-06-yieldy/src/contracts/Staking.sol:265: return epoch.number >= info.expiry && info.expiry != 0; 2022-06-yieldy/src/contracts/Staking.sol:285: epoch.number >= info.expiry && 2022-06-yieldy/src/contracts/Staking.sol:288: ((requestedWithdrawals.minCycle <= currentCycleIndex && 2022-06-yieldy/src/contracts/Staking.sol:289: requestedWithdrawals.amount + withdrawalAmount >= 2022-06-yieldy/src/contracts/Staking.sol:290: info.amount) || withdrawalAmount >= info.amount); 2022-06-yieldy/src/contracts/Staking.sol:306: requestedWithdrawals.minCycle <= currentCycleIndex 2022-06-yieldy/src/contracts/Staking.sol:361: block.timestamp + timeLeftToRequestWithdrawal >= nextCycleStart && 2022-06-yieldy/src/contracts/Staking.sol:528: _amount <= walletBalance + warmUpBalance, 2022-06-yieldy/src/contracts/Staking.sol:535: if (_amount >= warmUpBalance) { 2022-06-yieldy/src/contracts/Staking.sol:586: require(reserveBalance >= _amount, "Not enough funds in reserve"); 2022-06-yieldy/src/contracts/Staking.sol:703: if (epoch.endTime <= block.timestamp) { 2022-06-yieldy/src/contracts/Staking.sol:713: if (balance <= staked) { 2022-06-yieldy/src/contracts/Yieldy.sol:190: require(creditAmount <= creditBalances[msg.sender], "Not enough funds"); 2022-06-yieldy/src/contracts/Yieldy.sol:210: require(_allowances[_from][msg.sender] >= _value, "Allowance too low"); 2022-06-yieldy/src/contracts/Yieldy.sol:286: require(currentCredits >= creditAmount, "Not enough balance");
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