sudoswap AMM Series : (1) Efficient NFT Trading Platform through Bonding Curve

verse2
verse2
Published in
9 min readSep 15, 2022

In this posting, we will introduce one of the emerging NFT trade protocols in the last three months, the sudoswap AMM protocol. We will highlight the gas-efficient AMM, user feature, liquidity pool, and other unique features of the sudoswap AMM through two Medium postings.

1.sudoswap AMM
1.1 Overview
sudoswap AMM is a protocol designed for the NFT trade using a liquidity-efficient AMM. It allows the users to experience low slippage while trading with NFT and tokens. Also, the liquidity provider can benefit from providing liquidity to buy/sell pools. When the transaction happens, liquidity providers collect the transaction fees from the NFT and tokens they provide to a liquidity pool. As a result, liquidity providers can manage the price range more efficiently, which allows dynamic buy/sell orders.

sudoswap AMM uses the on-chain liquidity pool pair (LP pair), replacing the off-chain order book. The base unit of the protocol is called LSSVMPair, a pool that can hold NFT, tokens, and both. The pair from sudoswap AMM use a bonding curve instead of the popular Uniswap’s constant function market makers. It allows for a minimized gas fee during the NFT and token swap. Furthermore, the users can swap within the multiple pools and manage approvals in a single LSSVMRouter contract.

Currently, sudoswap AMM does not distinguish ERC721ID like the other fractionalized NFT protocols. Regardless of the ID, an NFT buy/sell returns the same price if in the same collection. In short, the floor price (FP) of each collection determines the price, not the rarity.

Creating a pool

Protocol users are divided into liquidity providers and traders. Liquidity providers can select liquidity to provide (Token pair / NFT pair / Trade pair). A trader can execute their trade, such as bulk buying NFT in sudoswap AMM, or buy offering, based on the provided liquidity. In order to create a trade pair, one has to provide both NFT and tokens. Here, one can collect transaction fees in return.

When creating a new pool, sudoswap AMM is designed to interact with a unique smart contract instead of issuing the lp token. Unlike other protocols that issue the lp token for liquidity, sudoswap AMM assigns each liquidity to a unique smart contract and does not require additional token issuance.

1.2 Governance Token
The governance token of sudoswap AMM is called $SUDO. However, the actual distribution has not been started. According to the announcement, sudoswap AMM aims for a decentralized autonomous organization. It plans to change its management policy from the developer multi-sig to the $SUDO holder vote at the public launch.

According to the token economy announcement released on September 2, sudoswap AMM’s initial total supply is $60M.
- $25.12M will be allocated to $XMON holders (41.49%), $0.9M to 0xmons NFT holders (1.5%), $0.9 for LP airdrop (1.5%), and $15.08M to vault (51.1%).
- $9M will be allocated to the developers (15%) with a 1-year cliff and 3-years vesting period, and the same for SudoRandomLabs(15%).

1.3 Protocol UX
1.3.1 Trader UX

Collection purchase

A trader can buy/sell NFT from the collection provided by the liquidity providers.

Selling an NFT

  • There are two possible ways of selling an NFT: List & Sell
  • List: One can list at the willing price, but one has to wait until the buyer appears
  • Sell: Instant payment and settlement happen from the bonding curve
  • However, slippage occurs when the NFT is sold through a bonding curve. It means an NFT gets sold at a slightly lower price. As the number of total NFT in sales increases, the slippage widens.

Buying an NFT

  • Buying allows one to purchase NFT with tokens or with other NFT. Also, multiple purchases are possible in sudoswap AMM.
  • ‘Make collection offer’ allows one to make a buy offer for multiple NFTs after making a token deposit. To fully utilize the feature, one has to set the following parameters.
  • Start price: The price of the first NFT
  • Price decrease: the amount decrease for every NFT purchase
  • Max number to buy: The maximum number of NFTs to purchase

1.3.2 Liquidity provider UX
Liquidity providers can create LSSVMPair from sudoswap AMM .
There are three types of pairs.

  • Token pair: Deposit token and choose NFT for purchase
  • NFT pair: Deposit NFT and select type/amount of tokens
  • Trade pair: Deposits both token and NFT and collect a transaction fee

One has to set parameters to form the Token/NFT pair.

  • Initial price: The initial price of the NFT
  • Bonding curve: The type of bonding curve for a pair (Linear / Exponential)
  • Delta: The price change when a trade happens in a pair
  • Deposit amount: The amount of token/NFT for a pair

While creating a trade pair, the liquidity provider has to set additional conditions.

  • Fee: Percentage of the transaction fee (Trade pair collects the transaction fee from providing liquidity for other transactions to happen)
  • Deposit amount: The deposit amount for Token/NFT
  • Additionally, buy/sell price will be indicated on the bottom, calculated from the bonding curve.

2. Protocol structure & Price calculation from each bonding curve

Diagram explaining sudoswap AMM structure

The price is affected by the LSSVMPair, and it is affected by the customized bonding curve. sudoswap AMM currently offers two types of bonding curves: linear curve and exponential curve. Other types of bonds may be introduced via future whitepaper updates. The bonding curve is used to set the price after the pair trade, but it does not alter directly from the pair. Instead, the actual process required for the input/output check and the price update only happens at the LSSVMPair contract.

