@venusprotocol/oracle 1.6.12-dev.2 → 1.6.12-dev.3
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/contracts/ResilientOracle.sol +84 -55
- package/contracts/interfaces/FeedRegistryInterface.sol +4 -4
- package/contracts/interfaces/OracleInterface.sol +3 -1
- package/contracts/oracles/BinanceOracle.sol +46 -55
- package/contracts/oracles/BoundValidator.sol +22 -51
- package/contracts/oracles/ChainlinkOracle.sol +19 -59
- package/contracts/oracles/PythOracle.sol +27 -47
- package/contracts/oracles/TwapOracle.sol +36 -54
- package/contracts/oracles/mocks/MockBinanceFeedRegistry.sol +6 -6
- package/contracts/test/MockSimpleOracle.sol +14 -2
- package/dist/deploy/1-deploy-oracles.js +6 -6
- package/dist/deploy/1-deploy-oracles.js.map +1 -1
- package/package.json +2 -2
- package/artifacts/@chainlink/contracts/src/v0.8/interfaces/AggregatorInterface.sol/AggregatorInterface.dbg.json +0 -4
- package/artifacts/@chainlink/contracts/src/v0.8/interfaces/AggregatorInterface.sol/AggregatorInterface.json +0 -138
- package/artifacts/@chainlink/contracts/src/v0.8/interfaces/AggregatorV2V3Interface.sol/AggregatorV2V3Interface.dbg.json +0 -4
- package/artifacts/@chainlink/contracts/src/v0.8/interfaces/AggregatorV2V3Interface.sol/AggregatorV2V3Interface.json +0 -249
- package/artifacts/@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol/AggregatorV3Interface.dbg.json +0 -4
- package/artifacts/@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol/AggregatorV3Interface.json +0 -122
- package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/AccessControl.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/AccessControl.json +0 -215
- package/artifacts/@openzeppelin/contracts/access/IAccessControl.sol/IAccessControl.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/access/IAccessControl.sol/IAccessControl.json +0 -183
- package/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json +0 -297
- package/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.json +0 -194
- package/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.json +0 -233
- package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.json +0 -10
- package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.json +0 -10
- package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.json +0 -30
- package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.json +0 -30
- package/artifacts/@openzeppelin/contracts/utils/math/Math.sol/Math.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/utils/math/Math.sol/Math.json +0 -10
- package/artifacts/@openzeppelin/contracts/utils/math/SafeCast.sol/SafeCast.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/utils/math/SafeCast.sol/SafeCast.json +0 -10
- package/artifacts/@openzeppelin/contracts/utils/math/SignedMath.sol/SignedMath.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts/utils/math/SignedMath.sol/SignedMath.json +0 -10
- package/artifacts/@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol/Ownable2StepUpgradeable.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol/Ownable2StepUpgradeable.json +0 -115
- package/artifacts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.json +0 -76
- package/artifacts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.json +0 -24
- package/artifacts/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol/PausableUpgradeable.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol/PausableUpgradeable.json +0 -63
- package/artifacts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.json +0 -10
- package/artifacts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.dbg.json +0 -4
- package/artifacts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.json +0 -24
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlManager.sol/AccessControlManager.dbg.json +0 -4
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlManager.sol/AccessControlManager.json +0 -369
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol/AccessControlledV8.dbg.json +0 -4
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol/AccessControlledV8.json +0 -181
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV8.sol/IAccessControlManagerV8.dbg.json +0 -4
- package/artifacts/@venusprotocol/governance-contracts/contracts/Governance/IAccessControlManagerV8.sol/IAccessControlManagerV8.json +0 -282
- package/artifacts/build-info/fc01a49cbd804e304740a46d676189d0.json +0 -1
- package/artifacts/contracts/ResilientOracle.sol/ResilientOracle.dbg.json +0 -4
- package/artifacts/contracts/ResilientOracle.sol/ResilientOracle.json +0 -617
- package/artifacts/contracts/interfaces/FeedRegistryInterface.sol/FeedRegistryInterface.dbg.json +0 -4
- package/artifacts/contracts/interfaces/FeedRegistryInterface.sol/FeedRegistryInterface.json +0 -79
- package/artifacts/contracts/interfaces/OracleInterface.sol/BoundValidatorInterface.dbg.json +0 -4
- package/artifacts/contracts/interfaces/OracleInterface.sol/BoundValidatorInterface.json +0 -40
- package/artifacts/contracts/interfaces/OracleInterface.sol/OracleInterface.dbg.json +0 -4
- package/artifacts/contracts/interfaces/OracleInterface.sol/OracleInterface.json +0 -30
- package/artifacts/contracts/interfaces/OracleInterface.sol/ResilientOracleInterface.dbg.json +0 -4
- package/artifacts/contracts/interfaces/OracleInterface.sol/ResilientOracleInterface.json +0 -43
- package/artifacts/contracts/interfaces/OracleInterface.sol/TwapInterface.dbg.json +0 -4
- package/artifacts/contracts/interfaces/OracleInterface.sol/TwapInterface.json +0 -49
- package/artifacts/contracts/interfaces/PublicResolverInterface.sol/PublicResolverInterface.dbg.json +0 -4
- package/artifacts/contracts/interfaces/PublicResolverInterface.sol/PublicResolverInterface.json +0 -30
- package/artifacts/contracts/interfaces/PythInterface.sol/AbstractPyth.dbg.json +0 -4
- package/artifacts/contracts/interfaces/PythInterface.sol/AbstractPyth.json +0 -545
- package/artifacts/contracts/interfaces/PythInterface.sol/IPyth.dbg.json +0 -4
- package/artifacts/contracts/interfaces/PythInterface.sol/IPyth.json +0 -446
- package/artifacts/contracts/interfaces/PythInterface.sol/PythStructs.dbg.json +0 -4
- package/artifacts/contracts/interfaces/PythInterface.sol/PythStructs.json +0 -10
- package/artifacts/contracts/interfaces/SIDRegistryInterface.sol/SIDRegistryInterface.dbg.json +0 -4
- package/artifacts/contracts/interfaces/SIDRegistryInterface.sol/SIDRegistryInterface.json +0 -30
- package/artifacts/contracts/interfaces/VBep20Interface.sol/VBep20Interface.dbg.json +0 -4
- package/artifacts/contracts/interfaces/VBep20Interface.sol/VBep20Interface.json +0 -246
- package/artifacts/contracts/libraries/PancakeLibrary.sol/FixedPoint.dbg.json +0 -4
- package/artifacts/contracts/libraries/PancakeLibrary.sol/FixedPoint.json +0 -10
- package/artifacts/contracts/libraries/PancakeLibrary.sol/IPancakePair.dbg.json +0 -4
- package/artifacts/contracts/libraries/PancakeLibrary.sol/IPancakePair.json +0 -60
- package/artifacts/contracts/libraries/PancakeLibrary.sol/PancakeOracleLibrary.dbg.json +0 -4
- package/artifacts/contracts/libraries/PancakeLibrary.sol/PancakeOracleLibrary.json +0 -10
- package/artifacts/contracts/oracles/BinanceOracle.sol/BinanceOracle.dbg.json +0 -4
- package/artifacts/contracts/oracles/BinanceOracle.sol/BinanceOracle.json +0 -342
- package/artifacts/contracts/oracles/BoundValidator.sol/BoundValidator.dbg.json +0 -4
- package/artifacts/contracts/oracles/BoundValidator.sol/BoundValidator.json +0 -392
- package/artifacts/contracts/oracles/ChainlinkOracle.sol/ChainlinkOracle.dbg.json +0 -4
- package/artifacts/contracts/oracles/ChainlinkOracle.sol/ChainlinkOracle.json +0 -462
- package/artifacts/contracts/oracles/PythOracle.sol/PythOracle.dbg.json +0 -4
- package/artifacts/contracts/oracles/PythOracle.sol/PythOracle.json +0 -445
- package/artifacts/contracts/oracles/TwapOracle.sol/TwapOracle.dbg.json +0 -4
- package/artifacts/contracts/oracles/TwapOracle.sol/TwapOracle.json +0 -663
- package/artifacts/contracts/oracles/mocks/MockBinanceFeedRegistry.sol/MockBinanceFeedRegistry.dbg.json +0 -4
- package/artifacts/contracts/oracles/mocks/MockBinanceFeedRegistry.sol/MockBinanceFeedRegistry.json +0 -116
- package/artifacts/contracts/oracles/mocks/MockBinanceOracle.sol/MockBinanceOracle.dbg.json +0 -4
- package/artifacts/contracts/oracles/mocks/MockBinanceOracle.sol/MockBinanceOracle.json +0 -144
- package/artifacts/contracts/oracles/mocks/MockChainlinkOracle.sol/MockChainlinkOracle.dbg.json +0 -4
- package/artifacts/contracts/oracles/mocks/MockChainlinkOracle.sol/MockChainlinkOracle.json +0 -144
- package/artifacts/contracts/oracles/mocks/MockPythOracle.sol/MockPythOracle.dbg.json +0 -4
- package/artifacts/contracts/oracles/mocks/MockPythOracle.sol/MockPythOracle.json +0 -163
- package/artifacts/contracts/oracles/mocks/MockTwapOracle.sol/MockTwapOracle.dbg.json +0 -4
- package/artifacts/contracts/oracles/mocks/MockTwapOracle.sol/MockTwapOracle.json +0 -163
- package/artifacts/contracts/test/AccessControlManager.sol/AccessControlManagerScenario.dbg.json +0 -4
- package/artifacts/contracts/test/AccessControlManager.sol/AccessControlManagerScenario.json +0 -364
- package/artifacts/contracts/test/BEP20Harness.sol/BEP20Harness.dbg.json +0 -4
- package/artifacts/contracts/test/BEP20Harness.sol/BEP20Harness.json +0 -328
- package/artifacts/contracts/test/MockPyth.sol/MockPyth.dbg.json +0 -4
- package/artifacts/contracts/test/MockPyth.sol/MockPyth.json +0 -684
- package/artifacts/contracts/test/MockSimpleOracle.sol/MockBoundValidator.dbg.json +0 -4
- package/artifacts/contracts/test/MockSimpleOracle.sol/MockBoundValidator.json +0 -95
- package/artifacts/contracts/test/MockSimpleOracle.sol/MockSimpleOracle.dbg.json +0 -4
- package/artifacts/contracts/test/MockSimpleOracle.sol/MockSimpleOracle.json +0 -72
- package/artifacts/contracts/test/MockV3Aggregator.sol/MockV3Aggregator.dbg.json +0 -4
- package/artifacts/contracts/test/MockV3Aggregator.sol/MockV3Aggregator.json +0 -306
- package/artifacts/contracts/test/PancakePairHarness.sol/Math.dbg.json +0 -4
- package/artifacts/contracts/test/PancakePairHarness.sol/Math.json +0 -10
- package/artifacts/contracts/test/PancakePairHarness.sol/PancakePairHarness.dbg.json +0 -4
- package/artifacts/contracts/test/PancakePairHarness.sol/PancakePairHarness.json +0 -158
- package/artifacts/contracts/test/PancakePairHarness.sol/UQ112x112.dbg.json +0 -4
- package/artifacts/contracts/test/PancakePairHarness.sol/UQ112x112.json +0 -10
- package/artifacts/contracts/test/VBEP20Harness.sol/VBEP20Harness.dbg.json +0 -4
- package/artifacts/contracts/test/VBEP20Harness.sol/VBEP20Harness.json +0 -346
|
@@ -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
|
|
|
@@ -58,13 +50,9 @@ contract PythOracle is AccessControlledV8, OracleInterface {
|
|
|
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 `vToken` can 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 address
|
|
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
|
}
|
|
@@ -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
|
-
* @custom:error Missing error is thrown if token config does not exist
|
|
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
|
|
115
|
+
* @notice Get the underlying TWAP price for the given asset
|
|
116
|
+
* @param asset asset address
|
|
147
117
|
* @return price Underlying 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 underlying asset 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
|
|
@@ -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
|
}
|
|
@@ -4,15 +4,15 @@ pragma solidity 0.8.13;
|
|
|
4
4
|
import "../../interfaces/FeedRegistryInterface.sol";
|
|
5
5
|
|
|
6
6
|
contract MockBinanceFeedRegistry is FeedRegistryInterface {
|
|
7
|
-
mapping(
|
|
7
|
+
mapping(address => uint256) public assetPrices;
|
|
8
8
|
|
|
9
|
-
function setAssetPrice(
|
|
9
|
+
function setAssetPrice(address base, uint256 price) external {
|
|
10
10
|
assetPrices[base] = price;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
function latestRoundData(
|
|
14
|
+
address base,
|
|
15
|
+
address quote
|
|
16
16
|
)
|
|
17
17
|
external
|
|
18
18
|
view
|
|
@@ -23,7 +23,7 @@ contract MockBinanceFeedRegistry is FeedRegistryInterface {
|
|
|
23
23
|
return (0, int256(assetPrices[base]), 0, block.timestamp - 10, 0);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
function
|
|
26
|
+
function decimals(address base, address quote) external view override returns (uint8) {
|
|
27
27
|
return 8;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -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,13 +137,13 @@ 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",
|
|
144
144
|
execute: {
|
|
145
145
|
methodName: "initialize",
|
|
146
|
-
args: network.live ? [sidRegistryAddress, accessControlManagerAddress] : [],
|
|
146
|
+
args: network.live ? [sidRegistryAddress, accessControlManagerAddress, WBNBAddress] : [],
|
|
147
147
|
},
|
|
148
148
|
},
|
|
149
149
|
});
|
|
@@ -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,EAAE;QACV,WAAW,EAAE,sBAAkB,CAAC,SAAS,CAAC,IAAI;QAC9C,WAAW,EAAE,4CAA4C;QACzD,UAAU,EAAE,sBAAkB,CAAC,SAAS,CAAC,GAAG;QAC5C,iBAAiB,EAAE,4CAA4C;QAC/D,kBAAkB,EAAE,4CAA4C;QAChE,GAAG,EAAE,4CAA4C;QACjD,QAAQ,EAAE,sBAAkB,CAAC,SAAS,CAAC,QAAQ;KAChD;IACD,UAAU,EAAE;QACV,WAAW,EAAE,sBAAkB,CAAC,SAAS,CAAC,IAAI;QAC9C,WAAW,EAAE,4CAA4C;QACzD,UAAU,EAAE,sBAAkB,CAAC,SAAS,CAAC,GAAG;QAC5C,iBAAiB,EAAE,4CAA4C;QAC/D,kBAAkB,EAAE,4CAA4C;QAChE,GAAG,EAAE,4CAA4C;QACjD,QAAQ,EAAE,sB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oB,KAAK,QAAQ,EAAE;YACrC,MAAM,eAAe,CAAC,iBAAiB,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;SAC1E;QAED,IAAI,eAAe,KAAK,QAAQ,EAAE;YAChC,MAAM,UAAU,CAAC,iBAAiB,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;SACrE;QAED,IAAI,kBAAkB,KAAK,QAAQ,EAAE;YACnC,MAAM,aAAa,CAAC,iBAAiB,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;SACxE;QAED,IAAI,oBAAoB,KAAK,QAAQ,EAAE;YACrC,MAAM,eAAe,CAAC,iBAAiB,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;SAC1E;QAED,IAAI,eAAe,KAAK,QAAQ,EAAE;YAChC,MAAM,UAAU,CAAC,iBAAiB,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;SACrE;QAED,IAAI,mBAAmB,KAAK,QAAQ,EAAE;YACpC,MAAM,cAAc,CAAC,iBAAiB,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,138 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_format": "hh-sol-artifact-1",
|
|
3
|
-
"contractName": "AggregatorInterface",
|
|
4
|
-
"sourceName": "@chainlink/contracts/src/v0.8/interfaces/AggregatorInterface.sol",
|
|
5
|
-
"abi": [
|
|
6
|
-
{
|
|
7
|
-
"anonymous": false,
|
|
8
|
-
"inputs": [
|
|
9
|
-
{
|
|
10
|
-
"indexed": true,
|
|
11
|
-
"internalType": "int256",
|
|
12
|
-
"name": "current",
|
|
13
|
-
"type": "int256"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"indexed": true,
|
|
17
|
-
"internalType": "uint256",
|
|
18
|
-
"name": "roundId",
|
|
19
|
-
"type": "uint256"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"indexed": false,
|
|
23
|
-
"internalType": "uint256",
|
|
24
|
-
"name": "updatedAt",
|
|
25
|
-
"type": "uint256"
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
"name": "AnswerUpdated",
|
|
29
|
-
"type": "event"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"anonymous": false,
|
|
33
|
-
"inputs": [
|
|
34
|
-
{
|
|
35
|
-
"indexed": true,
|
|
36
|
-
"internalType": "uint256",
|
|
37
|
-
"name": "roundId",
|
|
38
|
-
"type": "uint256"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"indexed": true,
|
|
42
|
-
"internalType": "address",
|
|
43
|
-
"name": "startedBy",
|
|
44
|
-
"type": "address"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"indexed": false,
|
|
48
|
-
"internalType": "uint256",
|
|
49
|
-
"name": "startedAt",
|
|
50
|
-
"type": "uint256"
|
|
51
|
-
}
|
|
52
|
-
],
|
|
53
|
-
"name": "NewRound",
|
|
54
|
-
"type": "event"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"inputs": [
|
|
58
|
-
{
|
|
59
|
-
"internalType": "uint256",
|
|
60
|
-
"name": "roundId",
|
|
61
|
-
"type": "uint256"
|
|
62
|
-
}
|
|
63
|
-
],
|
|
64
|
-
"name": "getAnswer",
|
|
65
|
-
"outputs": [
|
|
66
|
-
{
|
|
67
|
-
"internalType": "int256",
|
|
68
|
-
"name": "",
|
|
69
|
-
"type": "int256"
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
"stateMutability": "view",
|
|
73
|
-
"type": "function"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"inputs": [
|
|
77
|
-
{
|
|
78
|
-
"internalType": "uint256",
|
|
79
|
-
"name": "roundId",
|
|
80
|
-
"type": "uint256"
|
|
81
|
-
}
|
|
82
|
-
],
|
|
83
|
-
"name": "getTimestamp",
|
|
84
|
-
"outputs": [
|
|
85
|
-
{
|
|
86
|
-
"internalType": "uint256",
|
|
87
|
-
"name": "",
|
|
88
|
-
"type": "uint256"
|
|
89
|
-
}
|
|
90
|
-
],
|
|
91
|
-
"stateMutability": "view",
|
|
92
|
-
"type": "function"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
"inputs": [],
|
|
96
|
-
"name": "latestAnswer",
|
|
97
|
-
"outputs": [
|
|
98
|
-
{
|
|
99
|
-
"internalType": "int256",
|
|
100
|
-
"name": "",
|
|
101
|
-
"type": "int256"
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
"stateMutability": "view",
|
|
105
|
-
"type": "function"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"inputs": [],
|
|
109
|
-
"name": "latestRound",
|
|
110
|
-
"outputs": [
|
|
111
|
-
{
|
|
112
|
-
"internalType": "uint256",
|
|
113
|
-
"name": "",
|
|
114
|
-
"type": "uint256"
|
|
115
|
-
}
|
|
116
|
-
],
|
|
117
|
-
"stateMutability": "view",
|
|
118
|
-
"type": "function"
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
"inputs": [],
|
|
122
|
-
"name": "latestTimestamp",
|
|
123
|
-
"outputs": [
|
|
124
|
-
{
|
|
125
|
-
"internalType": "uint256",
|
|
126
|
-
"name": "",
|
|
127
|
-
"type": "uint256"
|
|
128
|
-
}
|
|
129
|
-
],
|
|
130
|
-
"stateMutability": "view",
|
|
131
|
-
"type": "function"
|
|
132
|
-
}
|
|
133
|
-
],
|
|
134
|
-
"bytecode": "0x",
|
|
135
|
-
"deployedBytecode": "0x",
|
|
136
|
-
"linkReferences": {},
|
|
137
|
-
"deployedLinkReferences": {}
|
|
138
|
-
}
|