Minting and Redeeming

Detailing the process of minting and redeeming FRAX

Minting

All FRAX 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 Frax Protocol:

F=(YPy)collateral value+(ZPz)FXS valueF = \overbrace{(Y*P_y)}^{\text{collateral value}} + \overbrace{(Z*P_z)}^{\text{FXS value}}

(1Cr)(YPy)=Cr(ZPz)(1-C_r)(Y*P_y) = C_r(Z*P_z)

FF is the units of newly minted FRAX CrC_r is the collateral ratio YY is the units of collateral transferred to the system PyP_y is the price in USD of YY collateral ZZ is the units of FXS burned PzP_z is the price in USD of FXS

Example A: Minting FRAX at a collateral ratio of 100% with 200 USDC ($1/USDC price)

To be explicit, we can start by finding the FXS needed to mint FRAX with 200 USDC ($1/USDC) at a collateral ratio of 1.00

(11.00)(1001.00)=1.00(ZPz)(1-1.00)(100*1.00) = 1.00(Z*P_z)

0=(ZPz)0 = (Z * P_z)

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

F=(2001.00)+(0)F = (200*1.00) + (0)

F=200F = 200

200 FRAX are minted in this scenario. Notice how the entire value of FRAX is in dollar value of the collateral when the ratio is at 100%. Any amount of FXS attempting to be burned to mint FRAX is returned to the user because the second part of the equation cancels to 0 regardless of the value of ZZ and PzP_z.

Example B: Minting FRAX at a collateral ratio of 80% with 120 USDC ($1/USDC price) and an FXS price of $2/FXS.

First, we need to figure out how much FXS we need to match the corresponding amount of USDC.

(10.8)(1201.00)=0.8(Z2.00)(1 - 0.8)(120 * 1.00) = 0.8(Z*2.00)

Z=15Z = 15

Thus, we need to deposit 15 FXS alongside 120 USDC at these conditions. Next, we compute how much FRAX we will get.

F=(1201.00)+(152.00)F = (120*1.00) + (15*2.00)

F=150F = 150

150 FRAX are minted in this scenario. 120 FRAX are backed by the value of USDC as collateral while the remaining 30 FRAX are not backed by anything. Instead, FXS is burned and removed from circulation proportional to the value of minted algorithmic FRAX.

Example C: Minting FRAX at a collateral ratio of 50% with 220 USDC ($.9995/USDC price) and an FXS price of $3.50/FXS

First, we start off by finding the FXS needed.

(1.50)(220.9995)=.50(Z3.50)(1-.50)(220*.9995) = .50(Z*3.50)

Z=62.54Z = 62.54

Next, we compute how much FRAX we will get.

F=(220.9995)+(62.543.50)F = (220*.9995) + (62.54*3.50)

F=437.78F = 437.78

437.78 FRAX are minted in this scenario. Proportionally, half of the newly minted FRAX are backed by the value of USDC as collateral while the remaining 50% of FRAX are not backed by anything. 62.54 FXS is burned and removed from circulation, half the value of the newly minted FRAX. Notice that the price of the collateral affects how many FRAX can be minted – FRAX is pegged to 1 USD, not 1 unit of USDC.

If not enough FXS is put into the minting function alongside the collateral, the transaction will fail with a subtraction underflow error.

Redeeming

Redeeming FRAX is done by rearranging the previous system of equations for simplicity, and solving for the units of collateral, YY, and the units of FXS, ZZ.

Y=F(Cr)PyY = \dfrac{F*(C_r)}{P_y}

Z=F(1Cr)PzZ = \dfrac{F*(1-C_r)}{P_z}

FF is the units of FRAX redeemed CrC_r is the collateral ratio YY is the units of collateral transferred to the user PyP_y is the price in USD of YY collateral ZZ is the units of FXS minted to the user PzP_z is the price in USD of FXS

Example D: Redeeming 170 FRAX at a collateral ratio of 65%. Oracle price is $1.00/USDC and $3.75/FXS.

Y=170(.65)1.00Y = \dfrac{170*(.65)}{1.00}

Z=170(.35)3.75Z = \dfrac{170*(.35)}{3.75}

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

Redeeming 170 FRAX returns $170 of value to the redeemer in 110.5 USDC from the collateral pool and 15.867 of newly minted FXS tokens at the current FXS market price.

Additionally, there is a 2 block delay parameter (adjustable by governance) on withdrawing redeemed collateral to protect against flash loans.

NOTE: These examples do not account for the minting and redemption fees, which are set between 0.20% and 0.45%