Liquidity operations
To Polkaswap means to exchange (swap) tokens on Polkaswap, Polkaswap is a non-custodial, cross-chain AMM DEX protocol for swapping tokens, Polkaswap removes trusted intermediaries and provides the opportunity for faster trading, and Polkaswap also combines multiple liquidity sources under a common liquidity aggregation algorithm, operating completely on-chain, in a trustless and decentralized way.
XYK Pools are managed by the community. Anyone can provide liquidity to any pool. Liquidity pools (XYK pools) are explained in this video on the Finemtaics YouTube channel. It's recommended to watch it in order to understand how Pools work in general.
You can provide liquidity in an XYK pool so that users are able to exchange tokens. There are 3 main cases here:
- 1.The pool doesn't exist and you'll be the first liquidity provider (LP)
- 2.The pool exists and you're adding liquidity
- 3.You already have a share in the pool and you'd like to remove liquidity
Every liquidity provider gets PSWAP rewards for providing liquidity. Rewards are the incentive for users to provide liquidity. There are 2 types of rewards:
- 1.Rewards paid from LP fees
Rewards paid from LP fees are distributed every day for each liquidity pool. For example, if you have a share in 3 liquidity pools, then your rewards that are available to claim will be updated twice a day.
LP Farming bonus rewards are distributed every 6 hours.
Along with the network fee in XOR, all 3 cases require an additional fee - liquidity provider fee (LP fee). The LP fee is used to incentivize liquidity providers to supply liquidity in liquidity pools. Liquidity pools are described in this article.
In order to see the total pooled amounts, check the tool Ceres has built https://tools.cerestoken.io/#/tokens
We recommend using the SORA testnet for practice exercises. Here are the Testnet links:
In the practice section, we'll create a liquidity pool, provide liquidity to the existing pool and remove the liquidity.
Creating a pool is really easy. Just open Polkaswap, then open the Pool section.
.png?alt=media&token=59c8b089-bbab-4593-b817-21c7098ede39)
There are 2 options:
- 1.Add liquidity
- 2.Create a pair
If you'd like to create a pool, you should click the Create a pair button. Select the tokens that should compose the trading pair. Keep in mind that all trading pairs in Polkaswap must contain XOR and another token. That's why the XOR token is preselected and can't be changed.

Select the second token for the trading pair. Oooops! The trading pair for XOR-VAL is already created. It means that someone has already created a pool with this trading pair and provided the liquidity.
You can provide liquidity to this pool as well.
.png?alt=media&token=6ca13c34-8e2d-4daf-bf69-34861fdb4276)
Let's select another token.
.png?alt=media&token=9281d672-ffba-4d13-a397-be72e0fa9f04)
Pay attention when you're the first liquidity provider. The ratio of tokens will set the price of this pool.
.png?alt=media&token=e23909f9-1495-4a80-8e40-a9d3e6bce673)
Let's describe the parameters:
- 1.XOR per SAT is the price of XOR in SAT tokens if a user will trade using this pool
- 2.SAT per XOR is the price of SAT in XOR tokens if a user will trade using this pool
- 3.Network fee - the fee for processing the transaction
- 4.Share of Pool - the percentage of your tokens in the pool
If everything is ok, confirm and sign the transaction.
.png?alt=media&token=d9f92d0e-dcf1-4148-a578-ead92c15b1f9)
Now you can see your pool share on the Pool page
.png?alt=media&token=acd23288-c1c3-43a6-82c0-fb372aae9e92)
There are 2 options where you can add liquidity:
- 1.If you already have a share in a specific pool, you can click Add liquidity on the pool details
- 2.If you'd like to provide liquidity to a pool where you don't have a share, then click Add liquidity on the Pool page
.png?alt=media&token=ddd34172-f00c-4bfd-b0fb-e3ae2f4125be)
The next steps are pretty much the same. If you select the pool where you already have a share, then the token pair will be preselected, otherwise, you should select the tokens by yourself.
Ok, the token pair is selected.
.png?alt=media&token=d85ca47d-04f3-4dca-83aa-bda22d61f571)
Enter the amount of source asset or destination asset. Pay attention, if you enter the amount of a source asset, the amount of dest. asset will be calculated according to the pool math. If you enter the amount of dest. asset, the amount of source asset will be calculated according to the pool math as well.
.png?alt=media&token=39949479-02c1-4b69-b6e8-74837c98290e)
Let's describe the parameters:
- 1.XOR per VAL is the price of XOR in VAL tokens if a user will trade using this pool
- 2.VAL per XOR is the price of VAL in XOR tokens if a user will trade using this pool
- 3.Network fee - the fee for processing the transaction
- 4.Share of Pool - the percentage of your tokens in the pool
If everything is ok, confirm and sign the transaction.
.png?alt=media&token=1fa4c251-55d3-46f1-b84f-9fa70af1cf39)
Now you can see your share of the pool on the Pool page
.png?alt=media&token=f5029fcb-47c1-42e2-ad83-b3e7058eaa83)
Once you've provided the liquidity to the pool, you're also able to remove it (get your tokens back). Just open the Pool page, then open the pool details and click on Remove liquidity.
.png?alt=media&token=0b9af830-c71d-4103-8097-864c59714b4f)
You'll see a lot of options there, but don't worry!
.png?alt=media&token=0aca18fe-c0f7-4131-97b7-d79050bb956d)
Enter the amount of source asset or dest asset to be removed. Pay attention, if you enter the amount of source asset, the amount of dest. asset will be calculated according to the pool math. If you enter the amount of dest. asset, the amount of source asset will be calculated according to the pool math as well.
You can use the Amount slider to select the percentage of liquidity to be removed:

If you're ok with the given parameters, Confirm and sign the transaction.
.png?alt=media&token=2bdb6f13-9b1e-40d3-9ad1-a8518f201adf)
You can then check if your pool share was reduced
.png?alt=media&token=d032f51a-d41c-4449-abcb-e858c5f25ce6)
You can find the transactions for providing and removing liquidity you have made in the block explorer. Open the list of transactions and filter it using the PoolXYK module parameter, and deposit_liquidity call for providing liquidity or withdraw_liquidity call for removing liquidity.
.png?alt=media&token=adc5b624-7b5f-443c-8e77-b10b95909cc7)
.png?alt=media&token=10dd11eb-d57a-4b16-becb-3c48364d9d1f)
Last modified 5mo ago