RoC Stable Platform - Collateral RIF Token
  • Introduction
  • RIF On Chain platform
    • Main concepts
    • System states
    • Public actions
      • User actions
      • Process actions
    • Contracts architecture
      • MoC
      • CommissionSplitter
      • MoCState
      • MoCBucketContainer
      • MoCSettlement
      • MoCHelperLib
      • MoCLibConnection
      • MoCConverter
      • MoCExchange
      • MoCConnector
      • MoCRiskProxManager
      • MoCInrate
      • MoCVendors
      • MoCWhitelist
      • MoCBase
      • OwnerBurnableToken
      • RiskProToken
      • StableToken
      • MoCToken
      • PriceProvider
    • Contract mocks
    • Relevant patterns and choices
    • Data dictionary
    • Getting started
  • Integration with RoC platform
    • Introduction to RoC
      • The MoC Contract
      • RoC Precisions
      • RoC State Contracts
    • Getting RIFPros
      • Minting RIFPros
      • Redeeming RIFPros
    • Getting USDRIF
      • Minting USDRIF
      • Redeeming USDRIF
        • On Settlement: redeemStableTokenRequest
        • On Settlement: alterRedeemRequestAmount
        • Outside Settlement: redeemFreeStableToken
        • On Liquidation State: redeemAllStableToken
        • How-to
    • Commission fees values
    • Vendors
    • Fees calculation
    • From outside the blockchain
      • Using RSK nodes
      • Using web3
      • Official RIF On Chain ABIs
      • Events
      • Example code minting RIFPros
      • Example code minting RIFPros without Truffle
      • Example code redeeming RIFPros
      • Example code redeeming RIFPros without Truffle
      • Example code minting USDRIF
      • Example code redeeming free USDRIF
      • Example code redeeming USDRIF Request
      • Example code redeeming all USDRIF
  • Smart contracts
    • Contracts verification
    • ABIs documentation
      • Blockable
      • Blocker
      • ERC20Mintable
      • Governed
      • Initializable
      • MakeStoppable
      • MakeUnstoppable
      • MoC
      • MoCBucketContainer
      • MoCConnector
      • MoCConverter
      • MoCEMACalculator
      • MoCExchange
      • MoCHelperLib
      • MoCHelperLibMock
      • MoCInrate
      • MoCInrateRiskproxChanger
      • MoCLibConnection
      • MoCPriceProviderMock
      • MoCReserve
      • MoCRiskProxManager
      • MoCSettlement
      • MoCSettlementMock
      • MoCState
      • MoCStateMock
      • MoCToken
      • MoCVendors
      • MoCWhitelist
      • MocInrateStableChanger
      • MockBlocker
      • MockMakeStoppable
      • MockMakeUnstoppable
      • MockStopper
      • MockUpgradeDelegator
      • MockUpgraderTemplate
      • OwnerBurnableToken
      • Pausable
      • PriceFeed
      • PriceFeederAdder
      • PriceFeederRemover
      • PriceProvider
      • PriceProviderChanger
      • PriceProviderMock
      • ReserveToken
      • RiskProToken
      • StableToken
      • Stoppable
      • Stopper
      • UpgradeDelegator
      • UpgraderTemplate
Powered by GitBook
On this page
  • Contract Members
  • BucketLiquidation
  • ContractLiquidated
  • Modifiers
  • whenSettlementReady
  • atState
  • atLeastState
  • atMostState
  • notInProtectionMode
  • bucketStateTransition
  • availableBucket
  • notBaseBucket
  • transitionState
  • Functions
  • initialize
  • riskProxBalanceOf
  • getRedeemRequestAt
  • redeemQueueSize
  • stableTokenAmountToRedeem
  • redeemStableTokenRequest
  • alterRedeemRequestAmount
  • addReserves
  • mintRiskPro
  • mintRiskProVendors
  • redeemRiskPro
  • redeemRiskProVendors
  • mintStableToken
  • mintStableTokenVendors
  • redeemRiskProx
  • redeemRiskProxVendors
  • mintRiskProx
  • mintRiskProxVendors
  • redeemFreeStableToken
  • redeemFreeStableTokenVendors
  • redeemAllStableToken
  • dailyInratePayment
  • payRiskProHoldersInterestPayment
  • calculateRiskProHoldersInterest
  • getRiskProInterestAddress
  • getRiskProRate
  • getRiskProInterestBlockSpan
  • isDailyEnabled
  • isRiskProInterestEnabled
  • isSettlementEnabled
  • isBucketLiquidationReached
  • evalBucketLiquidation
  • evalLiquidation
  • runSettlement
  • sendToAddress
  • liquidate
  • transferCommissions
  • transferMocCommission
  • redeemWithCommission
  • transferReserveTokenCommission
  • safeWithdrawFromReserve
  • safeWithdraw
  • safeDepositInReserve
  1. Smart contracts
  2. ABIs documentation

