-
Notifications
You must be signed in to change notification settings - Fork 0
/
aggregator.sol
39 lines (33 loc) · 887 Bytes
/
aggregator.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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface AggregatorV3Interface {
function latestRoundData() external view returns(
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
contract MockPriceFeed is AggregatorV3Interface {
int256 private _mockPrice;
constructor(int256 initialPrice){
_mockPrice = initialPrice;
}
function latestRoundData() external view override returns(
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
){
roundId = 0;
answer = _mockPrice;
startedAt = 0;
updatedAt = block.timestamp;
answeredInRound = 0;
}
function serPrice(int256 price) external{
_mockPrice = price;
}
}