MoCState
↗ Extends: MoCLibConnection, MoCBase, MoCEMACalculator, IMoCState ↘ Derived Contracts: MoCStateMock
MoCState - version: 0.1.12
struct InitializeParams {
address connectorAddress,
address governor,
address btcPriceProvider,
uint256 liq,
uint256 utpdu,
uint256 maxDiscRate,
uint256 dayBlockSpan,
uint256 ema,
uint256 smoothFactor,
uint256 emaBlockSpan,
uint256 maxMintBPro,
address mocPriceProvider,
address mocTokenAddress,
address mocVendorsAddress,
bool liquidationEnabled,
uint256 protected
}
Constants & Variables
enum IMoCState.States public state;
uint256 public dayBlockSpan;
uint256 public peg;
uint256 public bproMaxDiscountRate;
uint256 public liq;
uint256 public utpdu;
uint256 public rbtcInSystem;
uint256 public liquidationPrice;
bool public liquidationEnabled;
uint256 public protected;
uint256 public maxMintBPro;
contract PriceProvider internal btcPriceProvider;
contract IMoCSettlement internal mocSettlement;
address internal DEPRECATED_mocConverter;
contract DocToken internal docToken;
contract BProToken internal bproToken;
contract MoCBProxManager internal bproxManager;
contract PriceProvider internal mocPriceProvider;
contract MoCToken internal mocToken;
address internal mocVendors;
uint256[50] private upgradeGap;
Parameters
Name | Type | Description |
---|---|---|
newState | enum IMoCState.States | |
Parameters
Name | Type | Description |
---|---|---|
oldAddress | address | |
newAddress | address | |
Parameters
Name | Type | Description |
---|---|---|
oldAddress | address | |
newAddress | address | |
Parameters
Name | Type | Description |
---|---|---|
mocTokenAddress | address | |
Parameters
Name | Type | Description |
---|---|---|
mocVendorsAddress | address | |
Initializes the contract
function initialize(struct MoCState.InitializeParams params) public nonpayable initializer
Arguments
Name | Type | Description |
---|---|---|
params | struct MoCState.InitializeParams | Params defined in InitializeParams struct |
Sets the max discount rate.
function setMaxDiscountRate(uint256 rate) public nonpayable onlyAuthorizedChanger
Arguments
Name | Type | Description |
---|---|---|
rate | uint256 | Discount rate at liquidation level [using mocPrecision] |
Returns the value of the BPro max discount rate configuration param
function getMaxDiscountRate() public view
returns(uint256)
Returns
bproMaxDiscountRate BPro max discount rate
Arguments
Defines how many blocks there are in a day
function setDayBlockSpan(uint256 blockSpan) public nonpayable onlyAuthorizedChanger
Arguments
Name | Type | Description |
---|---|---|
blockSpan | uint256 | blocks there are in a day |
Sets a new BTCProvider contract
function setBtcPriceProvider(address btcProviderAddress) public nonpayable onlyAuthorizedChanger
Arguments
Name | Type | Description |
---|---|---|
btcProviderAddress | address | address of the BTC price provider contract |
Gets the BTCPriceProviderAddress
function getBtcPriceProvider() public view
returns(address)
Returns
address of the BTC price provider contract
Arguments
Gets how many blocks there are in a day
function getDayBlockSpan() public view
returns(uint256)
Returns
blocks there are in a day
Arguments
⤾ overrides IMoCState.subtractRbtcFromSystem
Subtract the btc amount passed by parameter to the total Bitcoin Amount
function subtractRbtcFromSystem(uint256 btcAmount) public nonpayable onlyWhitelisted
Arguments
Name | Type | Description |
---|---|---|
btcAmount | uint256 | Amount that will be subtract to rbtcInSystem |
⤾ overrides IMoCState.addToRbtcInSystem
btcAmount Add the btc amount passed by parameter to the total Bitcoin Amount
function addToRbtcInSystem(uint256 btcAmount) public nonpayable onlyWhitelisted
Arguments
Name | Type | Description |
---|---|---|
btcAmount | uint256 | Amount that will be added to rbtcInSystem |
All BPros in circulation
function bproTotalSupply() public view
returns(uint256)
Arguments
All docs in circulation
function docTotalSupply() public view
returns(uint256)
Arguments
Target coverage for complete system
function cobj() public view
returns(uint256)
Arguments
Amount of Bitcoins in the system excluding BTCx values and interests holdings
function collateralRbtcInSystem() public view
returns(uint256)
Arguments
⤾ overrides IMoCState.globalCoverage
GLOBAL Coverage
function globalCoverage() public view
returns(uint256)
Returns
coverage [using mocPrecision]
Arguments
BUCKET lockedBitcoin
function lockedBitcoin(bytes32 bucket) public view
returns(uint256)
Returns
lockedBitcoin amount [using reservePrecision]
Arguments
Name | Type | Description |
---|---|---|
bucket | bytes32 | Name of the bucket used |
Gets RBTC in BitPro within specified bucket
function getRbtcInBitPro(bytes32 bucket) public view
returns(uint256)
Returns
Bitcoin amount of BitPro in Bucket [using reservePrecision]
Arguments
Name | Type | Description |
---|---|---|
bucket | bytes32 | Name of the bucket used |
⤾ overrides IMoCState.getRbtcRemainder
Gets the RBTC in the contract that not corresponds to Doc collateral
function getRbtcRemainder() public view
returns(uint256)
Returns
RBTC remainder [using reservePrecision]
Arguments
⤾ overrides IMoCState.coverage
BUCKET Coverage
function coverage(bytes32 bucket) public view
returns(uint256)
Returns
coverage [using coveragePrecision]
Arguments
Name | Type | Description |
---|---|---|
bucket | bytes32 | Name of the bucket used |
⤾ overrides IMoCState.abundanceRatio
Abundance ratio, receives tha amount of doc to use the value of doc0 and Doc total supply
function abundanceRatio(uint256 doc0) public view
returns(uint256)
Returns
abundance ratio [using mocPrecision]
Arguments
Name | Type | Description |
---|---|---|
doc0 | uint256 | |
⤾ overrides IMoCState.currentAbundanceRatio
Relation between docs in bucket 0 and Doc total supply
function currentAbundanceRatio() public view
returns(uint256)
Returns
abundance ratio [using mocPrecision]
Arguments
⤾ overrides IMoCState.leverage
BUCKET Leverage
function leverage(bytes32 bucket) public view
returns(uint256)
Returns
coverage [using mocPrecision]
Arguments
Name | Type | Description |
---|---|---|
bucket | bytes32 | Name of the bucket used |
GLOBAL maxDoc
function globalMaxDoc() public view
returns(uint256)
Returns
abundance ratio [using mocPrecision]
Arguments
⤾ overrides IMoCState.freeDoc
Returns the amount of DoCs in bucket 0, that can be redeemed outside of settlement
function freeDoc() public view
returns(uint256)
Returns
amount of docs in bucket 0, that can be redeemed outside of settlement [using mocPrecision]
Arguments
BUCKET maxDoc
function maxDoc(bytes32 bucket) public view
returns(uint256)
Returns
abundance ratio [using mocPrecision]
Arguments
Name | Type | Description |
---|---|---|
bucket | bytes32 | |
GLOBAL maxBPro
function globalMaxBPro() public view
returns(uint256)
Returns
maxBPro for redeem [using reservePrecision]
Arguments
⤾ overrides IMoCState.absoluteMaxDoc
ABSOLUTE maxDoc
function absoluteMaxDoc() public view
returns(uint256)
Returns
maxDoc to issue [using mocPrecision]
Arguments
BUCKET maxBPro to redeem / mint
function maxBPro(bytes32 bucket) public view
returns(uint256)
Returns
maxBPro for redeem [using mocPrecision]
Arguments
Name | Type | Description |
---|---|---|
bucket | bytes32 | Name of the bucket used |
⚠ 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 bprox to mint
function maxBProx(bytes32 bucket) public view
returns(uint256)
Returns
maxBProx [using reservePrecision]
Arguments
Name | Type | Description |
---|---|---|
bucket | bytes32 | Name of the bucket used |
⚠ 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.maxBProxBtcValue
GLOBAL max bprox to mint
function maxBProxBtcValue(bytes32 bucket) public view
returns(uint256)
Returns
maxBProx BTC value to mint [using reservePrecision]
Arguments
Name | Type | Description |
---|---|---|
bucket | bytes32 | Name of the bucket used |
⤾ overrides IMoCState.absoluteMaxBPro
ABSOLUTE maxBPro
function absoluteMaxBPro() public view
returns(uint256)
Returns
maxDoc to issue [using mocPrecision]
Arguments
⤾ overrides IMoCState.maxBProWithDiscount
DISCOUNT maxBPro
function maxBProWithDiscount() public view
returns(uint256)
Returns
maxBPro for mint with discount [using mocPrecision]
Arguments
GLOBAL lockedBitcoin
function globalLockedBitcoin() public view
returns(uint256)
Returns
lockedBitcoin amount [using reservePrecision]
Arguments
⤾ overrides IMoCState.bproTecPrice
BTC price of BPro
function bproTecPrice() public view
returns(uint256)
Returns
the BPro Tec Price [using reservePrecision]
Arguments
⤾ overrides IMoCState.bucketBProTecPrice
BUCKET BTC price of BPro
function bucketBProTecPrice(bytes32 bucket) public view
returns(uint256)
Returns
the BPro Tec Price [using reservePrecision]
Arguments
Name | Type | Description |
---|---|---|
bucket | bytes32 | Name of the bucket used |
⤾ overrides IMoCState.bucketBProTecPriceHelper
BUCKET BTC price of BPro (helper)
function bucketBProTecPriceHelper(bytes32 bucket) public view
returns(uint256)
Returns
the BPro Tec Price [using reservePrecision]