FeedProjects
Developers
Settings
🎉 A new chapter begins: Boardroom has joined Agora
Learn more
protocol logo
Explore / Projects
Beanstalk DAO

Proposals

Members

Information

Create Proposal

Beanstalk DAO

ProposalsMembersInformation
Proposal
Back to Proposals
closedEnded 2 years ago · Snapshot (Offchain)

BIP-38: Migrate urBEAN3CRV to urBEANETH

By 0x47a4...Ad6888

Proposer

Beanstalk Farms, Brendan Sanderson, Ben Weintraub

Proposer Wallet: 0x87c5e5413d60e1419fd70b17c6d299aa107efb49

Summary

  • Migrate the BEAN:3CRV LP tokens (BEAN3CRV) that underly the Unripe BEAN:3CRV LP token (urBEAN3CRV) to BEAN:ETH Well LP tokens (BEANETH);
  • Migrate the corresponding Unripe liquidity from the BEAN3CRV pool to the BEANETH Well; and
  • Implement the first step in a two step process to track Deposited BDV that has not migrated to Silo V3.

Links

  • BIP-38 GitHub PR
  • GitHub Commit Hash: 76066733bcddb944b9af8f29acf150c02a5b8437
  • Safe Transaction

Problem

As of writing, over 98% of liquidity for Beans is currently in the BEAN3CRV pool.

BEAN3CRV:

  • Is exposed to the centralization risks of USDC, USDT and DAI.
  • Uses an oracle that is not resistant to inter-block MEV manipulation; and
  • Is subject to unnecessary trading fees that negatively affect peg maintenance.

Beanstalk currently does not support multiple Unripe LP tokens.

BDV that has not been migrated to Silo V3 is not included in s.siloBalances[token].depositedBdv. For Beanstalk to support a Grown Stalk Gauge System, it is necessary to track the total Deposited BDV for each whitelisted token.

Proposed Solution

Migration Process

Migrate the BEAN3CRV LP tokens that underly the urBEAN3CRV token to BEANETH Well LP tokens. In doing so, the liquidity underlying urBEAN3CRV is migrated to the BEANETH Well and the urBEAN3CRV token becomes the urBEANETH token (albeit, with the same token address).

Perform the following actions by the Beanstalk Community Multisig (BCM):

Transaction #ProtocolDescription
1BeanstalkExecute BIP-38 Diamond Cut and transfer underlying BEAN3CRV to the BCM
2CurveRemove BEAN3CRV liquidity as Bean, USDC, USDT and DAI proportionate to the ratio of the pool
3aCoW SwapUpgrade Safe to support CoW Swap TWAP + swap USDC into ETH using TWAP order
3bCoW SwapSwap USDT into ETH using TWAP order
3cCoW SwapSwap DAI into ETH using TWAP order
4BasinAdd Beans from Step (2) and ETH from Step (3) as liquidity to the BEANETH Well
5BeanstalkAdd BEANETH LP as underlying token for the new urBEANETH

In order to minimize the risk of the swap being frontrun (for example, immediately after the passage of the BIP), authorize the BCM to begin the migration process at any point within 30 days of the passage of this BIP.

During the migration process, attempts to Deposit, Convert or Chop Unripe assets will revert. After the migration process is complete, Conversions between urBEAN and urBEANETH will Convert in/out of the BEANETH Well instead of the BEAN3CRV pool.

The cost of slippage during Step (3) is passed onto the Unripe LP holders.

addMigratedUnderlying is added to the Unripe Facet to migrate the underlying token of an Unripe token to a new token.

Due to the multi-step nature of this BIP, BCM Signers are only expected to submit Etherscan verified messages for the initial Diamond Cut transaction.

Fertilizer Changes

Upgrade the Barn to add liquidity to the BEANETH Well instead of the BEAN3CRV pool upon each Fertilizer purchase.

As a result:

  • Fertilizer is bought with WETH instead of USDC;
  • The amount of Fertilizer received after purchase and increase in amount recapitalized is equal to the value of the WETH in USDC at the time of purchase;
  • The mintFertilizer function contains a minFertilizerOut parameter to protect against substantial movement in the ETH price; and
  • The addFertilizerOwner function is removed.

Silo V3 Unmigrated BDV

A two step process is required to start properly tracking the total Deposited BDV of each whitelisted token. Implement the first step by adding a counter (s.migratedBdvs) that tracks the amount of BDV that has been migrated to Silo V3 for each token.

In the second step, the total Deposited BDV for each token is incremented by the remaining unmigrated BDV at the BIP-38 commitment block subtracted by the BDV that has been migrated since that block as stored on-chain. This second step must be implemented in a future BIP.

Technical Rationale

Given that the migration process cannot be executed atomically and Unripe asset functionality will be in a broken state during it, attempts to Deposit, Convert or Chop Unripe assets during the migration process will revert.

