Skip to main content

Vault

class Vault
constructor(    chainId: number,    isPaused: boolean = false,    minTransferDelay: BigintIsh,    maxTransferDelay: BigintIsh,    minFee: BigintIsh,    maxFee: BigintIsh,    feeThreshold: BigintIsh,    supportedTokens: { [tokenAddress: string]: SupportedToken<Token> }  )

The Vault entity represents a vault contract on a specific network. Stores available immutable properties to support further calculations.

Example#

import { SupportedToken, Vault } from '@composable-finance/v1-sdk-typescript'
const supportedToken = new SupportedToken(...));
const vaultObj = new Vault(  chainId:1,  minTransferDelay:10,  maxTransferDelay:100,  minFee:0.1,  maxFee:4,  feeThreshold:40,  supportedTokens:[supportedToken]);

Properties#

chainId

chainId: number

chainId represent the unique identifier of the chain you are interacting with. The following list are the chains supported by Mosaic currently:

//- L1 (mainnet)//- Arbitrum//- Polygon//- Moonriver//- Avalanche

isPaused

isPaused: boolean

When a Vault is paused, transfers are not allowed anymore.

minTransferDelay

minTransferDelay: BigintIsh

minTransferDelay represents the minimum allowed transfer delay for a Vault. A flow has to be completed between minTransferDelay and maxTransferDelay, otherwise funds are returned to the source layer.

maxTransferDelay

maxTransferDelay: BigintIsh

maxTransferDelay represents the maximum allowed transfer delay for a Vault. A flow has to be completed between minTransferDelay and maxTransferDelay, otherwise funds are returned to the source layer.

minFee

minFee: BigintIsh

minFee represents the minimum amount of fee that could be taken from a transfer

maxFee

maxFee: BigintIsh

maxFee represents the maximum amount of fee that could be taken from a transfer

feeThreshold

feeThreshold: BigintIsh

The dynamic fee model Mosaic uses has a feeThreshold that represents the % of the available liquidity over which the maximum allowed fee is taken. Until feeThreshold, fee can be simulated in a linear curve, but over it, it becomes a flat value equal to maxFee.

supportedTokens

supportedTokens: { [tokenAddress: string]: SupportedToken<Token> }

supportedTokens represents the list of supported tokens by the Vault