MoCInrate

View Source: contracts/MoCInrate.sol

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

MoCInrate - version: 0.1.12

Structs

InrateParams

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

InitializeParams

struct InitializeParams {
 address connectorAddress,
 address governor,
 uint256 btcxTmin,
 uint256 btcxPower,
 uint256 btcxTmax,
 uint256 bitProRate,
 uint256 blockSpanBitPro,
 address payable bitProInterestTargetAddress,
 address payable commissionsAddressTarget,
 uint256 docTmin,
 uint256 docPower,
 uint256 docTmax
}

Contract Members

Constants & Variables

struct MoCInrateStructs.InrateParams internal btcxParams;

contract IMoCState internal mocState;

address internal DEPRECATED_mocConverter;

contract MoCBProxManager internal bproxManager;

uint256 public lastDailyPayBlock;

uint256 public bitProRate;

address payable public bitProInterestAddress;

uint256 public lastBitProInterestBlock;

uint256 public bitProInterestBlockSpan;

address payable public commissionsAddress;

uint256 public DEPRECATED_commissionRate;

uint256 public docTmin;

uint256 public docPower;

uint256 public docTmax;

uint8 public constant MINT_BPRO_FEES_RBTC;

uint8 public constant REDEEM_BPRO_FEES_RBTC;

uint8 public constant MINT_DOC_FEES_RBTC;

uint8 public constant REDEEM_DOC_FEES_RBTC;

uint8 public constant MINT_BTCX_FEES_RBTC;

uint8 public constant REDEEM_BTCX_FEES_RBTC;

uint8 public constant MINT_BPRO_FEES_MOC;

uint8 public constant REDEEM_BPRO_FEES_MOC;

uint8 public constant MINT_DOC_FEES_MOC;

uint8 public constant REDEEM_DOC_FEES_MOC;

uint8 public constant MINT_BTCX_FEES_MOC;

uint8 public constant REDEEM_BTCX_FEES_MOC;

mapping(uint8 => uint256) public commissionRatesByTxType;

uint256[50] private upgradeGap;

InrateDailyPay

Parameters

RiskProHoldersInterestPay

Parameters

Modifiers

onlyOnceADay

modifier onlyOnceADay() internal

Arguments

onlyWhenBitProInterestsIsEnabled

modifier onlyWhenBitProInterestsIsEnabled() internal

Arguments

Functions

setDoCTmin

function setDoCTmin(uint256 _docTmin) public nonpayable onlyAuthorizedChanger 

Arguments

setDoCTmax

function setDoCTmax(uint256 _docTmax) public nonpayable onlyAuthorizedChanger 

Arguments

setDoCPower

function setDoCPower(uint256 _docPower) public nonpayable onlyAuthorizedChanger 

Arguments

getDoCTmin

function getDoCTmin() public view
returns(uint256)

Arguments

getDoCTmax

function getDoCTmax() public view
returns(uint256)

Arguments

getDoCPower

function getDoCPower() public view
returns(uint256)

Arguments

docInrateAvg

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

function docInrateAvg(uint256 docRedeem) public view
returns(uint256)

Returns

Interest rate value [using mocPrecision]

Arguments

initialize

Initializes the contract

function initialize(struct MoCInrateStructs.InitializeParams params) public nonpayable initializer 

Arguments

getBtcxTmin

gets tMin param of BTCX tokens

function getBtcxTmin() public view
returns(uint256)

Returns

returns tMin of BTCX

Arguments

getBtcxTmax

gets tMax param of BTCX tokens

function getBtcxTmax() public view
returns(uint256)

Returns

returns tMax of BTCX

Arguments

getBtcxPower

gets power param of BTCX tokens

function getBtcxPower() public view
returns(uint256)

Returns

returns power of BTCX

Arguments

getBitProInterestBlockSpan

⤾ overrides IMoCInrate.getBitProInterestBlockSpan

Gets the blockspan of BPRO that represents the frecuency of BitPro holders intereset payment

function getBitProInterestBlockSpan() public view
returns(uint256)

Returns

returns power of bitProInterestBlockSpan

Arguments

setBtcxTmin

sets tMin param of BTCX tokens

function setBtcxTmin(uint256 _btxcTmin) public nonpayable onlyAuthorizedChanger 

Arguments

setBtcxTmax

sets tMax param of BTCX tokens

function setBtcxTmax(uint256 _btxcTax) public nonpayable onlyAuthorizedChanger 

Arguments

setBtcxPower

sets power param of BTCX tokens

function setBtcxPower(uint256 _btxcPower) public nonpayable onlyAuthorizedChanger 

Arguments

getBitProRate

⤾ overrides IMoCInrate.getBitProRate

Gets the rate for BitPro Holders

function getBitProRate() public view
returns(uint256)

Returns

BitPro Rate

Arguments

setBitProRate

Sets BitPro Holders rate

function setBitProRate(uint256 newBitProRate) public nonpayable onlyAuthorizedChanger 

Arguments

setBitProInterestBlockSpan

⤾ overrides IMoCInrate.setBitProInterestBlockSpan

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

function setBitProInterestBlockSpan(uint256 newBitProBlockSpan) public nonpayable onlyAuthorizedChanger 

Arguments

getBitProInterestAddress

⤾ overrides IMoCInrate.getBitProInterestAddress

Gets the target address to transfer BitPro Holders rate

function getBitProInterestAddress() public view
returns(address payable)

Returns

Target address to transfer BitPro Holders interest

Arguments

setBitProInterestAddress

Sets the target address to transfer BitPro Holders rate

function setBitProInterestAddress(address payable newBitProInterestAddress) public nonpayable onlyAuthorizedChanger 

Arguments

setCommissionsAddress

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

