Ramble On-Chain Pricing Mechanism and ERC7527
Overview
On-chain asset pricing is a fascinating task, commonly implemented using function-based quotations. Specifically, there are three main categories:
Various Automated Market Maker (AMM) curves are utilized for token swaps, with the constant product formula x * y = k gaining the most consensus, which is employed by Uniswap.
Bonding Curve mechanism that directly quote based on factors like supply, with recent examples including FriendTech and pump.fun.
Auction-based mechanism, where on-chain auctions often use Dutch auctions to enhance efficiency. English auctions are less common, and blind auctions based on sealed bids are also rare due to technical challenges. Notable examples include GDA and VRGDA referring to Paradigm's work , as well as the Dutch auction mechanism within UniswapX.
Each of these function-based pricing mechanism has certain advantages and drawbacks. This article will first introduce these widely used on-chain asset pricing mechanisms, then it will present a new generation of on-chain asset pricing mechanisms based on ERC7527 and continuous quotations based on functions.
AMM Curves
Currently, the most widely used pricing mechanism in pure on-chain pricing is Automated Market Maker(AMM) pricing. The AMM pricing mechanism that gaining the the most consensus is the constant product pricing curve, which was first introduced by Uniswap.
In this formula:
refers to the balance of asset x in the pool,
represents the balance of asset y in the pool
is a constant
The corresponding code is as follows:
uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));
uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));
require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K');
The code above includes four key variables, which are explained as follows:
balance0Adjusted
: The amount of asset x in the pool after the user sends asset x to the pool, minus a 0.3% fee charged on the sent amount of asset x.balance1Adjusted
: The amount of asset y in the pool after the user sends asset y to the pool, minus a 0.3% fee charged on the sent amount of asset y._reserve0
: The reserve of asset x within the pool._reserve1
: The reserve of asset y within the pool.
Let's explain the code in an example. Suppose the pool currently holds reserves of 20000 DAI and 10 WETH, and we want to swap 1 WETH for 1500 DAI. The calculation process is as follows:
_reserve0 = 20000 DAI
_reserve1 = 10 WETH
k = 20000 * 10 = 200000
The above represents the reserves before swapping 1 WETH for 1500 DAI. Now, let's proceed with the following swap:
balance0 = 20000 - 1500 = 18500
balance1 = 10 + 1 = 11
amount0In = 0
amount1In = 1
balance0Adjusted = 18500
balance1Adjusted = 11 - (1 * 0.003) = 10.997
newK = balance0Adjusted * balance1Adjusted = 203444.5
At this point, the condition where newK
is greater than k
holds, so the swap can proceed. Certainly, many users might feel they haven't encountered this type of swap, as they are usually given a direct quote on the Uniswap front-end showing the maximum amount of DAI that 1 WETH can be swapped for. This is calculated based on the newK = k condition and the reserves in the pool. If a user wants to swap x units of one asset for y units of another, the formula to calculate the maximum amount that can be swapped is derived as follows:
Here, represents the amount of assets provided by the user, and represents the amount of asset y received in exchange for asset x. and are the reserves in the pool at the time of the swap. The following diagram illustrates a token swap based on the formula:

For the AMM curve pricing solution, the advantages include:
As the most widely used token swap solution, the AMM curve has the strongest consensus.
For ERC20 exchanges, the AMM curve solution is currently the best solution.
However, the AMM curve also has significant drawbacks, with the largest one being related to liquidity providers (LP). For LPs of the AMM curve, they face the following issues:
Source of Liquidity Providers
For newly issued tokens, the token issuer must provide initial liquidity to ensure users can make exchanges. Ensuring the source of subsequent liquidity is challenging, and third-party liquidity providers or even token issuers might withdraw LPs, leading to a rapid loss of liquidity in the AMM pool.
Management of Liquidity
As research into AMM curves deepens, several factors that may lead to LP losses have been identified, such as the infamous Impermanent Loss. This makes LP management a complex task.
Malicious MEV Attacks
For Ethereum, Miner Extractable Value(MEV) for AMM curves is extremely developed, and most MEV operations result in losses for various participants. The most malicious MEV attack on AMM curves is the sandwich attack. Any transaction without slippage settings is vulnerable to sandwich attacks, resulting in significant asset losses for users.
In practice, the biggest problem with using AMM curves for asset pricing is still the provision of initial liquidity. For early project teams, issuing assets requires a substantial amount of assets for initial liquidity provision. For Meme coin project teams, it is challenging to have sufficient liquidity outside of FOMO (Fear of Missing Out) periods.
Additionally, another characteristic of AMM curves is that they can only price ERC20 assets. Using AMM curves to price NFTs and other assets requires special solutions. These AMM curve pricing solutions for NFTs essentially use the concept of NFT fragmentation. For example, ERC404 assets make it difficult to truly consider these AMM curve-priced NFTs as real NFTs.
Bonding Curve
The Bonding Curve is widely discussed earlier in the cryptocurrency space. Its full name is Token Bonding Curve, and it generally includes the following parameters:
Supply Token: The underlying token of the Bonding Curve pool. Generally, users are allowed to use the supply token to purchase issued tokens from the pool. In some cases, it can work in reverse, allowing users to sell issued tokens back to the pool in exchange for the supply token. The supply token is typically a fungible token.
Issued Token: The other type of token that users can purchase by using the supply token, calculated according to the curve. The issued token might be a fungible token but can also be a non-fungible token, though cases involving non-fungible tokens are less common.
Curve: This determines the price. Some applications use a single curve to set both the buy and sell prices, while others use more complex mechanisms where the buy and sell prices follow different curves. The spread between these prices effectively acts as a transaction tax.
In the Bonding Curve field, the most crucial element is the curve itself, as it determines the prices at which users buy and sell. The simplest form of a curve is as follows:
The following graph demonstrates an example of

When a user decides to enter the market, and if the user needs to purchase units of issued tokens, we will use the integral under the curve to calculate the number of supply tokens required by the user. We will use some methods to simplify the integral calculation. This process involves a series of mathematical derivations. If interested, please read the "Computing Buy and Sell Prices" section in the article Bonding Curves In Depth: Intuition & Parametrization.
The diagram below shows some common curves used for Bonding Curves.
The top left is the Sigmoid curve, with the function expression .
The top right is the power function curve, with the function expression .
The bottom left is a special function curve, with the mathematical expression . Its economic meaning is that when the token supply doubles, the token price increases by 25%. If interested, you can learn more from the article On Single Bonding Curves for Continuous Token Models.
The bottom right is the constant function.

These curves can be categorized into sublinear, linear, and superlinear.
Compared to AMM curve pricing mechanism, the biggest advantage of the Bonding Curve is that it does not rely on initial liquidity. The token issuer does not need to prepare a large amount of liquidity but can directly issue tokens, relying on user-injected liquidity to maintain the price. This is extremely beneficial for so-called Curation Markets. Curation Markets were one of the early discussion topics on Ethereum, aimed at allowing groups to coordinate more effectively and profit from the value they co-create toward common goals. The simplest case is currently pump.fun. Curators issue MEME tokens, and other participants buy the issued Meme tokens according to the Bonding Curve. Friend tech is also an example of a Curation Market.
For more detailed information, please refer to the article Introducing Curation Markets: Trade Popularity of Memes & Information (with code)! . Note that this article is written as early as 2017.
For Bonding Curves, the largest problem is that tokens are unable to operate for long periods due to overly mechanical rules. For applications like FriendTech, using curves can cause some issues, such as, since it is transparent that early participants can have significant gains later on, many bots participates early and then exits later, causing asset losses for mid-term participants. For pump.fun, this problem also exists, but pump.fun creatively uses the Bonding Curve only as an early LP fundraising tool, switching to the AMM model for trading later. This approach reduces the impact of mechanical curves to some extent.
Auction
Auctions are also a common pricing mechanism suitable for any asset. Due to technical issues, we generally do not conduct sealed auctions on-chain. Typically, we use the following two auction schemes:
Dutch Auction: This is the most commonly used auction approach on blockchain. The asset is auctioned starting from a pre-set highest price, and the price gradually decreases over time until a deal is made.
English Auction: During a fixed period, the price of the asset is gradually increased, and the highest price at the end of the auction wins.
Since auctions can provide a relatively fair pricing for any asset, there are currently many specialized ecosystems within Ethereum using auctions. A common form of non-continuous English auction is often used within flashbots, mainly for Maximal Extractable Value(MEV) bots competing for transaction positions.

