Supportive methods

Fetching list of vaults

This method returns a promise that resolves to an array of vault objects, each containing:

  • Address

  • Name

  • Timestamp of creation

  • Block number of creation

const vaults = await sdk.vaults.getVaults();

Fetching client data

This method returns the range of pool IDs (minimum to maximum) associated with a given client, as well as the client's name:

const integratorAddress = '0x555';
const vault = '0x1234';
const { minPool, maxPool, clientName } = await sdk.vaults.clientData(integratorAddress, vault);

Activate pool

Once the Yelay team assigns a pool range to a client and their integratorAddress, each poolId must be activated before deposits are allowed.

  • Activation can be done by Yelay or by the client using the method below.

  • Only a whitelisted operator address can perform this action.

  • To whitelist an address, provide your operator address to the Yelay team.

const poolToActivate = minPool + 5; // should be in range: minPool < poolToActivate < maxPool
const isPoolActive = await sdk.vaults.poolActive(vault, poolToActivate);
if (!isPoolActive) {
	await sdk.vaults.activatePool(vault, poolToActivate);
}

Migrate user deposits between pools

This method allows withdrawing a user’s liquidity from Pool A and depositing it into Pool B (both operated by the same client) in a single transaction:

const fromPool = 123;
const toPool = 456;
const migrateTx = await sdk.vaults.migrate(vault, fromPool, toPool, amount);
await migrateTx.wait();

Last updated