---
# System prepended metadata

title: Napier Math (9/18~)

---



# Napier Math (9/18~)


## Issue

At the current time $t_0$, issue $PT$ and $YT$ for the same amount of $y = x \cdot s(t_0)$ at the target $x$ amount that the user deposits.

If $s(t_0) < S(t_0)$ , the user can immediately collect a certain amount of targets from the just issued YT. It is reasonable to think that this target additional amount is in addition to the original deposit amount. The exact amount to add can be determined from the following formula:

$$
\Delta x = (x + \Delta x) \cdot s(t_0) \cdot \left( \frac{1}{s(t_0)} - \frac{1}{S(t_0)} \right) = (x + \Delta x) \cdot \left( 1 - \frac{s(t_0)}{S(t_0)} \right) \\
\Delta x \left( 1 - \left( 1 - \frac{s(t_0)}{S(t_0)} \right) \right) = x \cdot \left( 1 - \frac{s(t_0)}{S(t_0)} \right) \\
\Delta x \cdot \frac{s(t_0)}{S(t_0)} = x \cdot \left( 1 - \frac{s(t_0)}{S(t_0)} \right) \\
\Delta x = \frac{x \cdot \left( 1 - \frac{s(t_0)}{S(t_0)} \right)}{\frac{s(t_0)}{S(t_0)}} = x \cdot \left( \frac{S(t_0)}{s(t_0)} - 1 \right)
$$

So the full deposit amount is:

$$
X = x + \Delta x = x + x \cdot \left( \frac{S(t_0)}{s(t_0)} - 1 \right) = x \cdot \frac{S(t_0)}{s(t_0)}
$$

The total amount of issued tokens (both PT and YT are the same) is:

$$
Y = X \cdot s(t_0) = x \cdot \frac{S(t_0)}{s(t_0)} \cdot s(t_0) = x \cdot S(t_0) \tag{1}
$$

Also, if the user already has a certain amount of $YT$ when issuing additional tokens, then before issuing additional $YT$, the interest earned so far from these YT amounts will be must be recovered.

Assuming the user already has $Y_l$ of YT and last collected interest at time $t_l$, users can withdraw $Target$ in the amount of $xl$ with their $YT$.

$$
x_l = Y_l \cdot \left( \frac{1}{s(t_l)} - \frac{1}{S(t_0)} \right) \tag{2}
$$

Therefore, the total amount $Y$ of issued tokens considering $Target$ obtained from YT held at $t_l$ is as follows :

$$
Y = \left( x + Y_l \cdot \left( \frac{1}{s(t_l)} - \frac{1}{S(t_0)} \right) \right) \cdot S(t_0) \tag{3}
$$


## Add Liquidity
Note : To simply the Napier's arithmetic, in this explanation, we use the Underlying assets instead IBT token(One of Napier's two liquidity-providing asset pairs). 

### Underlying $\leftrightarrow$ PT Pool

A user wishes to provide $z$ amount of underlying liquidity to a pool that trades the principal token ($nPT$) and the underlying.

The user splits the original underlying into two parts $z = z' + z''$. $z'$ goes directly to the pool, while $z''$ is used to issue a PT that goes to the pool. Here, let's say you issue Aave's PT. The issue amount $y$ of $PT_{aave}$ is as follows.

$$
y = z'' \cdot S(t) \tag{4}
$$

#### Virtually calculate $PT_{aave}$ as $nPT$

One thing to note here. $PT_{aave}$ issued from the Underlying of $z''$ should be calculated by the system as $nPT$.


Therefore, $y''$ after calculation is defined as follows using the weighted average scaling factor $W(t)$.

$$
y'' = z'' \cdot W(t) \tag{5}
$$

At this time, if the reserve of PT issued from aave is $Y_{aave}$, the scale is $S(t)_{aave}$, and the yield sources such as Compound and Yearn are defined in the same way,the weighted average scaling factor, $W(t)$, can be written as:

$$
W(t) = \frac{Y_{aave} * S_{aave}(t) + Y_{comp} * S_{comp}(t) +…}{\Sigma{Y_i}} \tag{6}
$$


$Z$ is the underlying reserve pool and $Y_{all}$ is the reserve pool made up of several different PTs. Users must provide tokens in equal proportions, so $z''$ will be:


$$
\frac{z'}{y''} = \frac{Z}{Y_{all}} \\
\frac{z'}{z'' \cdot W(t) } = \frac{Z}{Y_{all}} \\
\frac{z - z''}{z'' \cdot W(t) } = \frac{Z}{Y_{all}} \\
(z - z'') \cdot Y = z'' \cdot W(t) \cdot Z \\
z \cdot Y = z'' \cdot \left( W(t) \cdot Z + Y_{all} \right) \\
z'' = z \cdot \frac{Y}{W(t) \cdot Z + Y_{all}}
$$



## Notation

$Underlying$: Underlying, non-yielding asset (e.g. DAI)

$Target$: Yield asset (e.g. aDAI, cDAI)

$Principal Token(PT)$ : The token representing the user's deposit value into the Napier Protocol. These tokens are redeemable 1-for-1 for the underlying asset at maturity.

$Napier Principal Token(PT)$ : Napier Principal Token are tokens that the system calculate and processe various principal tokens (e.g., same underlying asset, same maturity, different yield sources) as a single virtual principal tokens. The Napier Calculation system is also compatible with external (e.g. Element) principal tokens if certain conditions are met.

$Yield Token(YT)$ : The token representing the right to claim  interest stream over the term period for the deposited asset.

$t_0$：Issuing time

$t_m$：Maturity

$t_m$-$t$：Time to maturity

$s(t)$：Scaling parameter at $t$ (Target's price in Underlting at $t$)

$S(t)$：maximum scale at $t$ (Interest-Bearing token exchange rate [underlying]) 
Example: [Scale of cUSDC]
https://etherscan.io/token/0x39aa39c021dfbae8fac545936693ac917d5e7563#readContract#F4)

$W(t)$: Weighted average scaling factor that virtually calculates any PT to nPT when providing liquidity

$x$：Amount of target tokens deposited by the user

$y$：Amount of PT(or YT) deposited by the user

$y''$: Amount of any principal token after being computed as $nPT$

$\Delta x$：Target increase due to issuance or amount deposited by users

---