MoC

PreviousMakeUnstoppableNextMoCBucketContainer

Last updated 2 years ago

View Source:

↗ Extends: , , , , ,

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

Name
Type
Description

bucket

bytes32

ContractLiquidated

Parameters

Name
Type
Description

mocAddress

address

Modifiers

whenSettlementReady

modifier whenSettlementReady() internal

Arguments

atState

modifier atState(enum IMoCState.States _state) internal

Arguments

Name
Type
Description

_state

enum IMoCState.States

atLeastState

modifier atLeastState(enum IMoCState.States _state) internal

Arguments

Name
Type
Description

_state

enum IMoCState.States

atMostState

modifier atMostState(enum IMoCState.States _state) internal

Arguments

Name
Type
Description

_state

enum IMoCState.States

notInProtectionMode

modifier notInProtectionMode() internal

Arguments

bucketStateTransition

modifier bucketStateTransition(bytes32 bucket) internal

Arguments

Name
Type
Description

bucket

bytes32

availableBucket

modifier availableBucket(bytes32 bucket) internal

Arguments

Name
Type
Description

bucket

bytes32

notBaseBucket

modifier notBaseBucket(bytes32 bucket) internal

Arguments

Name
Type
Description

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

Name
Type
Description

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

Gets the RiskProx balance of an address

function riskProxBalanceOf(bytes32 bucket, address account) public view
returns(uint256)

Returns

RiskProx balance of the address

Arguments

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

tokenAmount

uint256

Amount to deposit.

mintRiskPro

Mints RiskPro and pays the comissions of the operation (retrocompatible function).

function mintRiskPro(uint256 resTokensToMint) public nonpayable

Arguments

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

resTokensToMint

uint256

Amount in ReserveTokens to mint

vendorAccount

address

Vendor address

redeemRiskProx

Redeems RiskProx Tokens and pays the comissions of the operation in ReserveToken (retrocompatible function).

function redeemRiskProx(bytes32 bucket, uint256 riskProxAmount) public nonpayable

Arguments

Name
Type
Description

bucket

bytes32

Bucket to reedem, for example X2

riskProxAmount

uint256

Amount in RiskProx

redeemRiskProxVendors

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

Name
Type
Description

bucket

bytes32

Bucket to reedem, for example X2

riskProxAmount

uint256

Amount in RiskProx

vendorAccount

address

Vendor address

mintRiskProx

BUCKET riskProx riskProx (retrocompatible function).

function mintRiskProx(bytes32 bucket, uint256 resTokensToMint) public nonpayable

Arguments

Name
Type
Description

bucket

bytes32

Name of the bucket used

resTokensToMint

uint256

amount to mint on ReserveToken

mintRiskProxVendors

BUCKET riskProx minting

function mintRiskProxVendors(bytes32 bucket, uint256 resTokensToMint, address vendorAccount) public nonpayable whenNotPaused whenSettlementReady availableBucket notBaseBucket transitionState bucketStateTransition 

Arguments

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

bucket

bytes32

Name of bucket.

evalBucketLiquidation

function evalBucketLiquidation(bytes32 bucket) public nonpayable availableBucket notBaseBucket whenSettlementReady 

Arguments

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

receiver

address

Account from which the tokens will be taken

