Liquidity Providers

How to LP in squared asset pools

Providing liquidity into squared asset pools is very similar to providing liquidity in standard pools.

The only differences being you must first mint some squared asset, e.g. sqOSMO, before you can LP. However, in addition to the normal benefits of being an LP you also gain exposure to the underlying^1.5.

How to LP

In order to LP users must:

  1. Mint squared asset

  2. Provide liquidity into the pool

Here we show users how to do this using [`osmosisd`](https://docs.osmosis.zone/osmosis-core/osmosisd/).

Minting Squared Asset

In order to mint squared asset we should:

  • Calculate the value of exposure we want

  • Decide on a collateralisation ratio (must be greater than 150%)

  • Mint the squared asset

If price of OSMO is 0.5 and we want to have an sqOSMO exposure of $500 then we can calculate the amount of sqOSMO we should mint:

sqOSMO=exposureSFindexNF=500100000.251=20×106sqOSMO = \frac{exposure * SF}{index * NF} = \frac{500 * 10000}{0.25*1} =20\times10^{6}

Where SF is an oracle scale factor and NF the normalisation factor.

Thus in order to have a collateralisation ratio of 200% we should provide 2000 OSMO.

This could be achieved using the following command:

export ACCOUNT=alice
osmosisd tx wasm execute \
	osmo1rk4hregdr63rlqqj0k2rjzk6kz7w6v6tw8f5fqx2wg8203eam5equ67tdl \
	'{"mint_power_perp": {"amount": "20000000000000", "rebase": false}}' \
	--from=$ACCOUNT --amount 2000000000uosmo --gas=auto \
	--gas-prices 0.003uosmo --gas-adjustment 1.3 \
	--output=json --node=https://rpc.osmosis.zone:443 \
	--chain-id='osmosis-1'

Deposit in Pool

Having minted sqOSMO we now can deposit it in the relevant LP pool. Prior to depositing we must decide on the boundaries of the ticks between which we will deposit.

Given an OSMO price again of 0.5 the mark price of sqOSMO would be:

0.5100000.251=20000\frac{0.5*10000}{0.25 * 1} = 20000

Note: as sqOSMO is the base asset in the pool we need to perform the calculation for the inverse price, i.e. 1/20000 = 0.00005.

Thus to provide liquidity across a range of 16,600 to 25,000 we should use the input of the inverse price for the calculation of the ticks -40000000 and -42000000 respectively.

This would be achieved using the command:

export ACCOUNT=alice
osmosisd tx concentratedliquidity \
	create-position 1267 "[-42000000]" "[-40000000]" \
	20000000000000factory/osmo1g8qypve6l95xmhgc0fddaecerffymsl7kn9muw/squosmo,2000000000uosmo 0 0 \
	--from=$ACCOUNT --gas=auto --gas-prices 0.0025uosmo \
	--gas-adjustment 1.3 --output=json --node=https://rpc.osmosis.zone:443 \
	--chain-id='osmosis-1'

Querying Position

Having minted a squared asset and provided liquidity in the relevant pool you can validate you position has successfully been created:

osmosisd query concentratedliquidity position-by-id 1126457  --node=https://rpc.osmosis.zone:443 --output=json | jq .
{
  "position": {
    "position": {
      "position_id": "1126457",
      "address": "osmo17du8wnzlxk3xjdhckfllvx7uav455r4j63tdas",
      "pool_id": "1267",
      "lower_tick": "-51000000",
      "upper_tick": "-49000000",
      "join_time": "2023-11-08T15:56:32.744506063Z",
      "liquidity": "1966345953494.241511191046480483"
    },
    "asset0": {
      "denom": "factory/osmo1g8qypve6l95xmhgc0fddaecerffymsl7kn9muw/squosmo",
      "amount": "41894371666095"
    },
    "asset1": {
      "denom": "uosmo",
      "amount": "644953767"
    },
    "claimable_spread_rewards": [
      {
        "denom": "factory/osmo1g8qypve6l95xmhgc0fddaecerffymsl7kn9muw/squosmo",
        "amount": "553942296"
      },
      {
        "denom": "uosmo",
        "amount": "14987"
      }
    ],
    "claimable_incentives": [],
    "forfeited_incentives": []
  }
}

Last updated