BIP-30: Generalized Pipeline and ERC-20 and ERC-721 Permit Support
Proposer
Beanstalk Farms
Proposer Wallet: 0xB77c0dBA1186483E9cc284a950564Fe886c12dB8
Summary
- Implement a version of Clipboard in the
farmfunction 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
farmfunction; - Add EIP-2612 permit support for ERC-20 tokens and EIP-4494 permit support ERC-721 tokens in Circulating balances; and
- Reduce the base
sunriseincentive reward.
Links
- BIP-30 GitHub PR
- GitHub Commit Hash: 9029875262f83cf394b0ed048704133e16e969d4
- Pipeline Whitepaper
- Safe Transaction
Problem
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.
Proposed Solution
Clipboard
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.
Specification
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
returnDatafrom previousAdvancedFarmCalls to copy (i.e.,returnDataIndex); - Where to copy from within (2) (i.e.,
copyIndex); and - Where to paste it in the
callDataof 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.
Depot V2
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.
ERC-20 and ERC-721 Token Permits
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.
Sunrise Incentive Adjustment
We propose reducing the base sunrise incentive from 100 Beans to 25 Beans such that the new formula for a_t is:
Technical Rationale
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%.
Economic Rationale
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.
Contract Changes
The Δ symbol indicates that there is a proposed change in functionality.
FarmFacet
The following FarmFacet is being removed from Beanstalk:
The following FarmFacet is being added to Beanstalk:
FarmFacet Function Changes
| Name | Selector | Action | Type | Δ |
|---|---|---|---|---|
advancedFarm | 0x36bfafbd | Add | Call | ✓ |
farm | 0x300dd6cf | Replace | Call | ✓ |
FarmFacet Event Changes
None.
DepotFacet
The following DepotFacet is being added to Beanstalk:
DepotFacet Function Changes
| Name | Selector | Action | Type | Δ |
|---|---|---|---|---|
pipe | 0x08e1a0ab | Add | Call | ✓ |
multiPipe | 0xcabec62b | Add | Call | ✓ |
advancedPipe | 0xb452c7ae | Add | Call | ✓ |
etherPipe | 0x6e47d07b | Add | Call | ✓ |
readPipe | 0xdd756c4f | Add | View | ✓ |
DepotFacet Event Changes
None.
TokenSupportFacet
The following TokenSupportFacet is being added to Beanstalk:
TokenSupportFacet Function Changes
| Name | Selector | Action | Type | Δ |
|---|---|---|---|---|
permitERC20 | 0xb442b398 | Add | Call | ✓ |
transferERC721 | 0x1aca6376 | Add | Call | ✓ |
permitERC721 | 0x4935ed43 | Add | Call | ✓ |
transferERC1155 | 0x0a7e880c | Add | Call | ✓ |
batchTransferERC1155 | 0xa9412a59 | Add | Call | ✓ |
TokenSupportFacet Event Changes
None.
SeasonFacet
The following SeasonFacet is being removed from Beanstalk:
The following SeasonFacet is being added to Beanstalk:
SeasonFacet Function Changes
| Name | Selector | Action | Type | Δ |
|---|---|---|---|---|
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 |
SeasonFacet Event Changes
None.
Beans Minted
None.
Audit
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
Effective immediately upon commit.
| Voter | Cast Power | Vote & Rationale |
|---|---|---|
0x10bf...DCC0e4 | 2.636M | For |
0xfb45...e7A1f7 | 1.955M | For |
0x9F79...A5F2FE | 1.825M | For |
0x87C9...6ac29e | 1.477M | For |
0xC385...1eB20E | 1.41M | For |
VOTE POWER
Proposal Status
- Thu December 01 2022, 08:00 pmVoting Period Starts
- Thu December 08 2022, 08:00 pmEnd Voting Period
Current Results
1-For
37.397M
2-Abstain
3,664.584
