Technical User Flows
Creating a Trading Pool
To create a trading pool, you need to provide the following parameters:
nft
: The NFT contract of the collection the pool trades.bondingCurve
: The bonding curve for the pool to price NFTs; it must be whitelisted.assetRecipient
: The address that receives the assets traders give during trades. If set toaddress(0)
, assets will be sent to the pool address. Not available for TRADE pools.receiver
: The address that receives the LP token generated to represent ownership of the pool.poolType
: TOKEN, NFT, or TRADE.delta
: The delta value used by the bonding curve. The meaning of delta depends on the specific curve.fee
: The fee taken by the LP in each trade. Can only be non-zero if_poolType
is TRADE.spotPrice
: The initial selling spot price.props
: A bytes variable for static variables, used by the bonding curve.state
: A bytes variable for stateful variables, used by the bonding curve.royaltyNumerator
: All trades result inroyaltyNumerator
*<trade amount>
/ 1e6 being sent to the account to which the traded NFT's royalties are awardable. Must be 0 if_nft
is not IERC2981 and no recipient fallback is set.royaltyRecipientFallback
: An address that receives all royalties if notaddress(0)
and ERC2981 is not supported or ERC2981 recipient is not set.initialNFTIDs
: The list of IDs of NFTs to transfer from the sender to the pool.
To define filter parameters, use the NFTFilterParams
struct:
merkleRoot
: The root of the Merkle tree of the allowed set of token IDs. Filters should accept at least one token ID. A pool that accepts no tokens is a dead pool.encodedTokenIDs
: The encoding of the token IDs, an efficient hexadecimal packing of the token IDs to minimize gas spent on emitting the event.initialProof
: The Merkle multiproof for initial NFT IDs. Together withinitialProofFlags
, it forms the Merkle proof for the initial set of NFT tokens put into the pool. Flags are used to indicate which proof is used for which token ID.initialProofFlags
: The Merkle multiproof flags for initial NFT IDs. Together withinitialProof
, it forms the Merkle proof for the initial set of NFT tokens put into the pool. Flags are used to indicate which proof is used for which token ID.externalFilter
: The address implementingIExternalFilter
for external filtering.
Note on initialNFTIDs
: The initial NFT IDs of the NFTs you wish to put into the pool. You must be the owner of these NFT IDs. Note that initial NFT IDs must be sorted using the filter_code
library. This ensures consistency with initialProof
and initialProofFlags
. If it's not sorted, a "not accepted" error will be thrown. The sorted list of IDs is the leaves
field of any Merkle proof you generate.
To generate filter parameters from the library:
Call
.root()
for the Merkle root.Call
.encode()
for encoded Token IDs.
Last updated