Sturdy contest - 0xliumin's results

The first protocol for interest-free borrowing and high yield lending.

General Information

Platform: Code4rena

Start Date: 13/05/2022

Pot Size: $30,000 USDC

Total HM: 8

Participants: 65

Period: 3 days

Judge: hickuphh3

Total Solo HM: 1

Id: 125

League: ETH

Sturdy

Findings Distribution

Researcher Performance

Rank: 23/65

Findings: 3

Award: $94.79

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

14.8433 USDC - $14.84

Labels

bug
duplicate
3 (High Risk)

External Links

Lines of code

https://github.com/code-423n4/2022-05-sturdy/blob/78f51a7a74ebe8adfd055bdbaedfddc05632566f/smart-contracts/LidoVault.sol#L141

Vulnerability details

We return before the require in the LidoVault. This means we could fail to send ETH back to the user and keep executing. Marking this as high because a user could inadvertently lose all their deposited funds.

#0 - sforman2000

2022-05-18T03:11:34Z

Could return the wrong deposit amount in the event

The deposit amount and msg.value aren't necessarily the same, so the amount in the event that's sent might not be representative of the amount that was actually deposited: https://github.com/code-423n4/2022-05-sturdy/blob/78f51a7a74ebe8adfd055bdbaedfddc05632566f/smart-contracts/GeneralVault.sol#L88

#0 - HickupHH3

2022-06-06T04:14:02Z

While I agree, that check is pushed to _depositToYieldPool()'s implementation. I'll leave this as a low-severity, but deduct points for incomplete description and mitigation.

Awards

34.9587 USDC - $34.96

Labels

bug
G (Gas Optimization)

External Links

Upgrade to Solidity 0.8.x

Solidity 0.8.x has some gas improvements that make it worth upgrading. This will also enable you to use custom errors, which also save gas.

Make ConvexCurveLPVault its own ERC20 token

You could consider making the vault an ERC20 token itself on initialization instead of creating a new contract for that. That way, you don't have to do a bunch of external calls to find out how many decimals it is, or mint them.

Use != 0 instead of > 0

This changes if you upgrade to modern solidity and use certain build tools, but != 0 is more gas efficient than > 0 https://github.com/code-423n4/2022-05-sturdy/blob/78f51a7a74ebe8adfd055bdbaedfddc05632566f/smart-contracts/LidoVault.sol#L36

Already have WETH address stored in a variable

https://github.com/code-423n4/2022-05-sturdy/blob/78f51a7a74ebe8adfd055bdbaedfddc05632566f/smart-contracts/LidoVault.sol#L59 You already have the WETH address stored in a vriable, use it here instead of pulling from the addresses provider.

Refactor for loop in getAssetYields

for (uint256 i = 0; i < length - 1; i++) { assetYields[i].asset = assets[i]; assetYields[i].amount = _totalYieldAmount.percentMul( volumes[i].mul(PercentageMath.PERCENTAGE_FACTOR).div(totalVolume) ); extraYieldAmount = extraYieldAmount.sub(assetYields[i].amount); } assetYields[length - 1].amount = extraYieldAmount;

That way, you don't have to do the awkward check for being on the last index.

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