@venusprotocol/oracle 1.4.1 → 1.5.1
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 +4 -0
- package/artifacts/@chainlink/contracts/src/v0.8/interfaces/AggregatorInterface.sol/AggregatorInterface.json +138 -0
- package/artifacts/@chainlink/contracts/src/v0.8/interfaces/AggregatorV2V3Interface.sol/AggregatorV2V3Interface.dbg.json +4 -0
- package/artifacts/{contracts → @chainlink/contracts/src/v0.8}/interfaces/AggregatorV2V3Interface.sol/AggregatorV2V3Interface.json +2 -2
- package/artifacts/@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol/AggregatorV3Interface.dbg.json +4 -0
- package/artifacts/@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol/AggregatorV3Interface.json +122 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json +2 -2
- 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/math/SafeCast.sol/SafeCast.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/utils/math/SafeCast.sol/SafeCast.json +2 -2
- package/artifacts/@openzeppelin/contracts/utils/math/SafeMath.sol/SafeMath.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/utils/math/SignedMath.sol/SignedMath.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/utils/math/SignedMath.sol/SignedMath.json +2 -2
- 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/AddressUpgradeable.sol/AddressUpgradeable.json +2 -2
- package/artifacts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.dbg.json +1 -1
- package/artifacts/build-info/4f6308532d612c9477fab05b03e221e5.json +1 -0
- package/artifacts/build-info/57da5d39a9f98618d0dcf1f6d4ff6b0d.json +1 -0
- package/artifacts/contracts/PriceOracle.sol/PriceOracle.dbg.json +1 -1
- package/artifacts/contracts/PriceOracle.sol/PriceOracle.json +0 -13
- package/artifacts/contracts/ResilientOracle.sol/ResilientOracle.dbg.json +1 -1
- package/artifacts/contracts/ResilientOracle.sol/ResilientOracle.json +33 -9
- 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/OracleInterface.dbg.json +1 -1
- package/artifacts/contracts/interfaces/OracleInterface.sol/ResilientOracleInterface.dbg.json +1 -1
- package/artifacts/contracts/interfaces/OracleInterface.sol/TwapInterface.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/PythInterface.sol/PythStructs.json +2 -2
- package/artifacts/contracts/interfaces/VBep20Interface.sol/VBep20Interface.dbg.json +1 -1
- package/artifacts/contracts/interfaces/VBep20Interface.sol/VBep20Interface.json +4 -17
- package/artifacts/contracts/libraries/PancakeLibrary.sol/FixedPoint.dbg.json +1 -1
- package/artifacts/contracts/libraries/PancakeLibrary.sol/FixedPoint.json +2 -2
- 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/libraries/PancakeLibrary.sol/PancakeOracleLibrary.json +2 -2
- package/artifacts/contracts/oracles/BinanceOracle.sol/BinanceOracle.dbg.json +1 -1
- package/artifacts/contracts/oracles/BinanceOracle.sol/BinanceOracle.json +26 -2
- package/artifacts/contracts/oracles/BoundValidator.sol/BoundValidator.dbg.json +1 -1
- package/artifacts/contracts/oracles/BoundValidator.sol/BoundValidator.json +39 -2
- package/artifacts/contracts/oracles/ChainlinkOracle.sol/ChainlinkOracle.dbg.json +1 -1
- package/artifacts/contracts/oracles/ChainlinkOracle.sol/ChainlinkOracle.json +39 -2
- package/artifacts/contracts/oracles/PythOracle.sol/PythOracle.dbg.json +1 -1
- package/artifacts/contracts/oracles/PythOracle.sol/PythOracle.json +39 -2
- package/artifacts/contracts/oracles/TwapOracle.sol/TwapOracle.dbg.json +1 -1
- package/artifacts/contracts/oracles/TwapOracle.sol/TwapOracle.json +53 -30
- package/artifacts/contracts/oracles/mocks/MockBinanceFeedRegistry.sol/MockBinanceFeedRegistry.dbg.json +1 -1
- package/artifacts/contracts/oracles/mocks/MockBinanceFeedRegistry.sol/MockBinanceFeedRegistry.json +2 -2
- package/artifacts/contracts/oracles/mocks/MockBinanceOracle.sol/MockBinanceOracle.dbg.json +1 -1
- package/artifacts/contracts/oracles/mocks/MockBinanceOracle.sol/MockBinanceOracle.json +2 -2
- 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/oracles/mocks/MockTwapOracle.sol/MockTwapOracle.json +2 -2
- package/artifacts/contracts/test/BEP20Harness.sol/BEP20Harness.dbg.json +1 -1
- package/artifacts/contracts/test/BEP20Harness.sol/BEP20Harness.json +2 -2
- package/artifacts/contracts/test/MockPyth.sol/MockPyth.dbg.json +1 -1
- package/artifacts/contracts/test/MockPyth.sol/MockPyth.json +2 -2
- package/artifacts/contracts/test/MockSimpleOracle.sol/MockBoundValidator.dbg.json +1 -1
- package/artifacts/contracts/test/MockSimpleOracle.sol/MockBoundValidator.json +2 -2
- package/artifacts/contracts/test/MockSimpleOracle.sol/MockSimpleOracle.dbg.json +1 -1
- package/artifacts/contracts/test/MockSimpleOracle.sol/MockSimpleOracle.json +2 -2
- package/artifacts/contracts/test/MockV3Aggregator.sol/MockV3Aggregator.dbg.json +1 -1
- package/artifacts/contracts/test/MockV3Aggregator.sol/MockV3Aggregator.json +3 -3
- package/artifacts/contracts/test/PancakePairHarness.sol/Math.dbg.json +1 -1
- package/artifacts/contracts/test/PancakePairHarness.sol/Math.json +2 -2
- package/artifacts/contracts/test/PancakePairHarness.sol/PancakePairHarness.dbg.json +1 -1
- package/artifacts/contracts/test/PancakePairHarness.sol/PancakePairHarness.json +2 -2
- package/artifacts/contracts/test/PancakePairHarness.sol/UQ112x112.dbg.json +1 -1
- package/artifacts/contracts/test/PancakePairHarness.sol/UQ112x112.json +2 -2
- package/artifacts/contracts/test/VBEP20Harness.sol/VBEP20Harness.dbg.json +1 -1
- package/artifacts/contracts/test/VBEP20Harness.sol/VBEP20Harness.json +2 -2
- package/contracts/PriceOracle.sol +4 -4
- package/contracts/ResilientOracle.sol +140 -92
- package/contracts/interfaces/FeedRegistryInterface.sol +7 -10
- package/contracts/interfaces/OracleInterface.sol +2 -3
- package/contracts/interfaces/PythInterface.sol +10 -13
- package/contracts/interfaces/VBep20Interface.sol +4 -4
- package/contracts/libraries/PancakeLibrary.sol +7 -20
- package/contracts/oracles/BinanceOracle.sol +37 -6
- package/contracts/oracles/BoundValidator.sol +33 -11
- package/contracts/oracles/ChainlinkOracle.sol +78 -44
- package/contracts/oracles/PythOracle.sol +51 -17
- package/contracts/oracles/TwapOracle.sol +113 -67
- package/contracts/oracles/mocks/MockBinanceFeedRegistry.sol +7 -10
- package/contracts/oracles/mocks/MockBinanceOracle.sol +1 -1
- package/contracts/oracles/mocks/MockChainlinkOracle.sol +1 -2
- package/contracts/oracles/mocks/MockPythOracle.sol +1 -1
- package/contracts/oracles/mocks/MockTwapOracle.sol +1 -1
- package/contracts/test/BEP20Harness.sol +3 -8
- package/contracts/test/MockPyth.sol +2 -2
- package/contracts/test/MockSimpleOracle.sol +2 -2
- package/contracts/test/MockV3Aggregator.sol +9 -24
- package/contracts/test/PancakePairHarness.sol +7 -20
- package/contracts/test/VBEP20Harness.sol +2 -3
- package/deploy/1-deploy-oracles.d.ts.map +1 -1
- package/deploy/1-deploy-oracles.js +11 -2
- package/deploy/1-deploy-oracles.js.map +1 -1
- package/package.json +10 -5
- package/artifacts/build-info/3965bb4348b0cd9f8e1c6653863ba2c7.json +0 -1
- package/artifacts/build-info/74e7c40ef8c9d7273f9e994ec1da9646.json +0 -1
- package/artifacts/contracts/interfaces/AggregatorV2V3Interface.sol/AggregatorV2V3Interface.dbg.json +0 -4
- package/artifacts/contracts/interfaces/BEP20Interface.sol/BEP20Interface.dbg.json +0 -4
- package/artifacts/contracts/interfaces/BEP20Interface.sol/BEP20Interface.json +0 -246
- package/artifacts/hardhat/console.sol/console.dbg.json +0 -4
- package/artifacts/hardhat/console.sol/console.json +0 -10
- package/contracts/interfaces/AggregatorV2V3Interface.sol +0 -60
- package/contracts/interfaces/BEP20Interface.sol +0 -97
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
2
|
-
pragma solidity
|
|
3
|
-
pragma experimental ABIEncoderV2;
|
|
1
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
2
|
+
pragma solidity 0.8.13;
|
|
4
3
|
|
|
5
4
|
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
5
|
+
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
|
6
6
|
import "../libraries/PancakeLibrary.sol";
|
|
7
7
|
import "../interfaces/OracleInterface.sol";
|
|
8
|
-
import "../interfaces/BEP20Interface.sol";
|
|
9
8
|
import "../interfaces/VBep20Interface.sol";
|
|
10
9
|
|
|
11
10
|
struct Observation {
|
|
@@ -25,7 +24,8 @@ struct TokenConfig {
|
|
|
25
24
|
/// @notice A flag identifies whether the pancake pair is reversed
|
|
26
25
|
/// e.g. XVS-WBNB is not reversed, while WBNB-XVS is.
|
|
27
26
|
bool isReversedPool;
|
|
28
|
-
/// @notice
|
|
27
|
+
/// @notice **twap** update period in second, which is the minimum time in seconds
|
|
28
|
+
/// required to update **twap** window
|
|
29
29
|
uint256 anchorPeriod;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -33,7 +33,12 @@ contract TwapOracle is OwnableUpgradeable, TwapInterface {
|
|
|
33
33
|
using FixedPoint for *;
|
|
34
34
|
|
|
35
35
|
/// @notice WBNB address
|
|
36
|
-
|
|
36
|
+
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
37
|
+
address public immutable WBNB;
|
|
38
|
+
|
|
39
|
+
/// @notice vBNB address
|
|
40
|
+
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
41
|
+
address public immutable vBnb;
|
|
37
42
|
|
|
38
43
|
/// @notice the base unit of WBNB and BUSD, which are the paired tokens for all assets
|
|
39
44
|
uint256 public constant bnbBaseUnit = 1e18;
|
|
@@ -44,17 +49,10 @@ contract TwapOracle is OwnableUpgradeable, TwapInterface {
|
|
|
44
49
|
/// @notice Configs by token
|
|
45
50
|
mapping(address => TokenConfig) public tokenConfigs;
|
|
46
51
|
|
|
47
|
-
/// @notice The current price observation of TWAP. With old and current observations
|
|
48
|
-
/// we can calculate the TWAP between this range
|
|
49
|
-
mapping(address => Observation) public newObservations;
|
|
50
|
-
|
|
51
|
-
/// @notice The old price observation of TWAP
|
|
52
|
-
mapping(address => Observation) public oldObservations;
|
|
53
|
-
|
|
54
52
|
/// @notice Stored price by token
|
|
55
53
|
mapping(address => uint256) public prices;
|
|
56
54
|
|
|
57
|
-
/// @notice Emit this event when
|
|
55
|
+
/// @notice Emit this event when **twap** window is updated
|
|
58
56
|
event TwapWindowUpdated(
|
|
59
57
|
address indexed asset,
|
|
60
58
|
uint256 oldTimestamp,
|
|
@@ -63,6 +61,12 @@ contract TwapOracle is OwnableUpgradeable, TwapInterface {
|
|
|
63
61
|
uint256 newAcc
|
|
64
62
|
);
|
|
65
63
|
|
|
64
|
+
/// @notice Keeps a record of token observations mapped by address, updated on every updateTwap invocation.
|
|
65
|
+
mapping(address => Observation[]) public observations;
|
|
66
|
+
|
|
67
|
+
/// @notice index of array which probably falls in current anchor period mapped with asset address
|
|
68
|
+
mapping(address => uint256) public windowStart;
|
|
69
|
+
|
|
66
70
|
/// @notice Emit this event when TWAP price is updated
|
|
67
71
|
event AnchorPriceUpdated(address indexed asset, uint256 price, uint256 oldTimestamp, uint256 newTimestamp);
|
|
68
72
|
|
|
@@ -74,19 +78,32 @@ contract TwapOracle is OwnableUpgradeable, TwapInterface {
|
|
|
74
78
|
_;
|
|
75
79
|
}
|
|
76
80
|
|
|
77
|
-
|
|
81
|
+
/// @notice Constructor for the implementation contract. Sets immutable variables.
|
|
82
|
+
/// @param vBnbAddress The address of the VBNB
|
|
83
|
+
/// @param wBnbAddress The address of the WBNB
|
|
84
|
+
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
85
|
+
constructor(address vBnbAddress, address wBnbAddress) notNullAddress(vBnbAddress) notNullAddress(wBnbAddress) {
|
|
86
|
+
vBnb = vBnbAddress;
|
|
87
|
+
WBNB = wBnbAddress;
|
|
88
|
+
_disableInitializers();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @notice Initializes the owner of the contract and sets the contracts required
|
|
93
|
+
*/
|
|
94
|
+
function initialize() public initializer {
|
|
78
95
|
__Ownable_init();
|
|
79
|
-
require(WBNB_ != address(0), "WBNB can't be zero address");
|
|
80
|
-
WBNB = WBNB_;
|
|
81
96
|
}
|
|
82
97
|
|
|
83
98
|
/**
|
|
84
99
|
* @notice Add multiple token configs at the same time
|
|
85
100
|
* @param configs config array
|
|
101
|
+
* @custom:error ZSero length error thrown, if length of the array in parameter is 0
|
|
86
102
|
*/
|
|
87
103
|
function setTokenConfigs(TokenConfig[] memory configs) external onlyOwner {
|
|
88
104
|
require(configs.length > 0, "length can't be 0");
|
|
89
|
-
|
|
105
|
+
uint256 numTokenConfigs = configs.length;
|
|
106
|
+
for (uint256 i; i < numTokenConfigs; ++i) {
|
|
90
107
|
setTokenConfig(configs[i]);
|
|
91
108
|
}
|
|
92
109
|
}
|
|
@@ -94,42 +111,49 @@ contract TwapOracle is OwnableUpgradeable, TwapInterface {
|
|
|
94
111
|
/**
|
|
95
112
|
* @notice Add single token configs
|
|
96
113
|
* @param config token config struct
|
|
114
|
+
* @custom:access Only Governance
|
|
115
|
+
* @custom:error Range error thrown if anchor period is not greater than zero
|
|
116
|
+
* @custom:error Range error thrown if base unit is not greater than zero
|
|
117
|
+
* @custom:error Value error thrown if base unit decimals not same as asset decimals
|
|
118
|
+
* @custom:error NotNullAddress if address of asset is zero
|
|
119
|
+
* @custom:error NotNullAddress if pancake swap pool address is zero
|
|
120
|
+
* @custom:event Emits TokenConfigAdded event if new token config are added with
|
|
121
|
+
* asset address, pancakepool address, anchor period address
|
|
97
122
|
*/
|
|
98
|
-
function setTokenConfig(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
notNullAddress(config.asset)
|
|
102
|
-
notNullAddress(config.pancakePool)
|
|
103
|
-
{
|
|
123
|
+
function setTokenConfig(
|
|
124
|
+
TokenConfig memory config
|
|
125
|
+
) public onlyOwner notNullAddress(config.asset) notNullAddress(config.pancakePool) {
|
|
104
126
|
require(config.anchorPeriod > 0, "anchor period must be positive");
|
|
105
127
|
require(config.baseUnit > 0, "base unit must be positive");
|
|
128
|
+
require(
|
|
129
|
+
config.baseUnit == 10 ** IERC20Metadata(config.asset).decimals(),
|
|
130
|
+
"base unit decimals must be same as asset decimals"
|
|
131
|
+
);
|
|
132
|
+
|
|
106
133
|
uint256 cumulativePrice = currentCumulativePrice(config);
|
|
107
134
|
|
|
108
135
|
// Initialize observation data
|
|
109
|
-
|
|
110
|
-
newObservations[config.asset].timestamp = block.timestamp;
|
|
111
|
-
oldObservations[config.asset].acc = cumulativePrice;
|
|
112
|
-
newObservations[config.asset].acc = cumulativePrice;
|
|
136
|
+
observations[config.asset].push(Observation(block.timestamp, cumulativePrice));
|
|
113
137
|
tokenConfigs[config.asset] = config;
|
|
114
138
|
emit TokenConfigAdded(config.asset, config.pancakePool, config.anchorPeriod);
|
|
115
139
|
}
|
|
116
140
|
|
|
117
141
|
/**
|
|
118
|
-
* @notice Get the underlying
|
|
142
|
+
* @notice Get the underlying **twap** price of input vToken
|
|
119
143
|
* @param vToken vToken address
|
|
120
|
-
* @return price in USD
|
|
144
|
+
* @return price in USD
|
|
145
|
+
* @custom:error Missing error thrown if token config is not exist
|
|
146
|
+
* @custom:error Range error thrown if **twap** price is not greater than zero
|
|
121
147
|
*/
|
|
122
148
|
function getUnderlyingPrice(address vToken) external view override returns (uint256) {
|
|
123
|
-
|
|
149
|
+
// VBNB token doesn't have `underlying` method, vBNB's underlying token is wBNB
|
|
150
|
+
address asset = address(vToken) == vBnb ? WBNB : VBep20Interface(vToken).underlying();
|
|
124
151
|
require(tokenConfigs[asset].asset != address(0), "asset not exist");
|
|
125
|
-
|
|
126
152
|
uint256 price = prices[asset];
|
|
127
153
|
|
|
128
154
|
// if price is 0, it means the price hasn't been updated yet and it's meaningless, revert
|
|
129
155
|
require(price > 0, "TWAP price must be positive");
|
|
130
|
-
|
|
131
|
-
BEP20Interface underlyingToken = BEP20Interface(VBep20Interface(vToken).underlying());
|
|
132
|
-
return (price * (10**(18 - underlyingToken.decimals())));
|
|
156
|
+
return (price * (10 ** (18 - IERC20Metadata(asset).decimals())));
|
|
133
157
|
}
|
|
134
158
|
|
|
135
159
|
/**
|
|
@@ -145,8 +169,14 @@ contract TwapOracle is OwnableUpgradeable, TwapInterface {
|
|
|
145
169
|
}
|
|
146
170
|
}
|
|
147
171
|
|
|
172
|
+
/**
|
|
173
|
+
* @notice Updates the current token/BUSD price from PancakeSwap, with 18 decimals of precision.
|
|
174
|
+
* @return vToken Address of vToken
|
|
175
|
+
* @custom:error Missing error thrown if token config is not exist
|
|
176
|
+
*/
|
|
148
177
|
function updateTwap(address vToken) public returns (uint256) {
|
|
149
|
-
|
|
178
|
+
// VBNB token doesn't have `underlying` method, vBNB's underlying token is wBNB
|
|
179
|
+
address asset = address(vToken) == vBnb ? WBNB : VBep20Interface(vToken).underlying();
|
|
150
180
|
require(tokenConfigs[asset].asset != address(0), "asset not exist");
|
|
151
181
|
// Update & fetch WBNB price first, so we can calculate the price of WBNB paired token
|
|
152
182
|
if (asset != WBNB && tokenConfigs[asset].isBnbBased) {
|
|
@@ -159,21 +189,26 @@ contract TwapOracle is OwnableUpgradeable, TwapInterface {
|
|
|
159
189
|
/**
|
|
160
190
|
* @notice Fetches the current token/BUSD price from PancakeSwap, with 18 decimals of precision.
|
|
161
191
|
* @return price in USD, with 18 decimals
|
|
192
|
+
* @custom:error Timing error thrown if current time is not greater than old observation timestamp
|
|
193
|
+
* @custom:error Zero price error thrown if token is BNB based and price is zero
|
|
194
|
+
* @custom:error Zero price error thrown if fetched anchorPriceMantissa is zero
|
|
195
|
+
* @custom:event Emits AnchorPriceUpdated event on sucussfully update of observation with assset address,
|
|
196
|
+
* AnchorPrice, old observation timestamp and current timestamp
|
|
162
197
|
*/
|
|
163
198
|
function _updateTwapInternal(TokenConfig memory config) internal virtual returns (uint256) {
|
|
164
199
|
// pokeWindowValues already handled reversed pool cases,
|
|
165
|
-
// priceAverage will always be Token/BNB or Token/BUSD
|
|
200
|
+
// priceAverage will always be Token/BNB or Token/BUSD *twap** price.
|
|
166
201
|
(uint256 nowCumulativePrice, uint256 oldCumulativePrice, uint256 oldTimestamp) = pokeWindowValues(config);
|
|
167
202
|
|
|
168
203
|
// This should be impossible, but better safe than sorry
|
|
169
204
|
require(block.timestamp > oldTimestamp, "now must come after before");
|
|
170
205
|
uint256 timeElapsed = block.timestamp - oldTimestamp;
|
|
171
206
|
|
|
172
|
-
// Calculate Pancakge
|
|
207
|
+
// Calculate Pancakge *twap**
|
|
173
208
|
FixedPoint.uq112x112 memory priceAverage = FixedPoint.uq112x112(
|
|
174
209
|
uint224((nowCumulativePrice - oldCumulativePrice) / timeElapsed)
|
|
175
210
|
);
|
|
176
|
-
//
|
|
211
|
+
// *twap** price with 1e18 decimal mantissa
|
|
177
212
|
uint256 priceAverageMantissa = priceAverage.decode112with18();
|
|
178
213
|
|
|
179
214
|
// To cancel the decimals in cumulative price, we need to mulitply the average price with
|
|
@@ -199,37 +234,48 @@ contract TwapOracle is OwnableUpgradeable, TwapInterface {
|
|
|
199
234
|
}
|
|
200
235
|
|
|
201
236
|
/**
|
|
202
|
-
* @notice
|
|
237
|
+
* @notice Append current Observation and pick equal or just greater than window start timestamp,
|
|
238
|
+
* If not available, then pick the last available Observation. Window start index is updated in both the cases.
|
|
239
|
+
* Only the current observation is saved, prior observations are deleted during this operation.
|
|
203
240
|
* @return cumulative price & old observation
|
|
241
|
+
* @custom:event emits TwapWindowUpdated on succesful calculation of cumulative price with asset address,
|
|
242
|
+
* new observation timestamp, current timestamp, new observation price and cumulative price
|
|
204
243
|
*/
|
|
205
|
-
function pokeWindowValues(
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
uint256,
|
|
209
|
-
uint256,
|
|
210
|
-
uint256
|
|
211
|
-
)
|
|
212
|
-
{
|
|
244
|
+
function pokeWindowValues(
|
|
245
|
+
TokenConfig memory config
|
|
246
|
+
) internal returns (uint256, uint256 startCumulativePrice, uint256 startCumulativeTimestamp) {
|
|
213
247
|
uint256 cumulativePrice = currentCumulativePrice(config);
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
uint256
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
248
|
+
uint256 currentTimestamp = block.timestamp;
|
|
249
|
+
uint256 windowStartTimestamp = currentTimestamp - config.anchorPeriod;
|
|
250
|
+
Observation[] memory storedObservations = observations[config.asset];
|
|
251
|
+
|
|
252
|
+
uint256 storedObservationsLength = storedObservations.length;
|
|
253
|
+
for (
|
|
254
|
+
uint256 windowStartIndex = windowStart[config.asset];
|
|
255
|
+
windowStartIndex < storedObservationsLength;
|
|
256
|
+
++windowStartIndex
|
|
257
|
+
) {
|
|
258
|
+
if (
|
|
259
|
+
(storedObservations[windowStartIndex].timestamp >= windowStartTimestamp) ||
|
|
260
|
+
(windowStartIndex == storedObservationsLength - 1)
|
|
261
|
+
) {
|
|
262
|
+
startCumulativePrice = storedObservations[windowStartIndex].acc;
|
|
263
|
+
startCumulativeTimestamp = storedObservations[windowStartIndex].timestamp;
|
|
264
|
+
windowStart[config.asset] = windowStartIndex;
|
|
265
|
+
break;
|
|
266
|
+
} else {
|
|
267
|
+
delete observations[config.asset][windowStartIndex];
|
|
268
|
+
}
|
|
232
269
|
}
|
|
233
|
-
|
|
270
|
+
|
|
271
|
+
observations[config.asset].push(Observation(currentTimestamp, cumulativePrice));
|
|
272
|
+
emit TwapWindowUpdated(
|
|
273
|
+
config.asset,
|
|
274
|
+
startCumulativeTimestamp,
|
|
275
|
+
startCumulativePrice,
|
|
276
|
+
block.timestamp,
|
|
277
|
+
cumulativePrice
|
|
278
|
+
);
|
|
279
|
+
return (cumulativePrice, startCumulativePrice, startCumulativeTimestamp);
|
|
234
280
|
}
|
|
235
281
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
2
|
-
pragma solidity
|
|
1
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
4
|
import "../../interfaces/FeedRegistryInterface.sol";
|
|
5
5
|
|
|
@@ -10,17 +10,14 @@ contract MockBinanceFeedRegistry is FeedRegistryInterface {
|
|
|
10
10
|
assetPrices[base] = price;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
function latestRoundDataByName(
|
|
13
|
+
function latestRoundDataByName(
|
|
14
|
+
string memory base,
|
|
15
|
+
string memory quote
|
|
16
|
+
)
|
|
14
17
|
external
|
|
15
18
|
view
|
|
16
19
|
override
|
|
17
|
-
returns (
|
|
18
|
-
uint80 roundId,
|
|
19
|
-
int256 answer,
|
|
20
|
-
uint256 startedAt,
|
|
21
|
-
uint256 updatedAt,
|
|
22
|
-
uint80 answeredInRound
|
|
23
|
-
)
|
|
20
|
+
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)
|
|
24
21
|
{
|
|
25
22
|
quote;
|
|
26
23
|
return (0, int256(assetPrices[base]), 0, 0, 0);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
2
|
-
pragma solidity
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
4
|
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
5
5
|
import "../ChainlinkOracle.sol";
|
|
6
6
|
import "../../interfaces/VBep20Interface.sol";
|
|
7
|
-
import "../../interfaces/BEP20Interface.sol";
|
|
8
7
|
|
|
9
8
|
contract MockChainlinkOracle is OwnableUpgradeable {
|
|
10
9
|
mapping(address => uint256) public assetPrices;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
2
|
-
pragma solidity
|
|
3
|
-
pragma experimental ABIEncoderV2;
|
|
1
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
2
|
+
pragma solidity 0.8.13;
|
|
4
3
|
|
|
5
4
|
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
|
6
5
|
|
|
7
6
|
contract BEP20Harness is ERC20 {
|
|
8
7
|
uint8 public decimalsInternal = 18;
|
|
9
8
|
|
|
10
|
-
constructor(
|
|
11
|
-
string memory name_,
|
|
12
|
-
string memory symbol_,
|
|
13
|
-
uint8 decimals_
|
|
14
|
-
) ERC20(name_, symbol_) {
|
|
9
|
+
constructor(string memory name_, string memory symbol_, uint8 decimals_) ERC20(name_, symbol_) {
|
|
15
10
|
decimalsInternal = decimals_;
|
|
16
11
|
}
|
|
17
12
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
2
|
-
pragma solidity
|
|
1
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
|
-
import "
|
|
4
|
+
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV2V3Interface.sol";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @title MockV3Aggregator
|
|
@@ -37,12 +37,7 @@ contract MockV3Aggregator is AggregatorV2V3Interface {
|
|
|
37
37
|
getStartedAt[latestRound] = block.timestamp;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
function updateRoundData(
|
|
41
|
-
uint80 _roundId,
|
|
42
|
-
int256 _answer,
|
|
43
|
-
uint256 _timestamp,
|
|
44
|
-
uint256 _startedAt
|
|
45
|
-
) public {
|
|
40
|
+
function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public {
|
|
46
41
|
latestRound = _roundId;
|
|
47
42
|
latestAnswer = _answer;
|
|
48
43
|
latestTimestamp = _timestamp;
|
|
@@ -51,16 +46,12 @@ contract MockV3Aggregator is AggregatorV2V3Interface {
|
|
|
51
46
|
getStartedAt[latestRound] = _startedAt;
|
|
52
47
|
}
|
|
53
48
|
|
|
54
|
-
function getRoundData(
|
|
49
|
+
function getRoundData(
|
|
50
|
+
uint80 _roundId
|
|
51
|
+
)
|
|
55
52
|
external
|
|
56
53
|
view
|
|
57
|
-
returns (
|
|
58
|
-
uint80 roundId,
|
|
59
|
-
int256 answer,
|
|
60
|
-
uint256 startedAt,
|
|
61
|
-
uint256 updatedAt,
|
|
62
|
-
uint80 answeredInRound
|
|
63
|
-
)
|
|
54
|
+
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)
|
|
64
55
|
{
|
|
65
56
|
return (_roundId, getAnswer[_roundId], getStartedAt[_roundId], getTimestamp[_roundId], _roundId);
|
|
66
57
|
}
|
|
@@ -68,13 +59,7 @@ contract MockV3Aggregator is AggregatorV2V3Interface {
|
|
|
68
59
|
function latestRoundData()
|
|
69
60
|
external
|
|
70
61
|
view
|
|
71
|
-
returns (
|
|
72
|
-
uint80 roundId,
|
|
73
|
-
int256 answer,
|
|
74
|
-
uint256 startedAt,
|
|
75
|
-
uint256 updatedAt,
|
|
76
|
-
uint80 answeredInRound
|
|
77
|
-
)
|
|
62
|
+
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)
|
|
78
63
|
{
|
|
79
64
|
return (
|
|
80
65
|
uint80(latestRound),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
2
|
-
pragma solidity
|
|
1
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
2
|
+
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
4
|
// a library for performing various math operations
|
|
5
5
|
|
|
@@ -28,7 +28,7 @@ library Math {
|
|
|
28
28
|
|
|
29
29
|
library UQ112x112 {
|
|
30
30
|
//solhint-disable-next-line state-visibility
|
|
31
|
-
uint224 constant Q112 = 2**112;
|
|
31
|
+
uint224 constant Q112 = 2 ** 112;
|
|
32
32
|
|
|
33
33
|
// encode a uint112 as a UQ112x112
|
|
34
34
|
function encode(uint112 y) internal pure returns (uint224 z) {
|
|
@@ -56,18 +56,10 @@ contract PancakePairHarness {
|
|
|
56
56
|
uint256 public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event
|
|
57
57
|
|
|
58
58
|
function currentBlockTimestamp() external view returns (uint32) {
|
|
59
|
-
return uint32(block.timestamp % 2**32);
|
|
59
|
+
return uint32(block.timestamp % 2 ** 32);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
function getReserves()
|
|
63
|
-
public
|
|
64
|
-
view
|
|
65
|
-
returns (
|
|
66
|
-
uint112 _reserve0,
|
|
67
|
-
uint112 _reserve1,
|
|
68
|
-
uint32 _blockTimestampLast
|
|
69
|
-
)
|
|
70
|
-
{
|
|
62
|
+
function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
|
|
71
63
|
_reserve0 = reserve0;
|
|
72
64
|
_reserve1 = reserve1;
|
|
73
65
|
_blockTimestampLast = blockTimestampLast;
|
|
@@ -80,14 +72,9 @@ contract PancakePairHarness {
|
|
|
80
72
|
}
|
|
81
73
|
|
|
82
74
|
// update reserves and, on the first call per block, price accumulators
|
|
83
|
-
function update(
|
|
84
|
-
uint256 balance0,
|
|
85
|
-
uint256 balance1,
|
|
86
|
-
uint112 _reserve0,
|
|
87
|
-
uint112 _reserve1
|
|
88
|
-
) external {
|
|
75
|
+
function update(uint256 balance0, uint256 balance1, uint112 _reserve0, uint112 _reserve1) external {
|
|
89
76
|
require(balance0 <= type(uint112).max && balance1 <= type(uint112).max, "PancakeV2: OVERFLOW");
|
|
90
|
-
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
|
|
77
|
+
uint32 blockTimestamp = uint32(block.timestamp % 2 ** 32);
|
|
91
78
|
unchecked {
|
|
92
79
|
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
|
|
93
80
|
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1-deploy-oracles.d.ts","sourceRoot":"","sources":["../../deploy/1-deploy-oracles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"1-deploy-oracles.d.ts","sourceRoot":"","sources":["../../deploy/1-deploy-oracles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAkB3D,QAAA,MAAM,IAAI,EAAE,cAsGX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -18,11 +18,13 @@ const hardhat_1 = __importDefault(require("hardhat"));
|
|
|
18
18
|
const ADDRESSES = {
|
|
19
19
|
bsctestnet: {
|
|
20
20
|
vBNBAddress: testnet_json_1.default.Contracts.vBNB,
|
|
21
|
+
WBNBAddress: "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd",
|
|
21
22
|
pythOracleAddress: "0xd7308b14BF4008e7C7196eC35610B1427C5702EA",
|
|
22
23
|
binanceFeedRegistryAddress: "0x999DD49FeFdC043fDAC4FE12Bb1e4bb31cB4c47B",
|
|
23
24
|
},
|
|
24
25
|
bscmainnet: {
|
|
25
26
|
vBNBAddress: mainnet_json_1.default.Contracts.vBNB,
|
|
27
|
+
WBNBAddress: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
|
|
26
28
|
pythOracleAddress: "",
|
|
27
29
|
binanceFeedRegistryAddress: "",
|
|
28
30
|
},
|
|
@@ -32,10 +34,13 @@ const func = function ({ getNamedAccounts, deployments, network }) {
|
|
|
32
34
|
const { deploy } = deployments;
|
|
33
35
|
const { deployer } = yield getNamedAccounts();
|
|
34
36
|
const networkName = network.name === "bscmainnet" ? "bscmainnet" : "bsctestnet";
|
|
37
|
+
const vBNBAddress = ADDRESSES[networkName].vBNBAddress;
|
|
38
|
+
const WBNBAddress = ADDRESSES[networkName].WBNBAddress;
|
|
35
39
|
yield deploy("BoundValidator", {
|
|
36
40
|
from: deployer,
|
|
37
41
|
log: true,
|
|
38
42
|
deterministicDeployment: false,
|
|
43
|
+
args: [vBNBAddress],
|
|
39
44
|
proxy: {
|
|
40
45
|
proxyContract: "OptimizedTransparentProxy",
|
|
41
46
|
execute: {
|
|
@@ -49,6 +54,7 @@ const func = function ({ getNamedAccounts, deployments, network }) {
|
|
|
49
54
|
from: deployer,
|
|
50
55
|
log: true,
|
|
51
56
|
deterministicDeployment: false,
|
|
57
|
+
args: [vBNBAddress],
|
|
52
58
|
proxy: {
|
|
53
59
|
proxyContract: "OptimizedTransparentProxy",
|
|
54
60
|
execute: {
|
|
@@ -62,6 +68,7 @@ const func = function ({ getNamedAccounts, deployments, network }) {
|
|
|
62
68
|
from: deployer,
|
|
63
69
|
log: true,
|
|
64
70
|
deterministicDeployment: false,
|
|
71
|
+
args: network.live ? [vBNBAddress] : [],
|
|
65
72
|
proxy: {
|
|
66
73
|
proxyContract: "OptimizedTransparentProxy",
|
|
67
74
|
execute: {
|
|
@@ -70,17 +77,17 @@ const func = function ({ getNamedAccounts, deployments, network }) {
|
|
|
70
77
|
},
|
|
71
78
|
},
|
|
72
79
|
});
|
|
73
|
-
const vBNBAddress = ADDRESSES[networkName].vBNBAddress;
|
|
74
80
|
yield deploy("TwapOracle", {
|
|
75
81
|
contract: network.live ? "TwapOracle" : "MockTwapOracle",
|
|
76
82
|
from: deployer,
|
|
77
83
|
log: true,
|
|
78
84
|
deterministicDeployment: false,
|
|
85
|
+
args: network.live ? [vBNBAddress, WBNBAddress] : [],
|
|
79
86
|
proxy: {
|
|
80
87
|
proxyContract: "OptimizedTransparentProxy",
|
|
81
88
|
execute: {
|
|
82
89
|
methodName: "initialize",
|
|
83
|
-
args: [vBNBAddress],
|
|
90
|
+
args: network.live ? [] : [vBNBAddress],
|
|
84
91
|
},
|
|
85
92
|
},
|
|
86
93
|
});
|
|
@@ -90,6 +97,7 @@ const func = function ({ getNamedAccounts, deployments, network }) {
|
|
|
90
97
|
from: deployer,
|
|
91
98
|
log: true,
|
|
92
99
|
deterministicDeployment: false,
|
|
100
|
+
args: network.live ? [vBNBAddress] : [],
|
|
93
101
|
proxy: {
|
|
94
102
|
proxyContract: "OptimizedTransparentProxy",
|
|
95
103
|
execute: {
|
|
@@ -104,6 +112,7 @@ const func = function ({ getNamedAccounts, deployments, network }) {
|
|
|
104
112
|
from: deployer,
|
|
105
113
|
log: true,
|
|
106
114
|
deterministicDeployment: false,
|
|
115
|
+
args: network.live ? [vBNBAddress] : [],
|
|
107
116
|
proxy: {
|
|
108
117
|
proxyContract: "OptimizedTransparentProxy",
|
|
109
118
|
execute: {
|
|
@@ -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,iBAAiB,EAAE,4CAA4C;QAC/D,0BAA0B,EAAE,4CAA4C;KACzE;IACD,UAAU,EAAE;QACV,WAAW,EAAE,sBAAkB,CAAC,SAAS,CAAC,IAAI;QAC9C,iBAAiB,EAAE,EAAE;QACrB,0BAA0B,EAAE,EAAE;KAC/B;CACF,CAAC;AAEF,MAAM,IAAI,GAAmB,UAAgB,EAAE,gBAAgB,EAAE,WAAW,EAAE,OAAO,EAA6B;;QAChH,MAAM,EAAE,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