# Yield Swapping

In the DeFi Pool Share protocol, we introduce a novel approach to earning from borrowed Uniswap v3 position NFTs. This section will detail the mathematical formula used to calculate the potential earnings a borrower can accrue from the fees generated by these NFTs over the loan duration.

#### Methodology

The primary variables in our calculation are:

NFTn: The individual Uniswap v3 position NFT being considered.

T: The total yields generated by the Uniswap pool over the loan duration.

LiquidityNFTn: The liquidity provided by NFTn.

LiquidityTotal: The total liquidity in the Uniswap pool.

From these variables, we derive:

ProportionNFTn: The proportion of the total pool that NFTn represents.

YieldNFTn: The yield generated by NFTn.

We calculate ProportionNFTn as follows:

ProportionNFTn = LiquidityNFTn / LiquidityTotal

This calculation divides the liquidity provided by NFTn by the total liquidity in the pool, giving us the proportion of the pool that NFTn represents.

We then use ProportionNFTn to calculate YieldNFTn, the fees that NFTn generates, as follows:

YieldNFTn = ProportionNFTn * T This calculation divides the liquidity provided by NFTn by the total liquidity in the pool, giving us the proportion of the pool that NFTn represents. We then use ProportionNFTn to calculate YieldNFTn, the fees that NFTn generates, as follows:

YieldNFTn = ProportionNFTn * T This calculation multiplies ProportionNFTn by T, the total fees generated by the pool over the loan duration, to give us the yield generated by NFTn.

#### Implications

The above methodology allows borrowers to assess the potential earnings from a borrowed Uniswap v3 position NFT. It’s worth noting that actual earnings can be influenced by several factors, including changes in total pool liquidity, trading volume, and price fluctuations of the underlying assets. As such, this formula provides an estimation rather than a guarantee of return.

Our protocol’s innovative approach opens up new possibilities for participation in DeFi, by allowing users to benefit from the yield generated by Uniswap v3 position NFTs without the need to provide liquidity themselves. Let’s say we’re examining a particular Uniswap v3 position NFT (NFTn) in a pool of DAI/ETH.

We need to know:

The liquidity NFTn provides to the pool (LiquidityNFTn).

The total liquidity in the pool (LiquidityTotal).

The total yield (T) generated by the pool over the loan duration.

For this example, let’s assume:

(these are only assumptions, and for a simpler explanation we’ve used stablecoins and assumed equal distribution of these assets in the pool generating equal yield in each asset, which might not be true in the real scenario.)

LiquidityNFTn is 5,000 DAI & 5,000 USDC

LiquidityTotal in the pool is $1 Million USD; 500,000 DAI & 500,000 USDC

T, the total yield generated by the pool over the loan duration, is 25,000 USDC & 25,000 DAI

First, we calculate ProportionNFTn, the proportion of the total pool that NFTn represents:

ProportionNFTn = LiquidityNFTn / LiquidityTotal

ProportionNFTn = 10,000 USD / 1,000,000 USD

ProportionNFTn = 0.01 So, NFTn represents 1% of the total liquidity in the pool.

Next, we calculate FeesNFTn, the yield that NFTn generates, as follows:

YieldNFTn = ProportionNFTn * T

YieldNFTn = 0.01 * 25,000 DAI & 0.01 * 25,000 USDC

YieldNFTn = 250 DAI + 250 USDC

Therefore, based on its proportion of total liquidity in the pool and the total yield generated by the pool over the loan duration, NFTn would generate 250 DAI & 250 USDC in yield.

This example illustrates how the borrower can estimate the potential yield they can earn from a borrowed Uniswap v3 position NFT over the loan duration. As always, actual results can vary based on factors like changes in total pool liquidity, trading volume, and price fluctuations of the underlying assets.

Now, assuming that the borrower calculated estimated YieldNFTn for this particular pool and thus paid a % of it as lending fees, for this example lets suppose the borrower paid $400 in ETH for borrowing this particular pool for the loan duration.

Borrower's Profit Yield = 250 DAI + 250 USDC (~$500) - 0.22 ETH (assuming ETH at $1800, ~$400) = $100

Last updated