Skip to content

4. Liquidity Pool

Sasha Nechaiev edited this page Sep 19, 2021 · 1 revision

Overview

A liquidity pool can be set up by anyone (namely liquidity provider) to support trading of selected assets and leverages. Synthetic asset liquidity pools are different from margin trading pools in functionality, and risk mechanisms.

Find out more details on synthetic asset liquidity pools.

Find out more details on margin trading liquidity pools.

Guide

Below are simple guidelines for

Synthetic Asset Pools

  1. Create a pool
  2. Deposit/withdraw liquidity
  3. Enable synthetic token for trade
  4. Set up collateral ratio and spread

Margin Trading Pools

  1. Create a Pool
  2. Deposit/withdraw Liquidity
  3. Enable trading pairs
  4. Set up spread, swap and other parameters

Polkadot UI Guide

Synthetic Asset Pools

Create a pool

Create a pool Create Pool Use Extrinsics call baseLiquidityPoolsForSynthetic.createPool()

Enable Trades Enable Trades Use Extrinsics call syntheticLiquidityPools.setSyntheticEnabled(pool_id, currency_id, enabled)

Set Spread Set Spread Use Extrinsics call syntheticLiquidityPools.setSpread(pool_id, currency_id, bid, ask)

Deposit/withdraw Liquidity

Deposit Deposit Liquidity Use Extrinsics call baseLiquidityPoolsForSynthetic.depositLiquidity(pool_id, amount)

Withdraw Withdraw Liquidity Use Extrinsics call baseLiquidityPoolsForSynthetic.withdrawLiquidity(pool_id, amount)

Set up collateral ratio

Collateral Pools have a default additional collateral ratio say 0.1 - meaning that for a $100 fEUR swap, users would put up $100 dollar worth of collateral to mint fEUR, while the synthetic asset pool will put up an additional 10% to counter price fluctuation. But this value can be overridden by individual pools, using Extrinsic call syntheticLiquidityPools.setAdditionalCollateralRatio(pool_id, currency_id, ratio)

Margin Pools

Create a pool

Create Pool Use Extrinsics call baseLiquidityPoolsForMargin.createPool()

Enable trading pairs Enable Use Extrinsics call marginLiquidityPools.liquidityPoolEnableTradingPair(pool_id, pair)

Enable leverage Enable Use Extrinsics call marginLiquidityPools.setEnabledLeverages(pool_id, pair, enabled)

[Note] currently there's an issue with Polkadot{js}, but this can be done via Laminar's sdk with something like marginLiquidityPools.setEnabledLeverages(3, ['FEUR', 'AUSD'], 0x1f1f)

Note that the leverage field is a bit mask represented in hex 0x1f1f as 0b0001111100011111 to support 2, 3, 5, 10 and 20 times long and short margin trading.

See more details on leverage bit mask here

Set up spread, swap and other parameters Enable Use Extrinsics call marginLiquidityPools.setSpread(pool_id, pair, bid, ask)

Deposit/withdraw Liquidity

Deposit Enable Use Extrinsics call marginLiquidityPools.depositLiquidity(pool_id, amount) Liquidity pool will require initial deposit for it to be operational.

Withdraw Enable Use Extrinsics call marginLiquidityPools.depositLiquidity(pool_id, amount) Only the amounts that are not used as collateral can be withdrawn.

DApp UI User Guide

Navigate to the Liquidity Pool page to see all pools available, their respective supported trading pairs and spreads, and also trade from there.

View

We do not provide a user interface for creating and setting up a pool at this stage. If you'd like to become a liquidity provider, please get in touch.