Proposed: December 1, 2022
Status: Passed
- Proposer
- Summary
- Links
- Problem
- Proposed Solution
- Technical Rationale
- Economic Rationale
- Contract Changes
- Beans Minted
- Audit
- Effective
Beanstalk Farms
Proposer Wallet: 0xB77c0dBA1186483E9cc284a950564Fe886c12dB8
- Implement a version of Clipboard in the
farm
function such that Farmers can copy return values from any function call into the function calldata of subsequent functions; - Wrap Pipeline functionality in Depot V2 such that Farmers can access Pipeline through the use of the
farm
function; - Add EIP-2612 permit support for ERC-20 tokens and EIP-4494 permit support ERC-721 tokens in Circulating balances; and
- Reduce the base
sunrise
incentive reward.
- BIP-30 GitHub PR
- GitHub Commit Hash: 9029875262f83cf394b0ed048704133e16e969d4
- Pipeline Whitepaper
- Safe Transaction
The farm
function allows Farmers to perform a series of function calls in a single transaction defined by static calldata. Static calldata is limiting as on-chain outputs can change between transaction creation and settlement.
Currently, adding Pipeline functionality requires new Pipelines to be added to the Depot via Beanstalk governance, which results in very high development overhead for enabling Farmers to use other protocols through Beanstalk.
Farmers have to approve transfers of ERC-20 and ERC-721 tokens in their Circulating balance through a separate transaction, which creates a suboptimal user experience.
Beanstalk is currently overpaying for the sunrise
incentive reward due to the high base incentive.
We propose upgrading the Farm Facet to support Clipboard functionality from Pipeline, allowing Farmers to copy return values from any function call into the function calldata of subsequent functions.
AdvancedFarmCall
is a farm
call that can use a version of Clipboard. With Clipboard, Farmers can copy return values stored as returnData
from any AdvancedFarmCalls
already executed and paste them into the callData
of the next AdvancedFarmCall
, in a customizable manner.
Each AdvancedPipeCall
includes a version of Clipboard to encode:
- How many paste operations to perform;
- Which
returnData
from previousAdvancedFarmCall
s to copy (i.e.,returnDataIndex
); - Where to copy from within (2) (i.e.,
copyIndex
); and - Where to paste it in the
callData
of the nextAdvancedFarmCall
(i.e.,pasteIndex
).
Bytes are pasted 32 bytes at a time.
The only difference between the Clipboard implemented on the Farm and the one implemented in Pipeline is that the Farm version always uses padding in the second byte, whereas the Pipeline version includes a Use Ether Flag
in the second byte, which specifies whether to include Ether in the Clipboard. Because the farm
call already is able to include Ether, the second byte does not need to be used in the Farm version of Clipboard.
We propose adding new Depot Facet that wraps the standalone Pipeline contract, providing access to Pipeline from Beanstalk through the use of the farm
function.
We propose adding EIP-2612 support for ERC-20 tokens and EIP-4494 support for ERC-721 tokens from Circulating balances, which allows Farmers to perform approvals through permits without the need for a separate transaction.
We propose reducing the base sunrise
incentive from 100 Beans to 25 Beans such that the new formula for
Allowing Farmers to copy return values from any function call into the function calldata of subsequent functions significantly improves the composability supported by the farm
function.
A new Depot that allows Farmers to access the standalone Pipeline contract from Beanstalk significantly reduces the development time necessary to enable Farmers to interact with new protocols via Beanstalk.
The ability for Farmers to approve transfers of ERC-20 and ERC-721 tokens in their Circulating balance without the need for a separate transaction reduces the friction of interacting with Beanstalk.
The majority of the transaction fee from sunrise
calls is the priority fee. Until a more sophisticated update to the sunrise
function has been audited, reducing the base reward is likely to reduce the Beans Beanstalk issues each month to pay for the sunrise
call by up to 75%.
Improving the composability of, and reducing the number of separate transactions required to interact with, Beanstalk should improve the user experience and utility of Beanstalk and Beans.
Reducing unnecessary Bean issuance in the sunrise
incentive reward can reduce sell pressure on Beans by 60,000 per month.
The following FarmFacet
is being removed from Beanstalk:
The following FarmFacet
is being added to Beanstalk:
Function Name | Selector | Action | Type | New Functionality |
---|---|---|---|---|
advancedFarm |
0x36bfafbd |
Add | Call | ✓ |
farm |
0x300dd6cf |
Replace | Call | ✓ |
None.
The following DepotFacet
is being added to Beanstalk:
Name | Selector | Action | Type | New Functionality |
---|---|---|---|---|
pipe |
0x08e1a0ab |
Add | Call | ✓ |
multiPipe |
0xcabec62b |
Add | Call | ✓ |
advancedPipe |
0xb452c7ae |
Add | Call | ✓ |
etherPipe |
0x6e47d07b |
Add | Call | ✓ |
readPipe |
0xdd756c4f |
Add | View | ✓ |
None.
The following TokenSupportFacet
is being added to Beanstalk:
Name | Selector | Action | Type | New Functionality |
---|---|---|---|---|
permitERC20 |
0xb442b398 |
Add | Call | ✓ |
transferERC721 |
0x1aca6376 |
Add | Call | ✓ |
permitERC721 |
0x4935ed43 |
Add | Call | ✓ |
transferERC1155 |
0x0a7e880c |
Add | Call | ✓ |
batchTransferERC1155 |
0xa9412a59 |
Add | Call | ✓ |
None.
The following SeasonFacet
is being removed from Beanstalk:
The following SeasonFacet
is being added to Beanstalk:
Function Name | Selector | Action | Type | New Functionality |
---|---|---|---|---|
sunrise |
0xfc06d2a6 |
Replace | Call | |
paused |
0x5c975abb |
Replace | View | |
plentyPerRoot |
0xe60d7a83 |
Replace | View | |
poolDeltaB |
0x471bcdbe |
Replace | View | |
rain |
0x43def26e |
Replace | View | |
season |
0xc50b0fb0 |
Replace | View | |
seasonTime |
0xca7b7d7b |
Replace | View | |
time |
0x16ada547 |
Replace | View | |
totalDeltaB |
0x06c499d8 |
Replace | View | |
weather |
0x686b6159 |
Replace | View | |
yield |
0x28593984 |
Replace | View |
None.
None.
The commit hash of this BIP is 9029875262f83cf394b0ed048704133e16e969d4.
Halborn has performed an audit of this BIP up until the commit hash that reduces the base sunrise
incentive reward. You can view the Halborn audit report of this commit hash on Arweave here:
Effective immediately upon commit.