2.1 Spot Price
Spot price represents the instantaneous price for selling 1 NFT to the pair. Here, the buy price of 1 NFT from the pair costs the sum of the spot price and delta. As such, the buying price of an NFT from the selected pair is always higher by delta compared to the selling price. (Linear curve will change by delta. The exponential curve will change by delta multiplied)

It can be represented as the following:

buy price of t_1 = sell price of t_0 + delta

Assume the spot price with 1 ETH and a linear curve with the delta value of 0.1ETH exists. The seller will get 1 ETH in the first transaction (=sell price), but the buyer has to pay (1+0.1) = 1.1ETH, which is considered the second transaction.

Hence, the pair managers who manage the spot price manually must keep the price gap in mind during the trade.

2.2 Linear Curve
The linear curve gradually brings the price change. In the linear curve, the spot price, buy price, and sell price are set as follows.

2.2.1 Pricing the Buy price

Using linear curve to create a buy pool

In the case of a linear curve, the spot price increases by the delta.

  • For example, when the spot price(=sell price) is S ETH, (S+delta)ETH is required for purchase. When the buying is completed, the new spot price and the sell price becomes (S+delta).
  • The reason spot price before buying(= sell price) increases by delta is to prevent arbitrage trade by the liquidity providers.
  • If the spot price and sell/buy price are the same, one can purchase 1NFT for S ETH and sell for (S + Delta) ETH. This activity returns a profit of Delta ETH.
  • When the buy price is set at (spot price + Delt) and the updated sell price equals the buy price after the purchase, arbitrage can not happen.
  • The total price of buying n amount of NFT can be calculated as the following.
    (spot buy price) + (spot buy price + 1*delta) +(spot buy price + 2*delta) +… + (spot buy price + (n-1)*delta)
    The general formula becomes
    : n*(spot buy price) + (delta)*(n*(n-1))/2
    n = the total number of NFTs sold

2.2.2 Pricing the Sell price

  • After the NFT is sold, the new spot price is calculated by (buy spot price — 1*delta)
  • If the current spot price is lower than the Delta amount, the new spot price becomes 0. (The sport price cannot be negative)
  • Until the spot price reaches 0, the linear curve calculates the total number of possible sales and rounds up.
  • The following shows the total sell price of selling n amount of NFTs
    (spot sell price) +(spot sell price — 1 *delta) + (spot sell price -2 *delta) + .. +(spot sell price — (n-1)*delta)
    The total sell price can be formularized as follows.
    : n *(spot sell price) — delta * (n*(n-1))/2
    n = the total number of NFTs sold

2.3 Exponential Curve
Unlike the linear curve, the exponential curve is a multiplicative operation. In other words, the spot price increases by delta multiplied by each purchased NFT. Compared to the linear curve, the difference is only in how delta is applied, and both curves function the same.

Selling NFT using exponential bonding curve

Selling NFT using exponential bonding curve
For example, if the spot price(=sell price) is S ETH, one needs to have (S*delta) ETH for 1 NFT purchase. When the purchase is completed, the new spot price becomes (S*delta) ETH, and the sell price becomes (S*delta) ETH.

As mentioned previously, the difference is how delta is applied to prevent arbitrage trades. Just like from the linear curve, if the spot price and buy/sell price are equal, the user can benefit from the arbitrage by purchasing 1 NFT for S ETH and selling it for (S*delta) ETH. This will leave a profit of S*(delta-1) ETH per trade. To avoid such cases,

  • The total purchase amount for the exponential bonding curve can be calculated as follows
    :spot buy price + (delta * spot buy price) + (delta² * spot buy price) + .. + (delta ^(n-1) * spot buy price)
    Total price for purchase = (delta^n -1) / (delta -1)
    n = the total number of NFTs purchased

2.4 Pricing for multi swaps
When a user buys or sells multiple NFTs in one swap transaction, the spot price will be updated by delta per each NFT trade.

Assume an LSSVMPair with a linear curve, an NFT with the spot price of 1 ETH, and a delta of 0.1 ETH. The following shows the example of the sell price when a user sells 5 NFTs to a pair.

  • Initial price: 1ETH, Second price: 0.9 ETH, Third price: 0.8 ETH, Fourth price: 0.7 ETH, Fifth price: 0.6 ETH The new spot price is set at 0.5 ETH when the multi-swap is over.

In the first sudoswap AMM post, we briefly introduced the sudoswap AMM and explained the price calculation from sudoswap AMM. In our second post, we will focus on the technical analysis of the LSSVMPair and LSSVM Router.

This article is <sudoswap AMM Series: (1) efficient NFT trade platform through the bonding curve> provided by verse2. Please see the list below if you want to read the entire series. We recommend you read the articles sequentially.

  1. sudoswap AMM Series: (1) Efficient NFT trade platform through the bonding curve
  2. sudoswap AMM Series: (2) Mechanisms under sudoswap AMM

verse2 is a builder from the beginning. We contributed to various DeFi protocols and diverse ecosystems as an infrastructure builder (e.g., Layer 1, wallet, IDE, node validator, etc). More than 60% of the team is Product based. Making verse2 a specialist in developing Onchain Structured Products.

verse2 [Homepage | Twitter | Medium]

--

--

verse2
verse2
Editor for

Build, incubate, invest — Making all possible in the crypto. / verse2.io