MoCInrate

View Source: contracts/MoCInrate.sol

↗ Extends: MoCInrateEvents, MoCInrateStructs, MoCBase, MoCLibConnection, Governed, IMoCInrate

MoCInrate - version: 0.1.10

Structs

InrateParams

struct InrateParams {
 uint256 tMax,
 uint256 tMin,
 uint256 power
}

Contract Members

Constants & Variables

struct MoCInrateStructs.InrateParams internal riskProxParams;

contract IMoCState internal mocState;



























InrateDailyPay

Parameters

Name
Type
Description

amount

uint256

daysToSettlement

uint256

nReserveBucketC0

uint256

RiskProHoldersInterestPay

Parameters

Name
Type
Description

amount

uint256

nReserveBucketC0BeforePay

uint256

Modifiers

onlyOnceADay

Arguments

onlyWhenRiskProInterestsIsEnabled

Arguments

Functions

setStableTmin

Arguments

Name
Type
Description

_stableTmin

uint256

setStableTmax

Arguments

Name
Type
Description

_stableTmax

uint256

setStablePower

Arguments

Name
Type
Description

_stablePower

uint256

getStableTmin

Arguments

getStableTmax

Arguments

getStablePower

Arguments

stableTokenInrateAvg

Calculates an average interest rate between after and before free stableToken Redemption

Returns

Interest rate value [using mocPrecision]

Arguments

Name
Type
Description

stableTokenRedeem

uint256

StableTokens to redeem [using mocPrecision]

initialize

Initializes the contract

Arguments

Name
Type
Description

connectorAddress

address

MoCConnector contract address

_governor

address

Governor contract address

riskProxTmin

uint256

Minimum interest rate [using mocPrecision]

riskProxPower

uint256

Power is a parameter for interest rate calculation [using noPrecision]

riskProxTmax

uint256

Maximun interest rate [using mocPrecision]

_riskProRate

uint256

BitPro holder interest rate [using mocPrecision]

blockSpanRiskPro

uint256

BitPro blockspan to configure payments periods[using mocPrecision]

riskProInterestTargetAddress

address payable

Target address to transfer the weekly BitPro holders interest

commissionsAddressTarget

address payable

Target addres to transfer commissions of mint/redeem

_stableTmin

uint256

Upgrade to support red stable inrate parameter

_stablePower

uint256

Upgrade to support red stable inrate parameter

_stableTmax

uint256

Upgrade to support red stable inrate parameter

getRiskProxTmin

âš  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 tMin param of RiskProx tokens

Returns

returns tMin of RiskProx

Arguments

getRiskProxTmax

âš  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 tMax param of RiskProx tokens

Returns

returns tMax of RiskProx

Arguments

getRiskProxPower

âš  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 power param of RiskProx tokens

Returns

returns power of RiskProx

Arguments

getRiskProInterestBlockSpan

⤾ overrides IMoCInrate.getRiskProInterestBlockSpan

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

Returns

returns power of riskProInterestBlockSpan

Arguments

setRiskProxTmin

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

sets tMin param of RiskProx tokens

Arguments

Name
Type
Description

_btxcTmin

uint256

tMin of RiskProx

setRiskProxTmax

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

sets tMax param of RiskProx tokens

Arguments

Name
Type
Description

_btxcTax

uint256

tMax of RiskProx

setRiskProxPower

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

sets power param of RiskProx tokens

Arguments

Name
Type
Description

_btxcPower

uint256

power of RiskProx

getRiskProRate

⤾ overrides IMoCInrate.getRiskProRate

Gets the rate for RiskPro Holders

Returns

RiskPro Rate

Arguments

setRiskProRate

Sets RiskPro Holders rate

Arguments

Name
Type
Description

newRiskProRate

uint256

New RiskPro rate

setRiskProInterestBlockSpan

⤾ overrides IMoCInrate.setRiskProInterestBlockSpan

Sets the blockspan RiskPro Intereset rate payment is enable to be executed

Arguments

Name
Type
Description

newRiskProBlockSpan

uint256

New RiskPro Block span

getRiskProInterestAddress

⤾ overrides IMoCInrate.getRiskProInterestAddress

Gets the target address to transfer RiskPro Holders rate

Returns

Target address to transfer RiskPro Holders interest

Arguments

setRiskProInterestAddress

Sets the target address to transfer RiskPro Holders rate

Arguments

Name
Type
Description

newRiskProInterestAddress

address payable

New RiskPro rate

setCommissionsAddress

Sets the target address to transfer commissions of Mint/Redeem transactions

Arguments

Name
Type
Description

newCommissionsAddress

address payable

New commisions address

spotInrate

Calculates interest rate for RiskProx Minting, redeem and Free StableToken Redeem

Returns

Interest rate value [using RatePrecsion]

Arguments

riskProxInrateAvg

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

Calculates an average interest rate between after and before mint/redeem

Returns

Interest rate value [using mocPrecision]

Arguments

Name
Type
Description

bucket

bytes32

Name of the bucket involved in the operation

resTokensAmount

uint256

Value of the operation from which calculates the inrate [using reservePrecision]

onMinting

bool

Value that represents if the calculation is based on mint or on redeem

dailyInrate

returns the amount of ReserveTokens to pay in concept of interest to bucket C0

Arguments

calcMintInterestValues

⤾ overrides IMoCInrate.calcMintInterestValues

Extract the inrate from the passed ReserveTokens value for RiskProx minting operation

Returns

ReserveTokens to pay in concept of interests [using reservePrecision]

Arguments

Name
Type
Description

bucket

bytes32

Bucket to use to calculate interés

reserveTokenAmount

uint256

Total value from which extract the interest rate [using reservePrecision]

calcStableTokenRedInterestValues

⤾ overrides IMoCInrate.calcStableTokenRedInterestValues

