EBIP-6: Resolve EBIP-4 and EBIP-5

Committed: November 15, 2022


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.

In the case of EBIP-6, functionality that was removed in EBIP-4 and EBIP-5 is reintroduced this EBIP.


EBIP-4 Problem

In s.podOrders[id], the number of Pods Ordered is stored for the ids of the 3 remaining V1 Pod Orders.

The createPodOrder(...), fillPodOrder(...) and cancelPodOrder(...) functions were removed in EBIP-4.

EBIP-5 Problem

The transferTokenFrom(...) function was removed in EBIP-5.


EBIP-4 Solution

Update s.podOrders[id] for the ids of the 3 remaining V1 Pod Orders from the number of Pods Ordered to the number of Beans locked. Information about the 3 V1 Pod Orders is included below:

Beans locked Price per Pod Pods Ordered Order Id
10,491.929346 0.10 104,919.293460 0x6f668ae24be6e177f8584600dbffea6e07f260e08e21fa47792385913e786da3
1.466423 0.001 1,466.423000 0xf47df2678d29e9d57c5e9ed5f8c990e71910918154a2ed6d5235718035d7d8b0
0.000380 0.01001 0.037962 0x186c6468ca4d3ce2575b9527fcf42cc3c86ab7cc915a550c9e84c5443691607a

Re-add the createPodOrder(...), fillPodOrder(...) and cancelPodOrder(...) functions.

Notably, because the whitehat from EBIP-4 returned the extra 9,228.946824 Beans they received from Cancelling their Pod Order to Beanstalk (see return transaction), no Beans need to be minted to Beanstalk as part of the fix.

EBIP-5 Solution

Change transferTokenFrom(...) to transferInternalTokenFrom(...) and re-add the function to Beanstalk. This function always transfers with INTERNAL fromMode.

All fixes have been reviewed by Halborn.

Contract Changes


The following MarketplaceFacet is still part of Beanstalk:

The following functions are added to MarketplaceFacet:

Name Selector
createPodOrder(...) 0x82c65124
fillPodOrder(...) 0x845a022b
cancelPodOrder(...) 0xdf18a3ee


The following TokenFacet is still part of Beanstalk:

The following TokenFacet is being added to Beanstalk:

With the following functions:

Name Selector
transferInternalTokenFrom(...) 0xd3f4ec6f


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