FeedProjects
Developers
Settings
🎉 A new chapter begins: Boardroom has joined Agora
Learn more
protocol logo
Explore / Projects
Beanstalk DAO

Proposals

Members

Information

Create Proposal

Beanstalk DAO

ProposalsMembersInformation
Proposal
Back to Proposals
closedEnded 3 years ago · Snapshot (Offchain)

BIP-29: Pod Market Price Functions

By 0x47a4...Ad6888

Proposer

Beanstalk Farms

Proposer Wallet: 0x36998db3f9d958f0ebaef7b0b6bf11f3441b216f

Summary

  • Implement V2 Pod Orders and Listings such that the Price per Pod is priced as a function of place in the Pod Line (via piecewise cubic polynomials);
  • Allow Farmers to delegate use of their Farm balances to other contracts and add EIP-2612 permit support to Farm balances; and
  • Add EIP-2612 permit support for Silo Deposits.

Note: BIP-28 was cancelled due to a bug that was reported during the Voting Period. One of the BCM Signers indicated that the transaction should be cancelled by signing a verified message.

A majority of the BCM Signers deemed this bug report valid by submitting and signing an on-chain rejection, rendering BIP-28 cancelled. As such, BIP-28 was removed from Snapshot.

The fix for the reported bug was verified by Halborn and included in the updated audit report.

Links

  • BIP-29 GitHub PR
    • RFC: Pod Market V2 (Price Functions)
    • RFC: ERC-20 Farm Balance Approval System and Permit Implementation
    • RFC: Silo Deposit Permit Implementation
  • GitHub Commit Hash
  • Gnosis Transaction

Quorum

Quorum is a majority of the Stalk supply voting For, or about 34,070,677 Stalk voting For based on the time of proposal.

Problem

The Pod Market currently limits Farmers to creating Pod Orders and Listings with a single Fill price per Pod independent of place in Line.

Because of the ordinal nature of Pods, the price per Pod is partially a function of place in Line. Pod Orders and Listings with a single Fill price fail to maximize overall marketplace liquidity by requiring the placing or updating of multiple orders in order to create a non-flat pricing curve, which is highly expensive for users.

Currently, there is no way for Farmers to delegate use of their Farm balances to other addresses; the only way to transfer Farm balances is by calling transferToken(s)() through the Farmer’s account.

Currently, a separate transaction is required in order for a Farmer to delegate another address to use their Silo Deposits.

Proposed Solution

Pod Market Price Functions

We propose the implementation of new V2 Pod Orders and Listings where the Price Per Pod is priced as a piecewise function of Place in Line of up to n cubic polynomial pieces. A new library, LibPolynomial.sol, is introduced to evaluate and integrate over piecewise cubic polynomials on-chain in a gas efficient fashion to facilitate dynamic pricing of V2 Pod Orders and Listings.

Implementing dynamically priced Pod Orders and Listings should significantly improve market efficiency by allowing Farmers to place and update prices across the entire Pod Line is a single Order or Listing.

Specification

The LibPolynomial.sol library is introduced, which contains the logical functionality required to store, integrate and evaluate price functions for use within the MarketplaceFacet.

Price functions as implemented in LibPolynomial.sol are represented as piecewise cubic polynomials. Each piece can represent any polynomial function of up to degree 3. There is no maximum number of pieces that can be contained within a single piecewise function.

Representation of Piecewise Cubic Polynomials

The data required to represent a piecewise cubic polynomial consists of the domain of each piece as well as the coefficient for each polynomial term (up to 4 terms in a cubic). The function domains are represented as an array of uint256 breakpoints in ascending order of domain. Each polynomial’s domain is inclusive at the start and exclusive at the end. The final polynomial’s domain starts at the final breakpoint and extends until infinity.

Floating Point Representation of Polynomial Coefficients

The polynomial coefficients are stored in floating point representation and separated into three parts: the significand (numerator), the exponent of base 10 that the significand is shifted by, and the sign of the coefficient, where true is positive. For example, the decimal number 0.1234 could be represented as:

  • significand: 1234
  • exponent: 4
  • sign: true
Byte Encoding of Function Data

V2 Orders and Listings use a dynamically sized bytes array to represent pricing functions in the transaction data allowing its data to be packed tightly without posing any limitation on the number of pieces allowed. All function data is concatenated into a bytes array that is divided up into sections. Data is ordered first by piecewise domain, and second by degree.

