You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: oracle/ResillientOracle.md
+161-1Lines changed: 161 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Keeping this in mind, we have designed a resilient oracle which uses multiple or
12
12
13
13
The way the resilient oracle works is for every market (vToken) we configure the main, pivot and fallback oracles. The main oracle oracle is the most trustworthy price source, the pivot oracle is is used as a loose sanity checker and the fallback oracle is used as a backup price source.
To validate the price between two oracles we set an upper and lower bound ratio for every market. The upper bound ratio represents the deviation between reported prices (price from oracle that’s being validated) and anchor price (price from oracle we are validating against) beyond which the reported price will be invalidated. And the lower bound ratio presents the deviation between reported price and anchor price below which the reported price will be invalidated. So for oracle price to be considered valid the below statement should be true:
We usually use Chainlink as the main oracle, TWAP or Pyth oracle as pivot oracle depending on which supports the given market and binance oracle is used as the fallback oracle. For some markets we may use Pyth or TWAP as the main oracle if the token price is not supported by Chainlink or Binance oracles.
25
25
26
26
When fetching an oracle price, for the price to be valid it must be positive and not stagnant. If the price is invalid then we consider the oracle to be stagnant and treat it like it's disabled.
27
+
28
+
## Solidity API
29
+
30
+
### initialize
31
+
32
+
```solidity
33
+
function initialize(contract BoundValidatorInterface _boundValidator) public
34
+
```
35
+
36
+
Initializes the contract admin and sets the required contracts
37
+
38
+
#### Parameters
39
+
40
+
| Name | Type | Description |
41
+
| ---- | ---- | ----------- |
42
+
|_boundValidator | contract BoundValidatorInterface | Address of the bound validator contract |
43
+
44
+
### pause
45
+
46
+
```solidity
47
+
function pause() external
48
+
```
49
+
50
+
Pause oracle
51
+
52
+
### unpause
53
+
54
+
```solidity
55
+
function unpause() external
56
+
```
57
+
58
+
Unpause oracle
59
+
60
+
### getTokenConfig
61
+
62
+
```solidity
63
+
function getTokenConfig(address vToken) external view returns (struct ResilientOracle.TokenConfig)
64
+
```
65
+
66
+
_Get token config by vToken address_
67
+
68
+
#### Parameters
69
+
70
+
| Name | Type | Description |
71
+
| ---- | ---- | ----------- |
72
+
| vToken | address | vtoken address |
73
+
74
+
### getOracle
75
+
76
+
```solidity
77
+
function getOracle(address vToken, enum ResilientOracle.OracleRole role) public view returns (address oracle, bool enabled)
78
+
```
79
+
80
+
Get oracle & enabling status by vToken address
81
+
82
+
#### Parameters
83
+
84
+
| Name | Type | Description |
85
+
| ---- | ---- | ----------- |
86
+
| vToken | address | vtoken address |
87
+
| role | enum ResilientOracle.OracleRole | oracle role |
88
+
89
+
### setTokenConfigs
90
+
91
+
```solidity
92
+
function setTokenConfigs(struct ResilientOracle.TokenConfig[] tokenConfigs_) external
0 commit comments