MoCState
View Source: contracts/MoCState.sol
↗ Extends: MoCLibConnection, MoCBase, MoCEMACalculator, IMoCState ↘ Derived Contracts: MoCStateMock
MoCState - version: 0.1.10
Structs
InitializeParams
struct InitializeParams {
address connectorAddress,
address governor,
address priceProvider,
uint256 liq,
uint256 utpdu,
uint256 maxDiscRate,
uint256 dayBlockSpan,
uint256 ema,
uint256 smoothFactor,
uint256 emaBlockSpan,
uint256 maxMintRiskPro,
address mocPriceProvider,
address mocTokenAddress,
address mocVendorsAddress,
bool liquidationEnabled,
uint256 protected
}Contract Members
Constants & Variables
StateTransition
Parameters
newState
enum IMoCState.States
PriceProviderUpdated
Parameters
oldAddress
address
newAddress
address
MoCPriceProviderUpdated
Parameters
oldAddress
address
newAddress
address
MoCTokenChanged
Parameters
mocTokenAddress
address
MoCVendorsChanged
Parameters
mocVendorsAddress
address
Functions
initialize
⤿ Overridden Implementation(s): MoCStateMock.initialize
Initializes the contract
Arguments
params
struct MoCState.InitializeParams
Params defined in InitializeParams struct
setMaxDiscountRate
Sets the max discount rate.
Arguments
rate
uint256
Discount rate at liquidation level [using mocPrecision]
getMaxDiscountRate
return the value of the RiskPro max discount rate configuration param
Returns
riskProMaxDiscountRate RiskPro max discount rate
Arguments
setDayBlockSpan
Defines how many blocks there are in a day
Arguments
blockSpan
uint256
blocks there are in a day
setPriceProvider
Sets a new PriceProvider contract
Arguments
priceProviderAddress
address
address of the price provider contract
getPriceProvider
Gets the PriceProviderAddress
Returns
address of the price provider contract
Arguments
getDayBlockSpan
Gets how many blocks there are in a day
Returns
blocks there are in a day
Arguments
substractFromReserves
⤾ overrides IMoCState.substractFromReserves
Subtract the reserve amount passed by parameter to the reserves total
Arguments
amount
uint256
Amount that will be subtract to reserves
addToReserves
⤾ overrides IMoCState.addToReserves
Add the reserve amount passed by parameter to the reserves total
Arguments
amount
uint256
Amount that will be added to reserves
riskProTotalSupply
All RiskPros in circulation
Arguments
stableTokenTotalSupply
All stableTokens in circulation
Arguments
cobj
Target coverage for complete system
Arguments
collateralReserves
Amount of ReserveTokens in the system excluding RiskProx values and interests holdings
Arguments
globalCoverage
⤾ overrides IMoCState.globalCoverage
GLOBAL Coverage
Returns
coverage [using mocPrecision].
Arguments
lockedReserveTokens
BUCKET lockedReserveTokens
Returns
lockedReserveTokens amount [using reservePrecision].
Arguments
bucket
bytes32
Name of the bucket used
getResTokensInRiskPro
Gets ReserveTokens in RiskPro within specified bucket
Returns
ReserveToken amount of RiskPro in Bucket [using reservePrecision].
Arguments
bucket
bytes32
Name of the bucket used
getReservesRemainder
⤾ overrides IMoCState.getReservesRemainder
Gets the ReserveTokens in the contract that not corresponds to StableToken collateral
Returns
ReserveTokens remainder [using reservePrecision].
Arguments
coverage
⤾ overrides IMoCState.coverage
BUCKET Coverage
Returns
coverage [using mocPrecision]
Arguments
bucket
bytes32
Name of the bucket used
abundanceRatio
⤾ overrides IMoCState.abundanceRatio
Abundance ratio, receives tha amount of stableToken to use the value of stableToken0 and StableToken total supply
Returns
abundance ratio [using mocPrecision]
Arguments
stableToken0
uint256
currentAbundanceRatio
⤾ overrides IMoCState.currentAbundanceRatio
Relation between stableTokens in bucket 0 and StableToken total supply
Returns
abundance ratio [using mocPrecision]
Arguments
leverage
⤾ overrides IMoCState.leverage
BUCKET Leverage
Returns
leverage [using mocPrecision]
Arguments
bucket
bytes32
Name of the bucket used
globalMaxStableToken
GLOBAL maxStableToken
Returns
maxStableToken to issue [using mocPrecision]
Arguments
freeStableToken
⤾ overrides IMoCState.freeStableToken
Returns the amount of stableTokens in bucket 0, that can be redeemed outside of settlement
Returns
amount of stableTokens in bucket 0, that can be redeemed outside of settlement [using mocPrecision]
Arguments
maxStableToken
BUCKET maxStableToken
Returns
maxStableToken to issue [using mocPrecision]
Arguments
bucket
bytes32
globalMaxRiskPro
GLOBAL maxRiskPro
Returns
maxRiskPro for redeem [using mocPrecision].
Arguments
absoluteMaxStableToken
⤾ overrides IMoCState.absoluteMaxStableToken
ABSOLUTE maxStableToken
Returns
maxStableToken to issue [using mocPrecision]
Arguments
maxRiskPro
BUCKET maxRiskPro to redeem / mint
Returns
maxRiskPro for redeem [using mocPrecision].
Arguments
bucket
bytes32
Name of the bucket used
maxRiskProx
âš 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.
GLOBAL max riskProx to mint
Returns
maxRiskProx [using mocPrecision]
Arguments
bucket
bytes32
Name of the bucket used
maxRiskProxResTokenValue
âš 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.
⤾ overrides IMoCState.maxRiskProxResTokenValue
GLOBAL max riskProx to mint
Returns
maxRiskProx ReserveTokens value to mint [using reservePrecision]
Arguments
bucket
bytes32
Name of the bucket used
absoluteMaxRiskPro
⤾ overrides IMoCState.absoluteMaxRiskPro
ABSOLUTE maxRiskPro
Returns
maxStableToken to issue [using mocPrecision].
Arguments
maxRiskProWithDiscount
⤾ overrides IMoCState.maxRiskProWithDiscount
DISCOUNT maxRiskPro
Returns
maxRiskPro for mint with discount [using mocPrecision]
Arguments
globalLockedReserveTokens
GLOBAL lockedReserveTokens
Returns
lockedReserveTokens amount [using reservePrecision].
Arguments
riskProTecPrice
⤾ overrides IMoCState.riskProTecPrice
ReserveTokens price of RiskPro
Returns
the RiskPro Tec Price [using reservePrecision].
Arguments
bucketRiskProTecPrice
⤾ overrides IMoCState.bucketRiskProTecPrice
BUCKET ReserveTokens price of RiskPro
Returns
the RiskPro Tec Price [using reservePrecision]
Arguments
bucket
bytes32
Name of the bucket used
bucketRiskProTecPriceHelper
⤾ overrides IMoCState.bucketRiskProTecPriceHelper
BUCKET ReserveTokens price of RiskPro (helper)
Returns
the RiskPro Tec Price [using reservePrecision]
Arguments
bucket
bytes32
Name of the bucket used
riskProDiscountPrice
⤾ overrides IMoCState.riskProDiscountPrice
ReserveTokens price of RiskPro with spot discount applied
Returns
the RiskPro Tec Price [using reservePrecision].
Arguments
riskProUsdPrice
RiskPro USD PRICE
Returns
the RiskPro USD Price [using mocPrecision]
Arguments
maxRiskProxRiskProValue
âš 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.
GLOBAL max riskProx to mint
Returns
max RiskPro allowed to be spent to mint RiskProx [using reservePrecision]
Arguments
bucket
bytes32
Name of the bucket used
riskProxRiskProPrice
âš 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.
BUCKET RiskProx price in RiskPro
Returns
RiskPro RiskPro Price [[using mocPrecision]Precision].
Arguments
bucket
bytes32
Name of the bucket used
riskProSpotDiscountRate
⤾ overrides IMoCState.riskProSpotDiscountRate
GLOBAL ReserveTokens Discount rate to apply to RiskProPrice.
Returns
RiskPro discount rate [using DISCOUNT_PRECISION].
Arguments
daysToSettlement
⤾ overrides IMoCState.daysToSettlement
⤿ Overridden Implementation(s): MoCStateMock.daysToSettlement
Calculates the number of days to next settlement based dayBlockSpan
Returns
days to next settlement
Arguments
blocksToSettlement
Number of blocks to settlement
Returns
Number of blocks to settlement
Arguments
isLiquidationReached
Verifies if forced liquidation is reached checking if globalCoverage <= liquidation (currently 1.04) and if liquidation is enabled
Returns
true if liquidation state is reached, false otherwise
Arguments
getLiquidationPrice
⤾ overrides IMoCState.getLiquidationPrice
Returns the price to use for stableToken redeem in a liquidation event
Returns
price to use for stableToken redeem in a liquidation event
Arguments
getBucketNReserve
⤾ overrides IMoCState.getBucketNReserve
Arguments
bucket
bytes32
getBucketNRiskPro
Arguments
bucket
bytes32
getBucketNStableToken
Arguments
bucket
bytes32
getBucketCobj
Arguments
bucket
bytes32
getInrateBag
Arguments
bucket
bytes32
getBcons
Arguments
getReserveTokenPrice
⤾ overrides IMoCState.getReserveTokenPrice
Arguments
calculateReserveTokenMovingAverage
Arguments
getLiq
return the value of the liq threshold configuration param
Returns
liq threshold, currently 1.04
Arguments
setLiq
sets the value of the liq threshold configuration param
Arguments
_liq
uint256
liquidation threshold
getUtpdu
return the value of the utpdu threshold configuration param
Returns
utpdu Universal TPro discount sales coverage threshold
Arguments
setUtpdu
sets the value of the utpdu threshold configuration param
Arguments
_utpdu
uint256
Universal TPro discount sales coverage threshold
getPeg
returns the relation between StableToken and dollar. By default it is 1.
Returns
peg relation between StableToken and dollar
Arguments
setPeg
sets the relation between StableToken and dollar. By default it is 1.
Arguments
_peg
uint256
relation between StableToken and dollar
getProtected
⤾ overrides IMoCState.getProtected
return the value of the protected threshold configuration param
Returns
protected threshold, currently 1.5
Arguments
setProtected
sets the value of the protected threshold configuration param
Arguments
_protected
uint256
protected threshold
getLiquidationEnabled
returns if is liquidation enabled.
Returns
liquidationEnabled is liquidation enabled
Arguments
setLiquidationEnabled
returns if is liquidation enabled.
Arguments
_liquidationEnabled
bool
is liquidation enabled
nextState
⤾ overrides IMoCState.nextState
Transitions to next state.
Arguments
setMaxMintRiskPro
Sets max mint RiskPro value
Arguments
_maxMintRiskPro
uint256
[using mocPrecision]
getMaxMintRiskPro
return Max value posible to mint of RiskPro
Returns
maxMintRiskPro
Arguments
setMoCPriceProvider
Sets a new MoCProvider contract
Arguments
mocProviderAddress
address
MoC price provider address
getMoCPriceProvider
Gets the MoCPriceProviderAddress
Returns
MoC price provider address
Arguments
getMoCPrice
⤾ overrides IMoCState.getMoCPrice
Gets the MoCPrice
Returns
MoC price
Arguments
setMoCToken
Sets the MoC token contract address
Arguments
mocTokenAddress
address
MoC token contract address
getMoCToken
⤾ overrides IMoCState.getMoCToken
Gets the MoC token contract address
Returns
MoC token contract address
Arguments
setMoCVendors
Sets the MoCVendors contract address
Arguments
mocVendorsAddress
address
MoCVendors contract address
getMoCVendors
⤾ overrides IMoCState.getMoCVendors
Gets the MoCVendors contract addfress
Returns
MoCVendors contract address
Arguments
stableTokensToResToken
⤾ overrides IMoCState.stableTokensToResToken
Arguments
stableTokenAmount
uint256
resTokenToStableToken
⤾ overrides IMoCState.resTokenToStableToken
Arguments
resTokensAmount
uint256
riskProxToResToken
âš 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.
⤾ overrides IMoCState.riskProxToResToken
Arguments
riskProxAmount
uint256
bucket
bytes32
riskProxToResTokenHelper
âš 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.
Arguments
riskProxAmount
uint256
bucket
bytes32
resTokenToRiskProx
âš 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.
⤾ overrides IMoCState.resTokenToRiskProx
Arguments
resTokensAmount
uint256
bucket
bytes32
setMoCTokenInternal
Sets the MoC token contract address (internal function)
Arguments
mocTokenAddress
address
MoC token contract address
setMoCVendorsInternal
Sets the MoCVendors contract address (internal function)
Arguments
mocVendorsAddress
address
MoCVendors contract address
setLiquidationPrice
Calculates price at liquidation event as the relation between the stableToken total supply and the amount of ReserveTokens available to distribute
Arguments
initializeValues
Arguments
_governor
address
_priceProvider
address
_liq
uint256
_utpdu
uint256
_maxDiscRate
uint256
_dayBlockSpan
uint256
_maxMintRiskPro
uint256
_mocPriceProvider
address
_liquidationEnabled
bool
_protected
uint256
initializeContracts
Arguments
_mocTokenAddress
address
_mocVendorsAddress
address
Last updated