Math
Calculations used in the YieldBlox protocol.

Utilization Ratio Calculations

Utilization Ratio

Used to calculate the current utilization ratio for an asset.
U=LL+BU=\frac {L} {L+B}
Where:
U=U=
the Utilization ratio
L=L=
the total number of liability tokens
B=B=
the total balance of the pool

Originating Utilization Ratio

Used to calculate the originating utilization for an asset.
Uo=Ud+2bo+1boU_o = \frac {U_{d+2}} {b_{o+1} - b_o}
Where:
Uo=U_o=
the originating utilization ratio
Ud+2=U_{d+2}=
the utilization delta payment 2 utilization-modifying transactions after loan origination
bo+1=b_{o+1}=
the block of the next utilization-modifying transaction
bo=b_o=
the loan origination block

Utilization Tracker Delta

Used to calculate the utilization tracker delta of a transaction. This allows the protocol to measure an asset's average utilization ratio over a period of time.
Ud=Li1Bi1+Li1(bibi1)U_d = \frac {L_{i-1}} {B_{i-1} + L_{i-1}} *(b_{i} - b_{i-1})
Where:
Ud=U_d=
the utilization tracker delta
Li1=L_{i-1}=
the total number of liability tokens at the pre-transaction ledger state of the last utilization-modifying transaction
Bi1=B_{i-1}=
the total pool balance at the pre-transaction ledger state of the last utilization-modifying transaction
bi=b_{i}=
the block of the last utilization-modifying transaction
bi1=b_{i-1}=
the block of the second-to-last utilization-modifying transaction

Utilization Adjustment

Used to calculate the necessary utilization ratio delta adjustment.
Ua=i=UΔlUΔwLi2Bi2+Li2(bi1bi2)UdiUaiU_a =\sum^{U_{\Delta w}}_{i=U_{\Delta l}} \frac {L_{i-2}} {B_{i-2} + L_{i-2}} *(b_{i-1} - b_{i-2}) -U_{di} - U_{ai}
Where:
Ua=U_a=
the utilization adjustment
UΔw=U_{\Delta w} =
the place of the furthest back incorrect utilization delta payment
UΔl=U_{\Delta l} =
the place of the utilization delta payment of the last utilization-modifying transaction
Li2=L_{i-2} =
the total number of liability tokens at the pre-transaction ledger state of the utilization-modifying transaction 2 utilization-modifying transactions ago
Bi2=B_{i-2} =
the total pool balance at the pre-transaction ledger state of the utilization-modifying transaction 2 utilization-modifying transactions ago
bi1=b_{i-1} =
the block of second-to-last utilization-modifying transaction
bi2=b_{i-2} =
the block of the third-to-last utilization-modifying transaction
Udi=U_{di} =
the utilization delta payment of the last utilization-modifying transaction
Uai=U_{ai} =
the utilization adjustment payment of the last utilization-modifying transaction

Average Utilization Ratio

Used to calculate the average utilization ratio for a loan.
UA=BcBo+Ud+1+Uabibo+UbcbiU_A = \frac {B_c - B_o + U_{d+1} + U_a} {b_i - b_o} + \frac {U} {b_c - b_i}
Where:
UA=U_A =
the average utilization ratio
Bc=B_c =
the current utilization tracker balance
Bo=B_o =
the utilization tracker balance at the time of loan origination
Ud+1=U_{d+1} =
The utilization delta payment of the next utilization tracker transaction (this will be applied in the next utilization modifying transaction, but it needs applied now to get an accurate average utilization)
Ua=U_a =
the utilization ratio adjustment
bi=b_i =
the block of the last utilization delta payment
bo=b_o =
the block at loan origination
U=U =
the current utilization ratio
bc=b_c =
the current block

Interest Rate Calculations

Interest rates change based on the interest threshold and rates below.
T1=T_1 =
threshold one; initially set to 0.75
T2=T_2 =
threshold two; initially set to 0.90
T3=T_3 =
threshold three; initially set to 0.95
R0=R_0 =
rate zero; initially set to 0.20
R1=R_1 =
rate one; initially set to 1.5
R2=R_2 =
rate two; initially set to 7.5
R3=R_3 =
rate three; initially set to 15

Base Interest Rate

Used to calculate the current interest rate when the utilization rate is below
T1T_1
.
I0(U)=b+UR0I_0(U) = b + U *R_0
Where:
I0=I_0 =
the base interest rate
U=U =
the utilization ratio
b=b =
the base rate constant (low
UU
). It is set by a pool data entry and controls the base interest rate for an asset; initially set to 0.05

Interest Rate - Threshold One

Used to calculate the current interest rate when the utilization rate is above
T1T_1
.
I1(U)=(UT1)R1+I0(T1)I_1(U) = (U-T_1) R_1 +I_0(T_1)
Where:
I1=I_1 =
interest rate one
U=U =
the utilization ratio
I0=I_0 =
the base interest rate

Interest Rate - Threshold Two

