laitimes

Walk through the on-chain pricing model with ERC7527

author:MarsBit

原文作者:Wong's Blog

overview

Pure on-chain asset pricing is quite an interesting endeavor, and common schemes are based on function quotes. Specifically, there are three categories:

  1. Various AMM curves for token swaps, most notably Uniswap's x * y = k
  2. The Bonding Curve scheme, which quotes directly based on factors such as supply, has recently been the case with FriendTech and pump.fun
  3. Auction-based schemes, on-chain auction schemes tend to use Dutch-style auctions to improve efficiency, and are less common due to British auctions, and it is also difficult to see blind auctions based on sealed bids due to technical problems. The more famous ones are the GDA and VRGDA solutions launched by paradigm, as well as the Dutch-style auction solutions within UniswapX

This article will first introduce these widely used on-chain asset pricing schemes, and then introduce a new generation of on-chain asset pricing schemes based on ERC7527 and continuous function pricing.

AMM curves

At present, the most widely used and the most consensus pricing scheme among the pure chain pricing schemes is AMM pricing. The most well-known solution for AMM pricing is the x * y = k pricing curve, which was first introduced by Uniswap.

x in this formula refers to the balance of x assets in the pool, while y represents the balance of y assets in the pool, and k is a constant. The corresponding code is as follows

There are four variables in the above code, which have the following meanings:

  • balance0Adjusted When a user sends x assets to a pool, the number of x assets in the pool minus 0.3% of the x assets sent to the pool
  • balance1Adjusted When a user sends y assets to a pool, the amount of y assets in the pool minus 0.3% of the y assets sent to the pool
  • _reserve0 x the amount of reserves that the asset has inside the pool
  • _reserve1 y The reserve of the asset inside the pool

Let's take a practical example of how the above code works. For example, if the pool currently contains 20,000 DAI / 10 WETH, and we want to exchange 1 WETH for 1,500 DAI, the calculation process is as follows:

The above is the reserve of funds before making 1 WETH for 1500 DAI, and then we make the following conversion:

Walk through the on-chain pricing model with ERC7527

At this time, the condition that newK is greater than k is true, so the exchange can be carried out normally. Of course, many users feel as if they have not been exposed to this exchange method, but directly given 1 WETH, the Uniswap frontend will display the maximum amount of DAI that can be exchanged for 1 WETH, which is calculated based on newK = k and the amount of reserves in the pool, if the user uses a given x unit of assets to exchange y units of another asset, the specific formula for the maximum amount that can be exchanged is as follows:

Walk through the on-chain pricing model with ERC7527

Here, dx is the amount of assets given by the user, while dy is the amount of y assets that the user gets by paying x assets, and x and y are the reserves in the pool at the time of exchange. The following diagram illustrates a visual representation of a token swap based on x * y = k:

Walk through the on-chain pricing model with ERC7527

For the AMM curve scheme, the biggest advantages of this scheme are:

  1. The most widely used token swap scheme, the AMM curve has a strong consensus
  2. For ERC20 conversion, the AMM curve scheme is currently the best solution

But AMM curves also have their own important pitfalls, one of the biggest of which lies with liquidity providers. For liquidity providers of the AMM curve (hereinafter referred to as LP abbreviation), there are several issues they face:

1) The source of the liquidity provider. Since for the newly issued token, the token issuer must provide initial liquidity for the token to guarantee the user's exchange. It is difficult to guarantee the source of subsequent liquidity, and third-party liquidity providers and even token issuers may withdraw LPs, causing a rapid loss of liquidity in the AMM pool

2) Liquidity management. With the in-depth study of the AMM curve, a series of factors that may lead to LP loss have been discovered, such as the famous Impermanent Loss. This has led to LP management becoming a complex endeavor.

3) Malicious attacks by MEV. In Ethereum, the MEV of the AMM curve is extremely developed, and most MEV operations will cause damage to different participants. The more malicious MEV on the AMM curve is a sandwich attack, and for any transaction that does not set slippage, it will be sandwiched attack, and the end result is that the user loses a large amount of assets.

In fact, the biggest problem with the use of AMM curves as asset pricing is still the provision of initial liquidity, for early project parties, the issuance of assets must require a large number of assets for initial liquidity provision, and for meme coin project parties, it is difficult to have sufficient liquidity at non-FOMO time nodes.

Of course, another feature of the AMM curve is that it can only price ERC20 asset pairs, and using the AMM curve to price assets such as NFTs requires the use of some special schemes, and the essence of these AMM curve pricing NFT schemes is to use the idea of NFT fragmentation, such as ERC404 assets, and it is difficult for us to really call these NFTs priced by the AMM curve a real NFT.

