-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPriceFeed.sol
43 lines (37 loc) · 1.36 KB
/
PriceFeed.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
41
42
43
pragma solidity ^0.4.25;
// ----------------------------------------------------------------------------
// BokkyPooBah's Pricefeed from a single source
//
// Deployed to: 0xD649c9b68BB78e8fd25c0B7a9c22c42f57768c91
//
// Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2018. The MIT Licence.
// ----------------------------------------------------------------------------
import "Operated.sol";
import "PriceFeedInterface.sol";
// ----------------------------------------------------------------------------
// Pricefeed from a single source
// ----------------------------------------------------------------------------
contract PriceFeed is PriceFeedInterface, Operated {
string private _name;
uint private _rate;
bool private _live;
event SetRate(uint oldRate, bool oldLive, uint newRate, bool newLive);
constructor(string name, uint rate, bool live) public {
initOperated(msg.sender);
_name = name;
_rate = rate;
_live = live;
emit SetRate(0, false, _rate, _live);
}
function name() public view returns (string) {
return _name;
}
function setRate(uint rate, bool live) public onlyOperator {
emit SetRate(_rate, _live, rate, live);
_rate = rate;
_live = live;
}
function getRate() public view returns (uint rate, bool live) {
return (_rate, _live);
}
}