Math
Calculations used in the YieldBlox protocol.
Used to calculate the current utilization ratio for an asset.
Used to calculate the originating utilization for an asset.
Where:
the originating utilization ratio
the utilization delta payment 2 utilization-modifying transactions after loan origination
the block of the next utilization-modifying transaction
the loan origination block
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.
Where:
the utilization tracker delta
the total number of liability tokens at the pre-transaction ledger state of the last utilization-modifying transaction
the total pool balance at the pre-transaction ledger state of the last utilization-modifying transaction
the block of the last utilization-modifying transaction
the block of the second-to-last utilization-modifying transaction
Used to calculate the necessary utilization ratio delta adjustment.
Where:
the utilization adjustment
the place of the furthest back incorrect utilization delta payment
the place of the utilization delta payment of the last utilization-modifying transaction
the total number of liability tokens at the pre-transaction ledger state of the utilization-modifying transaction 2 utilization-modifying transactions ago
the total pool balance at the pre-transaction ledger state of the utilization-modifying transaction 2 utilization-modifying transactions ago
the block of second-to-last utilization-modifying transaction
the block of the third-to-last utilization-modifying transaction
the utilization delta payment of the last utilization-modifying transaction
the utilization adjustment payment of the last utilization-modifying transaction
Used to calculate the average utilization ratio for a loan.
Where:
the average utilization ratio
the current utilization tracker balance
the utilization tracker balance at the time of loan origination
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)
the utilization ratio adjustment
the block of the last utilization delta payment
the block at loan origination
the current utilization ratio
the current block
Used to calculate accrued interest tracker updates
Accrued interest tracker update amount
The block the last accrued interest tracker update occured on
The block the accrued interest tracker update before last occured on
Average blocks per year. Hardcoded variable. Assumed to be 6,307,200 (5-sec ledger close time).
Accrued interest tracker balance
Equations used to calculate the value of liability tokens and user liabilities.
The number of liability tokens issued to a user when they borrow from the pool.
liability tokens issued
Borrow amount
Accrued Interest tracker balance for the asset being borrowed
Estimated next accrued interest tracker balance
The value of a single liability token. Used when calculating the value of a user's liability.
The value of a liability token
Accrued Interest tracker balance for the asset being borrowed
Estimated next accrued interest tracker balance
Liabilities Outstanding for a given asset
liabilities outstanding
liability tokens outstanding
liability token value
Interest rates change based on the interest threshold and rates below.
threshold one; initially set to 0.75
threshold two; initially set to 0.90
threshold three; initially set to 0.95
rate zero; initially set to 0.20
rate one; initially set to 1.5
rate two; initially set to 7.5
rate three; initially set to 15
Used to calculate the current interest rate when the utilization rate is below
.
Where:
the base interest rate
the utilization ratio
the base rate constant (low
). It is set by a pool data entry and controls the base interest rate for an asset; initially set to 0.05
Used to calculate the current interest rate when the utilization rate is above
.
Where:
interest rate one
the utilization ratio
the base interest rate
Used to calculate the interest rate when the utilization rate is above
.
Where:
interest rate two
the utilization ratio
interest rate one
Used to calculate the interest rate when the utilization rate is above
.
Where:
interest rate three
the utilization ratio
interest rate two
Calculated using the above interest rate equations, but
becomes an aggregated utilization ratio.
Calculated using the above interest rate equations, but
becomes an originating utilization ratio.
Used to calculate the stable interest rate for a loan.
Where:
the stable rate
the originating interest rate
the utilization ratio at the time the loan was originated
Used to calculate the minimum collateral required for a loan.
Where:
the minimum collateral value requirement
the value of the loan
the average liquidation factor of the selected collateral types
Used to calculate the number of pool tokens issued to a user account.
Where:
the number of pool tokens to be issued to the user
the asset balance the user deposited
the current number of outstanding pool tokens
the current asset balance amount
the current number of outstanding liability tokens
Used to calculate the value of a pool token
Where:
the value of a pool token
the asset balance in the pool
the total number of liability tokens outstanding
the total number of pool tokens
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.
Where:
the maximum allowable liquidation amount
the average liquidation for the account's collateral balances
the collateral value
the liability value
the average liquidation incentive for the collateral assets being withdrawn
the average liquidation factor for the collateral assets being withdrawn
Used to calculate an account's health factor.
Where:
the account's health factor
the number of collateral assets
the liquidation factor for asset
the collateral value of collateral asset
the number of outstanding loans
the liability value of loaned asset
Used to calculate the maximum liability an account can hold at one time.
Where:
the maximum liability value for an account
the number of collateral assets
the liquidation factor for asset
the collateral value of collateral asset
Used to calculate how much YBX to issue.
Where:
the number of YBX issued
the total number of YBX tokens to be issued; 1,500,000,000
the total number of YBX tokens outstanding
the total YBX issuance rate; initially 0.0075
Used to calculate how much YBX to issue per liability or pool token
Where:
the issuance ratio for a given liability or pool token
the issuance allocation for the given liability or pool token
the total number of YBX tokens to be issued for the period
the total number of the given liability or pool token in claimable balances
Used to calculate the pessimistic block-average position size for a given collateral or liability position. Used to calculate YBX issuance for a position
Where:
the positions pessimistic block-weighted average size
the most recent position size
the previous position size
the block of the most recent issuance update payment
the block the position was last modified on
the greater of the block of the last issuance update payment prior to the position being modified and the block the position was last modified on before the most recent modification.
Used to calculate how much of the user's liability should be taken on as pool debt as part of the Default Protection Program.
the YieldBlox Default Protection amount
the liability value
the collateral value
the average liquidation incentive for the account's collateral balances
Last modified 1yr ago