Bonding Curve

Bonding Curve is a widely discussed topic in the early crypto space, and its whole process is Token Bonding Curve, which generally includes the following parameters:

  1. Supply tokens. The underlying asset of the Bonding Curve pool. In general, users are allowed to purchase and issue tokens using supply tokens in the pool; In some cases, it is also possible to do the opposite, i.e., sell the issued tokens to the pool in exchange for the supply tokens. In general, the supply token is fungible token
  2. Issuance of tokens. Another token that can be purchased by the user after using the supplied token, calculated according to the curve. The issued token may be fungible but it can also be non-fungible token, but cases of non-fungible tokens are rare
  3. Curve. To determine the price, some applications use only one curve to determine the buy and sell prices, while others use a more complex mechanism where the buy and sell prices follow different curves, and the difference between the two is actually a tax on the transaction

In the Bonding Curve space, the core is the curve, because the curve determines the price at which the user buys and sells. The simplest form of the curve is as follows:

The diagram below illustrates:

Walk through the on-chain pricing model with ERC7527

When a user decides to enter the market, if a user needs to purchase k quantities of issued tokens, we will use the points under the curve to calculate the number of tokens that the user needs to supply. Of course, there are a few schemes that we use to simplify the calculation of points. The process involves a series of mathematical derivations, and if you are interested, please read the Computing Buy and Sell Prices chapter of the article Bonding Curves In Depth: Intuition & Parametrization.

The following diagram illustrates some of the most common curves used for bonding curves. In the upper left corner is the Sigmoid curve, which is expressed as a function of

, the upper right corner is the power function curve, and its function expression is y=m⋅xn

。 左下角为特殊函数曲线,其数学表达式为 y=m(1+25%)log2x+b,其经济学含义为当代币供应量每增加一倍,代币的价格就增加 25%。 如果读者对此特殊函数十分感兴趣,请阅读On Single Bonding Curves for Continuous Token Models一文。 而右下角为常数函数。

Walk through the on-chain pricing model with ERC7527

In fact, these curves can all be boiled down to sublinearity, linearity, and superlinearity. Compared with the AMM curve scheme, the biggest advantage of Bonding Curve is that it does not rely on initial liquidity at all, and token issuers do not need to prepare a large amount of liquidity, but can directly issue tokens and rely on users to inject liquidity to maintain the price. This is extremely beneficial to the so-called Curation Markets. Curated marketplaces were one of the early topics of discussion at Ethereum, with the aim of being a model that allowed groups to coordinate more effectively and profit from the value they co-created around a common goal. The simplest example is the current pump.fun. The curator issues the MEME, and other participants buy the issued MEME tokens according to the Bonding Curve. And Friend Tech is also one of the cases in the curated market.

For more detailed information, please refer to the article Introducing Curation Markets: Trade Popularity of Memes & Information (with code)!, which was written in 2017. The biggest problem for Bonding Curve is that the overly mechanical rules prevent the token from running for a long time. For applications such as FriendTech, there is a part of the problem with using curves, which leads to the fact that early participants can get a decent increase in the later stages, and this transparent rule leads to a large number of bots participating early and then directly opting out later, resulting in the loss of mid-stage participants' assets. For pump.fun, this problem also exists, but pump.fun creatively only uses the Bonding Curve as an early LP fundraising tool, and directly uses the AMM model for later transactions, which reduces the impact of mechanical curves to a certain extent.

auction

Auctions are also a common pricing scheme, and this pricing scheme can be applied to any asset. Due to technical issues, we generally do not conduct sealed auctions on-chain, and in general, we often use the following two auction schemes:

  1. Dutch auction. At present, the most widely used auction method on the chain, the underlying asset starts from the highest price set in advance, and gradually decreases the price over time until it is closed
  2. English Auction. For a fixed period of time, the price of the underlying asset is gradually pushed upward, and it is sold at the highest price at the end of the auction.

Since auctions can reasonably price any asset, there are currently a large number of special ecosystems in Ethereum that use auctions. The more conventional non-contiguous British auctions are often used within flashbots and are mainly used by MEV bots to compete for trading positions:

Walk through the on-chain pricing model with ERC7527

