I. SunSwap V3 Overview
SunSwap V3 utilizes concentrated liquidity to boost capital efficiency, allowing users to add liquidity by customizing the token pair, fee tier, and price range. As trading fees collected within the price range are allocated in proportion to the amount of liquidity contributed, investors need to find a reasonable range for their liquidity in order to maximize their gains.
1.1 Limitations of SunSwap V2
SunSwap V2 uses the classic constant product model, expressed as x * y = k. Here, x and y represent the respective reserve balance of the tokens involved (tokenA and tokenB). Their product, denoted as k, remains constant. When trading tokenA for tokenB, users deposit their tokenA into the contract and receive a corresponding amount of tokenB in exchange. As a result, the product of x and y remains unchanged no matter how many trades have been executed. The price curve is illustrated below:
The horizontal axis represents the reserve balance of tokenA, the vertical axis represents the reserve balance of tokenB, and the green curve reflects the price change of the pool. Given the indexes above, we can draw a green block that stands for the product of the quantity of tokenA and tokenB, and a red line that indicates the price of tokenA. When the price of tokenA/tokenB remains relatively stable, the major chunk of the market’s volume will fall within the price range represented by the orange block, which means the funds indicated by the green block are not put into good use.
To improve the capital efficiency of the pools, a concentrated liquidity model SunSwap V3 has been redesigned based on SunSwap V2.
1.2 Concentrated liquidity model
SunSwap V3 adopts a concentrated liquidity model based on constant product, introducing the idea of virtual liquidity to SunSwap V2. The formula for this market maker model is the following:
(x + x_virtual)(y + y_virtual)= L^2* Formula 1
It is clear from the mechanism of concentrated liquidity that x_virtual and y_virtual correlate with p_upper and p_lower. The formula for the concentrated liquidity model can then be derived as the following:
(x + L / √p_upper )(y +L√p_lower) = L^2 Formula 2
1.3 Price range and fee
SunSwap V3 enables users to choose the price range their liquidity is added to, which spans from p_lower to p_upper in Formula 2. According to Formula 2, a user’s price range should cover the current price, and the narrower the range, the more efficient the user’s funds and the higher the return; conversely, the wider the price range, the less efficient the user’s funds. Users of SunSwap V3 are encouraged to select an appropriate price range to effectively manage the trade-off between risks and returns.
SunSwap V3 offers four tiers of fee rates, allowing users to customize pools for tokens with different levels of risk. The use case for each fee tier is outlined below. Liquidity providers are advised to choose pools based on the type of tokens they hold.
Fee Rate | Use Case |
---|---|
0.01% | For stablecoins in large amounts |
0.05% | For tokens with lower price volatility |
0.3% | For the majority of tokens |
1% | For tokens with greater price volatility |
II. Instruction Manual
2.1 Add liquidity to a new pool
- First, click “Connect Wallet” on the top right corner of the SunSwap homepage.
- Choose “SunSwap” > “V3” > “Pool” to access the “Add liquidity” screen.
- Click “Add liquidity”.
- Choose the token pair, fee tier, and price range (note that you will also need to set an initial price if the pool has not been created before).
- Enter the amount of the tokens you wish to add. As you enter a value into a box, the other input box will be automatically filled according to the exchange rate between the two tokens.
- Click “Supply”. If this is your first time providing liquidity for either of the tokens, your signature will be requested to grant approval for the token concerned.
- After giving approval, you will see a “Confirm Supply” window showing details of the liquidity provision. To proceed, click “Confirm Supply”, and a pop-up will appear requesting your signature. Once signing this action, you will see a “Liquidity added” message. Close the message and you will be directed to a page listing the pools where you have added liquidity.
2.2 Provide additional liquidity for a pool
- Click on a pool where you have already provided liquidity under “Your Liquidity”, and you will be directed to a page presenting more details of that pool. You may click “Add” on this page to provide additional liquidity to the pool.
- After clicking “Add”, you will be directed to the liquidity provision page. Note that you will only be allowed to customize the amount of the tokens to be added and not the fee tier or price range. After completing this step, click “Supply”.
- Additional liquidity is provided to the pool after you confirm and sign, and a “Liquidity added” pop-up will appear. After this step, you may view the updated liquidity and token amount on the page that shows the pool details.
2.3 Remove liquidity
- By clicking “Remove” on the page showing pool details, you will be directed to a page where added liquidity can be removed in proportion. After selecting the share of liquidity you want to remove, click “Remove” and sign this action. After this step, you may view the updated liquidity and token amount on the page with pool details.
- Click “Remove”, and you will see a “You will remove” window showing details of the liquidity removal. To proceed, confirm and sign this action, and a “Liquidity removed” message will appear upon successful removal.
- With successful liquidity removal, all rewards will be collected automatically.
2.4 Collect rewards
- You can collect your rewards on the page with pool details. A “Collect” button will appear when there are rewards ready for collection.
- Click “Collect” and a “Confirm Collect” pop-up will appear, displaying the amount of rewards to be collected.
- Click “Confirm Collect”, and a pop-up will appear requesting your signature. Once signing this action, you will see a “Reward Collected” message. The rewards will be sent to your wallet, and the remaining reward amount will be shown on the page with pool details.
2.5 Swap
- Click “Swap” and select the pair of tokens you wish to swap.
- Enter the amount of tokens that you wish to sell.
- Click “Swap” and start trading. If this is your first time trading this token with SunSwap, a window will appear requesting your signature to grant approval for the token.
- Click “Sign” in your wallet, and you will see a “Confirm Swap” pop-up.
- Click “Confirm Swap”, and your wallet will request your signature for the transaction. Click “Sign” to confirm this transaction, and it will take a few seconds for the transaction to complete.