MoCEMACalculator
MoCEMACalculator - version: 0.1.12
Constants & Variables
uint256 internal bitcoinMovingAverage;
uint256 public smoothingFactor;
uint256 public lastEmaCalculation;
uint256 public emaCalculationBlockSpan;
uint256 public constant PRICE_PRECISION;
uint256 public constant FACTOR_PRECISION;
uint256[50] private upgradeGap;
Parameters
Name | Type | Description |
---|---|---|
price | uint256 | |
movingAverage | uint256 | |
function getBitcoinMovingAverage() public view
returns(uint256)
Arguments
function getSmoothingFactor() public view
returns(uint256)
Arguments
function setSmoothingFactor(uint256 factor) public nonpayable onlyAuthorizedChanger
Arguments
Name | Type | Description |
---|---|---|
factor | uint256 | |
function getGovernorAddress() public view
returns(address)
Arguments
function getEmaCalculationBlockSpan() public view
returns(uint256)
Arguments
function setEmaCalculationBlockSpan(uint256 blockSpan) public nonpayable onlyAuthorizedChanger
Arguments
Name | Type | Description |
---|---|---|
blockSpan | uint256 | Defines how many blocks should pass between BMA calculations* |
function shouldCalculateEma() public view
returns(bool)
Arguments
function getLastEmaCalculation() public view
returns(uint256)
Arguments
Provides Bitcoin's Price and Moving average. More information of EMA calculation https://en.wikipedia.org/wiki/Exponential_smoothing
function initializeMovingAverage(uint256 initialEma, uint256 smoothFactor, uint256 emaBlockSpan) internal nonpayable
Arguments
Name | Type | Description |
---|---|---|
initialEma | uint256 | Initial ema value |
smoothFactor | uint256 | Weight coefficient for EMA calculation. |
emaBlockSpan | uint256 | Block count in a period for EMA calculation |
Calculates a EMA of the price. More information of EMA calculation https://en.wikipedia.org/wiki/Exponential_smoothing
function setBitcoinMovingAverage(uint256 btcPrice) internal nonpayable
Arguments
Name | Type | Description |
---|---|---|
btcPrice | uint256 | Current price. |
Calculates the smoothing factor complement
function coefficientComp() internal view
returns(uint256)
Arguments
function initializeGovernor(address _governor) internal nonpayable
Arguments
Name | Type | Description |
---|---|---|
_governor | address | |
function _doSetSmoothingFactor(uint256 factor) private nonpayable
Arguments
Name | Type | Description |
---|---|---|
factor | uint256 | |
Last modified 1yr ago