EBIP-11: Upgrade Minting Oracle to 60 Minute TWA ETH/USD Price

Committed: October 30, 2023


Beanstalk Community Multisig


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.


Prior to this EBIP, Beanstalk did not support querying a TWA price from the ETH/USD Chainlink data feed.

Change ETH/USD Minting Oracle

Since BIP-37 was committed, and prior to this EBIP, when determining how many Beans/Soil to mint, Beanstalk calculated the price of ETH in USD using the instantaneous price from the Chainlink ETH/USD data feed and compared it 15 minute TWA prices in the ETH:USDC and ETH:USDT 0.05% fee Uniswap V3 pools.

When minting Beans during a gm call, Beanstalk compared this USD price of ETH with the TWA reserves of Beans and ETH in Multi Flow to calculate the TWA deltaB in the BEANETH Well. Because the Chainlink price in the former was not time weighted, the TWA deltaB calculated at the end of the Season would be higher than necessary if the ETH price was increasing. Similarly, the TWA deltaB calculated at the end of the Season would be lower than necessary if the ETH price was decreasing.

Removed Beans from EBIP-10 Issue

As a result of the issue fixed in EBIP-10, about 33,049.986249 excess Beans were removed from the Beanstalk contract. About 28,855.05179 of these Beans were returned by the Farmers who Converted extra Beans as a result of the issue, resulting in a difference of 4,194.934459 Beans that are still missing from Beanstalk.


All changes were reviewed by Cyfrin.

Add support for querying a time weighted average (TWA) ETH/USD price from Chainlink.

Change ETH/USD Minting Oracle

Upgrade the ETH/USD price that the Well minting oracle uses to:

Removed Beans from EBIP-10 Issue

Mint the remaining 4,194.934459 Beans to the Beanstalk contract.

Contract Changes

Initialization Contract

The init function on the following InitMint 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


Beans Minted

A total of 4,194.934459 Beans are minted to the Beanstalk contract (0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5) to cover the remaining Beans removed from Beanstalk as a result of the issue fixed in EBIP-10.


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