# Depositing

Last updated

Last updated

Providing liquidty on Aftermath is simple. Navigate to the Earn -> Pools tab, and select the pool you wish to deposit into. This can be any pool for which you own any one of the coins; you do not need to have all of them to become a liquidity provider.

Here you will see two choices at the top of the page: Official, and Community.

Official Pools are those which are created by Aftermath in coordination with partners. Community Pools are completely permissionless and can be created by anyone. We took this approach to ensure the best user experience, while also respecting decentralization.

Select a pool, and once on the page for that specific pool you will see a Deposit button at the top right. Click this button, and the following modal will appear:

Here you will see your optionality for depositing into a pool. Depending on the pool, there may be up to 8 total coins which you can deposit. You may deposit any coin you have in your wallet, whether it is just one of the coins, some of the coins, or all of them, and at any relative amount.

Depending upon the current balance of the pool compared to the specified weight of each asset, you may obtain better results by depositing more of one coin than another. You can view the notional value of the LP tokens you will receive beneath the first field at the top of the Deposit modal. Comparing this value to the field at the bottom labeled Total will allow you to determine the optimal ratio of coins to deposit. For most Official pools, depositing according to the specified weight of each coin in the pool will yield the best results, but be sure to check to ensure the value of the LP tokens you will recieve is satisfactory before proceeding, especially when depositing large amounts.

Once you have entered the amount of each coin you wish to deposit press the deposit button, a preview will appear:

Here you can review your deposit to ensure the value of the LP tokens you will receive and set your maximum allowed slippage. Slippage refers to the price impact that results from depositing coins into the pool, and is most significant when depositing large amounts relative to the total liquidity in the pool. For example, in the image above the total value of the coins being deposited is $30.44, while the value of the LP tokens to be received is $30.45. The specified Slippage Tolerance of 0.5% ensures that at least $30.30 worth of LP tokens will be received, or the deposit will revert and not be completed.

Once you have reviewed your deposit and determined it is to your satisfaction, click the Deposit button and approve the transaction in your wallet to complete the deposit. You will then receive your LP tokens in your wallet. You can also view all of your LP tokens on the Portfolio page.

Price Impact and Minimum to Receive

When depositing an amount which is significant relative to the overall liquidity in the pool, Price Impact may affect the value of LP tokens received versus tokens deposited. When depositing, all the deposited funds are transfered to the pool and LP is minted and transfered to the user. In the discrepancy we are considering the deposited funds don't disappear -- they participate in trading along with the rest of the pool's assets. The discrepancy is between how much was deposited and how much LP was returned.

That begs the next question: How does the pool determine how much LP to return for a deposit? A simple deposit (and the most favorable to the depositor) is one which matches the pool's balance distribution perfectly. If a deposit increases each balance by 10% (e.g. if the pool starts with 100 USDC and 110 USDT, a 10% deposit is 10 USDC and 11 USDT) then the amount of LP minted equals 10% of the total of all LP in existence at the beginning of the deposit (if there is 105 LP in circulation then a 10% deposit earns 10.5 LP).

When a user prefers to deposit a single coin type instead of a balance-matched combination of all coin types, the pool needs to do some calculating to see how much LP that is worth. It internally converts the amount deposited into each of the other coin types so that the result is a balance-matched distribution of funds, then it deposits those and follows the proportionality rule described above.

Here is an example which illustrates this behavior. Suppose a stable pool with 105 circulating LP consists of 100 USDC and 110 USDT (USDT/USDC = 1.1) and that we want to deposit $50 into it. The way to do this to maximize the LP we earn is to deposit 23.81 USDC and 26.19 USDT (USDT/USDC is also 1.1). This deposit is $50 total (23.81 + 26.19 = 50) and consists of 23.81% of each asset in the pool (23.81% of 100 is 23.81 and 23.81% of 110 is 26.19). Thus we are rewarded with 23.81% of the circulating supply (105 LP), or 25 LP.

If instead we deposit all 50 as one coin, we will earn less LP. If we deposit all 50 as USDC then the pool will convert that to amounts which allow for an all-asset deposit. In this case it takes 21.59 USDC from our 50 and trades it into 20.83 USDT (notice the price impact playing a role here because this is such a large trade), which turns the pool's balances to 121.59 (100 + 21.59) and 89.17 (110 - 20.83). The remaining 28.41 USDC (50 - 21.59) and the 20.83 USDT are both 23.37% of the respective pool balances (28.41 is 23.37% of 121.59 and 20.83 is 23.37% of 89.17), so this deposit earns us 23.31% of the total LP. That is 24.53 LP, 23.31% of 105. Notice how this is less than 25 LP which we would have earned with a direct all-asset deposit.

Running the numbers the other way, suppose we instead want to deposit 50 USDT and no USDC. The pool converts 20.37 USDT into 18.52 USDC (the price impact is even worse because USDT is more abundant to begin with), changing the pool balances to 81.48 USDC and 130.37 USDT. The 18.52 USDC we traded for and our remaining 29.63 USDT are each 22.72% of the respective pool balances, so we earn 22.72% of the total LP. That is 23.86 LP, the least of the three scenarios.

Before depositing a large quantity, be sure to consult the Deposit Preview modal to view the Total Deposit and Minimum to Receive to ensure they are satisfactory. If not, it is best to deposit multiple coins in equal quantity.