Original title: "One Article Explains - AMM Mechanism of NFT Market Rookie SudoSwap - Innovation Challenges and Limitations"
Original Source: Fourteen Jun
The recent downturn in the NFT trading market has been frequent, and the liquidity of the entire market has been greatly reduced. At this time, SudoSwap, which has sprung up in August, has brought the trading market based on the AMM mechanism into the public eye with its strong growth data. .
Based on the data analysis on the chain, as of August 20th, thousands of NFT projects have entered, and transactions involving 8.5W NFTs have been completed, with a cumulative transaction volume of 20 million US dollars .
This article will start from the mainstream model of the NFT trading market, and explain in depth the unique pricing function and functional details of SudoSwap by restoring the classic constant product formula of Uniswap. From the advantages and disadvantages of each point to comment on the value of the development of the trading market.
Classification of the operating model of the trading market Based on three core aspects: how to publish, how to bid, and where to make deals.
Different implementations of these three aspects lead to differences in traffic sources, operating costs, and market audiences.
The famous CRYPTOPUNKS (crypto punks), in fact A built-in trading market integrates various mechanisms for on-chain publishing, on-chain bidding, and on-chain ordering, all of which are implemented in a contract of just 230 lines. Details can be seen here: [Contract Interpretation] CryptoPunk, the world's earliest decentralized NFT trading market.
There are also projects with built-in markets: StepN, Axie Infinity, NBA Top Shot, etc.
Overall, it is not complicated to realize the transaction, but the chaining of each link is very detrimental to the liquidity problem at the core of NFT. As a buyer, the seller determines whether to sell Funds had to be locked in before, and the unlimited waiting period allowed punk's contract to lock 6,400 ETH daily.

p>
As for the pricing problem of what price a unique artwork should be sold, it needs a reasonable public auction mechanism to help match. The model of paying gas first for each bid can only be said to be acceptable in high-net-worth Punk Can be ignored, the long tail NFT can only catch up.
Top blue chips may not need direct trading liquidity, because most of the loyal long-term Holders, presumably in the future top blue chips will gradually become financial accessories, application In the lending, leasing and other markets, the trading market may have a price but no market, and no one is placing an order. Expandable reading: [Source Code Interpretation] How does the new Ethereum standard EIP-4907 realize NFT leasing?
So as an early market, Punk’s mechanism exploration has the advantage of high trust in the whole chain, but is also limited to the disadvantages of liquidity and pricing.
These markets are currently The leader calculated by the total transaction value, the overall operation mode is to release and match pricing off the chain, and complete the order on the chain.
A variety of auction mechanisms allow the rationality of the price to be evaluated, and Opensea's new agreement Seaport is one of the strongest contract designs of the era, through a large number of Compilation optimization reduces the gas cost by 30%, and the flexibility of various order modes is full. In the case of Seaport's open source and open source, it is very beneficial for various vertical projects (gamefi, creative copyright, etc.) to have transaction capabilities built in

The disadvantage of such platforms is that the degree of centralization is too high, almost Both require the user to authorize the NFT to the contract of the platform, and even codes like X2Y2 are filled with a large number of proxy upgrade settings, which have the ability to sell and run away in an instant.
Secondly, the rationality of pricing comes from the current attention. For long-tail NFT projects, it seems that they are always in a death spiral, and they are too dependent on the project at the beginning Will it come to the party, otherwise, even the whitelist mint may not be released at the first level. However, the recent hot free mint is a manifestation of low confidence in the market.
Before SudoSwap, it seemed that NFT was destined to be difficult to circulate and could only Point-to-point transactions are realized with the help of the huge scale of the platform. Apply value to underpin market prices. Expandable reading: NFT leasing proposal EIP-5006 enters final review! Make it possible to change the chain of large overseas games
Secondly, SudoSwap uses the Based Ghouls Pool called the "official pool", which is also a long-tail NFT project Bring a tool platform that facilitates "doing things".
Why can he help Long Tail achieve rural encirclement of cities, Pinduoduo vs. Taobao? Let us further analyze its release, pricing, and transaction from the implementation mechanism.
The following figure shows the core data performance of SudoSwap as of 8.20:


