Create Pool

Example

CreatePoolOptions

interface CreatePoolOptions {
  coinTreasuryCap: string;
  coinType: string;
  name: string;
  symbol: string;
  url: string;
  description: string;
  twitter: string;
  telegram: string;
  website: string;
  currentAddress: string;
  lp_type: 0 | 1;
  tx?: Transaction;
}

createPool

async createPool({
    coinTreasuryCap,
    coinType,
    name,
    symbol,
    url,
    description,
    twitter,
    telegram,
    website,
    currentAddress,
    lp_type,
    tx,
  }: CreatePoolOptions) {
    const txb = tx || new Transaction();

    const apyAmount = Math.round(
      new Decimal(this.deployment_fee).mul(10 ** this.quote_decimals).toNumber(),
    );

    const paySuiCoin = coinWithBalance({
      type: '0x2::sui::SUI',
      balance: apyAmount,
    });

    txb.setSenderIfNotSet(currentAddress);
    txb.moveCall({
      target: `${pakcageId}::parrot_fun::create`,
      arguments: [
        txb.object(globalConfig),
        txb.object(funConfig),
        txb.object(coinTreasuryCap),
        paySuiCoin,
        txb.pure.string(name),
        txb.pure.string(symbol),
        txb.pure.string(url),
        txb.pure.string(description),
        txb.pure.string(twitter),
        txb.pure.string(telegram),
        txb.pure.string(website),
        txb.pure.u8(lp_type),
        txb.object(SUI_CLOCK_OBJECT_ID),
      ],
      typeArguments: [coinType],
    });

    return txb;
  }

Last updated