Skip to content

Commit

Permalink
feat: merge create farm and create pools for token creators
Browse files Browse the repository at this point in the history
  • Loading branch information
RodinGolodin committed May 20, 2024
1 parent 00a892b commit d161875
Show file tree
Hide file tree
Showing 20 changed files with 147 additions and 16 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/apps/katana/assets/katana-confirm-pool-creation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/apps/katana/assets/katana-create-new-pool.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/apps/katana/assets/katana-create-pool-supply.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/apps/katana/assets/katana-farm-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/apps/katana/assets/katana-pool-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/apps/katana/assets/katana-select-token-pair.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions docs/apps/katana/guides/create-farm.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
title: Create a farm
description: Create a farm on Katana to encourage users to contribute liquidity to your pool.
---

import katanaIncentivizePool from './../assets/katana-incentivize-pool.png'
import katanaCreateNewPool from './../assets/katana-create-new-pool.png'
import katanaCreatePoolSuccess from './../assets/katana-create-pool-success.png'
import katanaConfirmPoolCreation from './../assets/katana-confirm-pool-creation.png'
import katanaConfigureFarmRewards from './../assets/katana-configure-farm-rewards.png'
import katanaEditPublishedFarm from './../assets/katana-edit-published-farm.png'
import katanaEditPublishedFarmConfirm from './../assets/katana-edit-published-farm-confirm.png'
import katanaEditScheduledFarm from './../assets/katana-edit-scheduled-farm.png'
import katanaEditScheduledFarmConfirm from './../assets/katana-edit-scheduled-farm-confirm.png'
import katanaEditScheduledPool from './../assets/katana-edit-scheduled-pool.png'
import katanaConfirmPoolIncentive from './../assets/katana-confirm-pool-incentive.png'
import katanaIncentivizePoolSuccess from './../assets/katana-incentivize-pool-success.png'
import katanaIncentivizeSupply from './../assets/katana-incentivize-supply.png'
import katanaSelectTokenPair from './../assets/katana-select-token-pair.png'

## Overview

You can create a farm in the liquidity pool with your ERC20 token on Katana. When users contribute liquidity to your pool, they receive liquidity pool (LP) tokens in return. A farm is a way for users to earn rewards by staking their LP tokens.

