Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Get started and User guide for VARA #384

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 140 additions & 0 deletions docs/docs/vara/get_started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
---
title: Get Started

slug: /vara/get_started
---

This guide will walk you through the essential steps to get started on our [platform](https://vara.invariant.app/), from connecting your wallet and requesting an airdrop to adding a liquidity position, swapping tokens, claiming fees, and closing your position. If you encounter any issues, check out the more detailed User Guide. If you have any questions, feel free to join our community on [Invariant's Discord](https://discord.gg/w6hTeWTJvG) for support. Please note that this walkthrough is on the testnet.

### Connect your wallet

To begin using Invariant, you'll need to connect your wallet. Follow these steps:

1. Click on the **"Connect wallet"** button at the top right corner of the page or or in the swap area.
![Connect wallet](/img/docs/app/vara/vara_connectwallet.jpg)

2. Select your wallet provider (in this tutorial we are using SubWallet).
![SubWallet](/img/docs/app/vara/vara_choosewallet.jpg)

3. Follow the prompts to authorize the connection, and you are ready to go with your wallet connected.

### Request airdrop from Vara Network Faucet

To start interacting with the Invariant platform on the Vara Network testnet, you will need some [testnet tokens](/docs/vara/user_guide/faucet). You can request these tokens from the Vara Network Faucet.

1. Open your web browser and navigate to the [Vara Network Faucet page](https://idea.gear-tech.io/programs?node=wss%3A%2F%2Ftestnet.vara.network).

![A0 Faucet](/img/docs/app/vara/vara_faucetpage.png)

2. Connect your wallet to the **Vara Network** portal.

![Connect to Vara Faucet](/img/docs/app/vara/vara_connectfaucet.jpg)

3. After connecting your wallet, click the icon under **"Transferable Balance"**.

![Nightly wallet](/img/docs/app/vara/vara_faucetbalance.jpg)

4. Click **"Get Test Balance"**

![Paste adress](/img/docs/app/vara/vara_getbalance.jpg)

5. Solve the captcha you are going to see after clicking **"Get Test Balance"** button.

After few second, airdrop of testnet **TVARA** should be in your wallet.

### Request airdrop from Invaraint Faucet

Now that you have testnet tokens to approve transactions on the Vara Network Testnet, you can request an airdrop from Invariant. You will receive testnet BTC, ETH, and USDC.

1. Click the **"Faucet"** button on Invariant site.

![Buttons](/img/docs/app/vara/vara_nav.jpg)

2. Approve transaction in your wallet

![Approve transaction](/img/docs/app/vara/vara_approvetransaction.jpg)

3. After a while, you should have airdropped tokens in your wallet.

### Add liquidity

Adding a liquidity position allows you to earn fees from trades on the Invariant DEX. To [add a position](/docs/vara/user_guide/how_to_add_liquidity) follow these steps:

1. Go to the **"Liqudity"** tab and click on **"Add Position"** button.

![Add position](/img/docs/app/a0/a0_addposition.png)

2. Choose the tokens you want to provide liquidity for.

![Select tokens](/img/docs/app/vara/vara_selecttokens.jpg)

3. Select fee tier. The fee tier determines the percentage of tokens deducted from a user who makes a swap, thus defining the amount of fees you will earn when a user utilizes your liquidity in the swap. Each fee tier represents a different liquidity pool.

![Fee tier](/img/docs/app/vara/vara_selectfeetier.jpg)

4. Specify the price range within which you want to provide liquidity This range determines where your tokens will be active in the market. You will earn fees only when trades occur within this range. Adjust the min and max price sliders to set your range.

![Price range](/img/docs/app/vara/vara_pricerange.jpg)

5. Enter the amount you want to contribute to the liquidity pool. Please note that you need to provide both tokens in the correct ratio.

![Deposit amount](/img/docs/app/vara/vara_depositamount.jpg)

6. Click **"Add Position"** button

![Add position](/img/docs/app/vara/vara_addpositionclick.jpg)

### Exchange tokens

Now you can use testnet tokens, that you received form Airdrop. This point will show you [how to perform swap](/docs/vara/user_guide/how_to_swap) with this tokens.

1. Navigate to **"Exchange tab"**.

2. Select the tokens you wish to swap. A modal will appear where you can choose a specific token by either entering its name or selecting one from the list. Additionally, you can add a token by clicking the plus button and providing its token address. In this example, we're swapping from AZERO to USDC.

![Swap](/img/docs/app/vara/vara_searchtoken.jpg)

3. Enter the amount of tokens you want to swap. To swap all tokens from your wallet, simply click **“Max”**.

![Swap](/img/docs/app/vara/vara_exchange.jpg)

4. Click **"Exchange"** and confirm the transaction in your wallet. Your swapped tokens will appear in your wallet once the transaction is completed.

![Swap](/img/docs/app/vara/vara_exchangelight.jpg)

**Potential problems:**

- **Insufficient balance** - this means that your balance is smaller than the amount of tokens you want to swap. To fix this, try swapping fewer tokens.

![Swap](/img/docs/app/vara/vara_insufficientbalance.jpg)

- **Insufficient liquidity** - this means that there is not enough liquidity in the pool to perform your swap. To fix this, add more liquidity or decrease the amount of tokens you want to swap.

![Swap](/img/docs/app/vara/vara_insufficientliquidity.jpg)

- **Insufficient volume** - this means that you probably did not enter any tokens in the exchange window.

![Swap](/img/docs/app/vara/vara_insufficientvolume.jpg)

### Claim fees

As a liquidity provider, you can [claim your earned fees](/docs/vara/user_guide/how_to_claim_fee). To claim fees:

- Navigate to the **"Liquidity"** section and open the position from which you want to claim fees.

- Click on **"Claim Fee"** to initiate the transaction.

![Claim fees](/img/docs/app/vara/vara_claimfee.jpg)

- Confirm the transaction in your wallet.
- Your claimed fees will be added to your wallet balance.

### Close position

If you want to [close your position](/docs/vara/user_guide/how_to_remove_liquidity) and remove liquidity, you can do this even if your fees are unclaimed. The fees after closing the position will be sent to your wallet along with the liquidity.

- Navigate to the **"Liquidity"** section and open the position which you want to close.

- Click **"Close Position"** and confirm the transaction in your wallet. Deposited tokens as well as unclaimed fees will be transferred to your wallet

![Position details](/img/docs/app/vara/vara_closeposition.jpg)
96 changes: 96 additions & 0 deletions docs/docs/vara/user_guide/faq_tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
title: FAQ

slug: /vara/user_guide/faq_tutorial
---

<!-- <details id='1' class='question'>
<summary>
What if during swap I got wrapped SOL instead of the chosen token?
<a href='/docs/eclipse/user_guide/faq_tutorial#1'>#</a>
</summary>
<p>
Invariant operates on the Solana blockchain, where SOL is a specific token used to handle
transaction fees. During swapping, only the wrapped Solana token is utilized. Therefore, when
exchanging, such as from SOL to USDC, two transactions occur under the hood:
<ul>
<li>SOL to wrapped SOL</li>
<li>Wrapped SOL to USDC</li>
</ul>
If you receive wrapped SOL instead of your intended token, it indicates that the first
transaction succeeded but the second did not. To swap Solana again, you must first unwrap it.
</p>
</details> -->

<details id='2'>
<summary>
Is slippage tolerance effective for both minimizing losses and maximizing bonus token
acquisition?? <a href='/docs/eclipse/user_guide/faq_tutorial#2'>#</a>
</summary>
<p>
No, slippage tolerance only safeguards you from excessive costs. If the slippage benefits you,
the transaction will proceed without interruption and you can get more tokens then expected.
</p>
</details>

<details id='3'>
<summary>
Why was the fee deducted even though the transaction failed?{' '}
<a href='/docs/eclipse/user_guide/faq_tutorial#3'>#</a>
</summary>
<p>
The fee is deducted upon initiating a transaction on Invariant, irrespective of its success or
failure. This fee covers processing the transaction. Even if the transaction fails, these costs
are incurred and not refunded to the user, but are smaller then in case of success.
</p>
</details>

<details id='4'>
<summary>
Can I claim fees at any time? <a href='/docs/eclipse/user_guide/faq_tutorial#4'>#</a>
</summary>
<p>
Yes, you can claim fees from the liquidity pool whenever you desire. However, note that each fee
claim is a separate transaction incurring a small fee. Therefore, it's advisable to claim fees
only when necessary.
</p>
</details>

<details id='5'>
<summary>
Why isn't my pool indexed by the Jupiter aggregator? <a href='/docs/eclipse/user_guide/faq_tutorial#5'>#</a>
</summary>
<p>
If your pool isn't indexed yet, ensuring the following will enable its indexing:
<ul>
<li>
Ensure your token exists on-chain with metadata following the Metaplex Token Metadata.
</li>
<li>Maintain at least $250 liquidity on both buy and sell sides.</li>
<li>Limit buy and sell price impact to 30% to prevent single-sided liquidity markets.</li>
</ul>
Once these criteria are met, Jupiter automatically lists your token within minutes (usually up
to ~30 min).
</p>
</details>

<details id='6'>
<summary>
Do I need to claim fees and close my pool position separately?
<a href='/docs/eclipse/user_guide/faq_tutorial#6'>#</a>
</summary>
<p>
No, you can simply close your position, and the fees will be automatically claimed to your
wallet.
</p>
</details>

<details id='7'>
<summary>
Does the Invariant have an independent security audit?
<a href='/docs/eclipse/user_guide/faq_tutorial#6'>#</a>
</summary>
<p>
Yes, the Invariant project underwent a security audit by the Soteria team. The audit focused on the Invariant Protocol v0.1.0 Eclipse smart contract program. Audit is available here: <b><a href='https://invariant.app/audit.pdf'>Invariant Protocol Audit.</a></b>
</p>
</details>
47 changes: 47 additions & 0 deletions docs/docs/vara/user_guide/faucet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: Faucet

slug: /vara/user_guide/faucet
---

To be able to claim an airdrop from the Invariant platform, we need to have TVARA (Testnet VARA) to pay the network fee for the transaction. Therefore, we need to go through three steps to receive the airdrop.


# Vara Network Faucet


1. Open your web browser and navigate to the [Vara Network Faucet page](https://idea.gear-tech.io/programs?node=wss%3A%2F%2Ftestnet.vara.network).

![Vara Faucet](/img/docs/app/vara/vara_faucetpage.png)

2. Connect your wallet to the **Vara Network** portal.

![Connect to Vara Faucet](/img/docs/app/vara/vara_connectfaucet.jpg)

3. After connecting your wallet, click the icon under **"Transferable Balance"**.

![Faucet balance](/img/docs/app/vara/vara_faucetbalance.jpg)

4. Click **"Get Test Balance"**

![Get balance](/img/docs/app/vara/vara_getbalance.jpg)

5. Solve the captcha you are going to see after clicking **"Get Test Balance"** button.

After few second, airdrop of testnet **TVARA** should be in your wallet.

### Request airdrop from Invaraint Faucet

Now that you have testnet tokens to approve transactions on the Vara Network Testnet, you can request an airdrop from Invariant. You will receive testnet BTC, ETH, and USDC.

1. Click the **"Faucet"** button on Invariant site.

![Buttons](/img/docs/app/vara/vara_nav.jpg)

2. Approve transaction in your wallet

![Approve transaction](/img/docs/app/vara/vara_approvetransaction.jpg)

3. After a while, you should have airdropped tokens in your wallet.


89 changes: 89 additions & 0 deletions docs/docs/vara/user_guide/how_to_add_liquidity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: How to add liquidity?

slug: /vara/user_guide/how_to_add_liquidity
---

**You can easily become a Liquidity Provider (LP) by adding your assets to a pool by following steps below:**

### Add new position to existing pool

1. Head to the "Liquidity" page and click **Add position**.

![add position](/img/docs/app/a0/a0_addposition.png)

2. This will be your position identifier. It is called the **Market ID**.

![marketid](/img/docs/app/vara/vara_marketidlight.jpg)

3. Select pair of tokens. We have chosen as an example the **VARA/USDC** pair.

![varausdc](/img/docs/app/vara/vara_selecttokens.jpg)

4. Select **fee tier**. The fee tier determines the percentage of tokens deducted from a user who makes a swap, thus defining the amount of fees you will earn when a user utilizes your liquidity in the swap. Each fee tier represents a different liquidity pool.

![feetier](/img/docs/app/vara/vara_selectfeetier.jpg)

Invariant provides specific **fee values** that you can choose to create you position. For your better experience, wondering which fee should choose, for some positions we highlighted which option is most recommended.

<blockquote>
The fees you earn on your liquidity position come from swaps initiated by other users on the platform, and the token you receive as a fee always corresponds to the token a user is giving up in their swap. For example, if you have a VARA/USDC liquidity position, you'll earn a fee in USDC when a user swaps USDC for VARA, and vice versa. This ensures your fees directly reflect the trading activity within your chosen pool.

Users control the precision of their range orders. A tighter range (smaller difference between upper and lower limits) can generate higher fees if the price fluctuates within your set range. However, it also increases the risk of incomplete orders if the market price moves significantly before your entire range is filled. Conversely, a wider range (larger difference between upper and lower limits) results in lower fees but provides less control over the final execution price.

When selecting a range for your orders, consider the characteristics of the assets involved. For stable coins, which typically have low volatility, a narrower range may be appropriate to capture smaller price movements and maintain stability in your liquidity provision. In contrast, for more dynamic coins with higher volatility, a wider range could be advantageous to accommodate larger price fluctuations and capture potential trading opportunities. Adjusting the range based on the stability and volatility of the assets allows you to optimize your liquidity provision strategy and adapt to market conditions effectively.

</blockquote>

5. Choose between two options for adding **concentrated liquidity** and setting up the pool range.

6. Provide an amount of tokens. The amount of tokens is interdependent, as the result of multiplying them must always yield the same outcome.

- [**Uniform liquidity**](/docs/uniform_concentration) - Ideal for beginners, this option evenly distributes liquidity on both sides of the current price. It utilizes a simple slider to inform you about the potential increase in fees compared to the full range with the same amount of tokens

- [**Price range**](/docs/price_range) - Offers full customization, allowing you to set the liquidity range at any point, even on one side of the current price. This option utilizes movable flags on the chart to set the minimum and maximum price of the liquidity range.

![pricerange](/img/docs/app/vara/vara_pricerange.jpg)

#### Legend:

<blockquote>

- <b>yellow bold line</b> - represents current price.

- <b>lines labeled with min and max</b> - represents the user-defined liquidity range for creating position in pool.

You can switch view between <b>Bar chart</b> and <b>Line chart</b>.

</blockquote>

7. Once you're ready, click **Add Liquidity** You'll then be prompted to confirm the transaction in your wallet. A small amount of **VARA** will be deducted from your wallet as a deposit to create your liquidity pool and position. If the pool already exists, this fee is only for creating your position, not for pool creation itself. Most of this fee will be returned to you when you decide to close your position. However, currently, closing the entire pool is not possible.

8. In the **liquidity position list**, you can easily identify your active positions. These positions will have their fee highlighted in green, indicating that they are currently generating fees.

![positions](/img/docs/app/vara/vara_positionslight.jpg)

**In the position interface, we can read data regarding:**

**FEE TIER**
![positions](/img/docs/app/vara/vara_positionfee.jpg)

**Fee Tier** represents the percentage of fees you earn based on your share in the pool. It determines how much of the pool’s fee income you receive.


**RATIO**
![positions](/img/docs/app/vara/vara_positionratio.jpg)

**Ratio** Ratio refers to the proportion of different assets within liquidity position. It indicates how each asset is distributed relative to the total amount. This balance is important because it affects how changes in the market impact the overall value of your position.


**MIN-MAX**
![positions](/img/docs/app/vara/vara_positionminmax.jpg)

**Min-max** Range refers to the price per token within which your position earns fees. This range is defined by the minimum and maximum price limits for the token in your position.


**VALUE**
![positions](/img/docs/app/vara/vara_valuelight.jpg)

**Value** is the total worth of your position, encompassing the initial amount of liquidity you contributed and any accumulated fees. This measure is important because it provides a complete picture of your financial performance.
13 changes: 13 additions & 0 deletions docs/docs/vara/user_guide/how_to_add_liquidity/price_range.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Price range

slug: /vara/user_guide/price_range
---

For greater precision compared to uniform concentration, Invariant offers the option to manually set the price range of your liquidity pool, providing full customization of where you allocate your capital.

![price range](/img/docs/app/a0/a0_range.png)

To set the price range, simply drag the movable flags on the liquidity chart labeled as **MIN** and **MAX**. Alternatively, you can use buttons to adjust the min and max prices of the range.

In cases where the price range does not cover the current market price, you can still create a specific liquidity pool by adding only one token from the pair. This allows users to participate in providing liquidity, even with a limited range, ensuring flexibility in managing assets within the decentralized exchange ecosystem.
Loading
Loading