The above diagram shows the auction of different builders competing for block MEV opportunities. Readers can view the real-time MEV auction status for any block on payload.de, from which the above diagram is taken. This auction uses an English auction system, where different participants gradually bid higher prices to obtain MEV opportunities. For Ethereum, the existence of FlashBot prevents MEV bots from initiating gas wars, reducing Ethereum's gas fees. For block proposers, it allows them to further capture MEV revenue from the blocks, making it more profitable. Due to efficiency issues, English auctions are rarely used for actual Ethereum asset issuance. Some Intent systems use English auctions to maximize the benefit for the Intent initiator. For example, CowSwap uses English auctions during token swaps. If the Intent initiator offers 100 tokens A in exchange for at least 80 tokens B, other participants can bid more than 80 tokens B. The highest bidder can obtain 100 tokens A and give the Intent initiator the bid amount of tokens B.
Dutch auctions are another commonly used auction method, with Gradual Dutch Auctions (GDA) being used for actual asset issuance. First, we introduce non-continuous Dutch auctions, which are generally less used for asset issuance but sometimes used for asset swaps. UniswapX allows users to submit Dutch orders. If a user wants to exchange 100 tokens A for 50-80 tokens B, they can submit a Dutch order to UniswapX, which includes 100 tokens A, and the number of tokens B required decreases over time from 80. If the current decrease reaches 75 tokens B, and a user (referred to as a filler in UniswapX) accepts this order, they need to pay 75 tokens B to obtain 100 tokens A.
For actual asset issuance scenarios, we typically use Gradual Dutch Auctions (GDA) and Variable Rate Gradual Dutch Auctions (VRGDA) introduced by Paradigm. GDA can be used for both fungible and non-fungible token issuance, characterized by completing all token issuance with a single launch without needing the issuer to manually start each token auction. The principle is to initiate auctions for all issued tokens at different starting prices upon issuance. For more details, refer to the article In-Depth Exploration of GDA and VRGDA.
Compared to GDA, VRGDA incorporates a time factor, allowing the token issuer to set a token release curve. If the token issuance exceeds the expected release curve, VRGDA will increase the price to curb demand; conversely, it will lower the price to increase demand.
Both GDA and VRGDA, primarily used for asset issuance, have a significant issue. During auctions, users tend to wait for lower prices as time progresses. When all users choose to wait, the asset price continuously declines. In fact, GDA and VRGDA can be seen as variants of the Bonding Curve mechanism, which does not solve the problem of Bonding Curves while losing the secondary market functionality.
Moreover, GDA and VRGDA only solve primary market issues without addressing secondary market problems. After the auction ends, the token issuer can choose to place the auctioned assets into an AMM market. However, more likely, the issuer may conduct a soft rug, ceasing to promote the project. For auction participants, the acquired assets lack liquidity, and the asset pricing is relatively unrealistic.
ERC7527
ERC7527 is an asset issuance mechanism highly suitable for pricing, addressing many of the drawbacks of the Bonding Curve mechanism while ensuring asset liquidity. The specific operational process of ERC7527 is as follows:

The ERC7527 system consists of the following three parts:
Agency is a pool for reserving assets. The pool continually provides buy(wrap) and sell(unwrap) quotes based on its internal functions. When a user accepts a buy(wrap) quote, they can deposit the pre-specified asset into the Agency. At this point, the Agency will call the
mint
function of the App to mint an NFT for the user, an operation we refer to as "wrap." When a user accepts the Agency's sell quote, the Agency will send the asset to the user and call theburn
function of the App to destroy the NFT, an operation we refer to as "unwrap."App is an asset type that inherits from NFTs. Due to the guarantees provided by the Agency, this kind of asset can always maintain its liquidity.
Factory facilitates the deployment of Agency and App. Users can deploy Agency and App by inputting a few parameters.
Here lies the core issue: how does the Agency provide wrap and unwrap quotes? The simplest solution is to use a mechanism similar to Bonding Curve within the Agency, directly calculating quotes based on the total supply of NFTs. However, this solution does not solve the problems inherent in Bonding Curves. Here, we employ more interesting functions aimed at incorporating user wrap actions into the final quote results. The specific functions used for quoting depend on the following parameters:
: The time difference between the current and previous transaction.
: The price of the last transaction.
: The price of the current transaction.
Based on the above parameters, we can derive the following pricing function:
This function includes several constants:
is a constant that intend to bridge the gap between the transaction price and the next quoted price.
determines the price increase speed, this value must be greater than 0, and the larger the absolute value, the faster the increase.
determines the price decrease speed, this value must be greater than 0, and the larger the absolute value, the faster the decrease.
refers to the value of under the condition when . This value represents the maximum value within this interval.
: Determines the longest time interval for the rising phase, which, together with and , determines the final rise amplitude.
Note that should always be greater than or equal to , meaning that the current transaction price cannot be lower than the last transaction price.
The following diagram illustrates the quoted prices of the Agency within a specific interval. The quoted prices provided in the diagram are relative values, with the vertical axis representing and horizontal axis representing time blocks.