Check warning on line 23 in docs/apps/katana/guides/create-farm.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Parens] Use parentheses judiciously. Raw Output: {"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "docs/apps/katana/guides/create-farm.mdx", "range": {"start": {"line": 23, "column": 152}}}, "severity": "INFO"}

To add a farm, you need to choose the token for distribution, deposit the reward amount, and set the duration of the farm.

When users see that your pool offers farm rewards, they're encouraged to provide more liquidity, which increases the trading volume of the pool and reduces slippage when users swap the pool's tokens.

An important metric for farms is the rewards per second. This metric shows how much of the reward token is distributed to all users per second. The rewards per second are calculated based on the total reward amount and the farm duration. Changing the farm duration or the reward amount affects the rewards per second, resulting in a top-up from your wallet or a refund.

Check warning on line 29 in docs/apps/katana/guides/create-farm.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('is distributed'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('is distributed').", "location": {"path": "docs/apps/katana/guides/create-farm.mdx", "range": {"start": {"line": 29, "column": 105}}}, "severity": "INFO"}

Check warning on line 29 in docs/apps/katana/guides/create-farm.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('are calculated'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('are calculated').", "location": {"path": "docs/apps/katana/guides/create-farm.mdx", "range": {"start": {"line": 29, "column": 168}}}, "severity": "INFO"}

## Prerequisites

* Only _whitelisted_ Ronin addresses can create farms. To get whitelisted, submit your Ronin address to Sky Mavis. This address will be linked to our farm contract. **Note: **this address can be the same as the one you used for pool creation, but you still need to get it whitelisted for farm creation.

Check warning on line 33 in docs/apps/katana/guides/create-farm.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Will] Avoid using 'will'. Raw Output: {"message": "[Google.Will] Avoid using 'will'.", "location": {"path": "docs/apps/katana/guides/create-farm.mdx", "range": {"start": {"line": 33, "column": 129}}}, "severity": "WARNING"}

Check warning on line 33 in docs/apps/katana/guides/create-farm.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('be linked'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('be linked').", "location": {"path": "docs/apps/katana/guides/create-farm.mdx", "range": {"start": {"line": 33, "column": 134}}}, "severity": "INFO"}
* A liquidity pool with your ERC20 token created on Katana. For more information, see [Create a liquidity pool](pool.mdx#create-a-liquidity-pool).

## Create a farm

1. Go to [Katana](https://app.roninchain.com/liquidity) and connect your whitelisted Ronin address for farm creation. This address can be the same as the one you used for pool creation, or a different one.
1. On the **Liquidity pool** page, select the pool you want to create a farm for, then click **Incentivize a pool**.
<img src={katanaIncentivizePool} alt="Incentivize a pool" width="800" />
2. In the **Incentivize a pool** section, configure the farm rewards:
* Set the start and end dates for reward distribution. The start date must be at least 7 days in the future.
* Select the token you want to distribute as a reward, and enter the amount. You may need to approve the spending cap for the token in your Ronin Wallet.
<img src={katanaConfigureFarmRewards} alt="Configure farm rewards" width="800" />
3. Click **Incentivize pool** to finish configuring your farm.
<img src={katanaConfirmPoolIncentive} alt="Confirm incentives" width="800" />
4. Click **Incentivise pool & Supply**, then confirm the transaction in your Ronin Wallet.
<img src={katanaIncentivizeSupply} alt="Supply liquidity for farm rewards" width="800" />

Your farm is now created and scheduled for publishing on the start date. As long as the farm is in a scheduled state, only you can see it. On the start date, the farm becomes visible to everyone.

<img src={katanaIncentivizePoolSuccess} alt="Successful farm creation" width="800" />

Click **View farm details** to see the farm details and if you need to, edit the duration or the reward amount of the farm before it's published.

## Edit a scheduled farm

Before your farm is published, you can change the initial reward amount and adjust the period over which the rewards are distributed. Depending on the changes you make, you may need to top up the initial reward amount or receive a refund if the required amount is less than the initial reward.

Check warning on line 58 in docs/apps/katana/guides/create-farm.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('is published'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('is published').", "location": {"path": "docs/apps/katana/guides/create-farm.mdx", "range": {"start": {"line": 58, "column": 18}}}, "severity": "INFO"}

Check warning on line 58 in docs/apps/katana/guides/create-farm.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('are distributed'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('are distributed').", "location": {"path": "docs/apps/katana/guides/create-farm.mdx", "range": {"start": {"line": 58, "column": 118}}}, "severity": "INFO"}

1. Go to [Katana](https://app.roninchain.com/liquidity) and connect your whitelisted Ronin address for farm creation.
2. On the **Liquidity pool** page, select the scheduled farm that you want to edit, then click **Incentivize a pool**.
3. In the **Edit pool incentives** section, modify the farm duration or reward amount. Then, click **Confirm changes**.
<img src={katanaEditScheduledFarm} alt="Edit a scheduled farm" width="800" />
4. Review the amount of tokens you need to top up or receive due to the changes, then press **Confirm**, and then confirm the transaction in your Ronin Wallet.
<img src={katanaEditScheduledFarmConfirm} alt="Confirm farm edit" width="800" />

## Edit a published farm

After the farm is published, you can extend the reward distribution period or end it earlier. If you decide to extend the farm, the system will calculate the amount of rewards you need to pay on top of the initial rewards. If you want to end the farm earlier, the system will issue a refund for the remaining rewards.

Check warning on line 69 in docs/apps/katana/guides/create-farm.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('is published'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('is published').", "location": {"path": "docs/apps/katana/guides/create-farm.mdx", "range": {"start": {"line": 69, "column": 16}}}, "severity": "INFO"}

Check warning on line 69 in docs/apps/katana/guides/create-farm.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Will] Avoid using 'will'. Raw Output: {"message": "[Google.Will] Avoid using 'will'.", "location": {"path": "docs/apps/katana/guides/create-farm.mdx", "range": {"start": {"line": 69, "column": 140}}}, "severity": "WARNING"}

Check warning on line 69 in docs/apps/katana/guides/create-farm.mdx

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Will] Avoid using 'will'. Raw Output: {"message": "[Google.Will] Avoid using 'will'.", "location": {"path": "docs/apps/katana/guides/create-farm.mdx", "range": {"start": {"line": 69, "column": 272}}}, "severity": "WARNING"}

1. Go to [Katana](https://app.roninchain.com/liquidity) and connect your whitelisted Ronin address for farm creation.
2. On the **Liquidity pool** page, select the published farm that you want to edit, then click **Incentivize a pool**.
3. In the **Edit pool incentives** section, edit the end date. The reward amount will be recalculated automatically. Then, click **Confirm changes**.
<img src={katanaEditPublishedFarm} alt="Edit a published farm" width="800" />
4. Click **Confirm changes**, review the details, then confirm the transaction in your Ronin Wallet.
<img src={katanaEditPublishedFarmConfirm} alt="Confirm farm edit" width="800" />
4 changes: 2 additions & 2 deletions docs/apps/katana/guides/farm.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Stake your liquidity pool tokens to earn farm rewards.
slug: /apps/katana/farm
title: Farm reward tokens
title: Farm tokens
---

## Overview
Expand All @@ -10,7 +10,7 @@ When you provide liquidity to a pool on Katana, you receive liquidity pool (LP)

## Prerequisites

To farm tokens on Katana, you need to have LP tokens that you can stake. To acquire LP tokens, add your liquidity to a pool as described in the [Pool](pool.mdx#add-a-liquidity-pair) guide.
To farm tokens on Katana, you need to have LP tokens that you can stake. To acquire LP tokens, add your liquidity to a pool as described in the [Pool](pool.mdx#add-liquidity-to-a-pool) guide.

## Start farming

Expand Down
75 changes: 64 additions & 11 deletions docs/apps/katana/guides/pool.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@ title: Create a liquidity pool

## Overview

You can create your own liquidity pools (LP) on Katana, contribute your liquidity to existing pools, and earn trading fees from the resulting transactions.
You can create your own liquidity pools (LP) on Katana, contribute your liquidity to existing pools, and earn trading fees from the resulting transactions. This guide explains how to create a new pool, add liquidity to an existing pool, and remove liquidity from a pool.

:::info
If you're a token creator, you can launch your own ERC20 token on Katana and create a liquidity pool with it. This is a unique opportunity to bootstrap liquidity for your tokens and incentivize trading. By creating a pool, you provide a platform for users to trade your token with other tokens, increasing its utility and value.

During an initial whitelisting period, only you as the owner of the Ronin address that deployed the ERC20 token can create liquidity pools with your token. After the whitelisting period ends, users can contribute liquidity to your pool or create their own pools with your token.

After creating a liquidity pool, you can [create a farm](create-farm.mdx) to encourage users to contribute liquidity to your pool.
:::

When creating a new pool, you choose two tokens to pair together. These tokens can be any ERC20 tokens, including ["main" and "seed" tokens](../overview.mdx#trade-main-and-seed-tokens). The system deposits your tokens into a smart contract, effectively increasing the pool's liquidity.

For example, if you decide to contribute to the WETH-AXS pool, you need to
deposit an equivalent value of both tokens. Say the value of 1 WETH is USD 3,200.00 and the value of 1 AXS is USD 7.70. If you want to provide 1 WETH into the WETH-AXS pool, you also need to provide around 415 AXS.
For example, if you decide to contribute to the AXS-RON pool, you need to
deposit an equivalent value of both tokens. Say the value of 1 AXS is USD 7.17 and the value of 1 RON is USD 2.72. If you want to provide 1 AXS into the AXS-RON pool, you also need to provide around 2.7 AXS.

In recognition of your
contribution, you receive _liquidity pool (LP) tokens_, which represent your share in the pool.
Expand All @@ -28,38 +36,85 @@ fluctuations in the value of the deposited tokens.

## Prerequisites

To provide liquidity on Katana, you need to have tokens in your Ronin Wallet. You can acquire tokens by depositing from Ethereum using [Ronin Bridge](https://app.roninchain.com/bridge), buying tokens through the [Purchase](https://purchase.roninchain.com) website, or receiving tokens from other users.
* Only _whitelisted_ Ronin addresses can create liquidity pools during a token whitelisting period. To apply, submit your Ronin address to Sky Mavis. This address will be linked to your token contract after you deploy it.
* Have your token's details and tag classification finalized with Sky Mavis.
* To provide liquidity on Katana, you need to have tokens in your Ronin Wallet. You can acquire tokens by depositing from Ethereum using [Ronin Bridge](https://app.roninchain.com/bridge), buying tokens through the [Purchase](https://purchase.roninchain.com) website, or receiving tokens from other users.
For more information, see [Acquire RON](../../../basics/acquire-ron.mdx).

## Create your own pool
## Write your ERC20 token contract

To create a token, we recommend that you use the [OpenZeppelin ERC-20](https://docs.openzeppelin.com/contracts/5.x/erc20) contract. This way, you don't have to write the contract from scratch. Instead, you import the library and use its functions.

Your token contract MUST strictly follow the [ERC20 token standard](https://eips.ethereum.org/EIPS/eip-20) and our smart contract guidelines. For more information, refer to [Smart contract guidelines](https://docs.skymavis.com/ronin/smart-contracts/reference/guidelines).

## Deploy your ERC20 contract to Ronin

Deploy your token contract to the Ronin network. Make sure to test your contract on the Saigon testnet before deploying it to the Ronin mainnet.

For more information, refer to [Deploy a smart contract on Ronin](https://docs.skymavis.com/ronin/smart-contracts/overview).

## Submit your token address and publish timestamp

Submit the following information to your Sky Mavis partner engineer:

* Deployer Ronin address for LP creation.
* Publish timestamp for your token.
* ERC20 token contract address.
* Deployer Ronin address for farm creation if different from the LP creation address.

Sky Mavis will review your ERC20 token contract to ensure it meets the requirements. If the contract is approved, Sky Mavis will map your LP creation Ronin address with the contract address. This will make the token visible to you on Katana, where you can launch liquidity pools with it.

## Create a liquidity pool

1. Go to [Katana](https://app.roninchain.com/liquidity) and connect your Ronin Wallet.
2. Select the **Liquidity pool** page, then click **Create new pool**.
![Create a new pool](../assets/katana-create-new-pool.png)
3. Select the tokens you want to pool, then enter the amount. You may need to approve both tokens in your Ronin Wallet if you interact with them for the first time.
3. Select the tokens you want to pool, then enter the amount. You may need to approve both tokens in your Ronin Wallet if you interact with them for the first time. Token creators: select your token from the list. When selecting the token, you will see its publish date at the bottom. This date signifies when the whitelisting period ends
![Select a token pair](../assets/katana-select-token-pair.png)
4. Click **Confirm** to finalize pool creation.
![Confirm pool creation](../assets/katana-confirm-pool-creation.png)
5. Review the details of your liquidity contribution:
* The amount of tokens you are contributing.
* The amount of LP tokens you will receive in return.
* The exchange rate.
* The share of the pool you will receive, which is 100% for a pool creator.
* The publish date of the token, which signifies when the whitelisting period ends.

Click **Create pool & Supply**, then confirm the transaction in your Ronin Wallet.
![Create pool and supply liquidity](../assets/katana-create-pool-supply.png)

Your pool is now created, and anyone can add liquidity to it.
Your pool is now created and scheduled for publishing on the specified date.

![Successful pool creation](../assets/katana-create-pool-success.png)

As long as the pool is in a scheduled state, only you can see it.

![Scheduled pool in the list](../assets/katana-pool-list.png)

On the publishing date, the pool will become available for all Katana users to contribute liquidity to. As a liquidity provider, you will start earning fees from the pool's transactions.

As a token creator, you can also create a farm for your token. For more information, see [Create a farm](create-farm.mdx).

## Edit a pool

You can change the amount of tokens in a pool as long as the pool is in a scheduled state.

1. On the **Liquidity pool** page, select the pool you want to edit.
2. Add or remove tokens from the pool. For more information, see [Add liquidity to a pool](#add-liquidity-to-a-pool) and [Remove liquidity from a pool](#remove-liquidity-from-a-pool).
3. Click **Confirm**, review the details, then confirm the transaction in your Ronin Wallet.

## Add liquidity to a pool

You can contribute liquidity to existing pools to earn fees from the pool's transactions.

1. Open [Katana](https://app.roninchain.com/swap) and connect your Ronin Wallet.
2. Select the **Liquidity pool** page, then open the pool you want to contribute to.
![Liquidity pool](../assets/katana-pool.png)
3. Enter the amount of tokens you want to contribute, then click **Add**. Katana automatically calculates the equivalent amount of the other token based on the current exchange rate. You may need to approve both tokens in your Ronin Wallet if you interact with them for the first time.

![Enter amount](../assets/katana-pool-enter-amount.png)

6. Review the details of your liquidity contribution:
4. Review the details of your liquidity contribution:
* The amount of LP tokens you will get in return.
* The amount of tokens you are contributing.
* The share of the pool you will receive.
Expand All @@ -74,13 +129,11 @@ Your transaction is now submitted to the blockchain. When it completes, Katana d

The **My position** panel is now updated with your latest contribution:

* The amount of ERC 20 tokens you contributed.
* The amount of ERC20 tokens you contributed.
* The amount of LP tokens received in return.

![My position](../assets/katana-pool-add-position.png)

Congratulations, you are now a liquidity provider on Katana. You can now earn fees from the pool's transactions. If the pool supports farming, you can also stake your LP tokens to earn farm rewards. For more information, see [Farm](#farm).

## View your positions

To see all the pools you contributed to and the fees earned, open the **Liquidity pool** page, then select **My positions**.
Expand Down
8 changes: 5 additions & 3 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,13 @@ const sidebars = {
id: 'apps/katana/overview',
},
items: [
// Swap
// Swap tokens
'apps/katana/guides/swap',
// Pool
// Create a liquidity pool
'apps/katana/guides/pool',
// Farm
// Create a farm
'apps/katana/guides/create-farm',
// Farm tokens
'apps/katana/guides/farm',
]
},
Expand Down

0 comments on commit d161875

Please sign in to comment.