MoCHelperLib
View Source: contracts/MoCHelperLib.sol
MoCHelperLib - version: 0.1.12
Structs
MocLibConfig
Contract Members
Constants & Variables
Functions
getMaxInt
Returns max uint256 value constant.
Returns
max uint256 value constant
Arguments
inrateAvg
Calculates average interest using integral function: T = Rate = a * (x ** b) + c
Returns
average interest rate [using mocPrecision]
Arguments
spotInrate
⚠ This has been deprecated since the Proposal to remove leveraged positions from the protocol was approved, however it is necessary to maintain the contracts and their documentation for legacy support.
Calculates spot interest rate that BProx owners should pay to BPro owners: Rate = tMax * (abRatio ** power) + tMin
Arguments
potential
Calculates potential interests function with given parameters: Rate = a * (x ** b) + c
Arguments
avgInt
Calculates average of the integral function: T = ( (c * xf + ((a * (xf ** (b + 1))) / (b + 1))) - (c * xi + ((a * (xi ** (b + 1))) / (b + 1))) ) / (xf - xi)
Returns
average interest rate [using mocPrecision]
Arguments
integral
Calculates integral of the exponential function: T = c * (value) + (a * value ** (b + 1)) / (b + 1))
Returns
integration result [using mocPrecision]
Arguments
abundanceRatio
Relation between docs in bucket 0 and Doc total supply
Returns
abundance ratio [using mocPrecision]
Arguments
bproSpotDiscountRate
Returns the Ratio to apply to BPro Price in discount situations: SpotDiscountRate = TPD * (utpdu - cob) / (uptdu -liq)
Returns
Spot discount rate [using mocPrecision]
Arguments
maxBProWithDiscount
Max amount of BPro to available with discount: MaxBProWithDiscount = (uTPDU * nDOC * PEG - (nBTC * B)) / (TPusd * TPD)
Returns
Total BPro amount [using mocPrecision]
Arguments
maxBProWithDiscountAux
Max amount of BPro to available with discount: MaxBProWithDiscount = (uTPDU * nDOC * PEG - (nBTC * B)) / (TPusd * TPD)
Returns
Total BPro amount [using mocPrecision]
Arguments
lockedBitcoin
Calculates Locked bitcoin
Returns
Locked bitcoin [using reservePrecision]
Arguments
liquidationPrice
Calculates price at liquidation event as a relation between the doc total supply and the amount of RBTC available to distribute
Returns
Price at liquidation event [using mocPrecision]
Arguments
bproTecPrice
Calculates BPro BTC price: TPbtc = (nB-LB) / nTP
Returns
BPro BTC price [using reservePrecision]
Arguments
bproxBProPrice
⚠ This has been deprecated since the Proposal to remove leveraged positions from the protocol was approved, however it is necessary to maintain the contracts and their documentation for legacy support.
Calculates BPro BTC price: BProxInBPro = bproxTecPrice / bproPrice
Returns
BProx price in BPro [using mocPrecision]
Arguments
applyDiscountRate
Returns a new value with the discountRate applied: TPbtc = (price)* (1 - discountRate)
Returns
Price with discount applied [using SomePrecision]
Arguments
getInterestCost
Returns the amount of interest to pay: TPbtc = price * interestRate
Returns
Interest cost based on the value and interestRate [using SomePrecision]
Arguments
coverage
Calculates Coverage: Coverage = nB / LB
Returns
Coverage [using mocPrecision]
Arguments
leverageFromCoverage
Calculates Leverage from Coverage: Leverage = C / (C - 1)
Returns
Leverage [using mocPrecision]
Arguments
leverage
Calculates Leverage: Leverage = nB / (nB - lB)
Returns
Leverage [using mocPrecision]
Arguments
docsBtcValue
Price in BTC of the amount of Docs
Returns
Total value [using reservePrecision]
Arguments
bproBtcValue
Price in RBTC of the amount of BPros
Returns
Total value [using reservePrecision]
Arguments
maxDoc
Max amount of Docs to issue: MaxDoc = ((nBB)-(CobjB/BconsnDocPEG))/(PEG*(Cobj*B/BCons-1))
Returns
Total Docs amount [using mocPrecision]
Arguments
maxDocAux
Arguments
maxBPro
Max amount of BPro to redeem: MaxBPro = ((nBB)-(CobjnDoc*PEG))/TPusd
Returns
Total BPro amount [using mocPrecision]
Arguments
totalBProInBtc
Calculates the total BTC price of the amount of BPros
Returns
BPro total value in BTC [using reservePrecision]
Arguments
maxDocsWithBtc
Calculates the equivalent in Docs of the btcAmount
Returns
Equivalent Doc amount [using mocPrecision]
Arguments
maxBProWithBtc
Calculates the equivalent in BPro of the btcAmount
Returns
Equivalent Bpro amount [using mocPrecision]
Arguments
bucketTransferAmount
Calculates the Btc amount to move from C0 bucket to: toMove = btcAmount * (lev - 1) an L bucket when a BProx minting occurs
Returns
btc to move [using reservePrecision]
Arguments
maxBProxBtcValue
⚠ This has been deprecated since the Proposal to remove leveraged positions from the protocol was approved, however it is necessary to maintain the contracts and their documentation for legacy support.
Max amount of BTC allowed to be used to mint bprox: Maxbprox = nDOC/ (PEGB(lev-1))
Returns
Max bprox BTC value [using reservePrecision]
Arguments
maxMoCWithBtc
Calculates the equivalent in MoC of the btcAmount
Returns
Equivalent MoC amount
Arguments
mocBtcValue
Calculates the equivalent in BTC of the MoC amount
Returns
Equivalent MoC amount
Arguments
getPayableAddress
Transform an address to payable address
Returns
Payable address for account
Arguments
mulr
Rounding product adapted from DSMath but with custom precision
Returns
Product
Arguments
pow
Potentiation by squaring adapted from DSMath but with custom precision
Returns
power
Arguments
Last updated