Skip to content

Commit 2b966d0

Browse files
committed
added bound validator docs
1 parent d8b509e commit 2b966d0

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

oracle/BoundValidator.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Bound Validator
2+
3+
## Introduction
4+
5+
This contracts is used to validate prices from two different sources. We need to set upper and lower bound ratios config for each vToken in this contract.
6+
7+
## Solidity API
8+
9+
10+
### initialize
11+
12+
```solidity
13+
function initialize() public
14+
```
15+
16+
Initializes the owner of the contract
17+
18+
### setValidateConfigs
19+
20+
```solidity
21+
function setValidateConfigs(struct ValidateConfig[] configs) external virtual
22+
```
23+
24+
Add multiple validation configs at the same time
25+
26+
#### Parameters
27+
28+
| Name | Type | Description |
29+
| ---- | ---- | ----------- |
30+
| configs | struct ValidateConfig[] | config array |
31+
32+
### setValidateConfig
33+
34+
```solidity
35+
function setValidateConfig(struct ValidateConfig config) public virtual
36+
```
37+
38+
Add single validation config
39+
40+
#### Parameters
41+
42+
| Name | Type | Description |
43+
| ---- | ---- | ----------- |
44+
| config | struct ValidateConfig | config struct |
45+
46+
### validatePriceWithAnchorPrice
47+
48+
```solidity
49+
function validatePriceWithAnchorPrice(address vToken, uint256 reporterPrice, uint256 anchorPrice) public view virtual returns (bool)
50+
```
51+
52+
Test reported asset price against anchor price
53+
54+
#### Parameters
55+
56+
| Name | Type | Description |
57+
| ---- | ---- | ----------- |
58+
| vToken | address | vToken address |
59+
| reporterPrice | uint256 | the price to be tested |
60+
| anchorPrice | uint256 | |
61+
62+
### _isWithinAnchor
63+
64+
```solidity
65+
function _isWithinAnchor(address asset, uint256 reporterPrice, uint256 anchorPrice) internal view returns (bool)
66+
```
67+
68+
Test whether the reported price is within the predefined bounds
69+
70+
#### Parameters
71+
72+
| Name | Type | Description |
73+
| ---- | ---- | ----------- |
74+
| asset | address | asset address |
75+
| reporterPrice | uint256 | the price to be tested |
76+
| anchorPrice | uint256 | anchor price as testing anchor |

0 commit comments

Comments
 (0)