We have already introduced how ERC7527 quote a wrap, but how to quote an unwrap? The unwrap quote is actually the last transaction price. In the smart contract, it maintains a price stack, and each time a transaction is completed, the transaction price is appended to the stack.
When a user unwraps, the last appended price in the stack is popped as the unwrap price. In terms of price discovery, there is a certain symmetry between the wrap and unwrap behaviors.

After introducing the Agency’s quoting mechanism, the security risk caused by the over-transparency of Bonding Curves can be avoided. All price determinations are led by users' wrap and unwrap behaviors, fostering a more dynamic price discovery system. Users are now more focused on game strategies, both in collaboration with and against other players, rather than solely on quoting functions like Bonding Curves.
For example, users will not simply choose to wait, as transactions may occur during the price increase phase. Ultimately, dynamic competition will lead to more complex scenarios than those with the Bonding Curve. The following chart shows the transaction prices of App NFTs under random simulation:

Compared to the Bonding Curve, we can see the above pricing process as a combination of the Bonding Curve and the auction mechanism. The game theory in the auction process compensates for the over-transparency of the Bonding Curve. On the other hand, it retains other advantages of the Bonding Curve. After users obtain App NFTs through wrapping, the concept or entity represented by the Agency is closely related to users' economic interests. Driven by the economic interests, users may contribute to the concept or entity corresponding to the Agency. The Total Value Locked(TVL) of the Agency reflects the corresponding value. For instance, users can choose to issue Meme NFTs through the Agency. If users recognize this Meme, they will wrap with, let's say, ETH and actively encourage other users to participate. They share the same monetary interest with the spread of the Meme. The TVL of the Agency thus reflects the market value of the current Meme.
Compared to the auction mechanism, another major advantage of the ERC7527 scheme is that assets have full liquidity. Users can choose to trade directly in the secondary market. If the liquidity in the secondary market is insufficient, users can choose to destroy the NFT through the Agency’s unwrapping mechanism to obtain the underlying assets. Moreover, the assets within the Agency cannot be extracted by the token issuer, which to some extent avoids Rug Pull behavior by the token issuer.
Compared to the AMM mechanism, ERC7527 also maintains token liquidity. However, unlike AMMs, the liquidity of ERC7527 is self-provided. The funds injected by the wrap behavior of users make the market for the entire Agency. This self-provided liquidity avoids many issues associated with external liquidity providers, such as the token issuer not needing to provide initial liquidity, but simply waiting for users to participate in wrapping. Additionally, participants do not need to engage in complex LP management. Since the price is determined by the above price discovery mechanism, in most cases, liquidity providers are not affected by MEV attacks.
Summary
This article introduces several commonly used on-chain pricing models:
AMM Curve: Currently the most widely accepted on-chain pricing paradigm. However, it only provides pricing for ERC20 tokens and has several issues in liquidity provision, such as the difficulty of sourcing initial liquidity, potential losses for liquidity providers, and MEV issues.
Bonding Curve: An early and widely discussed pricing paradigm that can theoretically price any asset and does not have liquidity provision issues. However, its game theory relies solely on transparent mathematical functions, which cannot operate for long periods and often lead to failure in the later stages.
Auction: A common pricing solution. However, neither English nor Dutch auctions can solve liquidity problems in the later stages. Tokens issued through auctions often see all auction proceeds withdrawn in one go.
Compared to the above solutions, ERC7527 combines the advantages of different schemes. Firstly, it introduces an auction mechanism within the original Bonding Curve, making the game more dynamic and avoiding problems caused by overly transparent mechanisms. Secondly, ERC7527 uses all assets injected by users for market-making of the issued assets, avoiding the liquidity problems of the issued assets and circumventing a series of issues in liquidity provision seen with AMM curves, especially the problem of initial liquidity. Lastly, ERC7527 retains the so-called curation market capabilities, where users involved in wrapping are essentially a community of interests, actively promoting the development of relevant Agencies driven by economic interests.
May 2024 | Written by: @randomzly, @wong_ssh
Last updated