All XUSD tokens are fungible with one another and entitled to the same proportion of collateral no matter what collateral ratio they were minted at. This system of equations describes the minting function of the XUSD Protocol:

$F = \overbrace{Y * P_y}^\text{collateral value} + \overbrace{Z * P_z}^\text{XUS value} \\
(1 - C_r)(Y * P_y) = C_r(Z * P_z) \\$

$F$ is the units of newly minted XUSD $C_r$is the collateral ratio $Y$ is the units of collateral transferred to the system $P_y$is the price in USD of $Y$collateral $Z$ is the units of XUS burned $P_z$is the price in USD of XUS

**Example A: Minting XUSD at a collateral ratio of 100% with 200 DAI ($1/DAI price)**

To be explicit, we can start by finding the XUS needed to mint XUSD with `200 DAI`

(`$1/DAI`

) at a collateral ratio of 1.00

$(1−1.00) * (100∗1.00) =1.00 * (Z∗Pz) \\
0 = (Z * P_z)$

Thus, we show that no XUS is needed to mint XUSD when the protocol collateral ratio is 100% (fully collateralized). Next, we solve for how much XUSD we will get with the `200 DAI`

.

$F=(200∗1.00)+(0) \\
F=200$

`200 XUSD`

are minted in this scenario. Notice how the entire value of XUSD is in dollar value of the collateral when the ratio is at `100%`

. Any amount of XUS attempting to be burned to mint XUSD is returned to the user because the second part of the equation cancels to `0`

regardless of the value of $Z$ and $P_z$.

First, we need to figure out how much XUS we need to match the corresponding amount of DAI.

$(1−0.8)(120∗1.00)=0.8(Z∗2.00) \\
Z = 15$

Thus, we need to deposit 15 XUS alongside 120 DAI at these conditions. Next, we compute how much XUSD we will get.

$F=(120∗1.00)+(15∗2.00) \\
F = 150$

`150 XUSD`

are minted in this scenario. `120 XUSD`

are backed by the value of DAI as collateral while the remaining `30 XUSD`

are not backed by anything. Instead, XUS is burned and removed from circulation proportional to the value of minted algorithmic XUSD.

First, we start off by finding the XUS needed.

$(1−.50)(220∗.9995)=.50(Z∗3.50) \\
Z = 62.54$

Next, we compute how much XUSD we will get.

$F = (220*.9995) + (62.54*3.50) \\
F=437.78$

`437.78 XUSD`

are minted in this scenario. Proportionally, half of the newly minted XUSD are backed by the value of USDC as collateral while the remaining 50% of XUSD are not backed by anything. `62.54 XUS`

is burned and removed from circulation, half the value of the newly minted XUSD. Notice that the price of the collateral affects how many XUSD can be minted – XUSD is pegged to 1 USD, not 1 unit of DAI.

If not enough XUS is put into the minting function alongside the collateral, the transaction will fail with a `subtraction underflow`

error.

Redeeming XUSD is done by rearranging the previous system of equations for simplicity, and solving for the units of collateral,YYY, and the units of XUS,ZZZ.

$Y=\frac{F∗(C_r)}{P_y} \\
Z=\frac{F∗(1−Cr)}{Pz}$

$F$ is the units of XUSD redeemed $C_r$is the collateral ratio $Y$is the units of collateral transferred to the user $P_y$is the price in USD of $Y$collateral $Z$ is the units of XUS minted to the user $P_z$is the price in USD of XUS

$Y=\frac{170∗(.65)}{1.00} \\
Z=\frac{170∗(.35)}{3.75}$

Thus, $Y = 110.5$and $Z = 15.867$

Redeeming `170 XUSD`

returns `$170`

of value to the redeemer in `110.5 DAI`

from the collateral pool and `15.867 of newly minted XUS`

tokens at the current XUS market price.