The Unripe Facet must be updated to add support for migrating the Unripe LP token to a new underlying asset.

The mintFertilizer function must be updated to include the minFertilizerOut parameter to account for potential movement in the ETH price between transaction submission and execution. The addFertilizerOwner function is removed given that it would need to be updated to reflect the migration to urBEANETH, however it was only expected to be called once during the Replant.

The Convert Facet and Convert Getters Facet must be updated due to function changes in LibUnripeConvert.sol and LibWellConvert.sol.

The Metadata Facet must be updated in order to update the ERC-1155 metadata for urBEANETH Deposits.

The BDV Facet must be updated due to unripeLPToBDV being changed to reflect the migration to BEANETH.

The Migration Facet must be updated due to the introduction of the migrated BDV counter.

Economic Rationale

Beans primarily trade against 3CRV which is a significant centralization vector for Beanstalk. Ether is the most decentralized, censorship resistant and liquid asset on the Ethereum network.

For as long as most liquidity for Beans is in the BEAN3CRV pool, Beanstalk is still subject to inter-block MEV manipulation. The Multi Flow Pump on the BEANETH Well is the first Ethereum-native oracle for Ethereum-native data that offers inter-block MEV manipulation resistance in a post-Merge environment.

For as long as most volume for Beans is in the BEAN3CRV pool, most trades with Beans are still subject to an unnecessary trading fee in the pool, which results in worse prices for Farmers and worse peg maintenance for Beanstalk. The Constant Product 2 Well Function used by the BEANETH Well has no trading fee.

The price of 3CRV is dependent on the worst of the prices of USDC, USDT and DAI. ETH is not subject to the same risk.

Contract Changes

Initialization Contract

The init function on the following InitMigrateUnripeBean3CrvToBeanEth contract is called:

  • 0x810468cbC28ecb522C10cB53FEC9e387F1ebc84D

Unripe Facet

The following UnripeFacet is removed from Beanstalk:

  • 0x261b3ae660504537fbfe15b6c1c664976344eb0a

The following UnripeFacet is added to Beanstalk:

  • 0xAa8c44D0B89864b467C3776a7Dd367ff2aB6992A

UnripeFacet Function Changes

NameSelectorActionTypeNew Functionality
_getPenalizedUnderlying0xa84643e4ReplaceView
balanceOfPenalizedUnderlying0x1acc0a47ReplaceView
balanceOfUnderlying0x1acc0a47ReplaceView
getPenalizedUnderlying0x6de45df2ReplaceView
getPenalty0x014a8a49ReplaceView
getPercentPenalty0xbb7de478ReplaceView
getRecapFundedPercent0x43cc4ee0ReplaceView
getRecapPaidPercent0xab434eb7ReplaceView
getTotalUnderlying0xadef4533ReplaceView
getUnderlying0x9f06b3faReplaceView
getUnderlyingPerUnripeToken0xb8a04d1bReplaceView
getUnderlyingToken0x691bcc88ReplaceView
isUnripe0xfc6a19dfReplaceView
picked0xd3c73ec8ReplaceView
addMigratedUnderlying0x787cee99AddCall✓
addUnripeToken0xfa345569ReplaceCall
chop0x9a516cadReplaceCall✓
pick0x13ed3ceaReplaceCall
switchUnderlyingToken0xa33fa99fAddCall✓

Fertilizer Facet

The following FertilizerFacet is removed from Beanstalk:

  • 0xFC7Ed192a24FaB3093c8747c3DDBe6Cacd335B6C

The following FertilizerFacet is added to Beanstalk:

  • 0x3FA7ECcfbFDF4407932D2318401d20464189C5F1

FertilizerFacet Function Changes

NameSelectorActionTypeNew Functionality
balanceOfBatchFertilizer0x304ec65dReplaceView
balanceOfFertilized0xb6f42085ReplaceView
balanceOfFertilizer0x1799b3b2ReplaceView
balanceOfUnfertilized0x1edb6be1ReplaceView
beansPerFertilizer0x9bb4e35aReplaceView
getActiveFertilizer0xdc6ba285ReplaceView
getCurrentHumidity0x39448802ReplaceView
getEndBpf0xc85951a1ReplaceView
getFertilizer0x9c45a1d5ReplaceView
getFertilizers0x34af5416ReplaceView
getFirst0x1e223143ReplaceView
getHumidity0x29130a66ReplaceView
getLast0x4d622831ReplaceView
getMintFertilizerOut0x69744dd0AddView✓
getNext0xf4a057e2ReplaceView
isFertilizing0x6ae1c014ReplaceView
remainingRecapitalization0x4a16607cReplaceView
totalFertilizedBeans0x4f9a9678ReplaceView
totalFertilizerBeans0xf9c4ebdeReplaceView
totalUnfertilizedBeans0xa3ef48c9ReplaceView
addFertilizerOwner0x8cd31ca0RemoveCall
claimFertilized0x83e08888ReplaceCall
mintFertilizer0x0bfca7e3RemoveCall
mintFertilizer0xbb02e10bAddCall✓
payFertilizer0xd47aee59ReplaceCall

