Author: bHeau
Source: bHeau's Newsletter
foreword
SudoSwap, an NFT exchange previously known for peer-to-peer, fee-free asset swaps, recently launched its NFT AMM (Automated Market Maker). The move generated a lot of hype, but it also created some confusion, and led people to ask the question, "So why isn't this another NFT marketplace?" This article aims to help clear up a bit of that confusion.
Before we start the discussion, about SudoSwap's AMM model, you should pay attention to:
1. Instant liquidity to buy/sell
2. Completely on-chain (no centralized orders).
3. Sometimes the pricing is cheaper
Only 0.5% market fee
No royalty fees (unsurprisingly, this has been somewhat controversial)
Aggregators can take advantage of SudoSwap's pricing, even users who are not familiar with SudoSwap can get better pricing when they have the opportunity
4. Growing appeal
you've probably heard it on twitter
Some impressive volumes: Based Ghouls 730 ETH, Webaverse 755 ETH, CloneX 245 ETH
According to Dune , the total transaction volume exceeds 5k+ ETH
5. Can earn transaction fees
6. It can automatically buy/sell NFT series by DCA (dollar cost averaging method: refers to the fixed-time investment method, which is a programmed investment method)
This article is divided into 4 parts:
NFT Exchanges: Order Books vs AMMs
SudoSwap AMM architecture
Note to developers
What to think about SudoSwap
NFT Exchanges: Order Books vs AMMs
Most NFT marketplaces that you may be used to in the past, such as OpenSea and LooksRare, rely on off-chain order books to facilitate efficient gas transactions. To help you understand what this means, let's look at an example:
You want to sell one Bored Ape (BAYC) for 100 ETH. You go to an exchange like OpenSea and list it for sale.
OpenSea lets you sign a message with your wallet saying you want to sell your BAYC for 100 ETH. Obviously, your order can get more complex, but for this example we'll keep it simple and not go into too much detail.
Your signed order is stored in an off-chain order book, hosted in a database by the exchange, and displayed on their interface (and exposed via their API) for potential buyers to browse.
Your order is there until your BAYC is sold or you decide to cancel the order:
Buy: Someone likes your BAYC and decides to buy it for 100 ETH, so they take your order (taken from that exchange's off-chain order book) and submit a transaction to fill it. They get the NFT and you get 100 ETH (minus exchange fees + royalty fees).
Cancellation: You must submit a transaction to cancel the order. Since your order is stored in an off-chain order book, anyone can submit a transaction to fill it, unless you tell that exchange's smart contract "hey, I want to mark this order as invalid; if someone tries to fill it, don't Let them do that."
This model has several advantages, including that users do not need to pay gas fees (after initially approving the exchange contract to move their NFTs) to list or bid on NFTs. Gas fees are only payable for execution. The downside is that the exchange hosts the entire order book off-chain, which can make it harder to get all the orders – as evidenced by the issues some developers have had with obtaining OpenSea API keys.
Another downside is that all pricing has to be "active"; you can't specify things like "if my first NFT sells for 1 ETH, try selling the next one for 1.3 ETH" . On an order book based exchange, your list needs to be adjusted manually (unless you trust the exchange enough to give them your private key and have them cancel/sign new orders for you - given that BAYC holders have a private key, maybe exchanges should look into this for them).
SudoSwap takes a completely different route, using an on-chain AMM model instead of an off-chain order book. Let's take the same example as above, selling one BAYC for 100 ETH, using an AMM instead of an order book:
You want to sell 1 BAYC for 100 ETH through AMM. You chose SudoSwap.
SudoSwap lets you deposit NFTs into a "pool" smart contract and specify the price at which you want to sell them.
Others can query your pool contract to get the price of the NFT.
Your NFT sits there until it is bought or you decide to cancel:
Buy: Someone comes to SudoSwap and wants to buy your BAYC. They submit a transaction to buy it, remove it from the pool, and give you 100 ETH (minus 0.5% transaction fees, but no royalties).
Cancellation: You withdraw your NFT from the pool.
Although the AMM model requires you to pay gas fees to list your NFT, they are all on the chain and can be publicly queried. But overall, the two models seem similar so far. However, an AMM-based model allows you to do some interesting things that using an order book does not. To understand this, let's see how SudoSwap really works.
SudoSwap Architecture
If you are familiar with Uniswap V2, SudoSwap's NFT AMM can be roughly thought of as "Uniswap V2, but multiple custom liquidity pools for the same token", where token = NFT series, custom liquidity pool = different options Pricing curves and spot prices. These differences make sense given the non-fungible, non-fungible nature of NFTs versus ERC20s.
If you can't figure it out, I try to explain it in a simpler way, and I will focus on how an NFT series works on SudoSwap. I'll use Based Ghouls as an example. When you bring up the Based Ghouls page on SudoSwap, you'll see the following:
What do the above 4 data mean? The "floor price" is the cheapest price you can get (0.226 ETH). The "best offer" is 0.219, meaning that it is possible to sell one Based Ghoul instantly on SudoSwap for 0.219 ETH (how this works will be explained later). "Offer TVL" means 36.23 ETH worth of Based Ghouls in the SudoSwap liquidity pool (again, explained later), while "Trading Volume" simply refers to the ETH trading volume of Based Ghouls on SudoSwap so far.
Now, when you look at floor price NFTs, the difference between the AMM model and the order book model starts to become apparent. At the time of writing, there are 21 Based Ghouls listed for 0.226 ETH. This is very different from OpenSea or LooksRare, where you typically see something like 1-3 assets listed at floor prices.
The reason for this pricing is that for NFTs traded on SudoSwap, buying and selling are done through liquidity pools. Most of these floor price assets may be in the same liquidity pool, and the pricing will change dynamically as NFTs are bought (currently it is impossible for you to go in and buy all 21 floor price NFTs at a price of 0.226 each).
Again, the whole "pool" situation is best shown through an example. There are three types of liquidity pools on SudoSwap - "token", "NFT" and "exchange" - let's start with the "NFT" liquidity pool. This type of trading pair can be used to sell one or more NFTs in a series. I don't have a Based Ghoul NFT, but I do have a Tubby Cat, so when I try to create an NFT sale pool for my Tubby Cat, what do I see.
I set up my liquidity pool to sell my first NFT for 10 ETH ("Start Price" = 10 ETH), and, with each sale, the price of the next NFT will increase by 0.1 ETH ("Delta "=0.1 ETH"). That means, if someone bought my first Tubby Cat NFT, they would pay me 10 ETH. If they wanted a second one, they would pay 10.1 ETH for that — — Like I mentioned earlier, the price updates as NFTs are sold. You can also set your delta to "-0.5" (sell your second NFT for 9.5 ETH) or whatever. It depends Depends on how you set up your pool.
Each NFT series can (and will) have multiple pools. This makes sense when you consider that different users may want different pricing and deltas based on their NFT holdings.
Now, all of this may have left you with some questions. Below is some Q&A that should help you understand the situation.
1. What if I just want to sell my NFT at the same price?
Set your delta to 0, and all your NFTs can be sold at the starting price of your liquidity pool.
2. What if I own a rare NFT? How can I make sure I sell for a higher price than my floor price NFT?
You can create a separate liquidity pool for your rare NFT and set the starting price higher than your floor price NFT.
3. How do people know to buy from my pool?
I think this is a particularly good question. SudoSwap's smart contract will not automatically find you the cheapest pool to guide your trade. Instead, people will know to buy from your pool in two ways:
They want to buy your NFT, and this NFT can only come from your pool, so they have to buy from your pool.
They're "sweeping the floor" -- say, the cheapest price for a one-off purchase of 10 NFTs -- and your pricing matches the 10 cheapest NFTs in the collection. If so, SudoSwap (or the aggregator) will know this as they will track pricing across all series in order to give users the best pricing and route some of the trades through your pool.
4. What if I want to buy NFT instead of just selling it?
You can create a pool (called a "token" pool) for buying NFTs and fund them with ETH. You can set the price at which to buy NFTs, and the delta to adjust the offer after each transaction. You can offer 5 ETH for your first purchase and 4 ETH for your next purchase with a delta of -1; the setup is very similar to a pool for selling NFTs.
5. I thought I could sell NFT instantly on SudoSwap?
You can, by selling your NFTs to the "buy NFT pool" ("token" pool) that offers the highest bid offer. This actually explains what the offer does; to make an offer for 0.2 ETH, you simply create a pool containing 0.2 ETH and specify "I will buy any NFT in this series for 0.2 ETH". Then, someone can sell their NFT to your pool for 0.2 ETH, giving you the NFT.
6. What about DCAing?
If you want to do something similar to DCAing, you can create a pool with your initial buy-in price, and move the delta in the direction you want to DCA. I guess you could say it's not DCAing because you're not buying/selling at definite time intervals, but at least you're buying/selling at definite prices. Perhaps a bonding curve including a "time lock" between buys could be deployed in the future if there is a need for this.
7. What about transaction fees?
If you create a pool of "transactions" -- offering both buying NFTs at a certain price and selling NFTs at a slightly lower price -- you can specify a fee percentage for each transaction.
Note to developers
If you're not a developer, or you don't really care how SudoSwap's AMM works on a lower level, please skip this section.
Behind the scenes, SudoSwap's LSSVMPairFactory contract is creating new pools (called "Pairs" at the contract level), each pool is a contract named LSSVMPair, owned by the pool creator, and created with custom parameters, such as Pair type (token, NFT, or transaction), bonding curve type (currently only linear or exponential), spot price, delta, etc. Then you can monitor the pair and price quotes of its assets (obtained by calling 'getBuyNFTQuote', as shown in the figure below).
The LSSVMRouter contract is used for token approval (combining approvals into one contract) and for swapping. There are multiple swap types ("Robust" and "Normal"), each of which handles "what if this trade cannot be executed due to slippage or rapid price movement?" - the Robust type will jump pass and refund the user, the normal type will revert if excessive slippage occurs. Also, as a developer, the fact that the swap function directly returns the amount of unspent tokens is appreciated.
For various reasons such as aggregator inclusivity, MEV, etc., you may want to get the pricing yourself. To do this, you need to: track all pools (via the NewPair event of LSSVMPairFactory), track the NFTs in the pool (via the NFTDeposit event of LSSVMPairFactory, or via the getAllHeldIds function of the pool), track assets in the pool (via the pool TokenDeposit & TokenWithdrawal events), and get the pricing (through the pool's getBuyNFTQuote and getSellNFTQuote functions). I may be forgetting something, but here's the gist.
What to think about SudoSwap
I like to build "mental models" of new products to figure out where they fit in the market landscape and what they can be compared to. Actually, I don't know what a mental model is, I just hear it a lot lately, but it sounds similar to what I do.
It seems appropriate to think of SudoSwap as an NFT exchange competitor that uses an AMM rather than an order book. SudoSwap is making trade-offs like "increased gas fees but fully on-chain" vs "arguably more complicated for new users, but adds instant liquidity" and it will be up to users to decide which they prefer in different situations Exchange type.
I also fully understand that for many NFT users/traders, AMM/DeFi is something they don't care about. That said, Sudowap is still in a good position to get more volume through integrations with aggregators (I'm actually doing this myself, at Flip.xyz), Sudo's low transaction fees and The liquidity that is usually concentrated at the floor price means that for some NFT series, routing some or all of the batch transactions through the Sudowap pool will bring users cheaper execution prices, and users do not even need to learn (or understand) Sudowap.
As I mentioned before, Sudoswap also does not include royalty fees in their transactions. It's an interesting choice and has sparked some debate. "NFT series can make LPs for their collections on SudoSwap and earn LP fees", which generally refutes "you are entrapping collections and their treasury". I don't have a firm opinion on this; it will be interesting to see if which side (royalty or not) caves in, or if the collection is actually trying to actively avoid SudoSwap.
Overall, it's good to see a new protocol design - the NFT AMM - gaining some traction and demonstrating the trade-offs between NFT AMMs and order books in the real world.