@venusprotocol/oracle 1.6.12 → 1.7.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/@chainlink/contracts/src/v0.8/interfaces/AggregatorInterface.sol/AggregatorInterface.dbg.json +1 -1
- package/artifacts/@chainlink/contracts/src/v0.8/interfaces/AggregatorV2V3Interface.sol/AggregatorV2V3Interface.dbg.json +1 -1
- package/artifacts/@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol/AggregatorV3Interface.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/AccessControl.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/access/IAccessControl.sol/IAccessControl.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/utils/math/Math.sol/Math.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/utils/math/SafeCast.sol/SafeCast.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/utils/math/SignedMath.sol/SignedMath.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol/Ownable2StepUpgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol/PausableUpgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.dbg.json +1 -1
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlManager.sol/AccessControlManager.dbg.json +1 -1
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol/AccessControlledV8.dbg.json +1 -1
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV8.sol/IAccessControlManagerV8.dbg.json +1 -1
- package/artifacts/build-info/{fc01a49cbd804e304740a46d676189d0.json → 793992aceb435e66ebae85744c16eda9.json} +1 -1
- package/artifacts/contracts/ResilientOracle.sol/ResilientOracle.dbg.json +1 -1
- package/artifacts/contracts/ResilientOracle.sol/ResilientOracle.json +36 -4
- package/artifacts/contracts/interfaces/FeedRegistryInterface.sol/FeedRegistryInterface.dbg.json +1 -1
- package/artifacts/contracts/interfaces/OracleInterface.sol/BoundValidatorInterface.dbg.json +1 -1
- package/artifacts/contracts/interfaces/OracleInterface.sol/BoundValidatorInterface.json +1 -1
- package/artifacts/contracts/interfaces/OracleInterface.sol/OracleInterface.dbg.json +1 -1
- package/artifacts/contracts/interfaces/OracleInterface.sol/OracleInterface.json +2 -2
- package/artifacts/contracts/interfaces/OracleInterface.sol/ResilientOracleInterface.dbg.json +1 -1
- package/artifacts/contracts/interfaces/OracleInterface.sol/ResilientOracleInterface.json +19 -0
- package/artifacts/contracts/interfaces/OracleInterface.sol/TwapInterface.dbg.json +1 -1
- package/artifacts/contracts/interfaces/OracleInterface.sol/TwapInterface.json +3 -3
- package/artifacts/contracts/interfaces/PublicResolverInterface.sol/PublicResolverInterface.dbg.json +1 -1
- package/artifacts/contracts/interfaces/PythInterface.sol/AbstractPyth.dbg.json +1 -1
- package/artifacts/contracts/interfaces/PythInterface.sol/IPyth.dbg.json +1 -1
- package/artifacts/contracts/interfaces/PythInterface.sol/PythStructs.dbg.json +1 -1
- package/artifacts/contracts/interfaces/SIDRegistryInterface.sol/SIDRegistryInterface.dbg.json +1 -1
- package/artifacts/contracts/interfaces/VBep20Interface.sol/VBep20Interface.dbg.json +1 -1
- package/artifacts/contracts/libraries/PancakeLibrary.sol/FixedPoint.dbg.json +1 -1
- package/artifacts/contracts/libraries/PancakeLibrary.sol/IPancakePair.dbg.json +1 -1
- package/artifacts/contracts/libraries/PancakeLibrary.sol/PancakeOracleLibrary.dbg.json +1 -1
- package/artifacts/contracts/oracles/BinanceOracle.sol/BinanceOracle.dbg.json +1 -1
- package/artifacts/contracts/oracles/BinanceOracle.sol/BinanceOracle.json +66 -34
- package/artifacts/contracts/oracles/BoundValidator.sol/BoundValidator.dbg.json +1 -1
- package/artifacts/contracts/oracles/BoundValidator.sol/BoundValidator.json +4 -54
- package/artifacts/contracts/oracles/ChainlinkOracle.sol/ChainlinkOracle.dbg.json +1 -1
- package/artifacts/contracts/oracles/ChainlinkOracle.sol/ChainlinkOracle.json +5 -60
- package/artifacts/contracts/oracles/PythOracle.sol/PythOracle.dbg.json +1 -1
- package/artifacts/contracts/oracles/PythOracle.sol/PythOracle.json +6 -43
- package/artifacts/contracts/oracles/TwapOracle.sol/TwapOracle.dbg.json +1 -1
- package/artifacts/contracts/oracles/TwapOracle.sol/TwapOracle.json +18 -41
- package/artifacts/contracts/oracles/mocks/MockBinanceFeedRegistry.sol/MockBinanceFeedRegistry.dbg.json +1 -1
- package/artifacts/contracts/oracles/mocks/MockBinanceOracle.sol/MockBinanceOracle.dbg.json +1 -1
- package/artifacts/contracts/oracles/mocks/MockChainlinkOracle.sol/MockChainlinkOracle.dbg.json +1 -1
- package/artifacts/contracts/oracles/mocks/MockChainlinkOracle.sol/MockChainlinkOracle.json +2 -2
- package/artifacts/contracts/oracles/mocks/MockPythOracle.sol/MockPythOracle.dbg.json +1 -1
- package/artifacts/contracts/oracles/mocks/MockPythOracle.sol/MockPythOracle.json +2 -2
- package/artifacts/contracts/oracles/mocks/MockTwapOracle.sol/MockTwapOracle.dbg.json +1 -1
- package/artifacts/contracts/test/AccessControlManager.sol/AccessControlManagerScenario.dbg.json +1 -1
- package/artifacts/contracts/test/BEP20Harness.sol/BEP20Harness.dbg.json +1 -1
- package/artifacts/contracts/test/MockPyth.sol/MockPyth.dbg.json +1 -1
- package/artifacts/contracts/test/MockSimpleOracle.sol/MockBoundValidator.dbg.json +1 -1
- package/artifacts/contracts/test/MockSimpleOracle.sol/MockBoundValidator.json +32 -3
- package/artifacts/contracts/test/MockSimpleOracle.sol/MockSimpleOracle.dbg.json +1 -1
- package/artifacts/contracts/test/MockSimpleOracle.sol/MockSimpleOracle.json +21 -2
- package/artifacts/contracts/test/MockV3Aggregator.sol/MockV3Aggregator.dbg.json +1 -1
- package/artifacts/contracts/test/PancakePairHarness.sol/Math.dbg.json +1 -1
- package/artifacts/contracts/test/PancakePairHarness.sol/PancakePairHarness.dbg.json +1 -1
- package/artifacts/contracts/test/PancakePairHarness.sol/UQ112x112.dbg.json +1 -1
- package/artifacts/contracts/test/VBEP20Harness.sol/VBEP20Harness.dbg.json +1 -1
- package/contracts/ResilientOracle.sol +100 -70
- package/contracts/interfaces/OracleInterface.sol +5 -3
- package/contracts/oracles/BinanceOracle.sol +63 -57
- package/contracts/oracles/BoundValidator.sol +22 -51
- package/contracts/oracles/ChainlinkOracle.sol +28 -68
- package/contracts/oracles/PythOracle.sol +28 -48
- package/contracts/oracles/TwapOracle.sol +39 -57
- package/contracts/test/MockSimpleOracle.sol +14 -2
- package/deployments/bsctestnet/BinanceOracle_Implementation.json +1 -1
- package/deployments/bsctestnet/BoundValidator_Implementation.json +1 -1
- package/deployments/bsctestnet/ChainlinkOracle_Implementation.json +1 -1
- package/deployments/bsctestnet/PythOracle_Implementation.json +1 -1
- package/deployments/bsctestnet/ResilientOracle_Implementation.json +1 -1
- package/deployments/bsctestnet/TwapOracle_Implementation.json +1 -1
- package/dist/deploy/1-deploy-oracles.js +5 -5
- package/dist/deploy/1-deploy-oracles.js.map +1 -1
- package/package.json +5 -5
|
@@ -23,14 +23,6 @@ contract ChainlinkOracle is AccessControlledV8, OracleInterface {
|
|
|
23
23
|
uint256 maxStalePeriod;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
/// @notice vBNB address
|
|
27
|
-
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
28
|
-
address public immutable vBnb;
|
|
29
|
-
|
|
30
|
-
/// @notice VAI address
|
|
31
|
-
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
32
|
-
address public immutable vai;
|
|
33
|
-
|
|
34
26
|
/// @notice Set this as asset address for BNB. This is the underlying address for vBNB
|
|
35
27
|
address public constant BNB_ADDR = 0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB;
|
|
36
28
|
|
|
@@ -51,42 +43,18 @@ contract ChainlinkOracle is AccessControlledV8, OracleInterface {
|
|
|
51
43
|
_;
|
|
52
44
|
}
|
|
53
45
|
|
|
54
|
-
/// @notice Constructor for the implementation contract.
|
|
55
|
-
/// @param vBnbAddress The address of the vBNB
|
|
56
|
-
/// @param vaiAddress The address of the VAI
|
|
46
|
+
/// @notice Constructor for the implementation contract.
|
|
57
47
|
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
58
|
-
constructor(
|
|
59
|
-
vBnb = vBnbAddress;
|
|
60
|
-
vai = vaiAddress;
|
|
48
|
+
constructor() {
|
|
61
49
|
_disableInitializers();
|
|
62
50
|
}
|
|
63
51
|
|
|
64
|
-
/**
|
|
65
|
-
* @notice Set the forced prices of the underlying token of input vToken
|
|
66
|
-
* @param vToken vToken address
|
|
67
|
-
* @param underlyingPriceMantissa price in 18 decimals
|
|
68
|
-
* @custom:access Only Governance
|
|
69
|
-
* @custom:error NotNullAddress thrown if address of vToken is null
|
|
70
|
-
* @custom:event Emits PricePosted event on succesfully setup of underlying price
|
|
71
|
-
*/
|
|
72
|
-
function setUnderlyingPrice(
|
|
73
|
-
VBep20Interface vToken,
|
|
74
|
-
uint256 underlyingPriceMantissa
|
|
75
|
-
) external notNullAddress(address(vToken)) {
|
|
76
|
-
_checkAccessAllowed("setUnderlyingPrice(address,uint256)");
|
|
77
|
-
|
|
78
|
-
address asset = address(vToken) == vBnb ? BNB_ADDR : address(vToken.underlying());
|
|
79
|
-
uint256 previousPriceMantissa = prices[asset];
|
|
80
|
-
prices[asset] = underlyingPriceMantissa;
|
|
81
|
-
emit PricePosted(asset, previousPriceMantissa, prices[asset]);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
52
|
/**
|
|
85
53
|
* @notice Manually set the price of a given asset
|
|
86
54
|
* @param asset Asset address
|
|
87
|
-
* @param price
|
|
55
|
+
* @param price Asset price in 18 decimals
|
|
88
56
|
* @custom:access Only Governance
|
|
89
|
-
* @custom:event Emits PricePosted event on succesfully setup of
|
|
57
|
+
* @custom:event Emits PricePosted event on succesfully setup of asset price
|
|
90
58
|
*/
|
|
91
59
|
function setDirectPrice(address asset, uint256 price) external notNullAddress(asset) {
|
|
92
60
|
_checkAccessAllowed("setDirectPrice(address,uint256)");
|
|
@@ -122,16 +90,7 @@ contract ChainlinkOracle is AccessControlledV8, OracleInterface {
|
|
|
122
90
|
}
|
|
123
91
|
|
|
124
92
|
/**
|
|
125
|
-
* @notice
|
|
126
|
-
* @param vToken vToken address
|
|
127
|
-
* @return price Underlying price in USD
|
|
128
|
-
*/
|
|
129
|
-
function getUnderlyingPrice(address vToken) external view override returns (uint256) {
|
|
130
|
-
return _getUnderlyingPriceInternal(VBep20Interface(vToken));
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* @notice Add single token config. vToken & feed cannot be null addresses and maxStalePeriod must be positive
|
|
93
|
+
* @notice Add single token config. asset & feed cannot be null addresses and maxStalePeriod must be positive
|
|
135
94
|
* @param tokenConfig Token config struct
|
|
136
95
|
* @custom:access Only Governance
|
|
137
96
|
* @custom:error NotNullAddress error is thrown if asset address is null
|
|
@@ -150,45 +109,46 @@ contract ChainlinkOracle is AccessControlledV8, OracleInterface {
|
|
|
150
109
|
}
|
|
151
110
|
|
|
152
111
|
/**
|
|
153
|
-
* @notice Gets the
|
|
154
|
-
*
|
|
155
|
-
* @
|
|
156
|
-
* has 18 decimals of precision
|
|
157
|
-
* @param vToken vToken address
|
|
158
|
-
* @return price Underlying price in USD
|
|
112
|
+
* @notice Gets the price of a asset from the chainlink oracle
|
|
113
|
+
* @param asset Address of the asset
|
|
114
|
+
* @return Price in USD from Chainlink or a manually set price for the asset
|
|
159
115
|
*/
|
|
160
|
-
function
|
|
161
|
-
address token;
|
|
116
|
+
function getPrice(address asset) public view returns (uint256) {
|
|
162
117
|
uint256 decimals;
|
|
163
118
|
|
|
164
|
-
|
|
165
|
-
if (address(vToken) == vBnb) {
|
|
166
|
-
token = BNB_ADDR;
|
|
167
|
-
decimals = 18;
|
|
168
|
-
} else if (address(vToken) == vai) {
|
|
169
|
-
token = vai;
|
|
119
|
+
if (asset == BNB_ADDR) {
|
|
170
120
|
decimals = 18;
|
|
171
121
|
} else {
|
|
172
|
-
token =
|
|
173
|
-
decimals =
|
|
122
|
+
IERC20Metadata token = IERC20Metadata(asset);
|
|
123
|
+
decimals = token.decimals();
|
|
174
124
|
}
|
|
175
125
|
|
|
176
|
-
|
|
126
|
+
return _getPriceInternal(asset, decimals);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @notice Gets the Chainlink price for a given asset
|
|
131
|
+
* @param asset address of the asset
|
|
132
|
+
* @param decimals decimals of the asset
|
|
133
|
+
* @return price Asset price in USD or a manually set price of the asset
|
|
134
|
+
*/
|
|
135
|
+
function _getPriceInternal(address asset, uint256 decimals) internal view returns (uint256 price) {
|
|
136
|
+
uint256 tokenPrice = prices[asset];
|
|
177
137
|
if (tokenPrice != 0) {
|
|
178
138
|
price = tokenPrice;
|
|
179
139
|
} else {
|
|
180
|
-
price = _getChainlinkPrice(
|
|
140
|
+
price = _getChainlinkPrice(asset);
|
|
181
141
|
}
|
|
182
142
|
|
|
183
|
-
uint256 decimalDelta = 18 -
|
|
143
|
+
uint256 decimalDelta = 18 - decimals;
|
|
184
144
|
return price * (10 ** decimalDelta);
|
|
185
145
|
}
|
|
186
146
|
|
|
187
147
|
/**
|
|
188
|
-
* @notice Get the Chainlink price for
|
|
148
|
+
* @notice Get the Chainlink price for an asset, revert if token config doesn't exist
|
|
189
149
|
* @dev The precision of the price feed is used to ensure the returned price has 18 decimals of precision
|
|
190
|
-
* @param asset
|
|
191
|
-
* @return price
|
|
150
|
+
* @param asset Address of the asset
|
|
151
|
+
* @return price Price in USD, with 18 decimals of precision
|
|
192
152
|
* @custom:error NotNullAddress error is thrown if the asset address is null
|
|
193
153
|
* @custom:error Price error is thrown if the Chainlink price of asset is not greater than zero
|
|
194
154
|
* @custom:error Timing error is thrown if current timestamp is less than the last updatedAt timestamp
|
|
@@ -30,14 +30,6 @@ contract PythOracle is AccessControlledV8, OracleInterface {
|
|
|
30
30
|
/// @notice Exponent scale (decimal precision) of prices
|
|
31
31
|
uint256 public constant EXP_SCALE = 1e18;
|
|
32
32
|
|
|
33
|
-
/// @notice vBNB address
|
|
34
|
-
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
35
|
-
address public immutable vBnb;
|
|
36
|
-
|
|
37
|
-
/// @notice VAI address
|
|
38
|
-
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
39
|
-
address public immutable vai;
|
|
40
|
-
|
|
41
33
|
/// @notice Set this as asset address for BNB. This is the underlying for vBNB
|
|
42
34
|
address public constant BNB_ADDR = 0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB;
|
|
43
35
|
|
|
@@ -51,20 +43,16 @@ contract PythOracle is AccessControlledV8, OracleInterface {
|
|
|
51
43
|
event PythOracleSet(address indexed oldPythOracle, address indexed newPythOracle);
|
|
52
44
|
|
|
53
45
|
/// @notice Emit when a token config is added
|
|
54
|
-
event TokenConfigAdded(address indexed
|
|
46
|
+
event TokenConfigAdded(address indexed asset, bytes32 indexed pythId, uint64 indexed maxStalePeriod);
|
|
55
47
|
|
|
56
48
|
modifier notNullAddress(address someone) {
|
|
57
49
|
if (someone == address(0)) revert("can't be zero address");
|
|
58
50
|
_;
|
|
59
51
|
}
|
|
60
52
|
|
|
61
|
-
/// @notice Constructor for the implementation contract.
|
|
62
|
-
/// @param vBnbAddress The address of the vBNB
|
|
63
|
-
/// @param vaiAddress The address of the VAI
|
|
53
|
+
/// @notice Constructor for the implementation contract.
|
|
64
54
|
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
65
|
-
constructor(
|
|
66
|
-
vBnb = vBnbAddress;
|
|
67
|
-
vai = vaiAddress;
|
|
55
|
+
constructor() {
|
|
68
56
|
_disableInitializers();
|
|
69
57
|
}
|
|
70
58
|
|
|
@@ -117,32 +105,38 @@ contract PythOracle is AccessControlledV8, OracleInterface {
|
|
|
117
105
|
}
|
|
118
106
|
|
|
119
107
|
/**
|
|
120
|
-
* @notice
|
|
121
|
-
*
|
|
122
|
-
* @
|
|
123
|
-
* @
|
|
124
|
-
* @custom:error
|
|
125
|
-
* @custom:error Zero address error thrown if asset address is null
|
|
126
|
-
* @custom:error Range error thrown if price of Pyth oracle is not greater than zero
|
|
108
|
+
* @notice Set single token config. `maxStalePeriod` cannot be 0 and `asset` cannot be a null address
|
|
109
|
+
* @param tokenConfig Token config struct
|
|
110
|
+
* @custom:access Only Governance
|
|
111
|
+
* @custom:error Range error is thrown if max stale period is zero
|
|
112
|
+
* @custom:error NotNullAddress error is thrown if asset address is null
|
|
127
113
|
*/
|
|
128
|
-
function
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
114
|
+
function setTokenConfig(TokenConfig memory tokenConfig) public notNullAddress(tokenConfig.asset) {
|
|
115
|
+
_checkAccessAllowed("setTokenConfig(TokenConfig)");
|
|
116
|
+
if (tokenConfig.maxStalePeriod == 0) revert("max stale period cannot be 0");
|
|
117
|
+
tokenConfigs[tokenConfig.asset] = tokenConfig;
|
|
118
|
+
emit TokenConfigAdded(tokenConfig.asset, tokenConfig.pythId, tokenConfig.maxStalePeriod);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @notice Gets the price of a asset from the pyth oracle
|
|
123
|
+
* @param asset Address of the asset
|
|
124
|
+
* @return Price in USD
|
|
125
|
+
*/
|
|
126
|
+
function getPrice(address asset) public view returns (uint256) {
|
|
132
127
|
uint256 decimals;
|
|
133
128
|
|
|
134
|
-
|
|
135
|
-
if (vToken == vBnb) {
|
|
136
|
-
asset = BNB_ADDR;
|
|
137
|
-
decimals = 18;
|
|
138
|
-
} else if (vToken == vai) {
|
|
139
|
-
asset = vai;
|
|
129
|
+
if (asset == BNB_ADDR) {
|
|
140
130
|
decimals = 18;
|
|
141
131
|
} else {
|
|
142
|
-
|
|
143
|
-
decimals =
|
|
132
|
+
IERC20Metadata token = IERC20Metadata(asset);
|
|
133
|
+
decimals = token.decimals();
|
|
144
134
|
}
|
|
145
135
|
|
|
136
|
+
return _getPriceInternal(asset, decimals);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function _getPriceInternal(address asset, uint256 decimals) internal view returns (uint256) {
|
|
146
140
|
TokenConfig storage tokenConfig = tokenConfigs[asset];
|
|
147
141
|
if (tokenConfig.asset == address(0)) revert("asset doesn't exist");
|
|
148
142
|
|
|
@@ -164,18 +158,4 @@ contract PythOracle is AccessControlledV8, OracleInterface {
|
|
|
164
158
|
return ((price * EXP_SCALE) / (10 ** int256(-priceInfo.expo).toUint256())) * (10 ** (18 - decimals));
|
|
165
159
|
}
|
|
166
160
|
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* @notice Set single token config. `maxStalePeriod` cannot be 0 and `vToken` can be a null address
|
|
170
|
-
* @param tokenConfig Token config struct
|
|
171
|
-
* @custom:access Only Governance
|
|
172
|
-
* @custom:error Range error is thrown if max stale period is zero
|
|
173
|
-
* @custom:error NotNullAddress error is thrown if asset address is null
|
|
174
|
-
*/
|
|
175
|
-
function setTokenConfig(TokenConfig memory tokenConfig) public notNullAddress(tokenConfig.asset) {
|
|
176
|
-
_checkAccessAllowed("setTokenConfig(TokenConfig)");
|
|
177
|
-
if (tokenConfig.maxStalePeriod == 0) revert("max stale period cannot be 0");
|
|
178
|
-
tokenConfigs[tokenConfig.asset] = tokenConfig;
|
|
179
|
-
emit TokenConfigAdded(tokenConfig.asset, tokenConfig.pythId, tokenConfig.maxStalePeriod);
|
|
180
|
-
}
|
|
181
161
|
}
|
|
@@ -23,7 +23,7 @@ contract TwapOracle is AccessControlledV8, TwapInterface {
|
|
|
23
23
|
struct TokenConfig {
|
|
24
24
|
/// @notice Asset address, which can't be zero address and can be used for existance check
|
|
25
25
|
address asset;
|
|
26
|
-
/// @notice Decimals of
|
|
26
|
+
/// @notice Decimals of asset represented as 1e{decimals}
|
|
27
27
|
uint256 baseUnit;
|
|
28
28
|
/// @notice The address of Pancake pair
|
|
29
29
|
address pancakePool;
|
|
@@ -36,18 +36,13 @@ contract TwapOracle is AccessControlledV8, TwapInterface {
|
|
|
36
36
|
uint256 anchorPeriod;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/// @notice Set this as asset address for BNB. This is the underlying for vBNB
|
|
40
|
+
address public constant BNB_ADDR = 0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB;
|
|
41
|
+
|
|
39
42
|
/// @notice WBNB address
|
|
40
43
|
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
41
44
|
address public immutable WBNB;
|
|
42
45
|
|
|
43
|
-
/// @notice vBNB address
|
|
44
|
-
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
45
|
-
address public immutable vBnb;
|
|
46
|
-
|
|
47
|
-
/// @notice VAI address
|
|
48
|
-
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
49
|
-
address public immutable vai;
|
|
50
|
-
|
|
51
46
|
/// @notice the base unit of WBNB and BUSD, which are the paired tokens for all assets
|
|
52
47
|
uint256 public constant BNB_BASE_UNIT = 1e18;
|
|
53
48
|
uint256 public constant BUSD_BASE_UNIT = 1e18;
|
|
@@ -85,18 +80,10 @@ contract TwapOracle is AccessControlledV8, TwapInterface {
|
|
|
85
80
|
}
|
|
86
81
|
|
|
87
82
|
/// @notice Constructor for the implementation contract. Sets immutable variables.
|
|
88
|
-
/// @param vBnbAddress The address of the VBNB
|
|
89
83
|
/// @param wBnbAddress The address of the WBNB
|
|
90
|
-
/// @param vaiAddress The address of the WBNB
|
|
91
84
|
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
92
|
-
constructor(
|
|
93
|
-
address vBnbAddress,
|
|
94
|
-
address wBnbAddress,
|
|
95
|
-
address vaiAddress
|
|
96
|
-
) notNullAddress(vBnbAddress) notNullAddress(wBnbAddress) notNullAddress(vaiAddress) {
|
|
97
|
-
vBnb = vBnbAddress;
|
|
85
|
+
constructor(address wBnbAddress) notNullAddress(wBnbAddress) {
|
|
98
86
|
WBNB = wBnbAddress;
|
|
99
|
-
vai = vaiAddress;
|
|
100
87
|
_disableInitializers();
|
|
101
88
|
}
|
|
102
89
|
|
|
@@ -125,38 +112,29 @@ contract TwapOracle is AccessControlledV8, TwapInterface {
|
|
|
125
112
|
}
|
|
126
113
|
|
|
127
114
|
/**
|
|
128
|
-
* @notice
|
|
129
|
-
* @
|
|
130
|
-
* @
|
|
131
|
-
*/
|
|
132
|
-
function updateTwap(address vToken) external returns (uint256) {
|
|
133
|
-
address asset = _getUnderlyingAsset(vToken);
|
|
134
|
-
|
|
135
|
-
if (tokenConfigs[asset].asset == address(0)) revert("asset not exist");
|
|
136
|
-
// Update & fetch WBNB price first, so we can calculate the price of WBNB paired token
|
|
137
|
-
if (asset != WBNB && tokenConfigs[asset].isBnbBased) {
|
|
138
|
-
if (tokenConfigs[WBNB].asset == address(0)) revert("WBNB not exist");
|
|
139
|
-
_updateTwapInternal(tokenConfigs[WBNB]);
|
|
140
|
-
}
|
|
141
|
-
return _updateTwapInternal(tokenConfigs[asset]);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* @notice Get the underlying TWAP price for the given vToken
|
|
146
|
-
* @param vToken vToken address
|
|
147
|
-
* @return price Underlying price in USD
|
|
115
|
+
* @notice Get the TWAP price for the given asset
|
|
116
|
+
* @param asset asset address
|
|
117
|
+
* @return price asset price in USD
|
|
148
118
|
* @custom:error Missing error is thrown if the token config does not exist
|
|
149
119
|
* @custom:error Range error is thrown if TWAP price is not greater than zero
|
|
150
120
|
*/
|
|
151
|
-
function
|
|
152
|
-
|
|
121
|
+
function getPrice(address asset) external view override returns (uint256) {
|
|
122
|
+
uint256 decimals;
|
|
123
|
+
|
|
124
|
+
if (asset == BNB_ADDR) {
|
|
125
|
+
decimals = 18;
|
|
126
|
+
asset = WBNB;
|
|
127
|
+
} else {
|
|
128
|
+
IERC20Metadata token = IERC20Metadata(asset);
|
|
129
|
+
decimals = token.decimals();
|
|
130
|
+
}
|
|
153
131
|
|
|
154
132
|
if (tokenConfigs[asset].asset == address(0)) revert("asset not exist");
|
|
155
133
|
uint256 price = prices[asset];
|
|
156
134
|
|
|
157
135
|
// if price is 0, it means the price hasn't been updated yet and it's meaningless, revert
|
|
158
136
|
if (price == 0) revert("TWAP price must be positive");
|
|
159
|
-
return (price * (10 ** (18 -
|
|
137
|
+
return (price * (10 ** (18 - decimals)));
|
|
160
138
|
}
|
|
161
139
|
|
|
162
140
|
/**
|
|
@@ -188,6 +166,25 @@ contract TwapOracle is AccessControlledV8, TwapInterface {
|
|
|
188
166
|
emit TokenConfigAdded(config.asset, config.pancakePool, config.anchorPeriod);
|
|
189
167
|
}
|
|
190
168
|
|
|
169
|
+
/**
|
|
170
|
+
* @notice Updates the current token/BUSD price from PancakeSwap, with 18 decimals of precision.
|
|
171
|
+
* @return anchorPrice anchor price of the asset
|
|
172
|
+
* @custom:error Missing error is thrown if token config does not exist
|
|
173
|
+
*/
|
|
174
|
+
function updateTwap(address asset) public returns (uint256) {
|
|
175
|
+
if (asset == BNB_ADDR) {
|
|
176
|
+
asset = WBNB;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (tokenConfigs[asset].asset == address(0)) revert("asset not exist");
|
|
180
|
+
// Update & fetch WBNB price first, so we can calculate the price of WBNB paired token
|
|
181
|
+
if (asset != WBNB && tokenConfigs[asset].isBnbBased) {
|
|
182
|
+
if (tokenConfigs[WBNB].asset == address(0)) revert("WBNB not exist");
|
|
183
|
+
_updateTwapInternal(tokenConfigs[WBNB]);
|
|
184
|
+
}
|
|
185
|
+
return _updateTwapInternal(tokenConfigs[asset]);
|
|
186
|
+
}
|
|
187
|
+
|
|
191
188
|
/**
|
|
192
189
|
* @notice Fetches the current token/WBNB and token/BUSD price accumulator from PancakeSwap.
|
|
193
190
|
* @return cumulative price of target token regardless of pair order
|
|
@@ -203,7 +200,7 @@ contract TwapOracle is AccessControlledV8, TwapInterface {
|
|
|
203
200
|
|
|
204
201
|
/**
|
|
205
202
|
* @notice Fetches the current token/BUSD price from PancakeSwap, with 18 decimals of precision.
|
|
206
|
-
* @return price
|
|
203
|
+
* @return price Asset price in USD, with 18 decimals
|
|
207
204
|
* @custom:error Timing error is thrown if current time is not greater than old observation timestamp
|
|
208
205
|
* @custom:error Zero price error is thrown if token is BNB based and price is zero
|
|
209
206
|
* @custom:error Zero price error is thrown if fetched anchorPriceMantissa is zero
|
|
@@ -300,19 +297,4 @@ contract TwapOracle is AccessControlledV8, TwapInterface {
|
|
|
300
297
|
);
|
|
301
298
|
return (cumulativePrice, startCumulativePrice, startCumulativeTimestamp);
|
|
302
299
|
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* @dev This function returns the underlying asset of a vToken
|
|
306
|
-
* @param vToken vToken address
|
|
307
|
-
* @return asset underlying asset address
|
|
308
|
-
*/
|
|
309
|
-
function _getUnderlyingAsset(address vToken) private view returns (address asset) {
|
|
310
|
-
if (vToken == vBnb) {
|
|
311
|
-
asset = WBNB;
|
|
312
|
-
} else if (vToken == vai) {
|
|
313
|
-
asset = vai;
|
|
314
|
-
} else {
|
|
315
|
-
asset = VBep20Interface(vToken).underlying();
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
300
|
}
|
|
@@ -14,6 +14,10 @@ contract MockSimpleOracle is OracleInterface {
|
|
|
14
14
|
return prices[vToken];
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
function getPrice(address asset) external view returns (uint256) {
|
|
18
|
+
return prices[asset];
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
function setPrice(address vToken, uint256 price) public {
|
|
18
22
|
prices[vToken] = price;
|
|
19
23
|
}
|
|
@@ -35,7 +39,15 @@ contract MockBoundValidator is BoundValidatorInterface {
|
|
|
35
39
|
return validateResults[vToken];
|
|
36
40
|
}
|
|
37
41
|
|
|
38
|
-
function
|
|
39
|
-
|
|
42
|
+
function validateAssetPriceWithAnchorPrice(
|
|
43
|
+
address asset,
|
|
44
|
+
uint256 reporterPrice,
|
|
45
|
+
uint256 anchorPrice
|
|
46
|
+
) external view returns (bool) {
|
|
47
|
+
return validateResults[asset];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function setValidateResult(address token, bool pass) public {
|
|
51
|
+
validateResults[token] = pass;
|
|
40
52
|
}
|
|
41
53
|
}
|
|
@@ -60,7 +60,7 @@ const func = function ({ getNamedAccounts, deployments, network }) {
|
|
|
60
60
|
from: deployer,
|
|
61
61
|
log: true,
|
|
62
62
|
deterministicDeployment: false,
|
|
63
|
-
args: [
|
|
63
|
+
args: [],
|
|
64
64
|
proxy: {
|
|
65
65
|
owner: proxyOwnerAddress,
|
|
66
66
|
proxyContract: "OptimizedTransparentProxy",
|
|
@@ -90,7 +90,7 @@ const func = function ({ getNamedAccounts, deployments, network }) {
|
|
|
90
90
|
from: deployer,
|
|
91
91
|
log: true,
|
|
92
92
|
deterministicDeployment: false,
|
|
93
|
-
args:
|
|
93
|
+
args: [],
|
|
94
94
|
proxy: {
|
|
95
95
|
owner: proxyOwnerAddress,
|
|
96
96
|
proxyContract: "OptimizedTransparentProxy",
|
|
@@ -105,7 +105,7 @@ const func = function ({ getNamedAccounts, deployments, network }) {
|
|
|
105
105
|
from: deployer,
|
|
106
106
|
log: true,
|
|
107
107
|
deterministicDeployment: false,
|
|
108
|
-
args: network.live ? [
|
|
108
|
+
args: network.live ? [WBNBAddress] : [],
|
|
109
109
|
proxy: {
|
|
110
110
|
owner: proxyOwnerAddress,
|
|
111
111
|
proxyContract: "OptimizedTransparentProxy",
|
|
@@ -121,7 +121,7 @@ const func = function ({ getNamedAccounts, deployments, network }) {
|
|
|
121
121
|
from: deployer,
|
|
122
122
|
log: true,
|
|
123
123
|
deterministicDeployment: false,
|
|
124
|
-
args:
|
|
124
|
+
args: [],
|
|
125
125
|
proxy: {
|
|
126
126
|
owner: proxyOwnerAddress,
|
|
127
127
|
proxyContract: "OptimizedTransparentProxy",
|
|
@@ -137,7 +137,7 @@ const func = function ({ getNamedAccounts, deployments, network }) {
|
|
|
137
137
|
from: deployer,
|
|
138
138
|
log: true,
|
|
139
139
|
deterministicDeployment: false,
|
|
140
|
-
args:
|
|
140
|
+
args: [],
|
|
141
141
|
proxy: {
|
|
142
142
|
owner: proxyOwnerAddress,
|
|
143
143
|
proxyContract: "OptimizedTransparentProxy",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1-deploy-oracles.js","sourceRoot":"","sources":["../../deploy/1-deploy-oracles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uGAAqF;AACrF,uGAAqF;AACrF,sDAA0B;AAI1B,MAAM,SAAS,GAAG;IAChB,UAAU,EAA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CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;SACzE;IACH,CAAC;CAAA,CAAC;AAEF,kBAAe,IAAI,CAAC;AACP,QAAA,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venusprotocol/oracle",
|
|
3
3
|
"description": "Venus Protocol Price Oracle",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"author": "",
|
|
4
|
+
"version": "1.7.0-dev.2",
|
|
5
|
+
"author": "Venus",
|
|
6
6
|
"engines": {
|
|
7
|
-
"node": ">=
|
|
7
|
+
"node": ">=18.x.x"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"artifacts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@venusprotocol/governance-contracts": "^0.0.2",
|
|
42
42
|
"@venusprotocol/venus-protocol": "0.7.0",
|
|
43
43
|
"ethers": "^5.6.8",
|
|
44
|
-
"hardhat": "^2.
|
|
44
|
+
"hardhat": "^2.16.1",
|
|
45
45
|
"hardhat-deploy": "^0.11.14",
|
|
46
46
|
"module-alias": "^2.2.2",
|
|
47
47
|
"solidity-docgen": "^0.6.0-beta.29"
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"shx": "^0.3.4",
|
|
90
90
|
"solhint": "^3.3.7",
|
|
91
91
|
"solhint-plugin-prettier": "^0.0.5",
|
|
92
|
-
"solidity-coverage": "^0.
|
|
92
|
+
"solidity-coverage": "^0.8.4",
|
|
93
93
|
"ts-generator": "^0.1.1",
|
|
94
94
|
"ts-node": "^10.8.1",
|
|
95
95
|
"typechain": "^8.1.0",
|