Risk Warning: Beware of illegal fundraising in the name of 'virtual currency' and 'blockchain'. — Five departments including the Banking and Insurance Regulatory Commission
Information
Discover
Search
Login
简中
繁中
English
日本語
한국어
ภาษาไทย
Tiếng Việt
BTC
ETH
HTX
SOL
BNB
View Market
A detailed explanation of the innovation, challenges and limitations of the SudoSwap AMM mechanism
十四君
特邀专栏作者
2022-08-21 05:15
This article is about 4953 words, reading the full article takes about 8 minutes
Let's explain SudoSwap's unique pricing function and functional details in depth, and finally comment on the value of the development of the trading market from the advantages and disadvantages of each point

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 made the most of theThe trading market based on the AMM mechanism has come into public view.

Based on the data analysis on the chain, as of August 20, 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.

first level title

1. The mainstream model of the NFT trading market

How to publish, how to bid, and where to make dealsHow to publish, how to bid, and where to make deals

secondary title

1.1. Punk-like built-in market

The famous CRYPTOPUNKS (encrypted punks) actually has a built-in trading market, which gathersPublishing on the chain, bidding on the chain, and ordering on the chain【Contract Interpretation】CryptoPunk is the world's earliest decentralized NFT trading market【Contract Interpretation】CryptoPunk is the world's earliest decentralized NFT trading market

Projects that also have a built-in market include: StepN, Axie Infinity, NBA Top Shot, etc.

Looking at it, it is actually 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, it has to lock in funds before the seller determines whether to sell, and there is no limit to the waiting period. Punk's contract 6400 ETH are locked daily

The pricing issue of what price a unique artwork should be sold requires a reasonable public auction mechanism to assist in matching. The model of paying gas first for each bid can only be said to be negligible in high-net-worth Punk, and the long-tail NFT can only catch up

[Source Code Interpretation] How does the new Ethereum standard EIP-4907 realize NFT leasing?

[Source Code Interpretation] How does the new Ethereum standard EIP-4907 realize NFT leasing?

So as an early market,secondary title

1.2. Third-party markets similar to OpneSea and X2Y2

This type of market is currently the leader based on the total transaction value, and the overall operation mode is to release and match pricing off the chain, and to complete orders 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 optimizations, the gas cost is reduced by 30%, and the flexibility of various order modes Full, in the case of Seaport open source and open source, it is very beneficial for various vertical projects (gamefi, creative copyright, etc.) to have built-in trading capabilities

The disadvantage of this type of platform is that the degree of centralization is too high, and almost all of them require users to authorize NFT to the contract of the platform. Even codes like X2Y2 are filled with a large number of proxy upgrade settings, and they have the ability to sell and run away in an instant.

Secondly, the rationality of pricing still comes from the current attention. For long-tail NFT projects, it seems that they are always in a death spiral.It depends too much on whether the project party will comesecondary title

1.3. Summary

Before SudoSwap, it seemed that NFT was destined to be difficult to circulate, and it could only use the huge scale of the platform to realize peer-to-peer transactions. Under such circumstances

The first breakthrough is NFT with more usage scenarios, which can support market prices by providing basic application value. Expandable reading:NFT leasing proposal EIP-5006 enters final review! Make it possible to change the chain of large overseas games

This is followed by SudoSwap via a method calledThe "Official Pool" Based Ghouls Pool, and also bring a convenient "doing" tool platform for long-tail NFT projects

Why can he help Changwei realize the rural encirclement of the city, Pinduoduo and Taobao? Let us further analyze its release, pricing, and transaction from the implementation mechanism

first level title

2. How to understand the AMM mechanism

The same three dimensions are release, bidding, and transaction. SudoSwap is released on the chain, priced on the chain according to the AMM mechanism, and traded on the chain, with a high degree of decentralization. Who to sell to and how much is determined by the market

secondary title

2.1. Briefly describe the Uniswap mechanism

Anyone in Uniswap can create a liquidity pool, allowing everyone to inject liquidity, helping transactions and earning LP income at the same time

Each transaction will change the price of the next exchange, so there is also a slippage designed to be able to accept the sliding range of the transaction price, which is relatively easy to handle in FT, because ERC20token can be highly divided

secondary title

2.2. Creation stage

image description

secondary title

2.3. Exchange stage

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) in a "proportion" to keep the total amount unchanged. This ratio is equal to K The exchange rate of X and Y is

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 exchange process of tokenAB

As shown in the figure below, when there are already ABtoken transaction pairs: Atoken-1200, Btoken-400, the current exchange rate is 3, then I transfer 3 TokenA to the contract and pay an additional handling fee. After the exchange, the smart contract will Give me TokenB 1