The image above illustrates the auction of different builders competing for a chance to block MEV. Readers can see the MEV auction in any block in real time in the payload.de, and the image above is taken from the website. The auction uses a British-style auction, where different participants gradually give higher prices for MEV opportunities. For Ethereum, the existence of FlashBot prevents MEV bots from initiating gas wars, reduces Ethereum's gas fees, and for block producers, it can further obtain the MEV income of blocks, making it more profitable. Due to efficiency issues, English auctions are less used for genuine Ethereum asset issuances. There are also some intent systems that use British auctions to maximize the benefits of intent promoters, such as CowSwap, which uses British auctions for credit exchange. For example, the intent initiator gives a boundary where 100 tokens A can be exchanged for at least 80 tokens B, and other participants can make more than 80 tokens B. The highest bidder can get 100 Token A and offer the Intent promoter the amount of Token B.

Dutch auctions are also one of the most commonly used auction schemes, and Progressive Dutch Auctions (GDAs) have been used in real asset issuance. We start with non-contiguous Dutch auctions, which are generally less used for asset issuance, but are sometimes used for asset swaps. UniswapX allows users to submit Dutch-style orders. If a user wants to exchange 100 Token A for 50 - 80 Token B, they can submit a Dutch order to UniswapX that contains 100 Token A, and the amount of Token B will decay from 80 over time. If the current decay is 75 tokens B, and a user (in UniswapX, we call this user filler) accepts this order, the user needs to pay 75 tokens B to get 100 tokens A in the order.

In the real asset issuance scenario, we generally use the Progressive Dutch Auction (GDA) and Variable Rate Dutch Auction (VRGDA) proposed by Paradigm. Progressive Dutch auctions can be used for both fungible and non-fungible token offerings, and is characterized by the fact that all token issuances can be completed with only one launch, without the need for token issuers to manually initiate each token auction. The principle is that at the time of token issuance, the auction of all issued tokens will be launched at one time according to different starting prices. For more information, please refer to the article "Exploring GDA and VRGDA".

Compared to GDA, variable rate Dutch auctions have a time factor attached to them, allowing token issuers to set a token release curve, and when the number of tokens issued is larger than the expected token issuance curve, VRGDA will raise the price to suppress demand; Conversely, the price is lowered to increase demand.

There is a serious problem with GDA and VRGDA, which are mainly used for asset issuance, because the price of assets must decrease over time when users participate in auctions, and a large number of users are more inclined to wait to get a lower price during the game. When all users choose to wait, the price of the issued asset will continue to fall. In fact, we can think of GDA and VRGDA as variants of the Bonding Curve solution, which does not solve the problems of the Bonding Curve, but rather loses the secondary market function of the Bonding Curve.

And GDA and VRGDA only solve the problem of the primary market, but not the problem of the secondary market, when the asset auction is over, the token issuer can choose to put the assets obtained during the auction into the AMM market, but it is more likely that the token issuer will conduct a soft rug and no longer continue to promote the project. For auction participants, the assets obtained from the auction are not given liquidity, and the pricing of the assets is quite unreal.

ERC7527

ERC7527 is an extremely priced asset offering that solves many of the drawbacks of the Bonding Curve solution and ensures the liquidity of the asset. The specific operation process of ERC7527 is as follows:

Walk through the on-chain pricing model with ERC7527

ERC7527 The system consists of the following three parts:

  1. Agency is used to reserve the asset pool, the pool will continue to give buy quotations and sell according to its internal functions, when the user accepts the buy quotation, the pre-specified assets can be deposited into the agency, at this time Agency will call the app's mint function to mint NFT for the user, we call this operation wrap; When the user accepts the agency's sell offer, the agency will send the asset to the user and call the app's burn function to destroy it, which we call unwrap
  2. App is an asset type that inherits NFTs, which can always remain liquid thanks to Agency guarantees
  3. Factory makes it easy for users to deploy agencies and apps. Users only need to enter a subset of parameters to deploy the Agency and the app directly

There is a core question here, how does Agency give buy and sell quotes? One of the simplest solutions is to use a scheme similar to Bonding Curve inside the Agency to directly calculate and get a quote based on the total supply of NFTs, etc. However, this solution still does not solve the problems of Bonding Curve. Here, we use some more interesting functions, the goal of which is to incorporate the user's buying behavior into the final quote result. The specific functions used by the tick depend on the following parameters:

  • The time difference between the ΔM user's minting and the previous user's minting
  • The price of the last deal in pn−1
  • pnThe price of this transaction

Based on the above parameters, we can give the following price function:

Walk through the on-chain pricing model with ERC7527

This function contains several constants:

  • c When the user buys, the jump between the next quotation and the user's transaction price is avoided
  • λup determines the rate of price increase, this value must be less than 0, and the higher the absolute value, the faster the price will rise
  • λdown determines how quickly the price will fall, and this value must be greater than 0, and the higher the absolute value, the faster the decline
  • pmax actually refers to the pn value in the case of Δm=Δtarget, which represents the maximum value in this interval
  • Δtarget determines the maximum duration of the ascending phase and is used in conjunction with the λup and pmax parameters to determine the final ascending magnitude

