MoC
View Source: contracts/MoC.sol
↗ Extends: MoCEvents, MoCReserve, MoCLibConnection, MoCBase, Stoppable, IMoC
MoC - version: 0.1.10
Contract Members
Constants & Variables
address internal stableToken;
contract RiskProToken internal riskProToken;
contract MoCRiskProxManager internal riskProxManager;
contract IMoCState internal mocState;
address internal DEPRECATED_mocConverter;
contract IMoCSettlement internal settlement;
contract IMoCExchange internal mocExchange;
contract IMoCInrate internal mocInrate;
bool internal liquidationExecuted;
address public DEPRECATED_mocBurnout;
uint256[50] private upgradeGap;
BucketLiquidation
Parameters
bucket
bytes32
ContractLiquidated
Parameters
mocAddress
address
Modifiers
whenSettlementReady
modifier whenSettlementReady() internal
Arguments
atState
modifier atState(enum IMoCState.States _state) internal
Arguments
_state
enum IMoCState.States
atLeastState
modifier atLeastState(enum IMoCState.States _state) internal
Arguments
_state
enum IMoCState.States
atMostState
modifier atMostState(enum IMoCState.States _state) internal
Arguments
_state
enum IMoCState.States
notInProtectionMode
modifier notInProtectionMode() internal
Arguments
bucketStateTransition
modifier bucketStateTransition(bytes32 bucket) internal
Arguments
bucket
bytes32
availableBucket
modifier availableBucket(bytes32 bucket) internal
Arguments
bucket
bytes32
notBaseBucket
modifier notBaseBucket(bytes32 bucket) internal
Arguments
bucket
bytes32
transitionState
modifier transitionState() internal
Arguments
Functions
initialize
Initializes the contract
function initialize(address connectorAddress, address governorAddress, address stopperAddress, bool startStoppable) public nonpayable initializer
Arguments
connectorAddress
address
MoCConnector contract address
governorAddress
address
Governor contract address
stopperAddress
address
Stopper contract address
startStoppable
bool
Indicates if the contract starts being unstoppable or not
riskProxBalanceOf
âš 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.
Gets the RiskProx balance of an address
function riskProxBalanceOf(bytes32 bucket, address account) public view
returns(uint256)
Returns
RiskProx balance of the address
Arguments
bucket
bytes32
Name of the bucket
account
address
Address
getRedeemRequestAt
Gets the RedeemRequest at the queue index position
function getRedeemRequestAt(uint256 index) public view
returns(address, uint256)
Returns
redeemer's address and amount he submitted
Arguments
index
uint256
queue position to get
redeemQueueSize
Returns current redeem queue size
function redeemQueueSize() public view
returns(uint256)
Returns
redeem queue size
Arguments
stableTokenAmountToRedeem
Returns the total amount of StableTokens in the redeem queue for redeemer
function stableTokenAmountToRedeem(address redeemer) public view
returns(uint256)
Returns
total amount of Docs in the redeem queue for redeemer
Arguments
redeemer
address
address for which ^ is computed
redeemStableTokenRequest
Creates or updates the amount of a StableToken redeem Request from the msg.sender
function redeemStableTokenRequest(uint256 stableTokenAmount) public nonpayable whenNotPaused whenSettlementReady
Arguments
stableTokenAmount
uint256
Amount of StableTokens to redeem on settlement [using mocPrecision]
alterRedeemRequestAmount
Alters the redeem amount position for the redeemer
function alterRedeemRequestAmount(bool isAddition, uint256 delta) public nonpayable whenNotPaused whenSettlementReady
Arguments
isAddition
bool
true if adding amount to redeem, false to substract.
delta
uint256
the amount to add/substract to current position
addReserves
⤾ overrides IMoC.addReserves
Adding tokens to the token reserve and C0 Bucket without minting any token. Could revert.
function addReserves(uint256 tokenAmount) public nonpayable
Arguments
tokenAmount
uint256
Amount to deposit.
mintRiskPro
Mints RiskPro and pays the comissions of the operation (retrocompatible function).
function mintRiskPro(uint256 resTokensToMint) public nonpayable
Arguments
resTokensToMint
uint256
Amount in ReserveToken to mint
mintRiskProVendors
Mints RiskPro and pays the comissions of the operation.
function mintRiskProVendors(uint256 resTokensToMint, address vendorAccount) public nonpayable whenNotPaused transitionState notInProtectionMode
Arguments
resTokensToMint
uint256
Amount Reserve Tokens to spend in minting
vendorAccount
address
Vendor address
redeemRiskPro
Redeems RiskPro Tokens and pays the comissions of the operation (retrocompatible function).
function redeemRiskPro(uint256 riskProAmount) public nonpayable
Arguments
riskProAmount
uint256
Amout in RiskPro
redeemRiskProVendors
Redeems RiskPro Tokens and pays the comissions of the operation in ReserveTokens
function redeemRiskProVendors(uint256 riskProAmount, address vendorAccount) public nonpayable whenNotPaused transitionState atLeastState
Arguments
riskProAmount
uint256
Amout in RiskPro
vendorAccount
address
Vendor address
mintStableToken
StableToken Doc tokens and pays the commisions of the operation (retrocompatible function).
function mintStableToken(uint256 resTokensToMint) public nonpayable
Arguments
resTokensToMint
uint256
Amount in ReserveToken to mint
mintStableTokenVendors
Mint StableToken tokens and pays the commisions of the operation
function mintStableTokenVendors(uint256 resTokensToMint, address vendorAccount) public nonpayable whenNotPaused transitionState atLeastState
Arguments
resTokensToMint
uint256
Amount in ReserveTokens to mint
vendorAccount
address
Vendor address
redeemRiskProx
âš 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.
Redeems RiskProx Tokens and pays the comissions of the operation in ReserveToken (retrocompatible function).
function redeemRiskProx(bytes32 bucket, uint256 riskProxAmount) public nonpayable
Arguments
bucket
bytes32
Bucket to reedem, for example X2
riskProxAmount
uint256
Amount in RiskProx
redeemRiskProxVendors
âš 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.
Redeems RiskProx Tokens and pays the comissions of the operation in ReserveTokens
function redeemRiskProxVendors(bytes32 bucket, uint256 riskProxAmount, address vendorAccount) public nonpayable whenNotPaused whenSettlementReady availableBucket notBaseBucket transitionState bucketStateTransition
Arguments
bucket
bytes32
Bucket to reedem, for example X2
riskProxAmount
uint256
Amount in RiskProx
vendorAccount
address
Vendor address
mintRiskProx
âš 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.
âš See the approved technical proposal to understand how the behavior of this function has changed.
BUCKET riskProx riskProx (retrocompatible function).
function mintRiskProx(bytes32 bucket, uint256 resTokensToMint) public nonpayable
Arguments
bucket
bytes32
Name of the bucket used
resTokensToMint
uint256
amount to mint on ReserveToken
mintRiskProxVendors
âš 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.
âš See the approved technical proposal to understand how the behavior of this function has changed.
BUCKET riskProx minting
function mintRiskProxVendors(bytes32 bucket, uint256 resTokensToMint, address vendorAccount) public nonpayable whenNotPaused whenSettlementReady availableBucket notBaseBucket transitionState bucketStateTransition
Arguments
bucket
bytes32
Name of the bucket used
resTokensToMint
uint256
amount to mint on ReserveToken
vendorAccount
address
Vendor address
redeemFreeStableToken
Redeems the requested amount for the msg.sender, or the max amount of free stableTokens possible (retrocompatible function).
function redeemFreeStableToken(uint256 stableTokenAmount) public nonpayable
Arguments
stableTokenAmount
uint256
Amount of StableTokens to redeem.
redeemFreeStableTokenVendors
Redeems the requested amount for the msg.sender, or the max amount of free stableTokens possible.
function redeemFreeStableTokenVendors(uint256 stableTokenAmount, address vendorAccount) public nonpayable whenNotPaused transitionState notInProtectionMode
Arguments
stableTokenAmount
uint256
Amount of StableTokens to redeem.
vendorAccount
address
Vendor address
redeemAllStableToken
Allow redeem on liquidation state, user StableTokens get burned and he receives the equivalent ReserveTokens if can be covered, or the maximum available*
function redeemAllStableToken() public nonpayable atState
Arguments
dailyInratePayment
Moves the daily amount of interest rate to C0 bucket
function dailyInratePayment() public nonpayable whenNotPaused
Arguments
payRiskProHoldersInterestPayment
Pays the RiskPro interest and transfers it to the address mocInrate.riskProInterestAddress RiskPro interests = Nb (bucket 0) * riskProRate.
function payRiskProHoldersInterestPayment() public nonpayable whenNotPaused
Arguments
calculateRiskProHoldersInterest
Calculates RiskPro holders holder interest by taking the total amount of RBCs available on Bucket 0. RiskPro interests = Nb (bucket 0) * riskProRate.
function calculateRiskProHoldersInterest() public view
returns(uint256, uint256)
Arguments
getRiskProInterestAddress
Gets the target address to transfer RiskPro Holders rate
function getRiskProInterestAddress() public view
returns(address)
Returns
Target address to transfer RiskPro Holders interest
Arguments
getRiskProRate
Gets the rate for RiskPro Holders
function getRiskProRate() public view
returns(uint256)
Returns
RiskPro Rate
Arguments
getRiskProInterestBlockSpan
Gets the blockspan of RiskPro that represents the frecuency of RiskPro holders interest payment
function getRiskProInterestBlockSpan() public view
returns(uint256)
Returns
returns power of bitProInterestBlockSpan
Arguments
isDailyEnabled
function isDailyEnabled() public view
returns(bool)
Arguments
isRiskProInterestEnabled
function isRiskProInterestEnabled() public view
returns(bool)
Arguments
isSettlementEnabled
Indicates if settlement is enabled
function isSettlementEnabled() public view
returns(bool)
Returns
Returns true if blockSpan number of blocks has passed since last execution; otherwise false
Arguments
isBucketLiquidationReached
Checks if bucket liquidation is reached.
function isBucketLiquidationReached(bytes32 bucket) public view
returns(bool)
Returns
true if bucket liquidation is reached, false otherwise
Arguments
bucket
bytes32
Name of bucket.
evalBucketLiquidation
function evalBucketLiquidation(bytes32 bucket) public nonpayable availableBucket notBaseBucket whenSettlementReady
Arguments
bucket
bytes32
evalLiquidation
Evaluates if liquidation state has been reached and runs liq if that's the case
function evalLiquidation() public nonpayable transitionState
Arguments
runSettlement
Runs all settlement process
function runSettlement(uint256 steps) public nonpayable whenNotPaused transitionState
Arguments
steps
uint256
Number of steps
sendToAddress
⤾ overrides IMoC.sendToAddress
Public function to extract and send tokens from the reserve. Will return false if transfer reverts or fails.
function sendToAddress(address receiver, uint256 tokenAmount) public nonpayable onlyWhitelisted
returns(bool)
Returns
False if RRC20 transfer fails or revert and true if succeeds*
Arguments
receiver
address
Account to which the tokens will be send
tokenAmount
uint256
Amount of tokens to send
liquidate
function liquidate() internal nonpayable
Arguments
transferCommissions
Transfer mint operation fees (commissions + vendor markup)
function transferCommissions(address sender, uint256 totalResTokensSpent, uint256 reserveTokenCommission, uint256 mocCommission, address vendorAccount, uint256 reserveTokenMarkup, uint256 mocMarkup) internal nonpayable
Arguments
sender
address
address of msg.sender
totalResTokensSpent
uint256
amount in ReserveToken spent
reserveTokenCommission
uint256
commission amount in ReserveToken
mocCommission
uint256
commission amount in MoC
vendorAccount
address
address of vendor
reserveTokenMarkup
uint256
vendor markup in ReserveToken
mocMarkup
uint256
vendor markup in MoC
transferMocCommission
Transfer operation fees in MoC (commissions + vendor markup)
function transferMocCommission(address sender, uint256 mocCommission, address vendorAccount, uint256 mocMarkup) internal nonpayable
Arguments
sender
address
address of msg.sender
mocCommission
uint256
commission amount in MoC
vendorAccount
address
address of vendor
mocMarkup
uint256
vendor markup in MoC
redeemWithCommission
Transfer redeem operation fees (commissions + vendor markup)
function redeemWithCommission(address sender, uint256 reserveTokenCommission, uint256 mocCommission, address vendorAccount, uint256 reserveTokenMarkup, uint256 mocMarkup, uint256 reserveTokenAmount) internal nonpayable
Arguments
sender
address
address of msg.sender
reserveTokenCommission
uint256
commission amount in ReserveToken
mocCommission
uint256
commission amount in MoC
vendorAccount
address
address of vendor
reserveTokenMarkup
uint256
vendor markup in ReserveToken
mocMarkup
uint256
vendor markup in MoC
reserveTokenAmount
uint256
transferReserveTokenCommission
Transfer operation fees in ReserveToken (commissions + vendor markup)
function transferReserveTokenCommission(address vendorAccount, uint256 reserveTokenCommission, uint256 reserveTokenMarkup) internal nonpayable
Arguments
vendorAccount
address
address of vendor
reserveTokenCommission
uint256
commission amount in ReserveToken
reserveTokenMarkup
uint256
vendor markup in ReserveToken
safeWithdrawFromReserve
Extracts tokens from the reserve and update mocState but reverts if token transfer fails
function safeWithdrawFromReserve(address receiver, uint256 tokenAmount) internal nonpayable
Arguments
receiver
address
Account to which the tokens will be send
tokenAmount
uint256
Amount to extract from reserve
safeWithdraw
Extracts tokens from the reserve
function safeWithdraw(address receiver, uint256 tokenAmount) internal nonpayable
Arguments
receiver
address
Account from which the tokens will be taken
tokenAmount
uint256
Amount to deposit
safeDepositInReserve
Extracts tokens from the reserve and update mocState
function safeDepositInReserve(address receiver, uint256 tokenAmount) private nonpayable
Arguments
receiver
address
Account from which the tokens will be taken
tokenAmount
uint256
Amount to deposit
Last updated