image description

"Uniswap Trading Pair Purchase Mechanism Diagram"

Since the price depends entirely on the real-time calculation logic of the contract on the chain, the price of the trading pair can only be changed through the transaction, soOnce 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 read further:

first level title

3. Principle of AMM mechanism of SudoSwap

In fact, it is similar to UniSwap,SudoAMM uses NFT as TokenA, using 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.

secondary title

3.1. Linear Curve

In the calculation curve program LinearCurve.sol, the new price is based onofof

Assuming that the delta value is 0.1, it means that each purchase (or sale) will add (or subtract) 0.1 ETH to the price.

Usually (1E) → buy (1.1E) → buy (1.2E) → sell (1.1E), and so on

3.2. Exponential Curve

In the calculation curve program-ExponentialCurve.sol, each time the cumulative increase is based on the number of purchases

Assuming that the delta value is 1.1, it means that every time you buy (or sell) the price will be multiplied (or divided) by 1.1 times.

secondary title

3.3 How big is the LP right to create a liquidity pool?

The creation of the liquidity pool uses the createPairETH function method in the LSSVMPairFactory.sol program. It is very exaggerated that compared with uniswap, he can set a lot of core parameters. The creation will use the EIP-1167 standard and deploy a mini proxy contract. In other words, there is the security of an independent contract (assets are stored in the newly deployed contract address), LP has super administrator authority, and can control the pricing function, incremental threshold, initial fee, and global handling fee

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 equals n(buy spot price + (n-1)delta) into the spot price) + (delta)(n(n-1))/2

Question 2: Which NFT did you buy?Will be any NFT in the pool specified by the user

Through the review of the calling method of the contract address on Ethereum, it can be found that the operation of exchanging ETH for NFT is: 0x11132000

The corresponding contract method swapETHForSpecificNFTs requires 4 parameters

  • swapList The list of tokens to be traded and the NFT IDs to be purchased.

  • Recipient will receive the address of unspent ETH input

  • nftRecipient Receives the address of NFT output

  • deadline timestamp, the order will not be executed if the timeout expires

From this it can be seen thatThe concept of rarity is smoothed out here, because the pricing has nothing to do with rarity.

In addition to the AMM mechanism, there are 2 additional functions or restrictions

1: Each liquidity pool can only have one LP, most of which are project parties themselves.

2: The limit order function, when users deposit NFT, they can set the floor price and wait for the transaction.

first level title

secondary title

4.1, starting from the function

Sudoswap has a powerful"Instant Pricing" Advantagessecondary title

4.2. Starting from the scene

It will work wonders for long-tailed NFTs, now there are only two types of NFT, 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. Instead, 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.

4.3 Starting from the mechanism

Hey, it’s not the AMM mechanism, but the LP mechanism surprised me. AMM allows sellers to sell immediately to obtain instant liquidity, while LP fully controls the pricing of the fund pool (from price functions to delta values ​​​​can be customized, and also 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 like Opensea that reads the address on the chain to make a central match. The project party itself can follow the project development cycle. Control whether to repurchase, price rise and fall,It means that the right returns to the user, in terms of mechanism and fees (the project party is also considered a user)

And the income of Lp can also replace royalties, bringing diversified income balance to the project side

Sort by fee: Punk(0%)< SudoSwap ≤ X2Y2(0.5%) < Looksrare(2%) < OS(2.5%)

4.4, starting from the code

Beautiful code always makes independent researchers in technology-based industries like Fourteen feel comfortable, and the design of sudoswap code has many optimization points, and the gas fee for the overall transaction belongs toIndustry first-class level, 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 has been endorsed by two 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)first level title

finally

By sorting out the logic of this article, it is true that the sudden emergence of sudoswap has certain market value

but,

but,Its sudoswap also loses the rarity differential, the values ​​of the same series of NFTs are all convergent, and NFT has evolved into another kind of FT. Therefore, sudoswap also has limited scenarios, and can only be applied to some long-tailed projects, or higher homogeneity Applied NFT.

see~~

High homogeneity, long tail, large quantity, is every wordBoth 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.

In the follow-up, the author will continue to study OpenSea, X2Y2, Looksrare, Gem and other top NFT market platforms, starting from the contract, to see its advantages and limitations, interested readers, please like and follow up quickly~

In the follow-up, the author will continue to study OpenSea, X2Y2, Looksrare, Gem and other top NFT market platforms, starting from the contract, to see its advantages and limitations, interested readers, please like and follow up quickly~

Like and follow 14, bring you value from a technical perspective

Like and follow 14, bring you value from a technical perspective

NFT
Web3.0
Welcome to Join Odaily Official Community