@interlay/interbtc-api / Exports / StandardLiquidityPool
LiquidityPoolCalculator
<StandardLpToken
>
↳ StandardLiquidityPool
• new StandardLiquidityPool(lpToken
, pooledCurrencies
, rewardAmountsYearly
, tradingFee
, isTradingActive
, totalSupply
, isEmpty
): StandardLiquidityPool
Name | Type |
---|---|
lpToken |
StandardLpToken |
pooledCurrencies |
PooledCurrencies |
rewardAmountsYearly |
MonetaryAmount <CurrencyExt >[] |
tradingFee |
Big |
isTradingActive |
boolean |
totalSupply |
MonetaryAmount <StandardLpToken > |
isEmpty |
boolean |
LiquidityPoolCalculator\<StandardLpToken\>.constructor
src/parachain/amm/liquidity-pool/standard.ts:15
• isEmpty: boolean
src/parachain/amm/liquidity-pool/standard.ts:22
• isTradingActive: boolean
src/parachain/amm/liquidity-pool/standard.ts:20
• lpToken: StandardLpToken
src/parachain/amm/liquidity-pool/standard.ts:16
• pooledCurrencies: PooledCurrencies
LiquidityPoolBase.pooledCurrencies
LiquidityPoolCalculator.pooledCurrencies
src/parachain/amm/liquidity-pool/standard.ts:17
• reserve0: MonetaryAmount
<CurrencyExt
>
src/parachain/amm/liquidity-pool/standard.ts:13
• reserve1: MonetaryAmount
<CurrencyExt
>
src/parachain/amm/liquidity-pool/standard.ts:14
• rewardAmountsYearly: MonetaryAmount
<CurrencyExt
>[]
LiquidityPoolBase.rewardAmountsYearly
src/parachain/amm/liquidity-pool/standard.ts:18
• token0: CurrencyExt
src/parachain/amm/liquidity-pool/standard.ts:11
• token1: CurrencyExt
src/parachain/amm/liquidity-pool/standard.ts:12
• totalSupply: MonetaryAmount
<StandardLpToken
>
LiquidityPoolCalculator.totalSupply
src/parachain/amm/liquidity-pool/standard.ts:21
• tradingFee: Big
src/parachain/amm/liquidity-pool/standard.ts:19
• type: PoolType
= PoolType.STANDARD
src/parachain/amm/liquidity-pool/standard.ts:10
▸ getLiquidityDepositInputAmounts(amount
): MonetaryAmount
<CurrencyExt
>[]
Calculates how much of pooled currencies needs to be deposited into pool with current ratio of currencies.
Name | Type | Description |
---|---|---|
amount |
MonetaryAmount <CurrencyExt > |
Amount of one of the pooled currencies. |
MonetaryAmount
<CurrencyExt
>[]
Monetary amounts of all pooled currencies in balanced proportion.
Throws
If pool is empty. Note: handle by checking isEmpty
property of pool.
LiquidityPoolCalculator.getLiquidityDepositInputAmounts
src/parachain/amm/liquidity-pool/calculator.ts:29
▸ getLiquidityDepositLpTokenAmount(amount
): MonetaryAmount
<StandardLpToken
>
Calculates expected amount of LP token account will get after depositing
amount
of pooled currency into pool.
Name | Type | Description |
---|---|---|
amount |
MonetaryAmount <CurrencyExt > |
Amount of one of the pooled currencies. |
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.
LiquidityPoolCalculator.getLiquidityDepositLpTokenAmount
src/parachain/amm/liquidity-pool/calculator.ts:47
▸ getLiquidityWithdrawalPooledCurrencyAmounts(amount
): MonetaryAmount
<CurrencyExt
>[]
Calculates expected amount of pooled currencies account will get
after withdrawing amount
of LP token.
Name | Type | Description |
---|---|---|
amount |
MonetaryAmount <StandardLpToken > |
Amount of liquidity in LP token to be withdrawn. |
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.
LiquidityPoolCalculator.getLiquidityWithdrawalPooledCurrencyAmounts
src/parachain/amm/liquidity-pool/calculator.ts:64
▸ getOutputAmount(inputAmount
): MonetaryAmount
<CurrencyExt
>
Get output amount of pool after swap of inputAmount
is made.
Name | Type | Description |
---|---|---|
inputAmount |
MonetaryAmount <CurrencyExt > |
Input amount of currency to swap. |
MonetaryAmount
<CurrencyExt
>
Output amount after swap of inputAmount
is made.
src/parachain/amm/liquidity-pool/standard.ts:51
▸ pathOf(inputCurrency
): MultiPathElementStandard
Name | Type |
---|---|
inputCurrency |
CurrencyExt |