# ETHRISE Rebalancing Mechanism

The rebalancing mechanism of ETHRISE - 2x Long ETH
ETHRISE rebalancing mechanism is designed to have small volatility decay as small as possible. This document explain the math behind the rebalancing process of ETHRISE.

## Background

We need to do the rebalancing in order to maintain the target leverage ratio. The leverage ratio is defined below:
$$$L = \frac{C}{V}$$$
Where $C$ is collateral value per ETHRISE token and $V$ is the net-asset value of the ETHRISE token.
The leverage ratio $L$ will decrease when the collateral price is up and $L$ will increase when the collateral price is down.

## Rebalancing Problem

We can simplify the rebalancing problem as follows:
$$$L_{t+1} = L_{t} + \Delta L$$$
Where:
• $L_{t+1}$ is the target leverage ratio
• $L_{t}$ is the current leverage ratio
• $\Delta L$ is the rebalancing step. The value of rebalancing step can be positive when we want to increase the current leverage ratio or negative when we want to decrease the current leverage ratio.

### Leveraging Up

When we want to increase the leverage ratio, we will use $\Delta L$ as positive value.
The next step is we want to find how much value we want to borrow $B_{t+1}$ in order to increase the current leverage ratio $L_{t}$ by $\Delta L$.
Suppose $N$ is the total supply of ETHRISE token, we can define $B_{t+1}$ as follows:
$$$B_{t+1} = \left(C_{t+1} - C_{t}\right)N$$$
We can easily solve the equation (3) by using equation (1) and (2) as follows:
\begin{align*} L_{t+1} &= L_{t} + \Delta L\\ \frac{C_{t+1}}{V} &= \frac{C_{t}}{V} + \Delta L\\ C_{t+1} &= \left(\frac{C_{t}}{V} + \Delta L\right)V\\ C_{t+1} &= \left(\frac{C_{t} + \Delta L V}{V}\right)V\\ C_{t+1} &= C_{t} + \Delta L V \end{align*}
Then we can use the equation (4) with (3) as follows:
\begin{align*} B_{t+1} &= \left(\left(C_{t}+\Delta L V \right) - C_{t}\right)N \\ &= \Delta L V N \\ \end{align*}

#### Example of Leveraging Up

Suppose we want to rebalance the ETHRISE.
We have the following initial states:
• ETH Price ($P$): 4000 USDC
• Total collateral managed by ETHRISE ($\hat C$): 100 ETH
• Total debt managed by ETHRISE ($\hat D$): 200000 USDC
• Total supply of the ETHRISE ($N$): 10000 ETHRISE
Based on the initial states above we can calculate the collateral amount per ETHRISE token ($A$):
\begin{align*} A = \frac{\hat C}{N} = \frac{100}{10000} = 0.01 \end{align*}
Each ETHRISE is collateralized by 0.01 ETH.
Then we can calculate the collateral value per ETHRISE token ($C$) as follows:
\begin{align*} C = AP = 0.01\times4000 = 40 \end{align*}
Each ETHRISE have collateral value 40 USDC.
Then we can calculate and debt per ETHRISE token ($D$) as follows:
\begin{align*} D = \frac{\hat D}{N} = \frac{200000}{10000} = 20 \end{align*}
Each ETHRISE have 20 USDC as debt.
So we can calculate the net-asset value ($V$) as follows:
\begin{align*} V = C - D = 40 - 20 = 20 \end{align*}
The net-asset value of ETHRISE is 20 USDC.
The current leverage ratio is:
\begin{align*} L = \frac{C}{V}=\frac{40}{20}=2 \end{align*}
To recap:
• Collateral value per ETHRISE: 40 USDC
• Debt per ETHRISE: 20 USDC
• NAV: 20 USDC
• Leverage ratio of ETHRISE: 2
Suppose the ETH price is going up to 4300 USDC. Now the leverage ratio is going down:
\begin{align*} L = \frac{C}{V}=\frac{AP}{AP-D}=\frac{0.01 \times 4300}{(0.01 \times4300)-20} = 1.869565217 \end{align*}
As you can see, when the price of ETH is going up from 4000 USDC to 4300 USDC:
• The net asset value is going up from 20 USDC to 23 USDC
• The leverage ratio is going down from 2 to 1.869565217.
Now it's time to leveraging up by $\Delta L=0.1$. Using equation (5) we now how much we want to borrow to increase the leverage:
$B= \Delta L V N = 0.1 \times 23 \times 10000 = 23000 \\$
We will borrow 23000 USDC from the vault, then swap it to ETH. Assuming there is no slippage when swapping, we will get 5.348837209 ETH as the collateral.
Now we have the new states:
• ETH Price ($P$): 4300 USDC
• Total collateral managed by ETHRISE ($\hat C$): 105.3488372 ETH
• Total debt managed by ETHRISE ($\hat D$): 223000 USDC
• Total supply of the ETHRISE ($N$): 10000 ETHRISE
Let's calculate the net-asset value once again after rebalancing:
$V = C - D = \left( \frac{\hat C}{N} \right)P - \left( \frac{\hat D}{N} \right) = \left( \frac{105.3488372}{10000} \right)4300 - \left( \frac{223000 }{10000} \right) = 23$
Now the new leverage ratio after rebalancing:
\begin{align*} L = \frac{C}{V}=\frac{AP}{AP-D}=\frac{45.3}{23} = 1.969565217 \end{align*}
As you can see, we have successfully leveraging up the leverage ratio from 1.869565217 to 1.969565217 without changing the net-asset value of the ETHRISE.

