Farm with Leverage

Farming with more power!

The pop-up box for adding amounts will be shown when clicking the ā€˜Farm’ button. The amounts users put will be equally divided into two groups in order to add a liquidity pool on PancakeSwap.

For example, in the BNB-USDT, there are 6 cases;

  1. Add BNB only x1 - no leverage, no destruction occurred.

  2. Add USDT only x1 - no leverage, no destruction occurred.

  3. Add BNB with leverage x1 x1.5 x2 x2.5 with minimum borrowed amounts of 0.2 BNB.

  4. Add BNB and USDT with leverage x1 x1.5 x2 x2.5 (the system will calculate how much USDT users put equal to how much BNB amount) with minimum borrowed amounts of 0.2 BNB.

  5. Add BNB and USDT only x1 - no leverage, no destruction occurred.

  6. Add USDT only with leverage x1 x1.5 x2 x2.5 (the system will calculate how much USDT users put equal to how much BNB amount) with minimum borrowed amounts of 0.2 BNB.

🧾Total Debt

The total amount of loan user takes on price leverage.

TotalDebt=LeveragePriceāˆ’CostTotal Debt=Leverage Priceāˆ’Cost

Leverage price can be calculated from the total input price (in BNB) and leverage.

LeveragePrice=TotalInputPriceāˆ—LeverageLeverage Price=Total Input Priceāˆ—Leverage

Total input price can easily get from the BNB input field, but in case the user enters a number in the alternative token input field, the token will be converted to BNB via PancakeSwap protocol.

🧾Slippage and Trading Fees

Slippage or price impact is the difference between the market price and estimated price due to trade size. The value can be calculated from the following equation.

Price Impact Calculation:

PriceĀ Impact=(reserve0āˆ—token1reserve1āˆ’reserve0āˆ—token1reserve1+token1)reserve0āˆ—token1reserve1āˆ—100{Price}\space{Impact}=\frac{(\frac{{reserve0}*{token1}}{reserve1}-\frac{{reserve0}*{token1}}{reserve1+token1})}{\frac{{reserve0}*{token1}}{reserve1}}*100

For further detail, the market price is the ratio between reserve0 and reserve1 (The amount of token0 and token1 stored in a pool).

MarketĀ Price=reserve0reserve1Market\ Price=\frac{reserve0}{reserve1}

The estimated price due to trade size is the market price with the additional token.

EstimatedĀ Price=reserve0reserve1+token1Estimated\ Price=\frac{reserve0}{reserve1+token1}

So, we can find the slippage value from the difference between the market price and estimated price due to trade size.

Slippage=∣MarketPriceāˆ’EstimatedPrice∣Slippage=∣Market Priceāˆ’Estimated Price∣

Now, the top equation could be simplified like this;

PriceĀ Impact=SlippageMarketĀ PriceƗ100Price\ Impact=\frac{Slippage}{Market\ Price}\times100

🧾Trading Fees Calculation (7 Days Avg.)

TradingfeeAPR=(oneDayVolumeUSDāˆ’volume7D)totalLiquidityƗ(3657)Ɨ100Ɨ(0.25100)Trading fee APR =\frac{(oneDayVolumeUSD - volume7D)}{totalLiquidity \times(\frac{365}7)} \times100\times(\frac{0.25}{100})

Last updated

Was this helpful?