-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMockEthFeed.sol
72 lines (64 loc) · 1.25 KB
/
MockEthFeed.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
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.6.2 <0.9.0;
import "src/interfaces/feeds/AggregatorV3Interface.sol";
contract MockEthFeed is AggregatorV3Interface {
uint80 private roundId;
int256 private answer;
uint256 private startedAt;
uint256 private updatedAt;
uint80 private answeredInRound;
constructor () public {
roundId = 0;
answer = 0;
startedAt = block.timestamp;
updatedAt = block.timestamp;
answeredInRound = 0;
}
function decimals() external pure override returns (uint8) {
return 18;
}
function description() external pure override returns (string memory) {
return "mock LINK/ETH data feed";
}
function version() external pure override returns (uint256) {
return 1;
}
function getRoundData(uint80)
override
external
view
returns (
uint80,
int256,
uint256,
uint256,
uint80
) {
return (
roundId,
answer,
block.timestamp,
block.timestamp,
answeredInRound
);
}
function latestRoundData()
override
external
view
returns (
uint80,
int256,
uint256,
uint256,
uint80
) {
return (
roundId,
answer,
block.timestamp,
block.timestamp,
answeredInRound
);
}
}