It is also publishing and bidding 3. Three dimensions of transaction. SudoSwap is released on the chain, and the price on the chain is based on the AMM mechanism. The transaction on the chain has a high degree of decentralization.
SudoSwap's AMM mechanism is actually not complicated. It is similar to Uniswap AMM V3, and its k=x*y constant product function has always been the most stable in Defi in my opinion. Graceful curves.
Anyone in Uniswap can create a liquidity pool , let everyone inject liquidity, help the transaction and earn LP income at the same time.
Each transaction will change the price of the next exchange, so there is also a slippage designed to accept the sliding range of the transaction price, which is in FT is relatively easy to deal with, because ERC20token can be highly divided.
Let’s go through the life cycle of Uniswap through the following figure, and go through the formula of x*y =k.
As shown on the left side of the picture below, I want to do LP (liquidity Provider), then at the same time, you have to give the Atoken and Btoken that you want to form a trading pair to transfer into the contract. Whenever the liquidity is deposited in the pool, the liquidity Token will be minted for me (LP). The calculation method of the obtained amount is based on the provided The amount accounts for the proportion of the total pool. These Tokens represent the contribution of LP to the fund pool. LP can obtain 0.03% of other people's transaction process as a dividend for handling fees.

< /p>
As shown on the right side of the figure below, when any Token is withdrawn (purchased) after the pool is built, another Token must be deposited (sold) according to the "proportion" to keep the total amount unchanged. This ratio is In K is also equal to the exchange rate of X and Y.
Although the value of K is a theoretical constant value, each transaction will generate a handling fee, which means that K will gradually increase and slowly rise during the tokenAB exchange process .
As shown in the figure below, when there are already ABtoken trading pairs: Atoken-1200, Btoken-400, the current exchange rate is 3, then I transfer to the contract I put in 3 TokenA and pay an additional handling fee, and the smart contract will give me 1 TokenB after the exchange.
At this time, because the total amount of Token pool in the entire system has changed, the new exchange rate has changed to 3.015.

Because the price depends entirely on the real-time calculation logic of the contract on the chain, the transaction pair The price can only be changed through transactions, so once the Uniswap price deviates from the external price, an arbitrage opportunity will be created. This mechanism ensures that the Uniswap price always tends to the market price.
The author likes this logic very much, allowing arbitrageurs to help the system become better and profitable, and can be expanded to read: One article explains-DeFI king AAVE latest Stablecoin GHO proposal
It is actually similar to UniSwap, SudoAMM uses NFT as TokenA and ETH as TokenB, allowing users to make a market for NFT-ETH within a specified price on SudoAMM. For buyers and sellers, the purpose of instant trading can be realized through the pool.
Because the NFT is indivisible, the calculation formula cannot be directly measured by k=X*Y (otherwise there must be a surplus), so SudoSwap designed SudoAMM, which provides Both linear and exponential pricing functions are introduced.
In the calculation curve program LinearCurve.sol , the new price is calculated according to the gradient accumulation system.
Assuming a delta value of 0.1, it means that each buy (or sell) will add (or subtract) 0.1 ETH to the price.
Usually (1E) buy (1.1E) buy (1.2E) sell (1.1E), and so on.

In the calculation curve program - ExponentialCurve.sol , it is based on the number of purchases Each multiplication increases.
Assuming a delta value of 1.1, it means that every buy (or sell) will multiply (or divide) the price by 1.1 times.
Usually (1E) buy 4 times (1.46E) sell 3 times (1.1E) sell 3 times (0.75E), and so on.

The liquidity pool is created using the createPairETH function method in the LSSVMPairFactory.sol program. It is very exaggerated that compared with uniswap, he can set many core parameters , the execution creation will adopt the EIP-1167 standard, and also deploy a mini proxy contract, which can be said to have the security of an independent contract (assets are stored in the newly deployed contract address), LP has super administrator authority, and for the pricing function, add Volume threshold, initial fee, and global handling fee can all be controlled.

