Sudoswap is a gas-efficient automated market maker (AMM) protocol that facilitates the exchange of NFTs for tokens (and vice versa) using customizable bonding curves. Sudoswap supports ERC721 and ERC1155 NFTs, as well as all ETH and ERC20 tokens.
Liquidity Providers (LPs) can deposit assets into single-sided buy or sell pools or dual-sided trading pools that buy and sell NFTs with an additional spread to generate trading fees.
Like other NFT floor protocols, sudoswap does not distinguish between different ERC721 identifiers. Pools that are willing to buy or sell NFTs will return the same price regardless of which NFT is sent to or from the collection.
How work NFT DEX
Sudoswap is an AMM protocol for NFTs, which means that users buy or sell into liquidity pools instead of directly trading amongst themselves. It's a similar concept to Uniswap, but for NFTs.
- Liquidity providers deposit NFT and/or ETH (or an ERC20 token) into liquidity pools. They choose whether they will buy or sell NFTs (or both) and specify a starting price and bond curve parameters.
- Users can then buy NFTs from these pools or sell NFTs into them. Each time an item is bought or sold, the buy or sell price of the other items changes for the pool based on its bond curve.
- At any time, liquidity providers can change their pool parameters or withdraw assets.
What is a liquidity pool?
A liquidity pool is a smart contract that allows you to instantly exchange two assets. On sudoswap, the most common type of pool is an NFT<>ETH pool, which means that any owner of NFTs in the collection can instantly exchange them for ETH, or vice versa.
Pools use a bonding curve to determine the relative price at which one asset is exchanged for another. The more an asset is bought from a pool, the more expensive it becomes. Conversely, the more an asset is sold to the pool, the cheaper it becomes.
Ideally, a pool contains some amount of both assets, allowing users to exchange them for each other. However, it is possible to create a pool with only one asset, and then users can only buy that asset from the pool.
Auctions are a type of sudoswap pool that utilizes gradual Dutch auction (GDA) or related bonding curves.
Wrapped liquidity pools
Sudoswap pools can be wrapped as ERC721 NFTs using a wrapper contract. This will allow pools to be used within any NFT-compatible protocol for purposes such as lending or fractionalization.
Currently, the contract-wrapper only supports ERC721<>ETH pools.
The NFT wrap holder has complete and exclusive control over the underlying pool. With a wrap contract, he can change the pool settings such as pricing, unwrap the pool which transfers ownership of the pool to him and subsequently burns the NFT.
Valuing Wrapped Pools can be complex due to different pricing curves and risk of manipulation. To mitigate this problem, you can starting protocols by only integrating certain categories of sudoswap pools.
For example, for a buy-only or sell-only pool that uses a linear or exponential pricing curve, the total value of the pool can be estimated by multiplying its NFT balance by the minimum NFT price (provided by the NFT valuation oracle of choice) and adding its ETH balance.
In addition, you must ensure that the pool price at the time of valuation is equal to or higher than the NFT floor price.
Listing collection
For a collection to show up in the search bar, it must have at least one liquidity pool or past volume on sudoswap. However, even if a collection is not displayed, holders can still create liquidity pools for it normally.
There is no special procedure to start an NFT collection on sudoswap. Simply mint your NFTs and place them on an auction or other liquidity pool of your choice.
Bonding curves
A bonding curve is a mathematical formula that defines the relationship between the price of an asset and its supply. Bonding curves are a key feature of automated market makers because they are used to algorithmically adjust asset prices.
Sudoswap supports three types of bonding curves: linear, exponential and XYK (constant product).
- In a linear bonding curve, the NFT price increases by a fixed amount (called delta) each time an item is purchased from the pool. Conversely, the price of the NFT decreases by the same fixed amount each time the item is sold to the pool.
- With an exponential bonding curve, the price of NFT increases by a certain percentage (also called delta) each time an item is purchased from the pool. Conversely, the NFT price equivalently decreases each time the item is sold to the pool.
- Using the XYK curve, the NFT price is adjusted each time an item is bought or sold to the pool so that the product of the two virtual reserves remains constant after each transaction. These virtual reserves correspond to the quantity and value of NFTs that the pool will buy or sell. An additional concentration parameter allows liquidity providers to adjust (i.e., tighten or loosen) the XYK curves.
NFT AMM key features
Royalty support for ERC2981-compliant collections, as well as fallback royalty solutions.
ERC2981 is a standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal support for royalty payments across all NFT marketplaces and ecosystem participants.
If the collection implements ERC2981, the RoyaltyEngine contract extracts royalty information from the collection contract itself. Otherwise, RoyaltyEngine looks for royalty information in the specifications of popular marketplaces: Manifold, Rarible V1 and V2, Foundation, SuperRare, Zora, ArtBlocks, KnownOriginV2
RoyaltyEngine also looks for entries in the general royalty registry at royaltyregistry.eth, where creators can manually override royalties.
LP agreements called Settings are opt-in contracts that allow creators to partially or fully waive royalties for liquidity pools that meet criteria they choose, such as a 90-day lock-in period or a 50:50 trading fee split.
Ability to create liquidity pools with specified properties. Only NFTs with specified properties can be sold into the pools. The logic for checking properties is contained in special contracts called Property Checkers. Users can develop Property Checkers using the logic as they see fit.
Support for ERC1155 NFT pairs against ETH and ERC20 tokens. ERC1155 pairs must specify a single NFT identifier that the pair can trade. The NFT identifier allowed to be traded must be specified when the pair is created and can't be changed afterwards.
When creating a pool, users can specify a separate address to receive fees.
The router handles all types of swaps (i.e. ERC721<>ETH, ERC721<>ERC20, ERC1155<>ETH, ERC1155<>ERC20) as well as partial fills when buying/selling multiple items from the same pool.
Swap events SwapNFTInPair and SwapNFTOutPair distinguish the direction of the swap, and register the input/output value and tokenIds (or number of NFTs in the case of ERC1155).