The first 32 bytes represent the number of polynomial pieces in the function array, which is then used to determine the length of the following sections of data. If there are n number of pieces in the function, the next 32n bytes following the length are occupied by the breakpoints. The following 128n bytes are occupied by the function coefficient significands. The following 4n bytes contain the coefficient exponents. And the final 4n bytes contain the coefficient signs.

bip-29-encoding.png

Storage

mapping(bytes32 => uint256) podOrders; Has been changed to store the amount of Beans to be used by a Pod Order rather than the amount of Pods requested by it. This is because the amount of Pods an Order will Fill is now variable.

Farm Balance Approval System and Permits

We propose adding an approval system to Farm balances, which allows Farmers to delegate their Farm balances to be used by other addresses.

We also propose adding EIP-2612 support for Farm balances, which allows Farmers to delegate use of their Farm balances through permits without the need for a separate transaction.

Silo Deposit Permits

We propose adding EIP-2612 support for Silo Deposits, which allows Farmers to delegate use of their Silo Deposits through permits without the need for a separate transaction.

Technical Rationale

Dynamically priced Pod Orders and Pod Listings reduce the user action (and associated gas costs) required to make or update sophisticated pricing curves on the Pod Market to a single transaction.

The ability for Farmers to delegate their Farm balances to another contract allows other protocols to build on top of Beanstalk’s Farm balance system. The ability to perform this delegation without a separate transaction reduces the friction of interacting with Beanstalk.

Similarly, the ability for Farmers to delegate their Silo Deposits to another contract without the need for a separate transaction reduces the friction of interacting with Beanstalk.

Economic Rationale

Implementing dynamically priced Pod Orders and Listings should improve market efficiency and depth.

Improving the composability of and reducing the number of separate transactions required to interact with Beanstalk should improve the utility of Beanstalk and Beans.

Contract Changes

Note: Due to the Snapshot character limit, a comprehensive log of each function selector and event that is added, changed or removed from Beanstalk in BIP-29 is not included here—an Arweave upload of BIP-29 with this information can be found here: https://arweave.net/bACTLzE0krWGLUGMB2xyG_yMjdowWtQ2hdoBColwV2U

MarketplaceFacet

The following MarketplaceFacet(s) are being deprecated:

  • 0x3600D953Cb26C75E8F0c76FcB20e3A8F8a3245F1
  • 0xD870aAB97c2739b320a3eFAd370511452894F1b2

The following MarketplaceFacet is being added to Beanstalk:

  • 0x0c9F436FBEf08914c1C68fe04bD573de6e327776

TokenFacet

The following TokenFacet is being deprecated:

  • 0x146f86c2EF039f9176bc2434D3DA5919C19B87fC

The following TokenFacet is being added to Beanstalk:

  • 0x8D00eF08775872374a327355FE0FdbDece1106cF

SiloFacet

The following SiloFacet is being deprecated:

  • 0x6530A76c77F11731Bf7F1C799AA97E0C15d3FB26

The following SiloFacet is being added to Beanstalk:

  • 0xf73db3fb33c7070db0f0ae4a76872251dca15e97

Audit

The commit hash of this BIP is 0bdd376263b0fe94af84aaf4adb6391b39fa80ab.

Halborn has performed an audit of this commit hash. You can view the Halborn audit report of this commit hash on Arweave here: https://arweave.net/4GwrRBM7K-0SvyryHVH1oQDpkcbwnAm3up45bYf_RYA

Effective

Effective immediately upon commit.

Continue Reading
Connect Wallet to Add Note
0
Votes 278
VoterCast PowerVote & Rationale
0x10bf...DCC0e4
2.631M

For

0xfb45...e7A1f7
1.856M

For

0x9F79...A5F2FE
1.723M

For

0x87C9...6ac29e
1.416M

For

0xC385...1eB20E
1.257M

For

SHOW MORE
VOTE POWER
0
Connect Wallet
Proposal Status
  • Sat November 05 2022, 01:00 amVoting Period Starts
  • Sat November 12 2022, 01:00 amEnd Voting Period
Current Results

1-For

34.464M

99.91%

2-Abstain

29,445.818

0.09%
DocumentationBrandingContact Us
Home
This Project is Currently Disabled

If you would like to enable it, please checkout below.

Boardroom Subscription

Sign up for an individual subscription (access all projects on the platform)

Subscribe
Enable Project

Enable the entire project for every user

Enable Project
Contact Us