Proposer
Beanstalk Farms
Quorum
50%: 106,664,659.23 Stalk
Two-thirds supermajority: 142,219,545.64 Stalk
Pull Request
https://github.com/BeanstalkFarms/Beanstalk/pull/72
Summary
- Execute a series of transactions to Replant Beanstalk.
- Commit a series of upgrades to Beanstalk.
- Unpause Beanstalk.
Note: Any bugs found during testing will continue to be fixed throughout the BIP-21 Voting Period such that the Replant may not be delayed.
Problem
BIP-21 addresses the following issues:
1. Beanstalk must be Replanted, which involves several steps.
- New ERC-20 tokens: The new Bean, Unripe Bean and Unripe BEAN:3CRV LP ERC-20 Tokens have not yet been deployed.
- New BEAN:3CRV pool: There is currently no liquidity pool in which the new Bean token can be traded.
- Remove old tokens from the Deposit Whitelist: The Deposit Whitelist still has the old Bean token and its associated LP Tokens. Leaving the old tokens on the Whitelist would pose security concerns to Beanstalk.
- Add new tokens to the Deposit Whitelist: The new Bean token, new BEAN:3CRV LP Token, Unripe Bean token and Unripe BEAN:3CRV LP Token have not yet been added to the Deposit Whitelist.
- Minting Pool: The Oracle still uses the old BEAN:ETH liquidity pool when calculating deltaB.
- Minting Schedule: It is unclear how the market will value Bean initially, and the deltaB will be significantly above peg upon Replant.
- Flood: Flood is still based on the old BEAN:ETH liquidity pool.
- Deposit Earned Beans: Pre-exploit Earned Beans are not currently Deposited in any Season, which complicates accounting for them during the Replant.
- Stalk and Seed balances: Stalk and Seed balances are still in their pre-exploit state and must be updated to reflect the Barn Raise structure.
- Barn: Support for the Barn Raise as described in BFP-72 has not yet been added to Beanstalk.
- Ratio at which Fertilizer sales add liquidity: Liquidity from Fertilizer sales must be added to the BEAN:3CRV pool at a particular ratio.
2. Beanstalk has improvements to the issues that have been audited for inclusion in the Replanted version of Beanstalk.
- Oracle Whitelist: The current architecture to facilitate Bean/Soil minting each Season is not generalized or flexible. From a technical perspective, it should be straightforward to add and remove liquidity pools from the list of pools that facilitate Bean/Soil minting.
- Convert Whitelist: The current architecture to facilitate Conversions within the Silo is not generalized or flexible. From a technical perspective, it should be straightforward to add and remove Conversions from the list of possible Conversions within the Silo.
- Sub-optimal Conversion: Currently, when a Stalkholder Converts a Deposited LP token to a Deposited Bean, Grown Stalk from Seeds can be lost if the current BDV of the Deposit is lower than at the time of Deposit due to impermanent loss. This makes Converting unattractive when Beanstalk wants to encourage Conversions.
- Soil issued when P > 1: When P > 1, Beanstalk is currently willing to issue enough Soil such that if demand for Soil remains high, the total number of Pods stays the same from Season to Season, independent of the Pod Rate. A more sophisticated Soil supply schedule should account for the Pod Rate.
- FarmFacet and Internal Balances: Currently there is no flexible way to compose multiple interactions with Beanstalk together into a single transaction.
- Depot and Curve Pipeline: Beanstalk previously supported complex transactions with Uniswap and Beanstalk in a single transaction. The architecture to support these types of transactions is not generalized to also be able to interact with other protocols.
- Withdrawal Freeze: The current 4 Season Withdrawal Freeze is an economic inefficiency that creates a supply overhang when there are Withdrawn assets.
- Deposit transferability: Deposits currently cannot be transferred from one address to another.
- Ownership transfer process: Ownership transfer of the Beanstalk contract is currently a one-step process and doesn’t require a claim by the receiving address.
- Division of Silo Reward Claiming: Silo Members cannot currently Mow Grown Stalk and Plant Plantable Seeds in separate transactions, even when it may be gas-efficient to do so.
- Minting of Plantable Seeds: Plantable Seeds are currently minted before being Planted, which is a suboptimal accounting practice.
- Contract ownership: Publius currently custodies ownership of the Beanstalk and Fertilizer contracts, and must transfer ownership of Beanstalk to the BCM and transfer ownership of the Fertilizer contracts to Beanstalk.
3. Beanstalk must be Unpaused.
- Unpause Beanstalk: A
sunrise() function call is currently not accepted by Beanstalk.
Proposed Solution
The following solutions are proposed to the issues listed above:
1. Execute a series of steps to Replant Beanstalk.
- New ERC-20 tokens: Deploy and distribute new Bean, Unripe Bean and Unripe BEAN:3CRV LP ERC-20 Tokens.
- Holders of Beans at the end of the block prior to the exploit received Unripe Beans at a 1:1 ratio.
- Holders of LP Tokens on the Deposit Whitelist that were not Deposited at the end of the block prior to the exploit received Unripe Φ at a ratio of 1 Unripe Φ per BDV of LP Tokens on the Deposit Whitelist held at the end of the block prior to the exploit.
- Holders of LP Tokens on the Deposit Whitelist that were Deposited at the end of the block prior to the exploit received Unripe Φ at a ratio of 1 Unripe Φ per the maximum of the BDV of the Deposit at the end of the block prior to the exploit and at the time of Deposit, per Deposit.
- New BEAN:3CRV pool: Deploy a new BEAN:3CRV metapool with an A parameter of 1 per BFP-77. Mint 100 Beans and add the 100 Beans and 100 USDC to the pool as initial liquidity.
- Remove old tokens from the Deposit Whitelist:
- Remove the old Bean token.
- Remove the old BEAN:3CRV LP Token.
- Remove the old BEAN:ETH LP Token.
- Remove the old BEAN:LUSD LP Token.
- Add new tokens to the Deposit Whitelist: For the BDV function, please refer to the appendix in the attached whitepaper.
- Add the new Bean token with 1 Stalk and 2 Seeds per BDV Deposited.
- Add the new BEAN:3CRV LP Token with 1 Stalk and 4 Seeds per BDV Deposited.
- Add the Unripe Bean token with 1 Stalk and 2 Seeds per BDV Deposited.
- Add the Unripe BEAN:3CRV LP Token with 1 Stalk and 4 Seeds per BDV Deposited.
- Minting Pool: Remove the old BEAN:ETH liquidity pool from the calculation of deltaB.
- Minting Schedule: Replant Beanstalk with a ramped minting schedule for Soil and Beans—deltaB will be equal to deltaB * R, where R starts at 0% and increases by 1% at the start of each Season for 100 Seasons after Replant.
- Flood: Remove the old BEAN:ETH liquidity pool from the Flood.
- Deposit Earned Beans: Distribute Earned Beans as Deposited Unripe Beans in Season 6074 upon Replant.
- Stalk and Seed balances: Recompute all Stalk and Seed balances.
- A Stalkholder’s Stalk upon Replant is the percentage of Fertilizer sold prior to Replant times their Stalk at the end of the block prior to the exploit.
- A Stalkholder’s Seeds upon Replant is the percentage of Fertilized sold prior to Replant times the sum of their Seeds at the end of the block prior to the exploit and their Plantable Seeds at the end of the block prior to the exploit.
- Old BEAN:LUSD LP Token holders are credited as if they had more Seeds, as Unripe BEAN:3CRV LP receives 4 Seeds for Depositing in the Silo.
- Barn: Implement the full specifications of the Barn. For a full writeup of the Barn, please refer to the Barn section in the attached whitepaper.
- Ratio at which Fertilizer sales add liquidity: Add liquidity from Fertilizer sales to the BEAN:3CRV pool at a ratio of 1:0.866616.
2. Implement a series of improvements to Beanstalk.
- Oracle Whitelist: Move the Oracle to mint based on the Oracle Whitelist (the whitelist of liquidity pools whose deltaB’s are summed to calculate a cumulative deltaB), which upon Replant will consist solely of the new BEAN:3CRV metapool.
- Convert Whitelist: Introduce the Convert Whitelist, the generalized whitelist that determines which Conversions within the Silo are permitted under certain conditions. For full details on the Convert Whitelist, please refer to the appendix in the attached whitepaper. The following Conversions are whitelisted upon Replant:
- Deposited Beans to Deposited BEAN:3CRV LP Tokens, when the Bean price in the BEAN:3CRV pool is greater than $1.
- Deposited BEAN:3CRV LP tokens to Deposited Beans, when the Bean price in the BEAN:3CRV pool is less than $1.
- Deposited Unripe Beans to Deposited Unripe BEAN:3CRV LP Tokens, when the Bean price in the BEAN:3CRV pool is greater than $1.
- Deposited Unripe BEAN:3CRV LP Tokens to Deposited Unripe Beans, when the Bean price in the BEAN:3CRV pool is less than $1.
- Sub-optimal Conversion: When a Stalkholder Converts a Deposit, they update its Season of Deposit to retain its Grown Stalk from Seeds, and BDV only if it is higher than when it was Deposited.
- Soil issued when P > 1: Change the definition of S_t^{min} to:

