Skip to content

Latest commit

 

History

History
362 lines (314 loc) · 11.3 KB

PriceFeedsMoC.md

File metadata and controls

362 lines (314 loc) · 11.3 KB

PriceFeedsMoC.sol

View Source: contracts/feeds/testnet/PriceFeedsMoC.sol

↗ Extends: IPriceFeedsExt, Ownable

PriceFeedsMoC contract

Contract Members

Constants & Variables

address public mocOracleAddress;
address public rskOracleAddress;

Events

event SetMoCOracleAddress(address indexed mocOracleAddress, address  changerAddress);
event SetRSKOracleAddress(address indexed rskOracleAddress, address  changerAddress);

Functions


peek

function peek() external view
returns(bytes32, bool)
Source Code
function peek() external view returns (bytes32, bool);

constructor

Initialize a new MoC Oracle. *

function (address _mocOracleAddress, address _rskOracleAddress) public nonpayable

Arguments

Name Type Description
_mocOracleAddress address The MoC Oracle address.
_rskOracleAddress address The RSK Oracle address.
Source Code
constructor(address _mocOracleAddress, address _rskOracleAddress) public {
        setMoCOracleAddress(_mocOracleAddress);
        setRSKOracleAddress(_rskOracleAddress);
    }

latestAnswer

undefined

Get the las time oracle updated the price.

function latestAnswer() external view
returns(uint256)
Source Code
function latestAnswer() external view returns (uint256) {
        (bytes32 value, bool hasValue) = Medianizer(mocOracleAddress).peek();
        if (hasValue) {
            return uint256(value);
        } else {
            (uint256 price, ) = IRSKOracle(rskOracleAddress).getPricing();
            return price;
        }
    }

setMoCOracleAddress

Set the MoC Oracle address. *

function setMoCOracleAddress(address _mocOracleAddress) public nonpayable onlyOwner 

Arguments

Name Type Description
_mocOracleAddress address The MoC Oracle address.
Source Code
function setMoCOracleAddress(address _mocOracleAddress) public onlyOwner {
        require(Address.isContract(_mocOracleAddress), "_mocOracleAddress not a contract");
        mocOracleAddress = _mocOracleAddress;
        emit SetMoCOracleAddress(mocOracleAddress, msg.sender);
    }

setRSKOracleAddress

Set the RSK Oracle address. *

function setRSKOracleAddress(address _rskOracleAddress) public nonpayable onlyOwner 

Arguments

Name Type Description
_rskOracleAddress address The RSK Oracle address.
Source Code
function setRSKOracleAddress(address _rskOracleAddress) public onlyOwner {
        require(Address.isContract(_rskOracleAddress), "_rskOracleAddress not a contract");
        rskOracleAddress = _rskOracleAddress;
        emit SetRSKOracleAddress(rskOracleAddress, msg.sender);
    }

Contracts