EBIP-10: Fix Bean to LP Well Convert

Committed: October 23, 2023


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.

Problem

Since BIP-38 was committed and prior to this EBIP, in Wells (i.e., only BEANETH currently), Farmers could Convert Deposited Beans to Deposited LP tokens past peg. Additionally, If a Farmer had enough Deposited Beans to Convert past peg, it was possible for that Farmer to Convert Deposited Beans to Deposited LP tokens up to the total amount of Beans in the Beanstalk contract.

This was because Beanstalk was Converting (1) the amount the user input, rather than (2) the minimum of the amount the user input and the amount required to Convert to peg.

Solution

Upgrade Beanstalk to only allow Converts up to (2).

All changes were reviewed by Cyfrin.

Contract Changes

Convert Facet

The following ConvertFacet is removed from Beanstalk:

The following ConvertFacet is added to Beanstalk:

ConvertFacet Function Changes

Name Selector Action Type New Functionality
convert 0xb362a6e8 Replace Call

Event Changes

None.

Beans Minted

None.

Effective

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