Question 1: How to count if you buy more than one at the same time? Will be settled one by one (according to linear calculation)
(buy spot price) + (buy spot price + 1delta) + ( Buy spot price + 2delta) + ... + (buy spot price + (n-1)delta), so this is equal to n(buy spot price) + (delta)(n(n-1))/ 2
Question 2: Which NFT did you buy? Any NFT in the pool specified by the user
Through the review of the contract address call method on Ethereum, it can be found that the ETH The operation of exchanging NFT is: 0x11132000
The corresponding contract method swapETHForSpecificNFTs requires 4 parameters:
swapList The list of tokens to be traded and the NFT ID to be purchased.
Recipient will receive unused ETH input address
nftRecipient receive NFT output address
deadline Execution
It can be seen that the concept of rarity has been smoothed out here, because pricing has nothing to do with rarity.
In addition to the AMM mechanism, there are 2 additional functions or limitations.
1: Each liquidity pool can only have one LP, most of which are project parties themselves.
2: Limit order function, users can set the floor price when depositing NFT and wait for the transaction.
At least the rights of the participants will not be lower than their own rational price, which is equivalent to the OpenSea pending order.
p>
Sudoswap has a strong "real-time pricing" advantage , Market matching instant pricing, through arbitrageurs to find the right price. Recalling the history of the rise of Uniswap, it is because as a new species, it solved the problem of small and medium-sized projects issuing coins, and achieved the leading role in encircling cities from rural areas.
It will have a miraculous effect on long-tailed NFTs. Now there are only two types of NFTs, blue chips and others. For punk, monkeys, and azuki, liquidity is not the core issue. The reason is explained in the punk part above. For "others", the difference in rarity is actually not that big, but it is extremely dependent on liquidity. The quick advantage of pricing + the launch of the official pool is basically equivalent to the stock repurchase mechanism, which helps the project party to do things well.
Hey, it’s not the AMM mechanism, but the LP mechanism that surprises me. AMM allows sellers to sell immediately to obtain instant liquidity, and LP fully controls the pricing of the fund pool (from the price function to the delta value can be customized , and the parameters can be adjusted at any time).
What does this look like? Setting up a stall and opening a store is a platform rather than a large supermarket. The project party itself can not only have a trading venue, but also has the ability to control. It is not the kind of opensea that reads the address on the chain to make a central match. The project party itself can follow the project development cycle. Controlling whether to repurchase, price rise and fall, means that rights return to users, in terms of mechanism and fees (project parties are also counted as users).
The income of Lp can also replace the royalties, bringing diversified income balance to the project side
Beautiful code always makes a technical type like Fourteen Independent researchers in the industry feel comfortable, and the design of sudoswap code has many optimization points. The GAS fee for the overall transaction is at the first-class level in the industry. A single NFT purchase only needs 14WGAS, and multiple transactions are also better than os, x2y2, etc.
Sort by transaction GAS: Punk < SudoSwap < opensea < GEM < Genie < X2Y2 < Looksrare
The project as a whole is endorsed by 2 auditing companies. Although a bunch of risk issues have been audited, they hardly threaten the core mechanism. The author sorted out the relevant information (source code audit report), which can be obtained by replying "sudoswap" after the official account.
Passed Combing the logic of this article, indeed, the sudden emergence of sudoswap has certain market value.
Its AMM mechanism introduces NFT market makers, which can naturally use financial methods to quantify arbitrage. As long as the liquidity pool is large, it can be bought and sold The price of NFT forms a support, and further extends to scenarios such as NFT leasing and lending. It is based on helping long-tail projects succeed, which is highly consistent with the history of Uniswap in the past, and may grow into a real agreement in the future.
However, its sudoswap also loses the difference in rarity, the value of the same series of NFTs is the same, and NFT has evolved into another meaning Therefore, sudoswap also has limited scenarios and can only be applied to some long-tailed projects, or application-oriented NFTs with high homogeneity.
Look~~
High homogeneity, long tail, large number, does every word exactly match the NFT in Gamefi ? That's right, dragon-slaying knives are necessary in a good game ecology, and branch long swords are also necessary.
The author believes that although the fully chained sudoswap only supports 721, it will be a high-quality trading market model in many GameFi or creator economies in the future. It is easy for project parties to do things, easy for creators to spread, and easier to find reasonable prices for low-priced and high-quantity products through AMM.
The author will continue to study OpenSea, X2Y2, Looksrare, Gem and other leading NFT market platforms, Starting from the contract, look at its advantages and limitations. If you are interested, please like and follow up.
This article is from a contribution, not Represents the views of BlockBeats.
Original link
Welcome to join the official BlockBeats community:
Telegram Subscription Group: https://t.me/theblockbeats
Telegram Discussion Group: https://t.me/BlockBeats_App
Official Twitter Account: https://twitter.com/BlockBeatsAsia