LiquidityPool

data class LiquidityPool(val assetA: Asset, val assetB: Asset, val fee: Int = FEE)

Represents a Liquidity Pool Parameters object on the Stellar network.

Liquidity pools allow for automated market making through constant product pools. Each pool contains two assets and a fee parameter.

Usage

val assetA = AssetTypeCreditAlphaNum4("USD", issuer)
val assetB = AssetTypeCreditAlphaNum4("EUR", issuer)
val pool = LiquidityPool(assetA, assetB)

Asset Ordering

Assets must be in lexicographic order (assetA < assetB). The constructor will automatically validate this ordering.

See also

Constructors

Link copied to clipboard
constructor(assetA: Asset, assetB: Asset, fee: Int = FEE)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The first asset in the pool (must be less than assetB)

Link copied to clipboard

The second asset in the pool (must be greater than assetA)

Link copied to clipboard
val fee: Int

The liquidity pool fee in basis points (default 30 = 0.3%)

Functions

Link copied to clipboard
suspend fun getLiquidityPoolId(): String

Generates the LiquidityPoolID for this LiquidityPool.

Link copied to clipboard

Converts this LiquidityPool to its XDR representation.