MoCInrate
View Source: contracts/MoCInrate.sol
↗ Extends: MoCInrateEvents, MoCInrateStructs, MoCBase, MoCLibConnection, Governed, IMoCInrate
MoCInrate - version: 0.1.12
Structs
InrateParams
InitializeParams
Contract Members
Constants & Variables
InrateDailyPay
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | |
daysToSettlement | uint256 | |
nReserveBucketC0 | uint256 |
RiskProHoldersInterestPay
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | |
nReserveBucketC0BeforePay | uint256 |
Modifiers
onlyOnceADay
Arguments
onlyWhenBitProInterestsIsEnabled
Arguments
Functions
setDoCTmin
Arguments
Name | Type | Description |
---|---|---|
_docTmin | uint256 |
setDoCTmax
Arguments
Name | Type | Description |
---|---|---|
_docTmax | uint256 |
setDoCPower
Arguments
Name | Type | Description |
---|---|---|
_docPower | uint256 |
getDoCTmin
Arguments
getDoCTmax
Arguments
getDoCPower
Arguments
docInrateAvg
Calculates an average interest rate between after and before free doc Redemption
Returns
Interest rate value [using mocPrecision]
Arguments
Name | Type | Description |
---|---|---|
docRedeem | uint256 | Docs to redeem [using mocPrecision] |
initialize
Initializes the contract
Arguments
Name | Type | Description |
---|---|---|
params | struct MoCInrateStructs.InitializeParams | Params defined in InitializeParams struct |
getBtcxTmin
gets tMin param of BTCX tokens
Returns
returns tMin of BTCX
Arguments
getBtcxTmax
gets tMax param of BTCX tokens
Returns
returns tMax of BTCX
Arguments
getBtcxPower
gets power param of BTCX tokens
Returns
returns power of BTCX
Arguments
getBitProInterestBlockSpan
⤾ overrides IMoCInrate.getBitProInterestBlockSpan
Gets the blockspan of BPRO that represents the frecuency of BitPro holders intereset payment
Returns
returns power of bitProInterestBlockSpan
Arguments
setBtcxTmin
sets tMin param of BTCX tokens
Arguments
Name | Type | Description |
---|---|---|
_btxcTmin | uint256 | tMin of BTCX |
setBtcxTmax
sets tMax param of BTCX tokens
Arguments
Name | Type | Description |
---|---|---|
_btxcTax | uint256 | tMax of BTCX |
setBtcxPower
sets power param of BTCX tokens
Arguments
Name | Type | Description |
---|---|---|
_btxcPower | uint256 | power of BTCX |
getBitProRate
⤾ overrides IMoCInrate.getBitProRate
Gets the rate for BitPro Holders
Returns
BitPro Rate
Arguments
setBitProRate
Sets BitPro Holders rate
Arguments
Name | Type | Description |
---|---|---|
newBitProRate | uint256 | New BitPro rate |
setBitProInterestBlockSpan
⤾ overrides IMoCInrate.setBitProInterestBlockSpan
Sets the blockspan BitPro Intereset rate payment is enable to be executed
Arguments
Name | Type | Description |
---|---|---|
newBitProBlockSpan | uint256 | New BitPro Block span |
getBitProInterestAddress
⤾ overrides IMoCInrate.getBitProInterestAddress
Gets the target address to transfer BitPro Holders rate
Returns
Target address to transfer BitPro Holders interest
Arguments
setBitProInterestAddress
Sets the target address to transfer BitPro Holders rate
Arguments
Name | Type | Description |
---|---|---|
newBitProInterestAddress | address payable | New BitPro 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 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.
Returns
Interest rate value [using RatePrecsion]
Arguments
btcxInrateAvg
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 |
btcAmount | 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 BTC to pay in concept of interest to bucket C0
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.
Returns
RBTC to pay in concept of interests [using reservePrecision]
Arguments
Name | Type | Description |
---|---|---|
bucket | bytes32 | Bucket to use to calculate interés |
rbtcAmount | uint256 | Total value from which extract the interest rate [using reservePrecision] |
calcDocRedInterestValues
⤾ overrides IMoCInrate.calcDocRedInterestValues
Extract the inrate from the passed RBTC value for the Doc Redeem operation
Returns
RBTC to pay in concept of interests [using reservePrecision]
Arguments
Name | Type | Description |
---|---|---|
docAmount | uint256 | Doc amount of the redemption [using mocPrecision] |
rbtcAmount | 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 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.
Returns
RBTC to recover in concept of interests [using reservePrecision]
Arguments
Name | Type | Description |
---|---|---|
bucket | bytes32 | Bucket to use to calculate interest |
rbtcToRedeem | uint256 | Total value from which calculate interest [using reservePrecision] |
calcCommissionValue
⤾ overrides IMoCInrate.calcCommissionValue
calculates the Commission rate from the passed RBTC amount and the transaction type for mint/redeem operations
Returns
finalCommissionAmount [using reservePrecision]
Arguments
Name | Type | Description |
---|---|---|
rbtcAmount | uint256 | Total value from which apply the Commission rate [using reservePrecision] |
txType | uint8 | Transaction type according to constant values defined in this contract |
calcCommissionValue
DEPRECATED calculates the Commission rate from the passed RBTC amount for mint/redeem operations
Returns
finalCommissionAmount [using reservePrecision]
Arguments
Name | Type | Description |
---|---|---|
rbtcAmount | uint256 | Total value from which apply the Commission rate [using reservePrecision] |
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 RBTC value to return to the user in concept of interests
Returns
RBTC to recover in concept of interests [using reservePrecision]
Arguments
Name | Type | Description |
---|---|---|
bucket | bytes32 | Bucket to use to calculate interest |
rbtcToRedeem | 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
isBitProInterestEnabled
⤾ overrides IMoCInrate.isBitProInterestEnabled
Arguments
calculateBitProHoldersInterest
⤾ overrides IMoCInrate.calculateBitProHoldersInterest
Calculates BitPro Holders interest rates
Returns
toPay interest in RBTC [using RBTCPrecsion]
Arguments
payBitProHoldersInterestPayment
⤾ overrides IMoCInrate.payBitProHoldersInterestPayment
Pays the BitPro Holders interest rates
Returns
interest payed in RBTC [using RBTCPrecsion]
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 RatePrecsion]
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 BTCx 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 Btcx in existance
Returns
Interests [using reservePrecision]
Arguments
Name | Type | Description |
---|---|---|
bucket | bytes32 | Bucket to use to calculate interest |
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.
Returns
Final bucket 0 Doc amount
Arguments
Name | Type | Description |
---|---|---|
bucket | bytes32 | Name of the bucket involved in the operation |
btcAmount | 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 |
btcxMin | uint256 | Minimum interest rate [using mocPrecision] |
btcxPower | uint256 | Power is a parameter for interest rate calculation [using noPrecision] |
btcxMax | uint256 | Maximun interest rate [using mocPrecision] |
_bitProRate | uint256 | BitPro holder interest rate [using mocPrecision] |
commissionsAddressTarget | address payable | |
blockSpanBitPro | uint256 | BitPro blockspan to configure payments periods[using mocPrecision] |
bitProInterestsTarget | address payable | Target address to transfer the weekly BitPro holders interest |
_docTmin | uint256 | |
_docPower | uint256 | |
_docTmax | uint256 |
Last updated