forked from bokkypoobah/FxxxLandRush
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakerDAOETHUSDPriceFeedSimulator.sol
40 lines (34 loc) · 1.43 KB
/
MakerDAOETHUSDPriceFeedSimulator.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
pragma solidity ^0.4.25;
// ----------------------------------------------------------------------------
// BokkyPooBah's MakerDAO's "pip" PriceFeed Simulator for testing
//
// Used to simulate the MakerDAO ETH/USD pricefeed on the Ethereum mainnet at
// https://etherscan.io/address/0x729D19f657BD0614b4985Cf1D82531c67569197B
//
//
// Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2018. The MIT Licence.
// ----------------------------------------------------------------------------
import "Owned.sol";
// ----------------------------------------------------------------------------
// Pricefeed with interface compatible with MakerDAO's "pip" PriceFeed
// ----------------------------------------------------------------------------
contract MakerDAOETHUSDPriceFeedSimulator is Owned {
uint public value;
bool public hasValue;
event SetValue(uint oldValue, bool oldHasValue, uint newValue, bool newHasValue);
constructor(uint _value, bool _hasValue) public {
initOwned(msg.sender);
value = _value;
hasValue = _hasValue;
emit SetValue(0, false, value, hasValue);
}
function setValue(uint _value, bool _hasValue) public onlyOwner {
emit SetValue(value, hasValue, _value, _hasValue);
value = _value;
hasValue = _hasValue;
}
function peek() public view returns (bytes32 _value, bool _hasValue) {
_value = bytes32(value);
_hasValue = hasValue;
}
}