generated from PaulRBerg/hardhat-template
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathMockSimpleOracle.sol
53 lines (42 loc) · 1.26 KB
/
MockSimpleOracle.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
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;
import "../interfaces/OracleInterface.sol";
contract MockSimpleOracle is OracleInterface {
mapping(address => uint256) public prices;
constructor() {
//
}
function getUnderlyingPrice(address vToken) external view returns (uint256) {
return prices[vToken];
}
function getPrice(address asset) external view returns (uint256) {
return prices[asset];
}
function setPrice(address vToken, uint256 price) public {
prices[vToken] = price;
}
}
contract MockBoundValidator is BoundValidatorInterface {
mapping(address => bool) public validateResults;
bool public twapUpdated;
constructor() {
//
}
function validatePriceWithAnchorPrice(
address vToken,
uint256 reporterPrice,
uint256 anchorPrice
) external view returns (bool) {
return validateResults[vToken];
}
function validateAssetPriceWithAnchorPrice(
address asset,
uint256 reporterPrice,
uint256 anchorPrice
) external view returns (bool) {
return validateResults[asset];
}
function setValidateResult(address token, bool pass) public {
validateResults[token] = pass;
}
}