Skip to content

Latest commit

 

History

History
332 lines (290 loc) · 10.4 KB

PriceFeedRSKOracle.md

File metadata and controls

332 lines (290 loc) · 10.4 KB

PriceFeedRSKOracle.sol

View Source: contracts/feeds/PriceFeedRSKOracle.sol

↗ Extends: IPriceFeedsExt, Ownable

PriceFeedRSKOracle contract

The Price Feed RSK Oracle contract.

  • This contract implements RSK Oracle query functionality, getting the price and the last timestamp from an external oracle contract.

Contract Members

Constants & Variables

address public rskOracleAddress;

Events

event SetRSKOracleAddress(address indexed rskOracleAddress, address  changerAddress);

Functions


constructor

Initialize a new RSK Oracle. *

function (address _rskOracleAddress) public nonpayable

Arguments

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

latestAnswer

undefined

Get the oracle price.

function latestAnswer() external view
returns(_price uint256)
Source Code
function latestAnswer() external view returns (uint256 _price) {
        IRSKOracle _rskOracle = IRSKOracle(rskOracleAddress);
        (_price, ) = _rskOracle.getPricing();
    }

latestTimestamp

Get the las time oracle updated the price.

function latestTimestamp() external view
returns(_timestamp uint256)
Source Code
function latestTimestamp() external view returns (uint256 _timestamp) {
        IRSKOracle _rskOracle = IRSKOracle(rskOracleAddress);
        (, _timestamp) = _rskOracle.getPricing();
    }

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