Convert Facet

The following ConvertFacet is removed from Beanstalk:

  • 0xC2f8F1412d10E4DC79D34a46ab1d3d862517f939

The following ConvertFacet is added to Beanstalk:

  • 0xDc6B4ef6bA55706B19Bd389eA446d232eFb4E5D4

ConvertFacet Function Changes

NameSelectorActionTypeNew Functionality
convert0xb362a6e8ReplaceCall

Convert Getters Facet

The following ConvertGettersFacet is removed from Beanstalk:

  • 0x912f505ecD6536733da22BB4349595aA36806918

The following ConvertGettersFacet is added to Beanstalk:

  • 0x789e37096Fb0abbD4f64A86B51D720b371853a70

ConvertGettersFacet Function Changes

NameSelectorActionTypeNew Functionality
getAmountOut0x4aa06652ReplaceView
getMaxAmountIn0x24dd285cReplaceView

Metadata Facet

The following MetadataFacet is removed from Beanstalk:

  • 0x5e6991aFa1352822e769c873200954B4dE6c6E48

The following MetadataFacet is added to Beanstalk:

  • 0x8aD8dfC3303469A8c2d14763199a99363bF580cc

MetadataFacet Function Changes

NameSelectorActionTypeNew Functionality
imageURI0xc20b8071ReplaceView
name0x06fdde03ReplaceView
symbol0x95d89b41ReplaceView
uri0x0e89341cReplaceView

BDV Facet

The following BDVFacet is removed from Beanstalk:

  • 0x9Cb54A8eAcD4d295dd02833cd2bdD385173c7fF5

The following BDVFacet is added to Beanstalk:

  • 0xC1Bbee46EcB6445B176F7f172F91976ADF4e21D9

BDVFacet Function Changes

NameSelectorActionTypeNew Functionality
beanToBDV0x5a049a47ReplaceView
curveToBDV0xf984019bReplaceView
unripeBeanToBDV0xc8cda2a0ReplaceView
unripeLPToBDV0xb0c22bb1ReplaceView✓
wellBdv0xc84c7727ReplaceView

Migration Facet

The following MigrationFacet is removed from Beanstalk:

  • 0x141209527f95540e0b018e56edf5a59e1339437f

The following MigrationFacet is added to Beanstalk:

  • 0x9F2444e6cFAAB6ea16Fc05B989f1017508F84A41

MigrationFacet Function Changes

NameSelectorActionTypeNew Functionality
balanceOfGrownStalkUpToStemsDeployment0x505f43eaReplaceView
balanceOfLegacySeeds0x1be2cfd8ReplaceView
getDepositLegacy0xa9be1acbReplaceView
mowAndMigrate0x1f4f3d55ReplaceCall
mowAndMigrateNoDeposits0xaed942e9ReplaceCall
totalMigratedBdv0x2b8cde0dAddView✓

Event Changes

NameChange
SwitchUnderlyingTokenNew event

Beans Minted

None.

Audit

The commit hash of this BIP is 76066733bcddb944b9af8f29acf150c02a5b8437.

Cyfrin has performed an audit of commit hash 12c608a22535e3a1fe379db1153185fe43851ea7 and then reviewed remediations included in commit hash 76066733bcddb944b9af8f29acf150c02a5b8437.

The final audit report can be found here.

Effective

No upgrades are necessarily executed by the BCM immediately upon the passage of this BIP.

The BCM has up to 30 days after the passage of this BIP to start the migration outlined in Migration Process.

Continue Reading
Connect Wallet to Add Note
0
Votes 181
VoterCast PowerVote & Rationale
0x15F5...1499E3
3.383M

For

0xEf49...0838C8
3.099M

For

0x3743...e2494B
3.099M

For

0xC385...1eB20E
2.576M

For

0x9664...9340cf
2.321M

For

SHOW MORE
VOTE POWER
0
Connect Wallet
Proposal Status
  • Fri October 13 2023, 04:00 pmVoting Period Starts
  • Fri October 20 2023, 04:00 pmEnd Voting Period
Current Results

1-For

68.69M

98.83%

2-Against

815,465.449

1.17%

3-Abstain

0.687

0%
DocumentationBrandingContact Us
Home
This Project is Currently Disabled

If you would like to enable it, please checkout below.

Boardroom Subscription

Sign up for an individual subscription (access all projects on the platform)

Subscribe
Enable Project

Enable the entire project for every user

Enable Project
Contact Us