What is not expressed in the above function is that pn is always greater than or equal to pn−1. That is, the transaction price shall not be lower than the previous transaction price.

The figure below shows the quotes given by Agency in a primary interval, and the quotes given in the chart below are all relative values, which are represented by the ordinate

Walk through the on-chain pricing model with ERC7527

We've covered how to make a buy quote above, but we haven't covered how to make a sell quote yet. The ask price is actually the last buy price. In the contract, we will maintain a price list, and the transaction price will be added to the price list after each marriage, and when the user sells, the last price of the price list will be directly used as the user's selling price. In terms of specific price performance, there will be a certain symmetry between the user's buying and selling.

Walk through the on-chain pricing model with ERC7527

After the introduction of the above Agency quotation formula, it is possible to avoid the Bonding Curve completely transparent price curve, and all price determinations are driven by users through buying and selling, so users are no longer only playing with the quotation function, but more with other users. For example, the user will not just choose the waiting strategy, because there is a possibility of a deal during the rising phase of the quote. Eventually, a dynamic game will produce a more complex game scenario than the Bonding Curve. The following diagram shows the transaction price of App NFTs under random simulation:

Walk through the on-chain pricing model with ERC7527

Compared with Bonding Curve, we can think of the above quotation process as a combination of Bonding Curve and the auction mechanism, and the game of the auction process just makes up for the overly transparent mechanism of Bonding Curve. But on the other hand, it also retains the other advantages of Bonding Curve. After a user obtains an App NFT through wrap, the narrative or entity represented by Agency is closely related to its economic interests, and based on the drive of economic interests, users may participate in the construction of the narrative or entity corresponding to Agency. And Agency's TVL also reflects the value of Agency's corresponding narrative. For example, users can choose to use Agency to issue meme NFTs. If the user agrees with this meme, they will use the wrap operation to vote with their money and actively encourage other users to participate. Agency's TVL, on the other hand, is a direct reflection of the current market value of memes.

Another major advantage of the ERC7527 solution compared to the auction scheme is that the assets have sufficient liquidity, and users can choose to change hands directly in the secondary market, and if the liquidity in the secondary market is not sufficient, then users can choose to directly destroy the NFT through the agency's unwrap mechanism to obtain the underlying assets. Moreover, the assets in the agency cannot be withdrawn by the token issuer, which avoids the RUG behavior of the token issuer to a certain extent.

Compared with the AMM mechanism, ERC7527 also has the characteristics of maintaining the liquidity of the token, but one difference from the AMM is that the liquidity of the ERC7527 is self-provided, that is, the funds injected by users participating in the wrap operation make the market for the entire agency. Compared to external liquidity providers, this kind of liquidity self-provision avoids many problems, such as the token issuer does not need to provide initial liquidity, but only needs to wait for user wrap to participate. And there's no need for complex LP management for participants. Since the price is determined based on the above quote function, in most cases, liquidity providers are not affected by MEV attacks.

summary

This article introduces the following commonly used pure chain pricing models:

  1. AMM curves. At present, the on-chain pricing paradigm with the strongest consensus can only provide pricing for ERC20 tokens, and there are a series of problems in liquidity provision, such as difficulties in sourcing initial liquidity, potential losses on liquidity providers, and MEV issues
  2. Bonding Curve。 The pricing paradigm, which was widely discussed in the early days, could theoretically price any asset without the liquidity problem. However, its game only relies on public mathematical functions, which cannot run for a long time, and often dies in the later stage
  3. Auction scheme. Commonly used pricing schemes, but neither British nor Dutch auctions can solve the subsequent liquidity problem, and token issuers that use auctions often withdraw all the auction proceeds at once

Compared to the above solutions, ERC7527 combines the advantages of different solutions. First of all, the auction mechanism is introduced into the original paradigm of Bonding Curve to make the game more dynamic and avoid the problems caused by the overly transparent mechanism. Secondly, ERC7527 chooses to use all the injected assets of users for market making of issued assets, which avoids the liquidity problem of the issued assets, and also avoids a series of problems in the liquidity provision of the AMM curve, especially the problem of initial liquidity. Finally, ERC7527 retains the ability to curate the marketplace, and the users who participate in WRAP are in fact communities of interest, and these users are motivated by financial interests to actively promote the development of the relevant agency.

Read on