Liquidity Provision and Farming in Swapr

In the past, we’ve already shared a post on participation in farming campaigns in Swapr, but since then the UI has changed, and people have recently asked for a fresh walkthrough.
Here we will showcase liquidity provision and farming in the latest Swapr UI. (Before you provide liqudity and farm tokens, make sure that you research and you are familiar with ‘impermanent loss’)

For the purpose of this tutorial we have some XDAI in a test address on Gnosis Chain. We click on the ‘Rewards’ tab in the menu at the top. In the below screenshot we see the first page of the currently active liquidity mining campaigns. For the tutorial we randomly chose the farm, which incentivizes provision of liquidity to the SWPR/WXDAI pair. It has a current APY of about 45%. (Those percentages are not fixed, they vary, the more people provide liquidity, the lower they get and vice versa. A great place to see cool stats on currently active farming campaigns is the Farming dashboard in DXstats.)

On the farm’s page below we see that liquidity providers who deposit and stake their LP tokens in this campaign are earning two types of rewards: 28’000 SWPR, plus a bonus amount doubling the rewards with another 28’000 tokens representing SWPR in the form of conditional carrot tokens. We can click on the orange ‘go to campaign’ button, which takes us to the campaign on Carrot.eth for details on the carrot tokens. *(for a detailed interpretation of the rewards scroll to the bottom of this post)

Before we click on the blue “add liquidity” button, we need to make sure we have what’s needed. Adding liquidity to a pair in an automated market maker like Swapr requires provision of an equal $-value of each token on each side of the pair. So, to provide liquidity to the SWPR/WXDAI pair we need to swap some of our XDAI for an equal worth of SWPR. To do this, we click on the “Swap” tab in the menu at the top, which takes us to the swap page where we set some XDAI aside (XDAI is a stable coin that is used as the native token of Gnosis Chain to pay for transactions, like ETH on Ethereum, and does not have a contract address.) and swap half of the remainder for SWPR.

Once we have equal dollar value of SWPR and XDAI, plus some extra XDAI left over to cover transaction costs, we head back to the ‘Rewards’ section, enter our chosen farm, and click on the blue ‘add liquidity’ button, which takes us to the below screenshot. By default, it asks for SWPR and WXDAI. In our case we have XDAI, which we haven’t wrapped into WXDAI, but we don’t need to because we can use the dropdown menu to change WXDAI to XDAI, deposit our XDAI, and it will be auto-wapped into WXDAI to add to the pair.
After we add liquidity, we automatically receive LP tokens representing our share of the pair’s liqudity pool. In the case of Swapr those LP tokens are called DXswap (DXS) tokens. We will stake those in the farm to earn rewards, but even before we do that we are now already earning a share of the swap fee that traders pay whenever they swap tokens from the SWPR/WXDAI pool. (Swap fees on all pairs can be seen in DXstats. The swap fee on pairs is adjusted by governance proposals and varies depending on the pair. You can see in the screenshot below that the swap fee on the SWPR/WXDAI pair is 1% of each trade, e.g. $1 of a swap worth $100. 10% of that, or $0.10 in this example is the protocol fee retained by Swapr, and 90% of that, or $0.9 is shared among liquidity providers, depending on their individual shares of the pool. As you can see below, for the tiny liquidity we’re providing in this example, our share of the pool is 0.00019%. A breakdown of earned fees can be seen when we enter our address on the ‘Accounts’ analytics page in DXstats.)
We’re done adding liquidity, so we click on the ← back arrow to the left and return to the farming campaign page.

Below we see the “Deposit and stake” button is now active. Clicking it we can approve and deposit our LP tokens we obtained above when we added liqudity to the pair. Staking them in this farming campaign below we start earning from the provided rewards. There are 16 days left and some of the rewards have already been distributed. We will be receiving a portion of the remaining rewards proportional to our share of the TVL /total value locked/ in the farm.

In a few moments we can already see below that we’ve already earned rewards and now the other buttons also become active, allowing us to claim rewards, withdraw staked LP tokens, or do both. (Some campaigns don’t let you withdraw your stake before the campaign ends, but you will always be advised about it before you stake.) We can see that this campaign says ‘unlocked staking’ next to the green padlock, so we can claim rewards and/or withdraw stake at any time.
Once a farming campaign expires, if there is a new farming campaign incentivizing the same pair, we cannot keep our stake in this one and earn new rewards. We have to withdraw our LP tokens, and stake them in the new campaign.

You can see below that we have claimed all rewards and we have withdrawn our stake. The deposit and stake button is still active because while doing this tutorial the campaign is still active, but once it expires, we can’t stake in it. We have to go to the ‘Rewards’ tab, find the new farm and stake there to start earning new rewards.

This is only valid for farms incentivizing the same pair SWPR/WXDAI. If we wish to stake in a farm incentivizing a different pair, e.g. SWPR/GNO, if we don’t have GNO tokens and can’t buy them with new funds, we will need to remove our liquidity from the SWPR/WXDAI pair, swap XDAI tokens for GNO tokens, add liquidity to the SPWR/GNO pair, and then stake in that farm. How to remove liqudity from the pair? Go to the ‘Liquidity’ tab in the menu, and toggle ‘my pairs’ to find the pairs, in which you hold stake.

Once inside the pair page you can click on ‘remove liquidity’ to collect your SWPR and XDAI from the pool back to your address. Then you are no longer in possession of the LP tokens.

You can see below that there is a ‘receive WXDAI’ option allowing you to choose between XDAI and WXDAI when you withdraw liqudity.
If you don’t want to stake in a farm of a different pair, and you don’t need these SWPR and XDAI tokens, you can keep them in the liquidity pool to keep earning a % of the swap fee as a liquidity provider.

*Detailed explanation of the carrot token rewards below:

We see that this carrot campaign has 39’200 SWPR locked in it, and 39’200 conditional carrot tokens have been minted representing those SWPR tokens. 28’000 of those carrot tokens are being distributed to stakers like us in the SWPR/WXDAI farm, and the remaining 11’200 in the DXD/WETH farm.
The redeemable value of those carrots is tied to a key performance indicator being measured and tracked. This particular campaign tracks the average daily liquidity in the Swapr protocol on Gnosis chain. The goal is to increase the TVL in Swapr, targeting the range $10m-$30m for the duration of the Swapr farms currently distributing these carrots.
The 28’000 carrots in the SWPR/WXDAI farm will be worth nothing if the value of the average daily liquidity is below $10m; it will pay in full at or above $30m, and inbetween the range $10m-$30m their value will be growing linearly from 0% to 100% of 1 SWPR per carrot. Since the farm launch, the average daily TVL for Swapr protocol on Gnosis has been about $22m /see the chart in the carrot campaign/, which is about 60% up the $10m-$30m target range, so if it stays like this til the end, if someone ends up earning 1’000 SWPR + 1’000 carrots, one will be allowed to reedem the carrots for 60% of the underlying collateral and unlock 600 SWPR on top of the other 1000 SWPR one has got directly, earning in total 1’600 SWPR.
This carrot campaign has the same duration as the Swapr farm, but sometimes they may differ so we need to pay attention.
Make sure you read how the Reality.eth oracle works as your input might be needed to correctly settle the condition of the campaign.