---
# System prepended metadata

title: Hyperdrive Writeup

---

# Pricing Shorts

In the Element Protocol, depositing 1 Base Token (BT) gives you 1 Principal Token (PT) and 1 Yield Token (YT):
\begin{aligned}
PT + YT &= 1
\end{aligned}

if a user ever saw that the market price of the PT plus the market price of the YT was greater than 1, then they could mint a PT and YT and sell it on the market for more than 1 BT.  Unfortunately, YT markets in the Element Protocol were inefficient due to a lack of liquidity so this arb opportunity was rare. Additionally, inefficient YT markets limited the protocol's ability to easily provide leveraged access to the variable rate market.

Hyperdrive solves this issue by combining the PT and YT markets into a single market that provides exposure to fixed and variable rates through longs and shorts. Purchasing a long is functionally identical to purchasing a PT in the Element Protocol. Purchasing a short, which is equivalent to leveraged exposure to variable rates, needed to be more straightforward than the YTC mechanism used in the Element Protocol and more efficient than the YT market; however, we did preserve the concept of what the Element Protocol determined a fair price was. We can use the fact that $PT + YT = 1$ to calculate the fair price for a YT:

\begin{aligned}
YT &= 1 - PT
\end{aligned}


The price of a PT with a 1 year term can be calculated by using the PV formula:
\begin{aligned}
PV&=\frac{FV}{(1+r)}
\end{aligned}

where $r$ is the market rate.  Since the PT matures to 1 BT, we substitute FV = 1 giving us the price of a PT in terms of BT:

\begin{aligned}
p&=\frac{1}{(1+r)}
\end{aligned}

Since $p$ is the price of a PT, then $1-p$ is the fair price of a YT. Now we can calculate how many YTs a PT is worth:

\begin{aligned}
\frac{p}{(1-p)}
\end{aligned}


substituting $p = \frac{1}{1+r}$ and simplyfying gives us: 

\begin{aligned}
\frac{1}{r}
\end{aligned}

which means at the market fixed rate $r$, 1 PT can is equivalent to $\frac{1}{r}$ YTs.

Despite the lack of a YT market in the Element Protocol there was a way to accomplish leveraged exposure to the variable rate through iterative process called Yield Token Compounding (YTC); however, this process would require an infinite number of compounds to get the full variable rate exposure. We can prove that YTCing a single PT results in the same variable rate exposure derived above by representing the number of YTs after N iterations by the following summation:

\begin{aligned}
\sum_{i=0}^{N}\left(1-r\right)^{i}
\end{aligned}

where $r$ is the market rate of the $PT$. The summation can be expanded as follows:

\begin{aligned}
S&=1+\left(1-r\right)^{1}+\left(1-r\right)^{2}+...+\left(1-r\right)^{N}
\end{aligned}

Multiplying both sides of equation by $(1-r)$ gives us:

\begin{aligned}
(1-r)\cdot S&=\left(1-r\right)^{1}+\left(1-r\right)^{2}+...+\left(1-r\right)^{N}+\left(1-r\right)^{N+1}
\end{aligned}

Next, subtract the two previous equations:

\begin{aligned}
\require{cancel}
S - S \cdot (1-r)&=\left(1+\left(1-r\right)^{1}+\left(1-r\right)^{2}+...+\left(1-r\right)^{N}\right)\ -\ \left(\left(1-r\right)^{1}+\left(1-r\right)^{2}+...+\left(1-r\right)^{N}+\left(1-r\right)^{N+1}\right)\\
\end{aligned}

simplifying and solving for $S$ gives us the equation for the number of YTs after N compounds:

\begin{aligned}
\frac{1-\left(1-r\right)^{N+1}}{r}
\end{aligned}

We can determine the number YTs generated after $\infty$ compounds by taking the limit as $N \to \infty$:

\begin{aligned}
\lim_{N \to \infty}\frac{1-\left(1-r\right)^{N+1}}{r}&=\frac{1}{r}
\end{aligned}

Now that we know YTCing results in the same conversion rate, we can use the process of minting and YTC as machinery to determine what the equivalent leveraged exposure using a short in Hyperdrive should cost.

1) Mint 1 PT and 1 YT for 1 BT
2) Principal Token Compound $\frac{1}{1+r}$ YTs for $1-\frac{1}{1+r}$ PTs *
3) Sell the AMM 1 PT for $\frac{1}{1+r}$ BTs (User has $1-\frac{1}{1+r}$ PTs, $1-\frac{1}{1+r}$ YTs and the AMM has 1 new PT)
4) Yield Token Compound $1-\frac{1}{1+r}$ PTs for $\frac{1}{1+r}$ YTs

User ends up with 1 YT costing them $1-\frac{1}{1+r}$ or $1-p$ BT. In other words, Hyperdrive shorts should pay the max loss for the full exposure to the principal generating the variable yield.

> **\* Note:** that Principal Token Compounding isn't possible in the Element Protocol due to a lack of a YT market. Instead, they would have to start by purchasing 1 PT from the fixed rate market; however, the example provided is closer to how Hyperdrive works since opening shorts push the rate up by creating additional bond liquidity.