tokenAmount

uint256

Amount to deposit

⚠ This has been deprecated since the from the protocol was approved, however it is necessary to maintain the contracts and their documentation for legacy support.

⚠ This has been deprecated since the from the protocol was approved, however it is necessary to maintain the contracts and their documentation for legacy support.

⚠ This has been deprecated since the from the protocol was approved, however it is necessary to maintain the contracts and their documentation for legacy support.

⚠ This has been deprecated since the from the protocol was approved, however it is necessary to maintain the contracts and their documentation for legacy support.

⚠ See the to understand how the behavior of this function has changed.

⚠ This has been deprecated since the from the protocol was approved, however it is necessary to maintain the contracts and their documentation for legacy support.

⚠ See the to understand how the behavior of this function has changed.

contracts/MoC.sol
MoCEvents
MoCReserve
MoCLibConnection
MoCBase
Stoppable
IMoC
Proposal to remove leveraged positions
Proposal to remove leveraged positions
Proposal to remove leveraged positions
Proposal to remove leveraged positions
approved technical proposal
Proposal to remove leveraged positions
approved technical proposal
whenSettlementReady
atState
atLeastState
atMostState
notInProtectionMode
bucketStateTransition
availableBucket
notBaseBucket
transitionState
initialize(address connectorAddress, address governorAddress, address stopperAddress, bool startStoppable)
riskProxBalanceOf(bytes32 bucket, address account)
getRedeemRequestAt(uint256 index)
redeemQueueSize()
stableTokenAmountToRedeem(address redeemer)
redeemStableTokenRequest(uint256 stableTokenAmount)
alterRedeemRequestAmount(bool isAddition, uint256 delta)
addReserves(uint256 tokenAmount)
mintRiskPro(uint256 resTokensToMint)
mintRiskProVendors(uint256 resTokensToMint, address vendorAccount)
redeemRiskPro(uint256 riskProAmount)
redeemRiskProVendors(uint256 riskProAmount, address vendorAccount)
mintStableToken(uint256 resTokensToMint)
mintStableTokenVendors(uint256 resTokensToMint, address vendorAccount)
redeemRiskProx(bytes32 bucket, uint256 riskProxAmount)
redeemRiskProxVendors(bytes32 bucket, uint256 riskProxAmount, address vendorAccount)
mintRiskProx(bytes32 bucket, uint256 resTokensToMint)
mintRiskProxVendors(bytes32 bucket, uint256 resTokensToMint, address vendorAccount)
redeemFreeStableToken(uint256 stableTokenAmount)
redeemFreeStableTokenVendors(uint256 stableTokenAmount, address vendorAccount)
redeemAllStableToken()
dailyInratePayment()
payRiskProHoldersInterestPayment()
calculateRiskProHoldersInterest()
getRiskProInterestAddress()
getRiskProRate()
getRiskProInterestBlockSpan()
isDailyEnabled()
isRiskProInterestEnabled()
isSettlementEnabled()
isBucketLiquidationReached(bytes32 bucket)
evalBucketLiquidation(bytes32 bucket)
evalLiquidation()
runSettlement(uint256 steps)
sendToAddress(address receiver, uint256 tokenAmount)
liquidate()
transferCommissions(address sender, uint256 totalResTokensSpent, uint256 reserveTokenCommission, uint256 mocCommission, address vendorAccount, uint256 reserveTokenMarkup, uint256 mocMarkup)
transferMocCommission(address sender, uint256 mocCommission, address vendorAccount, uint256 mocMarkup)
redeemWithCommission(address sender, uint256 reserveTokenCommission, uint256 mocCommission, address vendorAccount, uint256 reserveTokenMarkup, uint256 mocMarkup, uint256 reserveTokenAmount)
transferReserveTokenCommission(address vendorAccount, uint256 reserveTokenCommission, uint256 reserveTokenMarkup)
safeWithdrawFromReserve(address receiver, uint256 tokenAmount)
safeWithdraw(address receiver, uint256 tokenAmount)
safeDepositInReserve(address receiver, uint256 tokenAmount)