### Leveraging Down

When we want to decrease the leverage ratio, we will use $\Delta L$ as negative value.
The next step is we want to find how much debt we want to repay $R_{t+1}$ in order to descrease the current leverage ratio $L_{t}$ by $\Delta L$.
Suppose $N$ is the total supply of ETHRISE token, we can define $R_{t+1}$ as follows:
$$$R_{t+1} = \left(C_{t} - C_{t+1}\right)N$$$
We can use equations (4) and (5) to solve equations (6).
\begin{align*} R_{t+1} &= \left(C_{t} - \left(C_{t}+\Delta L V \right) \right)N \\ &= \Delta L V N \\ \end{align*}
You may notice that $B_{t+1}$ is equal to $R_{t+1}$ which is expected.
• $B_{t+1}$ is how much value we want to borrow in order to increase the leverage ratio by $\Delta L$
• $R_{t+1}$ is how much value we want repay the debt in order to decrease the leverage ratio by $\Delta L$

#### Example of Leveraging Down

Suppose we want to rebalance the ETHRISE.
We have the following initial states:
• ETH Price ($P$): 4000 USDC
• Total collateral managed by ETHRISE ($\hat C$): 100 ETH
• Total debt managed by ETHRISE ($\hat D$): 200000 USDC
• Total supply of the ETHRISE ($N$): 10000 ETHRISE
Based on the initial states above we can calculate the collateral amount per ETHRISE token ($A$):
\begin{align*} A = \frac{\hat C}{N} = \frac{100}{10000} = 0.01 \end{align*}
Each ETHRISE is collateralized by 0.01 ETH.
Then we can calculate the collateral value per ETHRISE token ($C$) as follows:
\begin{align*} C = AP = 0.01\times4000 = 40 \end{align*}
Each ETHRISE has a collateral value of 40 USDC.
Then we can calculate and debt per ETHRISE token ($D$) as follows:
\begin{align*} D = \frac{\hat D}{N} = \frac{200000}{10000} = 20 \end{align*}
Each ETHRISE has 20 USDC as debt.
So we can calculate the net asset value ($V$) as follows:
\begin{align*} V = C - D = 40 - 20 = 20 \end{align*}
The net-asset value of ETHRISE is 20 USDC.
The current leverage ratio is:
\begin{align*} L = \frac{C}{V}=\frac{40}{20}=2 \end{align*}
To recap:
• Collateral value per ETHRISE: 40 USDC
• Debt per ETHRISE: 20 USDC
• NAV: 20 USDC
• Leverage ratio of ETHRISE: 2
Suppose the ETH price is going down to 3800 USDC. Now the leverage ratio is going up:
\begin{align*} L = \frac{C}{V}=\frac{AP}{AP-D}=\frac{0.01 \times 3800}{(0.01 \times 3800)-20} = 2.111111111 \end{align*}
As you can see, when the price of ETH is going down from 4000 USDC to 3800 USDC:
• The net asset value is going down from 20 USDC to 18 USDC
• The leverage ratio is going up from 2 to 2.111111111.
Now it's time to leverage down by $\Delta L=0.1$. Using equation (5) we now how much debt we want to repay to decrease the leverage:
$R= \Delta L V N = 0.1 \times 18 \times 10000 = 18000 \\$
We will repay 18000 USDC debt to the vault. We do this by selling 4.736842105 ETH, assuming there is no slippage.
Now we have the new states:
• ETH Price ($P$): 3800 USDC
• Total collateral managed by ETHRISE ($\hat C$): 95.26315789 ETH
• Total debt managed by ETHRISE ($\hat D$): 182000 USDC
• Total supply of the ETHRISE ($N$): 10000 ETHRISE
Let's calculate the net-asset value once again after rebalancing:
$V = C - D = \left( \frac{\hat C}{N} \right)P - \left( \frac{\hat D}{N} \right) = \left( \frac{95.26315789}{10000} \right)3800 - \left( \frac{182000}{10000} \right) = 18$
Now the new leverage ratio after rebalancing:
\begin{align*} L = \frac{C}{V}=\frac{AP}{AP-D}=\frac{36.2}{18} = 2.011111111 \end{align*}
As you can see, we have successfully leveraging down the leverage ratio from 2.111111111 to 2.011111111 without changing the net-asset value of the ETHRISE.

## Rebalancing Rule

This is the rule of the rebalancing: When the leverage ratio is out of range ( $L_{t} < L_{min}$ or $L_{t} > L_{max}$) protocol will increase or decrease the leverage ratio by $\Delta L$. $L_{min}$, $L_{max}$ and $\Delta L$ will different based on the collateral asset.

### Maximum Borrow Value and Repay Value

In order to prevent high slippage when rebalancing, we want to limit $B_{t+1}$ and $S_{t+1}$ to 500K USDC. The maximum borrow and repay value may differ for each asset.

## Future Improvements

Currently we define $\Delta L$ as constants, we may use dynamic value of $\Delta L$ by utilizing of volatility value etc.