function setCommissionsAddress(address payable newCommissionsAddress) public nonpayable onlyAuthorizedChanger 

Arguments

spotInrate

Calculates interest rate for BProx Minting, redeem and Free Doc Redeem

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

function spotInrate() public view
returns(uint256)

Returns

Interest rate value [using RatePrecsion]

Arguments

btcxInrateAvg

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

function btcxInrateAvg(bytes32 bucket, uint256 btcAmount, bool onMinting) public view
returns(uint256)

Returns

Interest rate value [using mocPrecision]

Arguments

dailyInrate

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

function dailyInrate() public view
returns(uint256)

Arguments

calcMintInterestValues

⤾ overrides IMoCInrate.calcMintInterestValues

Extract the inrate from the passed RBTC value for Bprox minting operation

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

function calcMintInterestValues(bytes32 bucket, uint256 rbtcAmount) public view
returns(uint256)

Returns

RBTC to pay in concept of interests [using reservePrecision]

Arguments

calcDocRedInterestValues

⤾ overrides IMoCInrate.calcDocRedInterestValues

Extract the inrate from the passed RBTC value for the Doc Redeem operation

function calcDocRedInterestValues(uint256 docAmount, uint256 rbtcAmount) public view
returns(uint256)

Returns

RBTC to pay in concept of interests [using reservePrecision]

Arguments

calcFinalRedeemInterestValue

⤾ overrides IMoCInrate.calcFinalRedeemInterestValue

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

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

function calcFinalRedeemInterestValue(bytes32 bucket, uint256 rbtcToRedeem) public view
returns(uint256)

Returns

RBTC to recover in concept of interests [using reservePrecision]

Arguments

calcCommissionValue

⤾ overrides IMoCInrate.calcCommissionValue

calculates the Commission rate from the passed RBTC amount and the transaction type for mint/redeem operations

function calcCommissionValue(uint256 rbtcAmount, uint8 txType) public view
returns(uint256)

Returns

finalCommissionAmount [using reservePrecision]

Arguments

calcCommissionValue

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

function calcCommissionValue(uint256 rbtcAmount) external view
returns(uint256)

Returns

finalCommissionAmount [using reservePrecision]

Arguments

calculateVendorMarkup

⤾ overrides IMoCInrate.calculateVendorMarkup

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

function calculateVendorMarkup(address vendorAccount, uint256 amount) public view
returns(markup uint256)

Returns

finalCommissionAmount [using reservePrecision]

Arguments

calcRedeemInterestValue

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

function calcRedeemInterestValue(bytes32 bucket, uint256 rbtcToRedeem) public view
returns(uint256)

Returns

RBTC to recover in concept of interests [using reservePrecision]

Arguments

dailyInratePayment

⤾ overrides IMoCInrate.dailyInratePayment

Moves the daily amount of interest rate to C0 bucket

function dailyInratePayment() public nonpayable onlyWhitelisted onlyOnceADay 
returns(uint256)

Arguments

isDailyEnabled

⤾ overrides IMoCInrate.isDailyEnabled

function isDailyEnabled() public view
returns(bool)

Arguments

isBitProInterestEnabled

⤾ overrides IMoCInrate.isBitProInterestEnabled

function isBitProInterestEnabled() public view
returns(bool)

Arguments

calculateBitProHoldersInterest

⤾ overrides IMoCInrate.calculateBitProHoldersInterest

Calculates BitPro Holders interest rates

function calculateBitProHoldersInterest() public view
returns(uint256, uint256)

Returns

toPay interest in RBTC [using RBTCPrecsion]

Arguments

payBitProHoldersInterestPayment

⤾ overrides IMoCInrate.payBitProHoldersInterestPayment

Pays the BitPro Holders interest rates

function payBitProHoldersInterestPayment() public nonpayable onlyWhitelisted onlyWhenBitProInterestsIsEnabled 
returns(uint256)

Returns

interest payed in RBTC [using RBTCPrecsion]

Arguments

setCommissionRateByTxType

Sets the commission rate to a particular transaction type

function setCommissionRateByTxType(uint8 txType, uint256 value) public nonpayable onlyAuthorizedChanger 

Arguments

inrateToSettlement

Calculates the interest rate to pay until the settlement day

function inrateToSettlement(uint256 inrate, bool countAllDays) internal view
returns(uint256)

Returns

Interest rate value [using RatePrecsion]

Arguments

calcProportionalInterestValue

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

function calcProportionalInterestValue(bytes32 bucket, uint256 redeemInterest) internal view
returns(uint256)

Returns

InterestsInBag * (RedeemInterests / FullRedeemInterest) [using reservePrecision]

Arguments

calcFullRedeemInterestValue

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

function calcFullRedeemInterestValue(bytes32 bucket) internal view
returns(uint256)

Returns

Interests [using reservePrecision]

Arguments

simulateDocMovement

Calculates the final amount of Bucket 0 DoCs on BProx mint/redeem

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

function simulateDocMovement(bytes32 bucket, uint256 btcAmount, bool onMinting) internal view
returns(uint256)

Returns

Final bucket 0 Doc amount

Arguments

inrateDayCount

Returns the days to use for interests calculation

function inrateDayCount(bool countAllDays) internal view
returns(uint256)

Returns

days [using dayPrecision]

Arguments

initializeContracts

Initialize the contracts with which it interacts

function initializeContracts() internal nonpayable

Arguments

initializeValues

Initialize the parameters of the contract

function initializeValues(address _governor, uint256 btcxMin, uint256 btcxPower, uint256 btcxMax, uint256 _bitProRate, address payable commissionsAddressTarget, uint256 blockSpanBitPro, address payable bitProInterestsTarget, uint256 _docTmin, uint256 _docPower, uint256 _docTmax) internal nonpayable

Arguments

Last updated