Used to calculate the interest rate when the utilization rate is above
T2T_2
.
I2(U)=(UT2)R2+I1(T2)I_2(U) = (U-T_2)R_2 +I_1(T_2)
Where:
I2=I_2 =
interest rate two
U=U =
the utilization ratio
I1=I_1 =
interest rate one

Interest Rate - Threshold Three

Used to calculate the interest rate when the utilization rate is above
T3T_3
.
I3(U)=(UT3)R3+I2(T3)I_3(U) = (U - T_3)R_3 + I_2(T_3)
Where:
I3=I_3 =
interest rate three
U=U =
the utilization ratio
I2=I_2 =
interest rate two

Average Interest Rate

Calculated using the above interest rate equations, but
UU
becomes an aggregated utilization ratio.

Originating Interest Rate

Calculated using the above interest rate equations, but
UU
becomes an originating utilization ratio.

Stable Rate

Used to calculate the stable interest rate for a loan.
Is=Io(1+(1.05Uo))I_s = I_o(1+(1.05-U_o))
Where:
Is=I_s =
the stable rate
Io=I_o =
the originating interest rate
Uo=U_o =
the utilization ratio at the time the loan was originated

Minimum Collateral Requirement

Used to calculate the minimum collateral required for a loan.
Vc=Vl1.02FˉV_c = \frac {V_l * 1.02} {\bar{F}}
Where:
Vc=V_c =
the minimum collateral value requirement
Vl=V_l =
the value of the loan
Fˉ=\bar {F} =
the average liquidation factor of the selected collateral types

Pool Token Issuance

Used to calculate the number of pool tokens issued to a user account.
Oi=BnOoBc+LBnO_i = \frac {B_n *O_o} {B_c + L - B_n}
Where:
Oi=O_i =
the number of pool tokens to be issued to the user
Bn=B_n =
the asset balance the user deposited
Oo=O_o =
the current number of outstanding pool tokens
Bc=B_c =
the current asset balance amount
L=L =
the current number of outstanding liability tokens

Asset Payout

Used to calculate the asset payout for a given number of burned tokens.
A=(B+L)TbTtA = (B+L) \frac {T_b} {T_t}
Where:
A=A =
the amount of the asset paid out
B=B =
the asset balance in the pool
L=L =
the total number of liability tokens outstanding
Tb=T_b =
the number of pool tokens burned
Tt=T_t =
the total number of pool tokens burned

Maximum Liquidation Amount

Used to calculate the maximum amount of a loan's value the liquidator is allowed to liquidate in order to reach a health factor of 1.02.
ΔVl=FaˉVc1.02VlIˉFwˉ1.02\Delta V_l = \frac {\bar {F_a} * V_c - 1.02 *V_l} {\bar{I} * \bar{F_w} - 1.02}
Where:
ΔVl=\Delta V_l =
the maximum allowable liquidation amount
Faˉ=\bar{F_a} =
the average liquidation for the account's collateral balances
Vc=V_c =
the collateral value
Vl=V_l =
the liability value
Iˉ=\bar{I} =
the average liquidation incentive for the collateral assets being withdrawn
Fwˉ=\bar {F_w} =
the average liquidation factor for the collateral assets being withdrawn

Health Factor

Used to calculate an account's health factor.
H=i=1CFiVcii=1LVliH=\frac {\sum^{|C|}_{i=1}Fi*V_{ci}} {\sum^{|L|}_{i=1}V_{li}}
Where:
H=H =
the account's health factor
C=|C| =
the number of collateral assets
Fi=F_i =
the liquidation factor for asset
ii
Vci=V_{ci} =
the collateral value of collateral asset
ii
L=|L| =
the number of outstanding loans
Vli=V_{li} =
the liability value of loaned asset
ii

Maximum Liability

Used to calculate the maximum liability an account can hold at one time.
Vl=i=1CFiVci1.02V_l = \frac {\sum^{|C|}_{i=1} F_i V_{ci}} {1.02}
Where:
Vl=V_l =
the maximum liability value for an account
C=|C| =
the number of collateral assets
Fi=F_i =
the liquidation factor for asset
ii
Vci=V_{ci} =
the collateral value of collateral asset
ii

YBX Issuance

Used to calculate how much YBX to issue.
I=(TO)RI =(T-O)R
Where:
I=I =
the number of YBX issued
T=T =
the total number of YBX tokens to be issued; 1,500,000,000
O=O =
the total number of YBX tokens outstanding
R=R =
the total YBX issuance rate; initially 0.01

YBX Backstop Amount

Used to calculate how much of the user's liability should be repaid with the YBX backstop.
R=VlVcIaˉR =V_l - \frac {V_c} {\bar {I_a}}
R=R =
the YBX backstop repayment amount
Vl=V_l =
the liability value
Vc=V_c =
the collateral value
Iaˉ=\bar {I_a} =
the average liquidation incentive for the account's collateral balances
Last modified 1mo ago