Platform: Code4rena
Start Date: 24/03/2023
End Date: 30/03/2023
Period: 6 days
Status: Completed
Pot Size: $49,200 USDC
Participants: 246
Reporter: yadir
Judge: Picodes
Id: 226
League: ETH
d3e4 | 1/246 | $3,238.66 | 10 | 2 | 0 | 6 | 1 | - | Grade B | 0 |
adriro | 2/246 | $1,540.52 | 9 | 4 | 0 | 3 | 0 | Grade A | Grade A | 0 |
whoismatthewmc1 | 3/246 | $1,363.11 | 3 | 0 | 0 | 2 | 0 | - | 0 | 0 |
0x52 | 4/246 | $1,337.39 | 4 | 3 | 0 | 1 | 0 | 0 | 0 | 0 |
m_Rassska | 5/246 | $1,057.65 | 4 | 1 | 0 | 2 | 0 | Grade A | 0 | 0 |
T1MOH | 6/246 | $988.40 | 4 | 3 | 0 | 0 | 0 | Grade B | 0 | 0 |
Tricko | 7/246 | $969.37 | 6 | 2 | 0 | 3 | 0 | - | 0 | 0 |
anodaram | 8/246 | $766.20 | 4 | 2 | 0 | 1 | 0 | 0 | Grade B | 0 |
rvierdiiev | 9/246 | $762.38 | 6 | 4 | 0 | 1 | 0 | - | 0 | 0 |
yac | 10/246 | $749.96 | 8 | 2 | 0 | 4 | 0 | - | - | 0 |
Auditor per page
Automated findings output for the contest can be found here.
Note for C4 wardens: Anything included in the automated findings output is considered a publicly known issue and is ineligible for awards.
SafEth is a smart contract suite developed by Asymmetry Finance that enables a user to diversify their ETH into staked derivatives. Currently the supported staked derivatives are wstETH, rETH, and sfrxETH.
The goal of SafEth is to help decentralize the liquid staked derivatives on the Ethereum blockchain. This is done by enabling and easy access to diversification of derivatives.
In the future, SafEth will be used in conjunction with other smart contracts to allow the staking of SafEth to gain higher yield.
There are two main functions a user will interact with and they both reside in SafEth.sol
stake
: The main entry-point to the protocol. Will take the users ETH
and convert it into various derivatives based on their weights and mint an amount of safETH
that represents a percentage of the total assets in the system.unstake
: The main exit-point from the protocol. Will burn the users safETH
and convert a percentage of each derivative to give the user their ETH back including any of the rewards their derivatives have accrued over the time since they started staking.SafEth: An upgradeable ERC20 contract that handles the conversion between ETH and whatever derivatives that are implemented
These contracts handle all business logic to deposit and withdraw through their specific protocols. These will change after Shanghai is released when withdrawing from the beacon chain is enabled
File | SLOC | Description and Coverage | Libraries |
---|---|---|---|
Contracts (4) | |||
contracts/SafEth/derivatives/WstEth.sol 💰 | 54 | Derivative contract for wstETH, 95.00% | @openzeppelin/* |
contracts/SafEth/derivatives/SfrxEth.sol 💰 | 81 | Derivative contract for sfrxETH, 95.00% | @openzeppelin/* |
contracts/SafEth/SafEth.sol 💰 | 156 | This contract is the main staking/unstaking contract, 100.00% | @openzeppelin/* |
contracts/SafEth/derivatives/Reth.sol 💰 🧮 | 169 | Derivative contract for rETH, 97.56% | @openzeppelin/* |
Total (over 4 files): | 460 | 98.06% |
- If you have a public code repo, please share it here: https://github.com/asymmetryfinance/smart-contracts - How many contracts are in scope?: 4 - Total SLoC for these contracts?: 645 - How many external imports are there?: 12 - How many separate interfaces and struct definitions are there for the contracts within scope?: 20 - Does most of your code generally use composition or inheritance?: inheritance - How many external calls?: 27 - What is the overall line coverage percentage provided by your tests?: 92 - Is there a need to understand a separate part of the codebase / get context in order to audit this part of the protocol?: False - Please describe required context: - Does it use an oracle?: No - Does the token conform to the ERC20 standard?: Yes - Are there any novel or unique curve logic or mathematical models?: Yes - Does it use a timelock function?: No - Is it an NFT?: No - Does it have an AMM?: Yes - Is it a fork of a popular project?: False - Does it use rollups?: No - Is it multi-chain?: No - Does it use a side-chain?: False
To immediately get started run the following command
export FORK_URL="<your-mainnet-url-goes-here>" && rm -Rf 2023-03-asymmetry || true && git clone https://github.com/code-423n4/2023-03-asymmetry.git -j8 && cd 2023-03-asymmetry && cat .env.sample | sed -e 's|MAINNET_URL=|MAINNET_URL="'"$FORK_URL"'"|g' > .env && nvm use && yarn && yarn compile && REPORT_GAS=true yarn test
To use the correct node version run
nvm use
To install dependencies:
First copy the .env.sample
to a file called .env
and add an Alchemy Node URL under the variable MAINNET_URL
Next run yarn
to install dependencies and run yarn compile
to compile the project.
For testing on hardhat simply run:
yarn test
Or for complete coverage:
yarn coverage
Run the following command to spin up your local node
yarn local-node
In another terminal run this command to deploy the contracts to your local node
yarn deploy --network localhost
Once deployed you can interact with your local contracts through Ethernal or scripts/tests