Users can list NFTs (create Sell Pool), make offer (create Buy Pool) and liquidity mining (create Trade Pool) with this function

Request Parameters

Note: The outermost layer is an object, and the following parameters need to be enclosed in []

tokentoken address
_nftaddressThe address of the ERC721 NFT contract.0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
_bondingCurveaddressThe address of the AMM mechanism.
Linear: 0x0f776A85F842b605E0771B6a244DF2a2505Fa7A1
Exponential: 0x0F16Be0e961AD87f47A5e2a8177e0c2299C7849c
_assetRecipientaddressThe recipient address of the asset, as the asset of buy pool and sell pool will be directly sent to the assetRecipient, and the asset of trade pool will remain in the pool. Therefore, when _poolType is 0 or 1, pass the address of the asset recipient, such as the creator address, when _poolType is 2, pass the 0 address.msgsender or 0 address
_poolTypeenumBuy: 0; Sell: 1; Trade: 20 or 1 or 2
_deltauint128The amplitude of the price change in the pool after each transaction. For example, if the current linear pool price is 1 and delta is 0.1, the pool price will be 1.1 after buying an NFT (roughly calculated). If delta is 0, the pool price will remain unchanged after buying an NFT. Units: wei.0.1 * 10 ** 18 wei
_feeuint96The transaction fee for each transaction. Buy and sell pools do not have this option and are set to 0 by default. Trade pools allow users to customize the transaction fee. Units: wei.The transaction fee is a percentage, the fee is (fee / 1 10 18), and the contract specifies that the transaction fee cannot be greater than 10%, so the value cannot exceed 0.1 _ 10 18 wei.
_spotPsporiceuint128The initial price of the NFT in the pool, which needs to be calculated using a calculation library. Units: wei.1000000000000 wei
_initialNFTIDsuint256[]The TokenIDs passed into the pool when it is first created. Because there is no NFT passed into the buyPool, pass [] when _poolType is 0.[1003, 1005]
initialTokenBalanceuint256init token balance

call factory contract

// Data structure
function createPairERC20(CreateERC20PairParams calldata params) external
returns (LSSVMPairERC20 pair)
struct CreateERC20PairParams {
    ERC20 token;
    IERC721 nft;
    ICurve bondingCurve;
    address payable assetRecipient;
    LSSVMPair.PoolType poolType;
    uint128 delta;
    uint96 fee;
    uint128 spotPrice;
    uint256[] initialNFTIDs;
    uint256 initialTokenBalance;
Return Parameters
pairaddressAddress of the pool0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266

Calculation of spotPrice & totalAmount

When buying an NFT, there is a maximum expected cost, and if it exceeds this value, the transaction will not occur.
//Example: A user purchases an NFT, and the pool's change type is linear.
const price = mathLib?.[curve]?.[this.createPoolType](
  				//start price set
  				//delta value set
  				//trade transaction fee set
  				//the following two are fixed at 0
  				//number of purchases
  				//create is fixed
//Return value
//Values taken when creating a pool
spotPrice = priceData.spotPrice
//Creating a buy pool
totalAmount = priceData.poolBuyPrice
//Creating a sell or trade pool
totalAmount = priceData.poolSellPrice

Code Example

import { ethers, utils } from 'ethers';

const signer = new ethers.providers.Web3Provider(window?.ethereum).getSigner();
const contract = new ethers.Contract(factoryAddress, abi, signer);
const txResult = await contract.createPair1155ERC20([