Links

Technical User Flows

  • Creating a Trading Pool
    • createPoolETHFiltered
      • params
        • nft - address of the NFT Collection
          • bondingCurve - address of the bonding curve you want
          • assetRecipient - address of asset recipient of the asset after a buy/sell. Only applicable for NFT/ TRADE pools
          • receiver - Receiver of the LP token generated to represent ownership of the pool (generally should be yourself)
          • poolType - TOKEN/NFT/TRADE where enums 0/1/2 represent these categorical variables
          • delta - as specified by bonding curve, used by bonding curve
          • fee - input the fee you the user want to charge buyers or sellers where 1e18 = 100%. (e.g. 1e16 = 1%), used by bonding curve
          • spotPrice - a stateful variable for determining new bid/ask levels on every buy or sell transaction. Refer to bonding curve code to see how each one uses spot price
          • props - arbitrary bytes variable for static variables, used by bonding curve
          • state - arbitrary bytes variable for stateful variable, used by bonding curve
          • royaltyNumerator - % of royalties to give to ERC2981 recipient or its fallback. 1e18 = 100%; 1e16 = 1%
          • royaltyRecipientFallback- fallback if ERC2981 is not set. Necessary if you want to set a non-zero royalty numerator for a non-2981 contract.
          • initialNFTIDs - initial NFT IDs of nft that you wish to put into the pool, you must be the owner of these NFT IDs. Note that initial NFT IDs must be sorted by filter_code library. (This is to ensure consistency with the initialProof/ initialProofFlags. If it is not sorted, it will throw a not accepted error. The sorted list of IDs is simply the leaves field of any merkle proof you generate)
            • How to generate filter params from the library?
              • call .root() for Merkle root
              • call .encode() for encoded Token IDs
// tokenIDFilter is the main object of the library
// accept [1,2,3,4,5]
// Pool starts with [1, 2, 3]
let tokenIDFilter = new tokenIDs([1n,2n,3n,4n,5n]);
// Merkle multiproof is order sensitive. Always pass proof.leaves to tokenId fields
// required by the smart contract if a merkle proof is needed
const unsortedIDs = [1n, 2n, 3n]
const initialNFTIDs = tokenIDFilter.sort([1n, 2n, 3n]);
const root = tokenIDFilter.root()
const encodedTokenIDs = tokenIDFilter.encode()
const {proof: initialProof, proofFlags: initialProofFlags, leaves: initialNFTIDs } = tokenIDFilter.proofOf(initialNFTIDs)
  • filterParams
    • merkleRoot - Root of the Merkle tree of the allowedSet of token IDs.
      • Filters should accept at least one token ID. A pool that accepts no tokens is a dead pool.
    • encodedTokenIDs - Encoding of the token IDs. An efficient hexadecimal packing of the token IDs, to minimize gas spent on emitting the event.
    • initialProof - Together the initialProof and initialProofFlags form 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 - Together the initialProof and initialProofFlags form 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.