interbtc-api

@interlay/interbtc-api / Exports / StandardLiquidityPool

Class: StandardLiquidityPool

Hierarchy

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new StandardLiquidityPool(lpToken, pooledCurrencies, rewardAmountsYearly, tradingFee, isTradingActive, totalSupply, isEmpty): StandardLiquidityPool

Parameters

Name Type
lpToken StandardLpToken
pooledCurrencies PooledCurrencies
rewardAmountsYearly MonetaryAmount<CurrencyExt>[]
tradingFee Big
isTradingActive boolean
totalSupply MonetaryAmount<StandardLpToken>
isEmpty boolean

Returns

StandardLiquidityPool

Overrides

LiquidityPoolCalculator\<StandardLpToken\>.constructor

Defined in

src/parachain/amm/liquidity-pool/standard.ts:15

Properties

isEmpty

isEmpty: boolean

Implementation of

LiquidityPoolBase.isEmpty

Defined in

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


isTradingActive

isTradingActive: boolean

Defined in

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


lpToken

lpToken: StandardLpToken

Implementation of

LiquidityPoolBase.lpToken

Defined in

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


pooledCurrencies

pooledCurrencies: PooledCurrencies

Implementation of

LiquidityPoolBase.pooledCurrencies

Inherited from

LiquidityPoolCalculator.pooledCurrencies

Defined in

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


reserve0

reserve0: MonetaryAmount<CurrencyExt>

Defined in

src/parachain/amm/liquidity-pool/standard.ts:13


reserve1

reserve1: MonetaryAmount<CurrencyExt>

Defined in

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


rewardAmountsYearly

rewardAmountsYearly: MonetaryAmount<CurrencyExt>[]

Implementation of

LiquidityPoolBase.rewardAmountsYearly

Defined in

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


token0

token0: CurrencyExt

Defined in

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


token1

token1: CurrencyExt

Defined in

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


totalSupply

totalSupply: MonetaryAmount<StandardLpToken>

Implementation of

LiquidityPoolBase.totalSupply

Inherited from

LiquidityPoolCalculator.totalSupply

Defined in

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


tradingFee

tradingFee: Big

Implementation of

LiquidityPoolBase.tradingFee

Defined in

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


type

type: PoolType = PoolType.STANDARD

Implementation of

LiquidityPoolBase.type

Defined in

src/parachain/amm/liquidity-pool/standard.ts:10

Methods

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

LiquidityPoolCalculator.getLiquidityDepositInputAmounts

Defined in

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


getLiquidityDepositLpTokenAmount

getLiquidityDepositLpTokenAmount(amount): MonetaryAmount<StandardLpToken>

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<StandardLpToken>

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

LiquidityPoolCalculator.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<StandardLpToken> 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

LiquidityPoolCalculator.getLiquidityWithdrawalPooledCurrencyAmounts

Defined in

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


getOutputAmount

getOutputAmount(inputAmount): MonetaryAmount<CurrencyExt>

Get output amount of pool after swap of inputAmount is made.

Parameters

Name Type Description
inputAmount MonetaryAmount<CurrencyExt> Input amount of currency to swap.

Returns

MonetaryAmount<CurrencyExt>

Output amount after swap of inputAmount is made.

Defined in

src/parachain/amm/liquidity-pool/standard.ts:51


pathOf

pathOf(inputCurrency): MultiPathElementStandard

Parameters

Name Type
inputCurrency CurrencyExt

Returns

MultiPathElementStandard

Defined in

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