forked from Synthetixio/synthetix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBaseOneNetAggregator.sol
73 lines (57 loc) · 1.77 KB
/
BaseOneNetAggregator.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
pragma solidity ^0.5.16;
//import "@chainlink/contracts-0.0.10/src/v0.5/interfaces/AggregatorV2V3Interface.sol";
import "./AddressResolver.sol";
import "./interfaces/IDebtCache.sol";
import "./interfaces/ISynthetixDebtShare.sol";
import "./interfaces/AggregatorV2V3Interface.sol";
import "./SafeDecimalMath.sol";
// aggregator which reports the data from the system itself
// useful for testing
contract BaseOneNetAggregator is Owned, AggregatorV2V3Interface {
using SafeDecimalMath for uint;
AddressResolver public resolver;
uint public overrideTimestamp;
constructor(AddressResolver _resolver) public Owned(msg.sender) {
resolver = _resolver;
}
function setOverrideTimestamp(uint timestamp) public onlyOwner {
overrideTimestamp = timestamp;
emit SetOverrideTimestamp(timestamp);
}
function latestRoundData()
external
view
returns (
uint80,
int256,
uint256,
uint256,
uint80
)
{
return getRoundData(uint80(latestRound()));
}
function latestRound() public view returns (uint256) {
return 1;
}
function decimals() external view returns (uint8) {
return 0;
}
function getAnswer(uint256 _roundId) external view returns (int256 answer) {
(, answer, , , ) = getRoundData(uint80(_roundId));
}
function getTimestamp(uint256 _roundId) external view returns (uint256 timestamp) {
(, , timestamp, , ) = getRoundData(uint80(_roundId));
}
function getRoundData(uint80)
public
view
returns (
uint80,
int256,
uint256,
uint256,
uint80
);
event SetOverrideTimestamp(uint timestamp);
}