XY Finance
Search
⌃K

YOGA

Rest easy! It's just short for Yield Optimization Greedy Algorithm
Y Pool does not put all the money into the Swapper. Instead, some of the assets go into other DeFi protocols to earn yield. For example, the pool on Ethereum places
10%10\%
of assets into Swapper (X Swap) to provide liquidity needed for X Swap; another pool on BSC puts
20%20\%
of assets into Swapper; the other also puts
20%20\%
on Polygon. Meanwhile, the rest of the assets in each pool goes to lending protocols like AAVE.
What YOGA does is find the best percentage,
LL
, which maximizes the profits earned outside of Y Pool while still being able to afford the liquidity needed for X Swap. For instance, if there's $100m altogether in Y Pool, and Y Pool moves a certain ratio of $100m, say $80m, to a strategy that earns yield according to the YOGA, which begets the
LL
based on the parameters given.
Let's take a look at an example here, but first, we need some assumptions:
Parameter
Description
Ethereum
BSC
Polygon
TVLTVL
TVL of Y Pool
$5,000,000
$5,000,000
$5,000,000
RR
Ratio of swapping out
80%
80%
80%
APYAPY
Supply APY of USDT on lending platforms
10.5%
5%
2%
CC
Withdrawal cost from lending platforms
$20
$5
$1
SS
Safe reserve ratio
10%
10%
10%
And
DD
, the Daily trading volume in total, in reference to the 24h volume of the AnySwap bridge, is $10,000,000. We can have the earnings (Earning as in the formulae below) per day based on YOGA if
LL
of
TVLTVL
is moved to supply USDT on a certain lending platform:
Earning=TVLLAPY365Earning = TVL \cdot L \cdot \frac{APY}{365}
On the other hand, the cost to withdraw supplied assets in the lending platform back to the pool that supports liquidity would be:
Times of Rebalance=max(D[R(1R)]TVL(1L), 0)Times\ of \ Rebalance = max(\frac{D \cdot [R - (1 - R)]}{TVL \cdot(1-L)},\ 0)
Cost=max(Times of RebalanceC,0)Cost = max(Times\ of\ Rebalance \cdot C, 0)
By
RR
it imagines a scenario where every pool is not able to make ends meet themselves. Under these circumstances, users are more likely to withdraw money from one chain instead of making any more deposits, so XY Protocol would have to continuously return liquidity. Thus, we adjust
RR
to
80%80\%
to represent the worst scenario on each chain.
Net profit per day is displayed in the formula as follows.
Net Profit=TVLLAPY365max(D[R(1R)]TVL(1L)C,0)Net\ Profit = TVL \cdot L \cdot \frac{APY}{365} - max(\frac{D \cdot [R - (1 - R)]}{TVL \cdot(1-L)} \cdot C, 0)
We could find which
LL
leads to maximum
Net ProfitNet\ Profit
by differentiating
LL
.
Consider all the parameters from the table above, do the math and we will have:
Ethereum
BSC
Polygon
Parameter
Ethereum
BSC
Polygon
LL
88%
92%
94%
min(L, 1S)min(L,\ 1 - S)
88%
90%
90%
Bonus APYBonus\ APY
7.79%
4.05%
1.70%
LL
should never be greater than
1S1-S
.
We may earn more yields and get all the swap fees simultaneously owing to the invention of YOGA, which gives rise to the best way of managing your wealth and utilizing your assets. Notice that what we've just talked about is even the worst case of bonus APY, let alone the enormous full potential that YOGA can achieve!
Since we are purely being conservative in numbers and, in fact, the frequency of withdrawing from lending platforms should be much lower, it is impossible for
RR
to be greater than
50%50\%
on all chains at the same time and the volume should be divided into each chain accordingly. Simply put, the bonus APY would be a lot higher than the results we have yielded here.
If we charge 0.1% of the swap amount as our fee, the APY of collecting the fee would be
10,000,0000.1%=10,00010,000,000 \cdot 0.1\% = 10,000
APYfee=10,0003655,000,0003=24.3%APY_{fee} =\frac{10,000 \cdot 365}{5,000,000 \cdot 3} = 24.3\%
YOGA then provides at least
7.79%+4.05%+1.70%24.3%=55.7\frac{7.79\%+4.05\%+1.70\%}{24.3\%}=55.7
% boost of APY compared to merely collecting fees for liquidity providers.