Pool

Get the infos of the liquidity pool and initialize liquidity.

poolList

Get the list of liquidity pools

Copy

const res: IResType<IPool>= await floorswap.pool.poolList({
    page: 1
}: IPoolListParams)

interface IPoolListParams {
  page?: number;
}

interface IResType<T> {
  code: string;
  message: string;
  success: boolean;
  data: T;
}

interface IPool {
  collectionName: string;
  collectionAddress: string;
  nftsOffer: number;
  tokensOffer: number;
  volume24h: number;
  floorPrice: number;
  offerPrice: number;
}

IPoolListParams

NameTypeRequiredDescription

page

number

false

page numbers, defualt 1

IPool

NameTypeDescriptionExample

collectionName

string

Collection name

Koda

collectionAddress

string

Collection contract address

0xe012baf811cf9c05c408e879c399960d1f305903

nftsOffer

number

NFT reserve

10

tokensOffer

number

Token reserve

5.5

volume24h

number

24h trading volume

155

floorPrice

number

Best bid price

2

offerPrice

number

Best ask price

1

poolDetail

Get details of pool

Copy

const res: IResType<IPoolDetail>= await floorswap.pool.poolDetail({
    collectionAddress: '...'
}: IPoolDetailParams)

interface IPoolDetailParams {
  collectionAddress: string;
}

interface IPoolDetail {
  collectionName: string;
  collectionAddress: string;
  nftsOffer: number;
  tokensOffer: number;
  volume24h: number;
  floorPrice: number;
  offerPrice: number;
  position: {
    pairAddress: string;
    status: number;
  }[];
}

IPoolDetailParams

NameTypeRequiredDescription

collectionAddress

string

true

Collection contract address

IPoolDetail

NameTypeDescriptionExample

collectionName

string

Collection name

Koda

collectionAddress

string

Collection contract address

0xe012baf811cf9c05c408e879c399960d1f305903

nftsOffer

number

NFT reserve

10

tokensOffer

number

Token reserve

5.5

volume24h

number

24h trading volume

155

floorPrice

number

Best bid price

2

offerPrice

number

Best ask price

1

position

object[]

The list of positions

- pairAddress

string

Contract address of pair/position

0xe012baf811cf9c05c408e879c399960d1f305903

- status

number

Status of position

1: IN_RANGE

2: OUT_OF_RANGE

3: CLOSED

initLiquidity

Init liquidiity and signer is needed here.

Copy

const txHash: string = await floorswap.pool.initLiquidity({
    signer,
    collectionAddress: '...',
    bondingCurve: 0,
    fee: '50000000000000000',
    delta: 5,
    tokenIdList: ['5'],
    value: '100000000000000000',
}: IInitLiquidityParams & { signer: ethers.Signer })

interface IInitLiquidityParams {
  collectionAddress: string;
  bondingCurve: number;
  fee: string;
  delta: number;
  tokenIdList: string[];
  value: string;
}

IInitLiquidityParams

NameTypeRequiredDescription

signer

ethers.Signer

true

collectionAddress

string

true

Collection address

bondingCurve

number

true

Types of bondingCurve. 0 stands of "XYK".

fee

string

true

Transaction fee, and the unit is wei e.g. 50000000000000000 = 5%

delta

number

true

Concentration

tokenIdList

string[]

true

List of token ids

value

string

true

Amount of $ETH, and the unit is wei e.g. 50000000000000000 wei = 5 eth

initLiquidityForFundingPool

Init liquidity with Funding Pool. Please apply apiKey from Chamcha platform first.

Copy

const txHash: string = await floorswap.pool.initLiquidityForFundingPool({
    signer,
    collectionAddress: '...',
    bondingCurve: 0,
    fee: '50000000000000000',
    delta: 5,
    tokenIdList: ['5'],
    value: '100000000000000000',
}: IInitLiquidityParams)

interface IInitLiquidityParams {
  collectionAddress: string;
  bondingCurve: number;
  fee: string;
  delta: number;
  tokenIdList: string[];
  value: string;
}

IInitLiquidityParams

NameTypeRequiredDescription

signer

ethers.Signer

true

collectionAddress

string

true

Collection address

bondingCurve

number

true

Types of bondingCurve. 0 stands of "XYK".

fee

string

true

Transaction fee, and the unit is wei e.g. 50000000000000000 = 5%

delta

number

true

Concentration

tokenIdList

string[]

true

List of token ids

value

string

true

Amount of $ETH, and the unit is wei e.g. 50000000000000000 wei = 5 eth

Last updated