Adding new jettons

Overview

DeDust Protocol creates a unique vault for every new jetton.

When a new jetton appears, we should set up its vault.

Then, we can establish a pool and add liquidity to it.

Create a vault

Setting up a new vault is very straightforward.

You can do it using the SDK or by manually sending the create_vault message (TL-B) to the Factory contract.

// Address of a new jetton
const jettonAddress = Address.parse('EQBlqsm144Dq6SjbPI4jjZvA1hqTIP3CvHovbIfW_t-SCALE');

// Create a vault
await factory.sendCreateVault(sender, {
  asset: Asset.jetton(jettonAddress),
});

Create a volatile pool

To set up a pool, you can either use the Factory method sendCreateVolatilePool or send the create_volatile_pool message (TL-B) directly to the Factory contract.

import { Asset, PoolType, ReadinessStatus } from '@dedust/sdk';

/* ... */

const TON = Asset.native();
const SCALE = Asset.jetton(SCALE_ADDRESS);

const pool = tonClient.open(
  await factory.getPool(PoolType.VOLATILE, [TON, SCALE]),
);

const poolReadiness = await pool.getReadinessStatus();

if (poolReadiness === ReadinessStatus.NOT_DEPLOYED) {
  await factory.sendCreateVolatilePool(sender, {
    assets: [TON, SCALE],
  });
}