Beanstalk is a permissionless fiat stablecoin protocol built on Ethereum. Its primary objective is to incentivize independent market participants to regularly cross the price of 1 Bean over its dollar peg in a sustainable fashion. This audit is centered around the BIP (Beanstalk Improvement Proposal) that whitelists the BEAN:wstETH Well in the Silo and migrates liquidity underlying Unripe assets from BEAN:ETH to BEAN:wstETH.
Beanstalk is a permissionless fiat stablecoin protocol built on Ethereum. Its primary objective is to incentivize independent market participants to regularly cross the price of 1 Bean over its dollar peg in a sustainable fashion.
Beanstalk does not have any collateral requirements. Beanstalk uses credit instead of collateral to create Bean price stability relative to its value peg of $1. The practicality of using DeFi is currently limited by the lack of decentralized low-volatility assets with competitive carrying costs. Borrowing rates on USD stablecoins have historically been higher than borrowing rates on USD, even when supply increases rapidly. Non-competitive carrying costs are due to collateral requirements.
In particular, this audit is centered around the BIP (Beanstalk Improvement Proposal) that whitelists the BEAN:wstETH Well in the Silo and migrates liquidity underlying Unripe assets from BEAN:ETH to BEAN:wstETH. You can read more details in the RFC for the update here.
You can read an overview of how Beanstalk works here.
gm
caller
gm
function to start the next Season.Generally, the audit covers the Silo, the Sun and many of their associated libraries. A couple contracts from the Barn (related to Unripe assets) are also in scope.
Specifically, only the following contracts are in scope.
protocol/
└── contracts/
├── beanstalk/
│ ├── AppStorage.sol
│ ├── barn/
├── FertilizerFacet.sol
│ │ └── UnripeFacet.sol
│ ├── init/
│ │ └── InitMigrateUnripeBeanEthToBeanSteth.sol
│ ├── silo/
│ │ ├── BDVFacet.sol
│ │ └── SiloFacet/
│ │ └── Silo.sol
│ └── sun/
│ ├── GaugePointFacet.sol
│ ├── LiquidityWeightFacet.sol
│ └── SeasonFacet/
│ └── Oracle.sol
└── libraries/
├── Convert/
│ ├── LibConvert.sol
│ └── LibUnripeConvert.sol
├── LibBarnRaise.sol
├── LibEvaluate.sol
├── LibFertilizer.sol
├── Minting/
│ └── LibWellMinting.sol
├── Oracle/
│ ├── LibChainlinkOracle.sol
│ ├── LibEthUsdOracle.sol
│ ├── LibOracleHelpers.sol
│ ├── LibUniswapOracle.sol
│ ├── LibUsdOracle.sol
│ ├── LibWstethEthOracle.sol
│ └── LibWstethUsdOracle.sol
├── Silo/
│ └── LibWhitelist.sol
└── Well/
├── LibWell.sol
└── LibWellBdv.sol
Beanstalk implements the ERC-2535 Diamond standard. It supports various whitelists for Deposits, Minting, Converts, etc., particularly for LP tokens from Basin.
Blockchains:
Tokens:
Clone repo:
git clone https://github.com/Cyfrin/2024-04-beanstalk-2
Install dependencies:
cd Beanstalk/protocol
yarn
Add RPC:
export FORKING_RPC=https://eth-mainnet.g.alchemy.com/v2/{RPC_KEY}
generate:
yarn generate
Test:
yarn test
The enrootDeposits
functions do not properly emit ERC-1155 events.
enrootDeposits
updates a user's Unripe Deposits' BDV and issues the corresponding Stalk to the user. The single enrootDeposit
function correctly emits the ERC-1155 events, but the multiple variant incorrectly emits a transferSingle
event to the 0 address for each Deposit. Given the Beanstalk subgraph does not use these events, and cannot be used to harm the protocol, the fix will be implmented in a separate upgrade to Beanstalk.All findings in the following audit reports
Rank | Username | |||||
1 | B BARW | $14188.93 | 92 | 0 (0) | 1 (1) | 1 |
2 | B Bauchibred | $6962.17 | 144 | 0 (0) | 2 (0) | 0 |
3 | b bladesec | $5345.24 | 132 | 0 (0) | 2 (0) | 2 |
4 | h holydevoti0n | $1203.68 | 74 | 0 (0) | 1 (0) | 2 |
5 | K | $1048.27 | 84 | 0 (0) | 1 (0) | 0 |
6 | 0 | $822.31 | 66 | 0 (0) | 1 (0) | 1 |
7 | 0 | $748.77 | 60 | 0 (0) | 1 (0) | 0 |
8 | z zhuying | $748.77 | 60 | 0 (0) | 1 (0) | 0 |
9 | I IvanFitro | $171.61 | 8 | 0 (0) | 0 (0) | 1 |
10 | I | $102.97 | 8 | 0 (0) | 0 (0) | 1 |
11 | 0 0xbug | $50.04 | 8 | 0 (0) | 0 (0) | 1 |
12 | m mrMorningstar | $35.74 | 6 | 0 (0) | 0 (0) | 1 |
13 | K | $35.74 | 6 | 0 (0) | 0 (0) | 1 |
14 | g ge6a | $35.74 | 6 | 0 (0) | 0 (0) | 1 |
15 | B | $0.00 | 92 | 0 (0) | 0 (0) | 0 |
16 | a | $0.00 | 92 | 0 (0) | 0 (0) | 0 |
Rank | Username | |||||
Loading... |