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;




BucketLiquidation

Parameters

Name
Type
Description

bucket

bytes32

ContractLiquidated

Parameters

Name
Type
Description

mocAddress

address

Modifiers

whenSettlementReady

Arguments

atState

Arguments

Name
Type
Description

_state

enum IMoCState.States

atLeastState

Arguments

Name
Type
Description

_state

enum IMoCState.States

atMostState

Arguments

Name
Type
Description

_state

enum IMoCState.States

notInProtectionMode

Arguments

bucketStateTransition

Arguments

Name
Type
Description

bucket

bytes32

availableBucket

Arguments

Name
Type
Description

bucket

bytes32

notBaseBucket

Arguments

Name
Type
Description

bucket

bytes32

transitionState

Arguments

Functions

initialize

Initializes the contract

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

âš  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

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

Returns

redeemer's address and amount he submitted

Arguments

Name
Type
Description

index

uint256

queue position to get

redeemQueueSize

Returns current redeem queue size

Returns

redeem queue size

Arguments

stableTokenAmountToRedeem

Returns the total amount of StableTokens in the redeem queue for redeemer

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

Arguments

Name
Type
Description

stableTokenAmount

uint256

Amount of StableTokens to redeem on settlement [using mocPrecision]

alterRedeemRequestAmount

Alters the redeem amount position for the redeemer

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.

Arguments

Name
Type
Description

tokenAmount

uint256

Amount to deposit.

mintRiskPro

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

Arguments

Name
Type
Description

resTokensToMint

uint256

Amount in ReserveToken to mint

mintRiskProVendors

Mints RiskPro and pays the comissions of the operation.

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).

Arguments

Name
Type
Description

riskProAmount

uint256

Amout in RiskPro

redeemRiskProVendors

Redeems RiskPro Tokens and pays the comissions of the operation in ReserveTokens

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).

Arguments

Name
Type
Description

resTokensToMint

uint256

Amount in ReserveToken to mint

mintStableTokenVendors

Mint StableToken tokens and pays the commisions of the operation

Arguments

Name
Type
Description

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).

Arguments

Name
Type
Description

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

Arguments

Name
Type
Description

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).

Arguments

Name
Type
Description

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

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).

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.

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*

Arguments

dailyInratePayment

Moves the daily amount of interest rate to C0 bucket

Arguments

payRiskProHoldersInterestPayment

Pays the RiskPro interest and transfers it to the address mocInrate.riskProInterestAddress RiskPro interests = Nb (bucket 0) * riskProRate.

Arguments

calculateRiskProHoldersInterest

Calculates RiskPro holders holder interest by taking the total amount of RBCs available on Bucket 0. RiskPro interests = Nb (bucket 0) * riskProRate.

Arguments

getRiskProInterestAddress

Gets the target address to transfer RiskPro Holders rate

Returns

Target address to transfer RiskPro Holders interest

Arguments

getRiskProRate

Gets the rate for RiskPro Holders

Returns

RiskPro Rate

Arguments

getRiskProInterestBlockSpan

Gets the blockspan of RiskPro that represents the frecuency of RiskPro holders interest payment

Returns

returns power of bitProInterestBlockSpan

Arguments

isDailyEnabled

Arguments

isRiskProInterestEnabled

Arguments

isSettlementEnabled

Indicates if settlement is enabled

Returns

Returns true if blockSpan number of blocks has passed since last execution; otherwise false

Arguments

isBucketLiquidationReached

Checks if bucket liquidation is reached.

Returns

true if bucket liquidation is reached, false otherwise

Arguments

Name
Type
Description

bucket

bytes32

Name of bucket.

evalBucketLiquidation

Arguments

Name
Type
Description

bucket

bytes32

evalLiquidation

Evaluates if liquidation state has been reached and runs liq if that's the case

Arguments

runSettlement

Runs all settlement process

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.

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

Arguments

transferCommissions

Transfer mint operation fees (commissions + vendor markup)

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)

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)

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)

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

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

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

Arguments

Name
Type
Description

receiver

address

Account from which the tokens will be taken

tokenAmount

uint256

Amount to deposit

Last updated