- FarmFacet and Internal Balances: Introduce the FarmFacet and Internal (Farm) Balances that allow Farmers to compose transactions within Beanstalk together.
- Depot and Curve Pipeline: Add the Depot to the Farm. Add the Curve Pipeline to the Depot to enable interactions with Curve through Beanstalk.
The Curve Pipeline allows anyone to call functions in any pool registered in any of the following Curve registries.
- 0xB9fC157394Af804a3578134A6585C0dc9cc990d4
- 0x90E00ACe148ca3b23Ac1bC8C240C2a7Dd9c2d7f5
- 0x8F942C20D02bEfc377D41445793068908E2250D0
The following functions to interact with Curve pools can be called through the Curve Pipeline:
function exchange(
address pool,
address registry,
address fromToken,
address toToken,
uint256 amountIn,
uint256 minAmountOut,
LibTransfer.From fromMode,
LibTransfer.To toMode
) external payable nonReentrant;
// only in Metapools
function exchangeUnderlying(
address pool,
address fromToken,
address toToken,
uint256 amountIn,
uint256 minAmountOut,
LibTransfer.From fromMode,
LibTransfer.To toMode
) external payable nonReentrant;
function addLiquidity(
address pool,
address registry,
uint256[] memory amounts,
uint256 minAmountOut,
LibTransfer.From fromMode,
LibTransfer.To toMode
) external payable nonReentrant;
function removeLiquidity(
address pool,
address registry,
uint256 amountIn,
uint256[] calldata minAmountsOut,
LibTransfer.From fromMode,
LibTransfer.To toMode
) external payable nonReentrant;
function removeLiquidityImbalance(
address pool,
address registry,
uint256[] calldata amountsOut,
uint256 maxAmountIn,
LibTransfer.From fromMode,
LibTransfer.To toMode
) external payable nonReentrant;
function removeLiquidityOneToken(
address pool,
address registry,
address toToken,
uint256 amountIn,
uint256 minAmountOut,
LibTransfer.From fromMode,
LibTransfer.To toMode
) external payable nonReentrant;
- Withdrawal Freeze: Change x_i from 4 Seasons to 0.
- Deposit transferability: Make Deposits transferable.
- Ownership transfer process: Implement a 2-step ownership transfer process.
- Division of Silo Reward Claiming: Introduce division of Silo Reward claiming. Mow claims Grown Stalk and Plant claims Plantable Seeds, Earned Stalk and Earned Beans.
- Minting of Plantable Seeds: Change Plantable Seeds to only be minted once Planted.
- Contract ownership: Transfer ownership of Beanstalk from Publius to the BCM and ownership of Fertilizer from Publius to Beanstalk.
3. Unpause Beanstalk.
- Unpause Beanstalk: The BCM will Unpause Beanstalk on August 6th, 2022 around 16:00 UTC.
Rationale
BIP-21 exceeds the character limit on Snapshot, so the Rationale section can be found on the BIP-21 proposal on GitHub and this Arweave upload of BIP-21.
Post Audit Changes
BIP-21 exceeds the character limit on Snapshot, so the Post Audit Changes section can be found on the BIP-21 proposal on GitHub and this Arweave upload of BIP-21.
Effective
After either:
- A two-thirds supermajority is reached; or
- The Voting Period ends and more than half of the total outstanding Stalk votes in favor of the BIP,
Publius will:
- Execute the remainder of the Water Treatment approved by BIP-20;
- Transfer ownership of Beanstalk to the BCM;
- Deploy BIP-21 related facets and initialization script;
- Propose the BIP-21 Diamond Cut to the BCM;
- Propose the approve transaction to use the BCM’s USDC; and
- Propose the addFertilizer transaction that adds the BCM’s USDC to the new BEAN:3CRV pool.
After that, the BCM will:
- Execute the BIP-21 Diamond Cut, which removes all existing function selectors and adds the new ones;
- Initialize Beanstalk;
- Execute the approve transaction to use the BCM’s USDC; and
- Execute the addFertilizer transaction.
The BCM will Unpause Beanstalk thereafter on August 6, 2022 at around 16:00 UTC.
After the Unpause transaction and thus BIP-21 is fully executed, the BCM shall follow the process for verifying proposed BIPs moving forward.