Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (27 sloc) 893 Bytes
pragma solidity ^0.5.0;
import "./OracleBase.sol";
import "zos-lib/contracts/Initializable.sol";
/**
* @title BasicOracle
* @dev Extends OracleBase to allow the result to be set by a single data source
*/
contract BasicOracle is Initializable, OracleBase {
// The address that is able to set the result
address payable public dataSource;
/**
* @dev BasicOracle initializer
* @param _dataSource The address that is able to set the result
*/
function initialize(address payable _dataSource) public initializer {
require(_dataSource != address(0), "Require a non-null dataSource");
dataSource = _dataSource;
}
/**
* @dev Sets the result of the oracle
* @param _result The result being set
*/
function setResult(bytes32 _result) public {
require(msg.sender == dataSource, "The caller is not the data source.");
_setResult(_result);
}
}
You can’t perform that action at this time.