Extract the inrate from the passed ReserveTokens value for the StableToken Redeem operation

Returns

finalInterest

Arguments

Name
Type
Description

stableTokenAmount

uint256

StableToken amount of the redemption [using mocPrecision]

reserveTokenAmount

uint256

Total value from which extract the interest rate [using reservePrecision]

calcFinalRedeemInterestValue

⤾ overrides IMoCInrate.calcFinalRedeemInterestValue

This function calculates the interest to return to the user in a RiskProx redemption. It uses a mechanism to counteract the effect of free stableTokens redemption. It will be replaced with FreeStableToken redemption interests in the future

Returns

Reserves to recover in concept of interests [using reservePrecision]

Arguments

Name
Type
Description

bucket

bytes32

Bucket to use to calculate interest

reserveTokenToRedeem

uint256

Total value from which calculate interest [using reservePrecision]

calcCommissionValue

DEPRECATED calculates the Commission rate from the passed RBTC amount for mint/redeem operations

Returns

finalCommissionAmount [using reservePrecision]

Arguments

Name
Type
Description

reserveTokenAmount

uint256

Total value from which apply the Commission rate [using reservePrecision]

calcCommissionValue

⤾ overrides IMoCInrate.calcCommissionValue

calculates the Commission rate from the passed ReserveTokens amount for mint/redeem operations

Returns

finalCommissionAmount [using reservePrecision]

Arguments

Name
Type
Description

reserveTokenAmount

uint256

Total value from which apply the Commission rate [using reservePrecision]

txType

uint8

Transaction type according to constant values defined in this contract

calculateVendorMarkup

⤾ overrides IMoCInrate.calculateVendorMarkup

calculates the vendor markup rate from the passed vendor account and amount

Returns

finalCommissionAmount [using reservePrecision]

Arguments

Name
Type
Description

vendorAccount

address

Vendor address

amount

uint256

Total value from which apply the vendor markup rate [using reservePrecision]

calcRedeemInterestValue

Calculates ReserveTokens value to return to the user in concept of interests

Returns

Reserves to recover in concept of interests [using reservePrecision]

Arguments

Name
Type
Description

bucket

bytes32

Bucket to use to calculate interest

reserveTokenToRedeem

uint256

Total value from which calculate interest [using reservePrecision]

dailyInratePayment

⤾ overrides IMoCInrate.dailyInratePayment

Moves the daily amount of interest rate to C0 bucket

Arguments

isDailyEnabled

⤾ overrides IMoCInrate.isDailyEnabled

Arguments

isRiskProInterestEnabled

⤾ overrides IMoCInrate.isRiskProInterestEnabled

Arguments

calculateRiskProHoldersInterest

⤾ overrides IMoCInrate.calculateRiskProHoldersInterest

Calculates RiskPro Holders interest rates

Returns

toPay interest in ReserveTokens [using reservePrecsion]

Arguments

payRiskProHoldersInterestPayment

⤾ overrides IMoCInrate.payRiskProHoldersInterestPayment

Pays the RiskPro Holders interest rates

Returns

interest payed in ReserveTokens [using reservePrecsion]

Arguments

setCommissionRateByTxType

Sets the commission rate to a particular transaction type

Arguments

Name
Type
Description

txType

uint8

Transaction type according to constant values defined in this contract

value

uint256

Commission rate

inrateToSettlement

Calculates the interest rate to pay until the settlement day

Returns

Interest rate value [using mocPrecision]

Arguments

Name
Type
Description

inrate

uint256

Spot interest rate

countAllDays

bool

Value that represents if the calculation will use all days or one day less

calcProportionalInterestValue

This function calculates the interest to return to a user redeeming RiskProx as a proportion of the amount in the interestBag.

Returns

InterestsInBag * (RedeemInterests / FullRedeemInterest) [using reservePrecision]

Arguments

Name
Type
Description

bucket

bytes32

Bucket to use to calculate interest

redeemInterest

uint256

Total value from which calculate interest [using reservePrecision]

calcFullRedeemInterestValue

This function calculates the interest to return if a user redeem all RiskProx in existance

Returns

Interests [using reservePrecision]

Arguments

Name
Type
Description

bucket

bytes32

Bucket to use to calculate interest

simulateStableTokenMovement

Calculates the final amount of Bucket 0 StableTokens on RiskProx mint/redeem

Returns

Final bucket 0 StableToken amount

Arguments

Name
Type
Description

bucket

bytes32

Name of the bucket involved in the operation

resTokensAmount

uint256

Value of the operation from which calculates the inrate [using reservePrecision]

onMinting

bool

inrateDayCount

Returns the days to use for interests calculation

Returns

days [using dayPrecision]

Arguments

Name
Type
Description

countAllDays

bool

Value that represents if the calculation is based on mint or on redeem

initializeContracts

Initialize the contracts with which it interacts

Arguments

initializeValues

Initialize the parameters of the contract

Arguments

Name
Type
Description

_governor

address

the address of the IGovernor contract

riskProxMin

uint256

Minimum interest rate [using mocPrecision]

riskProxPower

uint256

Power is a parameter for interest rate calculation [using noPrecision]

riskProxMax

uint256

Maximun interest rate [using mocPrecision]

_riskProRate

uint256

RiskPro holder interest rate [using mocPrecision]

commissionsAddressTarget

address payable

blockSpanRiskPro

uint256

RiskPro blockspan to configure payments periods[using mocPrecision]

riskProInterestsTarget

address payable

Target address to transfer the weekly RiskPro holders interest

_stableTmin

uint256

Upgrade to support red stable inrate parameter

_stablePower

uint256

Upgrade to support red stable inrate parameter

_stableTmax

uint256

Upgrade to support red stable inrate parameter

Last updated