Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EBIP-9 #669

Merged
merged 4 commits into from
Oct 24, 2023
Merged

EBIP-9 #669

merged 4 commits into from
Oct 24, 2023

Conversation

BrendanSanderson
Copy link
Contributor

@BrendanSanderson BrendanSanderson commented Oct 21, 2023

EBIP-9: Temporarily Disable the Well Minting Oracle

Submitter

Beanstalk Community Multisig

Emergency Process Note

Per the process outlined in the BCM Emergency Response Procedures, the BCM can take swift action to protect Beanstalk in the event of a bug or security vulnerability.

Links

Problem

The first stage of the BIP-38 migration process is complete. The final stage of the process is to add the BEAN and ETH in the Beanstalk Community Multisig (BCM) as liquidity in the BEANETH Well.

However, given (1) time-weighted average reserves in the Multi Flow Pump are used by Beanstalk for minting, (2) the 0.1% cap on changes in the TWA Multi Flow Pump reserves each block and (3) the extreme % increase in the Well reserves as a result of the addition of liquidity, it will take about a substantial amount of time after the addition of liquidity for the TWA Multi Flow Pump reserves to catch up to the current Well reserves. This is exaggerated if the ETH price moves up some % during the catch up period.

The reserves in the BEANETH Well are expected to increase by ~7700% as a result of adding the liquidity. Increasing at 0.1% a block, it would take 4345.98 blocks for the TWA Multi Flow Pump reserves to catch up to the current Well reserves. This is ~14.4866 hours.

$$ 1.001^x = \ln(77) $$

$$ x \approx 4345.98 \ \text{blocks} $$

$$ \frac{x}{300} = \frac{4345.98}{300} \approx 14.4866 \ \text{hours} $$

Solution

Turn off minting in the BEANETH Well until Season 16665 (about 20 Seasons after the transaction was committed, in order to substantially overestimate the calculation of ~14.4866 hours) by adding a check in LibWellMinting.initializeOracle.

All changes were reviewed by Cyfrin.

Contract Changes

Initialization Contract

The init function on the following InitTurnOffBeanEthWell contract is called:

Season Facet

The following SeasonFacet is removed from Beanstalk:

The following SeasonFacet is added to Beanstalk:

SeasonFacet Function Changes

Name Selector Action Type New Functionality
abovePeg 0x2a27c499 Replace View
curveOracle 0x07a3b202 Replace View
paused 0x5c975abb Replace View
plentyPerRoot 0xe60d7a83 Replace View
poolDeltaB 0x471bcdbe Replace View
rain 0x43def26e Replace View
season 0xc50b0fb0 Replace View
seasonTime 0xca7b7d7b Replace View
sunriseBlock 0x3b2ecb70 Replace View
time 0x16ada547 Replace View
totalDeltaB 0x06c499d8 Replace View
weather 0x686b6159 Replace View
wellOracleSnapshot 0x597490c0 Replace View
gm 0x64ee4b80 Replace Call
sunrise 0xfc06d2a6 Replace Call

Event Changes

None.

Beans Minted

None.

Effective

Effective immediately upon commitment by the BCM, which has already happened.

Base automatically changed from bip-38 to master October 21, 2023 17:56
@netlify
Copy link

netlify bot commented Oct 23, 2023

Deploy Preview for basin canceled.

Name Link
🔨 Latest commit 447be2d
🔍 Latest deploy log https://app.netlify.com/sites/basin/deploys/6536efb750522f0008861233

@netlify
Copy link

netlify bot commented Oct 23, 2023

Deploy Preview for beanstalk-ui canceled.

Name Link
🔨 Latest commit 447be2d
🔍 Latest deploy log https://app.netlify.com/sites/beanstalk-ui/deploys/6536efb76dec0c000811d403

@BrendanSanderson BrendanSanderson merged commit 2ad9014 into master Oct 24, 2023
9 checks passed
@BrendanSanderson BrendanSanderson deleted the ebip-9 branch October 24, 2023 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant