interbtc-api

@interlay/interbtc-api / Exports / StableLiquidityMetaPool

Class: StableLiquidityMetaPool

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new StableLiquidityMetaPool(lpToken, metaPooledCurrencies, pooledCurrencies, rewardAmountsYearly, tradingFee, poolId, amplificationCoefficient, totalSupply, isEmpty, basePool): StableLiquidityMetaPool

Parameters

Name Type
lpToken StableLpToken
metaPooledCurrencies PooledCurrencies
pooledCurrencies PooledCurrencies
rewardAmountsYearly MonetaryAmount<CurrencyExt>[]
tradingFee Big
poolId number
amplificationCoefficient Big
totalSupply MonetaryAmount<StableLpToken>
isEmpty boolean
basePool StableLiquidityPool

Returns

StableLiquidityMetaPool

Overrides

StableLiquidityPool.constructor

Defined in

src/parachain/amm/liquidity-pool/stable-meta.ts:8

Properties

actuallyPooledCurrencies

actuallyPooledCurrencies: PooledCurrencies

Inherited from

StableLiquidityPool.actuallyPooledCurrencies

Defined in

src/parachain/amm/liquidity-pool/stable.ts:14


amplificationCoefficient

amplificationCoefficient: Big

Inherited from

StableLiquidityPool.amplificationCoefficient

Defined in

src/parachain/amm/liquidity-pool/stable.ts:20


basePool

basePool: StableLiquidityPool

Defined in

src/parachain/amm/liquidity-pool/stable-meta.ts:18


isEmpty

isEmpty: boolean

Inherited from

StableLiquidityPool.isEmpty

Defined in

src/parachain/amm/liquidity-pool/stable.ts:22


lpToken

lpToken: StableLpToken

Inherited from

StableLiquidityPool.lpToken

Defined in

src/parachain/amm/liquidity-pool/stable.ts:12


poolId

poolId: number

Inherited from

StableLiquidityPool.poolId

Defined in

src/parachain/amm/liquidity-pool/stable.ts:19


pooledCurrencies

pooledCurrencies: PooledCurrencies

Inherited from

StableLiquidityPool.pooledCurrencies

Defined in

src/parachain/amm/liquidity-pool/stable.ts:16


rewardAmountsYearly

rewardAmountsYearly: MonetaryAmount<CurrencyExt>[]

Inherited from

StableLiquidityPool.rewardAmountsYearly

Defined in

src/parachain/amm/liquidity-pool/stable.ts:17


totalSupply

totalSupply: MonetaryAmount<StableLpToken>

Inherited from

StableLiquidityPool.totalSupply

Defined in

src/parachain/amm/liquidity-pool/stable.ts:21


tradingFee

tradingFee: Big

Inherited from

StableLiquidityPool.tradingFee

Defined in

src/parachain/amm/liquidity-pool/stable.ts:18


type

type: STABLE_PLAIN | STABLE_META

Inherited from

StableLiquidityPool.type

Defined in

src/parachain/amm/liquidity-pool/stable.ts:11

Accessors

_feePerToken

get _feePerToken(): Big

Returns

Big

Inherited from

StableLiquidityPool._feePerToken

Defined in

src/parachain/amm/liquidity-pool/stable.ts:35


xp

get xp(): Big[]

Returns

Big[]

Inherited from

StableLiquidityPool.xp

Defined in

src/parachain/amm/liquidity-pool/stable.ts:194

Methods

calculateRemoveLiquidityOneToken

calculateRemoveLiquidityOneToken(tokenLPAmount, outputCurrencyIndex): [MonetaryAmount<CurrencyExt>, MonetaryAmount<CurrencyExt>]

Parameters

Name Type
tokenLPAmount MonetaryAmount<StableLpToken>
outputCurrencyIndex number

Returns

[MonetaryAmount<CurrencyExt>, MonetaryAmount<CurrencyExt>]

Inherited from

StableLiquidityPool.calculateRemoveLiquidityOneToken

Defined in

src/parachain/amm/liquidity-pool/stable.ts:223


calculateSwap

calculateSwap(inputIndex, outputIndex, inputAmount): MonetaryAmount<CurrencyExt>

Parameters

Name Type
inputIndex number
outputIndex number
inputAmount MonetaryAmount<CurrencyExt>

Returns

MonetaryAmount<CurrencyExt>

Inherited from

StableLiquidityPool.calculateSwap

Defined in

src/parachain/amm/liquidity-pool/stable.ts:263


calculateTokenAmount

calculateTokenAmount(amounts, deposit): MonetaryAmount<StableLpToken>

Parameters

Name Type Description
amounts PooledCurrencies Array of monetary amount for each pooled currency of this pool.
deposit boolean True for deposit, false for withdrawal

Returns

MonetaryAmount<StableLpToken>

LP token amount that will be minted/burned after operation.

Inherited from

StableLiquidityPool.calculateTokenAmount

Defined in

src/parachain/amm/liquidity-pool/stable.ts:204


getLiquidityDepositInputAmounts

getLiquidityDepositInputAmounts(amount): MonetaryAmount<CurrencyExt>[]

Calculates how much of pooled currencies needs to be deposited into pool with current ratio of currencies.

Parameters

Name Type Description
amount MonetaryAmount<CurrencyExt> Amount of one of the pooled currencies.

Returns

MonetaryAmount<CurrencyExt>[]

Monetary amounts of all pooled currencies in balanced proportion.

Throws

If pool is empty. Note: handle by checking isEmpty property of pool.

Inherited from

StableLiquidityPool.getLiquidityDepositInputAmounts

Defined in

src/parachain/amm/liquidity-pool/calculator.ts:29


getLiquidityDepositLpTokenAmount

getLiquidityDepositLpTokenAmount(amount): MonetaryAmount<StableLpToken>

Calculates expected amount of LP token account will get after depositing amount of pooled currency into pool.

Parameters

Name Type Description
amount MonetaryAmount<CurrencyExt> Amount of one of the pooled currencies.

Returns

MonetaryAmount<StableLpToken>

Expected amount of lp token that will be received after amount is added to pool.

Note

This method assumes all pooled currencies will be added in balance.

Throws

If pool is empty. Note: handle by checking isEmpty property of pool.

Inherited from

StableLiquidityPool.getLiquidityDepositLpTokenAmount

Defined in

src/parachain/amm/liquidity-pool/calculator.ts:47


getLiquidityWithdrawalPooledCurrencyAmounts

getLiquidityWithdrawalPooledCurrencyAmounts(amount): MonetaryAmount<CurrencyExt>[]

Calculates expected amount of pooled currencies account will get after withdrawing amount of LP token.

Parameters

Name Type Description
amount MonetaryAmount<StableLpToken> Amount of liquidity in LP token to be withdrawn.

Returns

MonetaryAmount<CurrencyExt>[]

Amounts of pooled currencies to be returned to account.

Note

This method assumes all pooled currencies will be withdrawn in balance.

Throws

If pool is empty. Note: handle by checking isEmpty property of pool.

Inherited from

StableLiquidityPool.getLiquidityWithdrawalPooledCurrencyAmounts

Defined in

src/parachain/amm/liquidity-pool/calculator.ts:64


getTokenIndex

getTokenIndex(currency): number

Parameters

Name Type
currency CurrencyExt

Returns

number

Inherited from

StableLiquidityPool.getTokenIndex

Defined in

src/parachain/amm/liquidity-pool/stable.ts:188


involvesToken

involvesToken(currency): boolean

Parameters

Name Type
currency CurrencyExt

Returns

boolean

Inherited from

StableLiquidityPool.involvesToken

Defined in

src/parachain/amm/liquidity-pool/stable.ts:182