@venusprotocol/oracle 1.6.12-dev.7 → 1.6.13
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/{5e3358a24918f424864f98433dd157fb.json → fc01a49cbd804e304740a46d676189d0.json} +1 -1
- package/artifacts/contracts/ResilientOracle.sol/ResilientOracle.dbg.json +1 -1
- package/artifacts/contracts/ResilientOracle.sol/ResilientOracle.json +4 -36
- package/artifacts/contracts/interfaces/FeedRegistryInterface.sol/FeedRegistryInterface.dbg.json +1 -1
- package/artifacts/contracts/interfaces/FeedRegistryInterface.sol/FeedRegistryInterface.json +10 -10
- 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 +0 -19
- 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 +32 -45
- package/artifacts/contracts/oracles/BoundValidator.sol/BoundValidator.dbg.json +1 -1
- package/artifacts/contracts/oracles/BoundValidator.sol/BoundValidator.json +54 -4
- package/artifacts/contracts/oracles/ChainlinkOracle.sol/ChainlinkOracle.dbg.json +1 -1
- package/artifacts/contracts/oracles/ChainlinkOracle.sol/ChainlinkOracle.json +60 -5
- package/artifacts/contracts/oracles/PythOracle.sol/PythOracle.dbg.json +1 -1
- package/artifacts/contracts/oracles/PythOracle.sol/PythOracle.json +43 -6
- package/artifacts/contracts/oracles/TwapOracle.sol/TwapOracle.dbg.json +1 -1
- package/artifacts/contracts/oracles/TwapOracle.sol/TwapOracle.json +41 -18
- package/artifacts/contracts/oracles/mocks/MockBinanceFeedRegistry.sol/MockBinanceFeedRegistry.dbg.json +1 -1
- package/artifacts/contracts/oracles/mocks/MockBinanceFeedRegistry.sol/MockBinanceFeedRegistry.json +16 -16
- 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 +3 -32
- package/artifacts/contracts/test/MockSimpleOracle.sol/MockSimpleOracle.dbg.json +1 -1
- package/artifacts/contracts/test/MockSimpleOracle.sol/MockSimpleOracle.json +2 -21
- 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 +70 -100
- package/contracts/interfaces/FeedRegistryInterface.sol +4 -4
- package/contracts/interfaces/OracleInterface.sol +3 -5
- package/contracts/oracles/BinanceOracle.sol +58 -53
- package/contracts/oracles/BoundValidator.sol +51 -22
- package/contracts/oracles/ChainlinkOracle.sol +68 -28
- package/contracts/oracles/PythOracle.sol +48 -28
- package/contracts/oracles/TwapOracle.sol +57 -39
- package/contracts/oracles/mocks/MockBinanceFeedRegistry.sol +6 -6
- package/contracts/test/MockSimpleOracle.sol +2 -14
- package/dist/deploy/1-deploy-oracles.js +6 -6
- package/dist/deploy/1-deploy-oracles.js.map +1 -1
- package/package.json +2 -2
|
@@ -137,8 +137,8 @@
|
|
|
137
137
|
"type": "function"
|
|
138
138
|
}
|
|
139
139
|
],
|
|
140
|
-
"bytecode": "
|
|
141
|
-
"deployedBytecode": "
|
|
140
|
+
"bytecode": "0x608060405234801561001057600080fd5b5061064c806100206000396000f3fe608060405234801561001057600080fd5b506004361061007c5760003560e01c80638129fc1c1161005b5780638129fc1c146100eb5780638da5cb5b146100f3578063f2fde38b1461010c578063fc57d4df1461011f57600080fd5b8062e4768b146100815780635e9a523c146100ad578063715018a6146100e3575b600080fd5b6100ab61008f3660046103f2565b6001600160a01b03909116600090815260656020526040902055565b005b6100cd6100bb36600461042f565b60656020526000908152604090205481565b6040516100da9190610460565b60405180910390f35b6100ab610132565b6100ab610146565b6033546001600160a01b03166040516100da9190610477565b6100ab61011a36600461042f565b61021e565b6100cd61012d36600461042f565b610255565b61013a6102d9565b6101446000610303565b565b600054610100900460ff16158080156101665750600054600160ff909116105b806101805750303b158015610180575060005460ff166001145b6101a55760405162461bcd60e51b815260040161019c906104d3565b60405180910390fd5b6000805460ff1916600117905580156101c8576000805461ff0019166101001790555b6101d0610355565b801561021b576000805461ff00191690556040517f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890610212906001906104f7565b60405180910390a15b50565b6102266102d9565b6001600160a01b03811661024c5760405162461bcd60e51b815260040161019c90610548565b61021b81610303565b600080826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610296573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ba9190610563565b6001600160a01b03166000908152606560205260409020549392505050565b6033546001600160a01b031633146101445760405162461bcd60e51b815260040161019c90610584565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661037c5760405162461bcd60e51b815260040161019c90610606565b610144600054610100900460ff166103a65760405162461bcd60e51b815260040161019c90610606565b61014433610303565b60006001600160a01b0382165b92915050565b6103cb816103af565b811461021b57600080fd5b80356103bc816103c2565b806103cb565b80356103bc816103e1565b6000806040838503121561040857610408600080fd5b600061041485856103d6565b9250506020610425858286016103e7565b9150509250929050565b60006020828403121561044457610444600080fd5b600061045084846103d6565b949350505050565b805b82525050565b602081016103bc8284610458565b61045a816103af565b602081016103bc828461046e565b602e81526000602082017f496e697469616c697a61626c653a20636f6e747261637420697320616c72656181526d191e481a5b9a5d1a585b1a5e995960921b602082015291505b5060400190565b602080825281016103bc81610485565b600060ff82166103bc565b61045a816104e3565b602081016103bc82846104ee565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b602082015291506104cc565b602080825281016103bc81610505565b80516103bc816103c2565b60006020828403121561057857610578600080fd5b60006104508484610558565b60208082528181019081527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726040830152606082016103bc565b602b81526000602082017f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206981526a6e697469616c697a696e6760a81b602082015291506104cc565b602080825281016103bc816105be56fea2646970667358221220ce0a88c06944a922bb095f5705571a5364f95b924d151733e4a012664be7c7b264736f6c634300080d0033",
|
|
141
|
+
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061007c5760003560e01c80638129fc1c1161005b5780638129fc1c146100eb5780638da5cb5b146100f3578063f2fde38b1461010c578063fc57d4df1461011f57600080fd5b8062e4768b146100815780635e9a523c146100ad578063715018a6146100e3575b600080fd5b6100ab61008f3660046103f2565b6001600160a01b03909116600090815260656020526040902055565b005b6100cd6100bb36600461042f565b60656020526000908152604090205481565b6040516100da9190610460565b60405180910390f35b6100ab610132565b6100ab610146565b6033546001600160a01b03166040516100da9190610477565b6100ab61011a36600461042f565b61021e565b6100cd61012d36600461042f565b610255565b61013a6102d9565b6101446000610303565b565b600054610100900460ff16158080156101665750600054600160ff909116105b806101805750303b158015610180575060005460ff166001145b6101a55760405162461bcd60e51b815260040161019c906104d3565b60405180910390fd5b6000805460ff1916600117905580156101c8576000805461ff0019166101001790555b6101d0610355565b801561021b576000805461ff00191690556040517f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890610212906001906104f7565b60405180910390a15b50565b6102266102d9565b6001600160a01b03811661024c5760405162461bcd60e51b815260040161019c90610548565b61021b81610303565b600080826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610296573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ba9190610563565b6001600160a01b03166000908152606560205260409020549392505050565b6033546001600160a01b031633146101445760405162461bcd60e51b815260040161019c90610584565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661037c5760405162461bcd60e51b815260040161019c90610606565b610144600054610100900460ff166103a65760405162461bcd60e51b815260040161019c90610606565b61014433610303565b60006001600160a01b0382165b92915050565b6103cb816103af565b811461021b57600080fd5b80356103bc816103c2565b806103cb565b80356103bc816103e1565b6000806040838503121561040857610408600080fd5b600061041485856103d6565b9250506020610425858286016103e7565b9150509250929050565b60006020828403121561044457610444600080fd5b600061045084846103d6565b949350505050565b805b82525050565b602081016103bc8284610458565b61045a816103af565b602081016103bc828461046e565b602e81526000602082017f496e697469616c697a61626c653a20636f6e747261637420697320616c72656181526d191e481a5b9a5d1a585b1a5e995960921b602082015291505b5060400190565b602080825281016103bc81610485565b600060ff82166103bc565b61045a816104e3565b602081016103bc82846104ee565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b602082015291506104cc565b602080825281016103bc81610505565b80516103bc816103c2565b60006020828403121561057857610578600080fd5b60006104508484610558565b60208082528181019081527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726040830152606082016103bc565b602b81526000602082017f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206981526a6e697469616c697a696e6760a81b602082015291506104cc565b602080825281016103bc816105be56fea2646970667358221220ce0a88c06944a922bb095f5705571a5364f95b924d151733e4a012664be7c7b264736f6c634300080d0033",
|
|
142
142
|
"linkReferences": {},
|
|
143
143
|
"deployedLinkReferences": {}
|
|
144
144
|
}
|
|
@@ -156,8 +156,8 @@
|
|
|
156
156
|
"type": "function"
|
|
157
157
|
}
|
|
158
158
|
],
|
|
159
|
-
"bytecode": "
|
|
160
|
-
"deployedBytecode": "
|
|
159
|
+
"bytecode": "0x608060405234801561001057600080fd5b50610758806100206000396000f3fe608060405234801561001057600080fd5b50600436106100875760003560e01c80638da5cb5b1161005b5780638da5cb5b14610116578063c4d66de81461012f578063f2fde38b14610142578063fc57d4df1461015557600080fd5b8062e4768b1461008c57806356fa5a56146100b85780635e9a523c146100e1578063715018a61461010e575b600080fd5b6100b661009a36600461046d565b6001600160a01b03909116600090815260656020526040902055565b005b6066546100cb906001600160a01b031681565b6040516100d891906104e0565b60405180910390f35b6101016100ef3660046104ee565b60656020526000908152604090205481565b6040516100d8919061051d565b6100b6610168565b6033546001600160a01b03166040516100d89190610534565b6100b661013d3660046104ee565b61017c565b6100b66101503660046104ee565b610296565b6101016101633660046104ee565b6102d0565b610170610354565b61017a600061037e565b565b600054610100900460ff161580801561019c5750600054600160ff909116105b806101b65750303b1580156101b6575060005460ff166001145b6101db5760405162461bcd60e51b81526004016101d290610590565b60405180910390fd5b6000805460ff1916600117905580156101fe576000805461ff0019166101001790555b6102066103d0565b6001600160a01b03821661022c5760405162461bcd60e51b81526004016101d2906105df565b606680546001600160a01b0319166001600160a01b0384161790558015610292576000805461ff00191690556040517f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989061028990600190610603565b60405180910390a15b5050565b61029e610354565b6001600160a01b0381166102c45760405162461bcd60e51b81526004016101d290610654565b6102cd8161037e565b50565b600080826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610311573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610335919061066f565b6001600160a01b03166000908152606560205260409020549392505050565b6033546001600160a01b0316331461017a5760405162461bcd60e51b81526004016101d290610690565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166103f75760405162461bcd60e51b81526004016101d290610712565b61017a600054610100900460ff166104215760405162461bcd60e51b81526004016101d290610712565b61017a3361037e565b60006001600160a01b0382165b92915050565b6104468161042a565b81146102cd57600080fd5b80356104378161043d565b80610446565b80356104378161045c565b6000806040838503121561048357610483600080fd5b600061048f8585610451565b92505060206104a085828601610462565b9150509250929050565b60006001600160a01b038216610437565b6000610437826104aa565b6000610437826104bb565b6104da816104c6565b82525050565b6020810161043782846104d1565b60006020828403121561050357610503600080fd5b600061050f8484610451565b949350505050565b806104da565b602081016104378284610517565b6104da8161042a565b60208101610437828461052b565b602e81526000602082017f496e697469616c697a61626c653a20636f6e747261637420697320616c72656181526d191e481a5b9a5d1a585b1a5e995960921b602082015291505b5060400190565b6020808252810161043781610542565b602281526000602082017f70797468206f7261636c652063616e6e6f74206265207a65726f206164647265815261737360f01b60208201529150610589565b60208082528101610437816105a0565b600060ff8216610437565b6104da816105ef565b6020810161043782846105fa565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b60208201529150610589565b6020808252810161043781610611565b80516104378161043d565b60006020828403121561068457610684600080fd5b600061050f8484610664565b60208082528181019081527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604083015260608201610437565b602b81526000602082017f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206981526a6e697469616c697a696e6760a81b60208201529150610589565b60208082528101610437816106ca56fea264697066735822122074b01e225d6b8e697dd206f5254d7108cec935d838824eba15478ce2a8601fbd64736f6c634300080d0033",
|
|
160
|
+
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100875760003560e01c80638da5cb5b1161005b5780638da5cb5b14610116578063c4d66de81461012f578063f2fde38b14610142578063fc57d4df1461015557600080fd5b8062e4768b1461008c57806356fa5a56146100b85780635e9a523c146100e1578063715018a61461010e575b600080fd5b6100b661009a36600461046d565b6001600160a01b03909116600090815260656020526040902055565b005b6066546100cb906001600160a01b031681565b6040516100d891906104e0565b60405180910390f35b6101016100ef3660046104ee565b60656020526000908152604090205481565b6040516100d8919061051d565b6100b6610168565b6033546001600160a01b03166040516100d89190610534565b6100b661013d3660046104ee565b61017c565b6100b66101503660046104ee565b610296565b6101016101633660046104ee565b6102d0565b610170610354565b61017a600061037e565b565b600054610100900460ff161580801561019c5750600054600160ff909116105b806101b65750303b1580156101b6575060005460ff166001145b6101db5760405162461bcd60e51b81526004016101d290610590565b60405180910390fd5b6000805460ff1916600117905580156101fe576000805461ff0019166101001790555b6102066103d0565b6001600160a01b03821661022c5760405162461bcd60e51b81526004016101d2906105df565b606680546001600160a01b0319166001600160a01b0384161790558015610292576000805461ff00191690556040517f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989061028990600190610603565b60405180910390a15b5050565b61029e610354565b6001600160a01b0381166102c45760405162461bcd60e51b81526004016101d290610654565b6102cd8161037e565b50565b600080826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610311573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610335919061066f565b6001600160a01b03166000908152606560205260409020549392505050565b6033546001600160a01b0316331461017a5760405162461bcd60e51b81526004016101d290610690565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166103f75760405162461bcd60e51b81526004016101d290610712565b61017a600054610100900460ff166104215760405162461bcd60e51b81526004016101d290610712565b61017a3361037e565b60006001600160a01b0382165b92915050565b6104468161042a565b81146102cd57600080fd5b80356104378161043d565b80610446565b80356104378161045c565b6000806040838503121561048357610483600080fd5b600061048f8585610451565b92505060206104a085828601610462565b9150509250929050565b60006001600160a01b038216610437565b6000610437826104aa565b6000610437826104bb565b6104da816104c6565b82525050565b6020810161043782846104d1565b60006020828403121561050357610503600080fd5b600061050f8484610451565b949350505050565b806104da565b602081016104378284610517565b6104da8161042a565b60208101610437828461052b565b602e81526000602082017f496e697469616c697a61626c653a20636f6e747261637420697320616c72656181526d191e481a5b9a5d1a585b1a5e995960921b602082015291505b5060400190565b6020808252810161043781610542565b602281526000602082017f70797468206f7261636c652063616e6e6f74206265207a65726f206164647265815261737360f01b60208201529150610589565b60208082528101610437816105a0565b600060ff8216610437565b6104da816105ef565b6020810161043782846105fa565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b60208201529150610589565b6020808252810161043781610611565b80516104378161043d565b60006020828403121561068457610684600080fd5b600061050f8484610664565b60208082528181019081527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604083015260608201610437565b602b81526000602082017f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206981526a6e697469616c697a696e6760a81b60208201529150610589565b60208082528101610437816106ca56fea264697066735822122074b01e225d6b8e697dd206f5254d7108cec935d838824eba15478ce2a8601fbd64736f6c634300080d0033",
|
|
161
161
|
"linkReferences": {},
|
|
162
162
|
"deployedLinkReferences": {}
|
|
163
163
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"inputs": [
|
|
13
13
|
{
|
|
14
14
|
"internalType": "address",
|
|
15
|
-
"name": "
|
|
15
|
+
"name": "vToken",
|
|
16
16
|
"type": "address"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
@@ -39,35 +39,6 @@
|
|
|
39
39
|
"stateMutability": "view",
|
|
40
40
|
"type": "function"
|
|
41
41
|
},
|
|
42
|
-
{
|
|
43
|
-
"inputs": [
|
|
44
|
-
{
|
|
45
|
-
"internalType": "address",
|
|
46
|
-
"name": "asset",
|
|
47
|
-
"type": "address"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"internalType": "uint256",
|
|
51
|
-
"name": "reporterPrice",
|
|
52
|
-
"type": "uint256"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"internalType": "uint256",
|
|
56
|
-
"name": "anchorPrice",
|
|
57
|
-
"type": "uint256"
|
|
58
|
-
}
|
|
59
|
-
],
|
|
60
|
-
"name": "validateAssetPriceWithAnchorPrice",
|
|
61
|
-
"outputs": [
|
|
62
|
-
{
|
|
63
|
-
"internalType": "bool",
|
|
64
|
-
"name": "",
|
|
65
|
-
"type": "bool"
|
|
66
|
-
}
|
|
67
|
-
],
|
|
68
|
-
"stateMutability": "view",
|
|
69
|
-
"type": "function"
|
|
70
|
-
},
|
|
71
42
|
{
|
|
72
43
|
"inputs": [
|
|
73
44
|
{
|
|
@@ -117,8 +88,8 @@
|
|
|
117
88
|
"type": "function"
|
|
118
89
|
}
|
|
119
90
|
],
|
|
120
|
-
"bytecode": "
|
|
121
|
-
"deployedBytecode": "
|
|
91
|
+
"bytecode": "0x608060405234801561001057600080fd5b50610253806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806379c5e512146100515780638146bf7f1461008c57806397c7033e146100af578063a050bcb3146100dd575b600080fd5b61008a61005f366004610148565b6001600160a01b03919091166000908152602081905260409020805460ff1916911515919091179055565b005b6001546100999060ff1681565b6040516100a69190610185565b60405180910390f35b6100996100bd3660046101a4565b50506001600160a01b031660009081526020819052604090205460ff1690565b6100996100eb3660046101f4565b60006020819052908152604090205460ff1681565b60006001600160a01b0382165b92915050565b61011c81610100565b811461012757600080fd5b50565b803561010d81610113565b80151561011c565b803561010d81610135565b6000806040838503121561015e5761015e600080fd5b600061016a858561012a565b925050602061017b8582860161013d565b9150509250929050565b81151581526020810161010d565b8061011c565b803561010d81610193565b6000806000606084860312156101bc576101bc600080fd5b60006101c8868661012a565b93505060206101d986828701610199565b92505060406101ea86828701610199565b9150509250925092565b60006020828403121561020957610209600080fd5b6000610215848461012a565b94935050505056fea264697066735822122055451f488486cc208d06cc090345b6fa628f140c177fabafa6ab909d51f4843a64736f6c634300080d0033",
|
|
92
|
+
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806379c5e512146100515780638146bf7f1461008c57806397c7033e146100af578063a050bcb3146100dd575b600080fd5b61008a61005f366004610148565b6001600160a01b03919091166000908152602081905260409020805460ff1916911515919091179055565b005b6001546100999060ff1681565b6040516100a69190610185565b60405180910390f35b6100996100bd3660046101a4565b50506001600160a01b031660009081526020819052604090205460ff1690565b6100996100eb3660046101f4565b60006020819052908152604090205460ff1681565b60006001600160a01b0382165b92915050565b61011c81610100565b811461012757600080fd5b50565b803561010d81610113565b80151561011c565b803561010d81610135565b6000806040838503121561015e5761015e600080fd5b600061016a858561012a565b925050602061017b8582860161013d565b9150509250929050565b81151581526020810161010d565b8061011c565b803561010d81610193565b6000806000606084860312156101bc576101bc600080fd5b60006101c8868661012a565b93505060206101d986828701610199565b92505060406101ea86828701610199565b9150509250925092565b60006020828403121561020957610209600080fd5b6000610215848461012a565b94935050505056fea264697066735822122055451f488486cc208d06cc090345b6fa628f140c177fabafa6ab909d51f4843a64736f6c634300080d0033",
|
|
122
93
|
"linkReferences": {},
|
|
123
94
|
"deployedLinkReferences": {}
|
|
124
95
|
}
|
|
@@ -8,25 +8,6 @@
|
|
|
8
8
|
"stateMutability": "nonpayable",
|
|
9
9
|
"type": "constructor"
|
|
10
10
|
},
|
|
11
|
-
{
|
|
12
|
-
"inputs": [
|
|
13
|
-
{
|
|
14
|
-
"internalType": "address",
|
|
15
|
-
"name": "asset",
|
|
16
|
-
"type": "address"
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
"name": "getPrice",
|
|
20
|
-
"outputs": [
|
|
21
|
-
{
|
|
22
|
-
"internalType": "uint256",
|
|
23
|
-
"name": "",
|
|
24
|
-
"type": "uint256"
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
"stateMutability": "view",
|
|
28
|
-
"type": "function"
|
|
29
|
-
},
|
|
30
11
|
{
|
|
31
12
|
"inputs": [
|
|
32
13
|
{
|
|
@@ -84,8 +65,8 @@
|
|
|
84
65
|
"type": "function"
|
|
85
66
|
}
|
|
86
67
|
],
|
|
87
|
-
"bytecode": "
|
|
88
|
-
"deployedBytecode": "
|
|
68
|
+
"bytecode": "0x608060405234801561001057600080fd5b506101be806100206000396000f3fe608060405234801561001057600080fd5b50600436106100405760003560e01c8062e4768b14610045578063cfed246b14610071578063fc57d4df146100a7575b600080fd5b61006f610053366004610116565b6001600160a01b03909116600090815260208190526040902055565b005b61009161007f366004610153565b60006020819052908152604090205481565b60405161009e919061017c565b60405180910390f35b6100916100b5366004610153565b6001600160a01b031660009081526020819052604090205490565b60006001600160a01b0382165b92915050565b6100ec816100d0565b81146100f757600080fd5b50565b80356100dd816100e3565b806100ec565b80356100dd81610105565b6000806040838503121561012c5761012c600080fd5b600061013885856100fa565b92505060206101498582860161010b565b9150509250929050565b60006020828403121561016857610168600080fd5b600061017484846100fa565b949350505050565b818152602081016100dd56fea26469706673582212208a12236934807c1e4ea1f2323a597dc8644d306dd67cc945d84d9935dd6d9fb264736f6c634300080d0033",
|
|
69
|
+
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100405760003560e01c8062e4768b14610045578063cfed246b14610071578063fc57d4df146100a7575b600080fd5b61006f610053366004610116565b6001600160a01b03909116600090815260208190526040902055565b005b61009161007f366004610153565b60006020819052908152604090205481565b60405161009e919061017c565b60405180910390f35b6100916100b5366004610153565b6001600160a01b031660009081526020819052604090205490565b60006001600160a01b0382165b92915050565b6100ec816100d0565b81146100f757600080fd5b50565b80356100dd816100e3565b806100ec565b80356100dd81610105565b6000806040838503121561012c5761012c600080fd5b600061013885856100fa565b92505060206101498582860161010b565b9150509250929050565b60006020828403121561016857610168600080fd5b600061017484846100fa565b949350505050565b818152602081016100dd56fea26469706673582212208a12236934807c1e4ea1f2323a597dc8644d306dd67cc945d84d9935dd6d9fb264736f6c634300080d0033",
|
|
89
70
|
"linkReferences": {},
|
|
90
71
|
"deployedLinkReferences": {}
|
|
91
72
|
}
|
|
@@ -20,9 +20,9 @@ import "@venusprotocol/governance-contracts/contracts/Governance/AccessControlle
|
|
|
20
20
|
* the protocol from oracle attacks. Currently it includes integrations with Chainlink, Pyth, Binance Oracle
|
|
21
21
|
* and TWAP (Time-Weighted Average Price) oracles. TWAP uses PancakeSwap as the on-chain price source.
|
|
22
22
|
*
|
|
23
|
-
* For every market (vToken) we configure the main, pivot and fallback oracles. The
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* For every market (vToken) we configure the main, pivot and fallback oracles. The main oracle oracle is the
|
|
24
|
+
* most trustworthy price source, the pivot oracle is used as a loose sanity checker and the fallback oracle
|
|
25
|
+
* is used as a backup price source.
|
|
26
26
|
*
|
|
27
27
|
* To validate prices returned from two oracles, we use an upper and lower bound ratio that is set for every
|
|
28
28
|
* market. The upper bound ratio represents the deviation between reported price (the price that’s being
|
|
@@ -109,8 +109,8 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
|
-
* @notice Checks whether token config exists by checking whether
|
|
113
|
-
* @dev
|
|
112
|
+
* @notice Checks whether token config exists by checking whether vToken is null address
|
|
113
|
+
* @dev vToken can't be null, so it's suitable to be used to check the validity of the config
|
|
114
114
|
* @param asset asset address
|
|
115
115
|
*/
|
|
116
116
|
modifier checkTokenConfigExistence(address asset) {
|
|
@@ -180,8 +180,8 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
/**
|
|
183
|
-
* @notice Sets oracle for a given
|
|
184
|
-
* @dev Supplied
|
|
183
|
+
* @notice Sets oracle for a given vToken and role.
|
|
184
|
+
* @dev Supplied vToken **must** exist and main oracle may not be null
|
|
185
185
|
* @param asset Asset address
|
|
186
186
|
* @param oracle Oracle address
|
|
187
187
|
* @param role Oracle role
|
|
@@ -203,8 +203,7 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
/**
|
|
206
|
-
* @notice Enables/ disables oracle for the input
|
|
207
|
-
* @dev Configuration for the asset **must** already exist and the asset cannot be 0 address
|
|
206
|
+
* @notice Enables/ disables oracle for the input vToken, input vToken **must** exist
|
|
208
207
|
* @param asset Asset address
|
|
209
208
|
* @param role Oracle role
|
|
210
209
|
* @param enable Enabled boolean of the oracle
|
|
@@ -228,33 +227,20 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
|
|
|
228
227
|
* @param vToken vToken address
|
|
229
228
|
*/
|
|
230
229
|
function updatePrice(address vToken) external override {
|
|
231
|
-
address
|
|
232
|
-
(address pivotOracle, bool pivotOracleEnabled) = getOracle(asset, OracleRole.PIVOT);
|
|
233
|
-
if (pivotOracle != address(0) && pivotOracleEnabled) {
|
|
234
|
-
//if pivot oracle is not TwapOracle it will revert so we need to catch the revert
|
|
235
|
-
try TwapInterface(pivotOracle).updateTwap(asset) {} catch {}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* @notice Updates the pivot oracle price. Currently using TWAP
|
|
241
|
-
* @dev This function should always be called before calling getPrice
|
|
242
|
-
* @param asset asset address
|
|
243
|
-
*/
|
|
244
|
-
function updateAssetPrice(address asset) external {
|
|
245
|
-
(address pivotOracle, bool pivotOracleEnabled) = getOracle(asset, OracleRole.PIVOT);
|
|
230
|
+
(address pivotOracle, bool pivotOracleEnabled) = getOracle(vToken, OracleRole.PIVOT);
|
|
246
231
|
if (pivotOracle != address(0) && pivotOracleEnabled) {
|
|
247
232
|
//if pivot oracle is not TwapOracle it will revert so we need to catch the revert
|
|
248
|
-
try TwapInterface(pivotOracle).updateTwap(
|
|
233
|
+
try TwapInterface(pivotOracle).updateTwap(vToken) {} catch {}
|
|
249
234
|
}
|
|
250
235
|
}
|
|
251
236
|
|
|
252
237
|
/**
|
|
253
|
-
* @dev Gets token config by
|
|
254
|
-
* @param
|
|
255
|
-
* @return tokenConfig Config for the
|
|
238
|
+
* @dev Gets token config by vToken address
|
|
239
|
+
* @param vToken vToken address
|
|
240
|
+
* @return tokenConfig Config for the vToken
|
|
256
241
|
*/
|
|
257
|
-
function getTokenConfig(address
|
|
242
|
+
function getTokenConfig(address vToken) external view returns (TokenConfig memory) {
|
|
243
|
+
address asset = _getUnderlyingAsset(vToken);
|
|
258
244
|
return tokenConfigs[asset];
|
|
259
245
|
}
|
|
260
246
|
|
|
@@ -273,21 +259,41 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
|
|
|
273
259
|
*/
|
|
274
260
|
function getUnderlyingPrice(address vToken) external view override returns (uint256) {
|
|
275
261
|
if (paused()) revert("resilient oracle is paused");
|
|
262
|
+
uint256 pivotPrice = INVALID_PRICE;
|
|
276
263
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
264
|
+
// Get pivot oracle price, Invalid price if not available or error
|
|
265
|
+
(address pivotOracle, bool pivotOracleEnabled) = getOracle(vToken, OracleRole.PIVOT);
|
|
266
|
+
if (pivotOracleEnabled && pivotOracle != address(0)) {
|
|
267
|
+
try OracleInterface(pivotOracle).getUnderlyingPrice(vToken) returns (uint256 pricePivot) {
|
|
268
|
+
pivotPrice = pricePivot;
|
|
269
|
+
} catch {}
|
|
270
|
+
}
|
|
280
271
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
if (
|
|
290
|
-
|
|
272
|
+
// Compare main price and pivot price, return main price and if validation was successful
|
|
273
|
+
// note: In case pivot oracle is not available but main price is available and
|
|
274
|
+
// validation is successful, the main oracle price is returned.
|
|
275
|
+
(uint256 mainPrice, bool validatedPivotMain) = _getMainOraclePrice(
|
|
276
|
+
vToken,
|
|
277
|
+
pivotPrice,
|
|
278
|
+
pivotOracleEnabled && pivotOracle != address(0)
|
|
279
|
+
);
|
|
280
|
+
if (mainPrice != INVALID_PRICE && validatedPivotMain) return mainPrice;
|
|
281
|
+
|
|
282
|
+
// Compare fallback and pivot if main oracle comparision fails with pivot
|
|
283
|
+
// Return fallback price when fallback price is validated successfully with pivot oracle
|
|
284
|
+
(uint256 fallbackPrice, bool validatedPivotFallback) = _getFallbackOraclePrice(vToken, pivotPrice);
|
|
285
|
+
if (fallbackPrice != INVALID_PRICE && validatedPivotFallback) return fallbackPrice;
|
|
286
|
+
|
|
287
|
+
// Lastly compare main price and fallback price
|
|
288
|
+
if (
|
|
289
|
+
mainPrice != INVALID_PRICE &&
|
|
290
|
+
fallbackPrice != INVALID_PRICE &&
|
|
291
|
+
boundValidator.validatePriceWithAnchorPrice(vToken, mainPrice, fallbackPrice)
|
|
292
|
+
) {
|
|
293
|
+
return mainPrice;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
revert("invalid resilient oracle price");
|
|
291
297
|
}
|
|
292
298
|
|
|
293
299
|
/**
|
|
@@ -297,7 +303,7 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
|
|
|
297
303
|
* @custom:access Only Governance
|
|
298
304
|
* @custom:error NotNullAddress is thrown if asset address is null
|
|
299
305
|
* @custom:error NotNullAddress is thrown if main-role oracle address for asset is null
|
|
300
|
-
* @custom:event Emits TokenConfigAdded event when
|
|
306
|
+
* @custom:event Emits TokenConfigAdded event when vToken config is set successfully by governnace
|
|
301
307
|
*/
|
|
302
308
|
function setTokenConfig(
|
|
303
309
|
TokenConfig memory tokenConfig
|
|
@@ -314,78 +320,42 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
|
|
|
314
320
|
}
|
|
315
321
|
|
|
316
322
|
/**
|
|
317
|
-
* @notice Gets oracle and enabled status by
|
|
318
|
-
* @param
|
|
323
|
+
* @notice Gets oracle and enabled status by vToken address
|
|
324
|
+
* @param vToken vToken address
|
|
319
325
|
* @param role Oracle role
|
|
320
326
|
* @return oracle Oracle address based on role
|
|
321
327
|
* @return enabled Enabled flag of the oracle based on token config
|
|
322
328
|
*/
|
|
323
|
-
function getOracle(address
|
|
329
|
+
function getOracle(address vToken, OracleRole role) public view returns (address oracle, bool enabled) {
|
|
330
|
+
address asset = _getUnderlyingAsset(vToken);
|
|
331
|
+
|
|
324
332
|
oracle = tokenConfigs[asset].oracles[uint256(role)];
|
|
325
333
|
enabled = tokenConfigs[asset].enableFlagsForOracles[uint256(role)];
|
|
326
334
|
}
|
|
327
335
|
|
|
328
|
-
function _getPrice(address asset) internal view returns (uint256) {
|
|
329
|
-
uint256 pivotPrice = INVALID_PRICE;
|
|
330
|
-
|
|
331
|
-
// Get pivot oracle price, Invalid price if not available or error
|
|
332
|
-
(address pivotOracle, bool pivotOracleEnabled) = getOracle(asset, OracleRole.PIVOT);
|
|
333
|
-
if (pivotOracleEnabled && pivotOracle != address(0)) {
|
|
334
|
-
try OracleInterface(pivotOracle).getPrice(asset) returns (uint256 pricePivot) {
|
|
335
|
-
pivotPrice = pricePivot;
|
|
336
|
-
} catch {}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// Compare main price and pivot price, return main price and if validation was successful
|
|
340
|
-
// note: In case pivot oracle is not available but main price is available and
|
|
341
|
-
// validation is successful, the main oracle price is returned.
|
|
342
|
-
(uint256 mainPrice, bool validatedPivotMain) = _getMainOraclePrice(
|
|
343
|
-
asset,
|
|
344
|
-
pivotPrice,
|
|
345
|
-
pivotOracleEnabled && pivotOracle != address(0)
|
|
346
|
-
);
|
|
347
|
-
if (mainPrice != INVALID_PRICE && validatedPivotMain) return mainPrice;
|
|
348
|
-
|
|
349
|
-
// Compare fallback and pivot if main oracle comparision fails with pivot
|
|
350
|
-
// Return fallback price when fallback price is validated successfully with pivot oracle
|
|
351
|
-
(uint256 fallbackPrice, bool validatedPivotFallback) = _getFallbackOraclePrice(asset, pivotPrice);
|
|
352
|
-
if (fallbackPrice != INVALID_PRICE && validatedPivotFallback) return fallbackPrice;
|
|
353
|
-
|
|
354
|
-
// Lastly compare main price and fallback price
|
|
355
|
-
if (
|
|
356
|
-
mainPrice != INVALID_PRICE &&
|
|
357
|
-
fallbackPrice != INVALID_PRICE &&
|
|
358
|
-
boundValidator.validatePriceWithAnchorPrice(asset, mainPrice, fallbackPrice)
|
|
359
|
-
) {
|
|
360
|
-
return mainPrice;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
revert("invalid resilient oracle price");
|
|
364
|
-
}
|
|
365
|
-
|
|
366
336
|
/**
|
|
367
|
-
* @notice Gets
|
|
337
|
+
* @notice Gets underlying asset price for the provided vToken
|
|
368
338
|
* @dev This function won't revert when price is 0, because the fallback oracle may still be
|
|
369
339
|
* able to fetch a correct price
|
|
370
|
-
* @param
|
|
340
|
+
* @param vToken vToken address
|
|
371
341
|
* @param pivotPrice Pivot oracle price
|
|
372
342
|
* @param pivotEnabled If pivot oracle is not empty and enabled
|
|
373
343
|
* @return price USD price in scaled decimals
|
|
374
|
-
* e.g.
|
|
344
|
+
* e.g. vToken decimals is 8 then price is returned as 10**18 * 10**(18-8) = 10**28 decimals
|
|
375
345
|
* @return pivotValidated Boolean representing if the validation of main oracle price
|
|
376
346
|
* and pivot oracle price were successful
|
|
377
|
-
* @custom:error Invalid price error is thrown if main oracle fails to fetch price of
|
|
347
|
+
* @custom:error Invalid price error is thrown if main oracle fails to fetch price of underlying asset
|
|
378
348
|
* @custom:error Invalid price error is thrown if main oracle is not enabled or main oracle
|
|
379
349
|
* address is null
|
|
380
350
|
*/
|
|
381
351
|
function _getMainOraclePrice(
|
|
382
|
-
address
|
|
352
|
+
address vToken,
|
|
383
353
|
uint256 pivotPrice,
|
|
384
354
|
bool pivotEnabled
|
|
385
|
-
)
|
|
386
|
-
(address mainOracle, bool mainOracleEnabled) = getOracle(
|
|
355
|
+
) private view returns (uint256, bool) {
|
|
356
|
+
(address mainOracle, bool mainOracleEnabled) = getOracle(vToken, OracleRole.MAIN);
|
|
387
357
|
if (mainOracleEnabled && mainOracle != address(0)) {
|
|
388
|
-
try OracleInterface(mainOracle).
|
|
358
|
+
try OracleInterface(mainOracle).getUnderlyingPrice(vToken) returns (uint256 mainOraclePrice) {
|
|
389
359
|
if (!pivotEnabled) {
|
|
390
360
|
return (mainOraclePrice, true);
|
|
391
361
|
}
|
|
@@ -394,7 +364,7 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
|
|
|
394
364
|
}
|
|
395
365
|
return (
|
|
396
366
|
mainOraclePrice,
|
|
397
|
-
boundValidator.validatePriceWithAnchorPrice(
|
|
367
|
+
boundValidator.validatePriceWithAnchorPrice(vToken, mainOraclePrice, pivotPrice)
|
|
398
368
|
);
|
|
399
369
|
} catch {
|
|
400
370
|
return (INVALID_PRICE, false);
|
|
@@ -405,25 +375,25 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
|
|
|
405
375
|
}
|
|
406
376
|
|
|
407
377
|
/**
|
|
408
|
-
* @dev This function won't revert when the price is 0 because
|
|
409
|
-
* @param
|
|
378
|
+
* @dev This function won't revert when the price is 0 because getUnderlyingPrice checks if price is > 0
|
|
379
|
+
* @param vToken vToken address
|
|
410
380
|
* @return price USD price in 18 decimals
|
|
411
381
|
* @return pivotValidated Boolean representing if the validation of fallback oracle price
|
|
412
382
|
* and pivot oracle price were successfull
|
|
413
|
-
* @custom:error Invalid price error is thrown if fallback oracle fails to fetch price of
|
|
383
|
+
* @custom:error Invalid price error is thrown if fallback oracle fails to fetch price of underlying asset
|
|
414
384
|
* @custom:error Invalid price error is thrown if fallback oracle is not enabled or fallback oracle
|
|
415
385
|
* address is null
|
|
416
386
|
*/
|
|
417
|
-
function _getFallbackOraclePrice(address
|
|
418
|
-
(address fallbackOracle, bool fallbackEnabled) = getOracle(
|
|
387
|
+
function _getFallbackOraclePrice(address vToken, uint256 pivotPrice) private view returns (uint256, bool) {
|
|
388
|
+
(address fallbackOracle, bool fallbackEnabled) = getOracle(vToken, OracleRole.FALLBACK);
|
|
419
389
|
if (fallbackEnabled && fallbackOracle != address(0)) {
|
|
420
|
-
try OracleInterface(fallbackOracle).
|
|
390
|
+
try OracleInterface(fallbackOracle).getUnderlyingPrice(vToken) returns (uint256 fallbackOraclePrice) {
|
|
421
391
|
if (pivotPrice == INVALID_PRICE) {
|
|
422
392
|
return (fallbackOraclePrice, false);
|
|
423
393
|
}
|
|
424
394
|
return (
|
|
425
395
|
fallbackOraclePrice,
|
|
426
|
-
boundValidator.validatePriceWithAnchorPrice(
|
|
396
|
+
boundValidator.validatePriceWithAnchorPrice(vToken, fallbackOraclePrice, pivotPrice)
|
|
427
397
|
);
|
|
428
398
|
} catch {
|
|
429
399
|
return (INVALID_PRICE, false);
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
4
|
interface FeedRegistryInterface {
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function latestRoundDataByName(
|
|
6
|
+
string memory base,
|
|
7
|
+
string memory quote
|
|
8
8
|
)
|
|
9
9
|
external
|
|
10
10
|
view
|
|
11
11
|
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
|
|
12
12
|
|
|
13
|
-
function
|
|
13
|
+
function decimalsByName(string memory base, string memory quote) external view returns (uint8);
|
|
14
14
|
}
|
|
@@ -2,22 +2,20 @@
|
|
|
2
2
|
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
4
|
interface OracleInterface {
|
|
5
|
-
function
|
|
5
|
+
function getUnderlyingPrice(address vToken) external view returns (uint256);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
interface ResilientOracleInterface is OracleInterface {
|
|
9
9
|
function updatePrice(address vToken) external;
|
|
10
|
-
|
|
11
|
-
function getUnderlyingPrice(address vToken) external view returns (uint256);
|
|
12
10
|
}
|
|
13
11
|
|
|
14
12
|
interface TwapInterface is OracleInterface {
|
|
15
|
-
function updateTwap(address
|
|
13
|
+
function updateTwap(address vToken) external returns (uint256);
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
interface BoundValidatorInterface {
|
|
19
17
|
function validatePriceWithAnchorPrice(
|
|
20
|
-
address
|
|
18
|
+
address vToken,
|
|
21
19
|
uint256 reporterPrice,
|
|
22
20
|
uint256 anchorPrice
|
|
23
21
|
) external view returns (bool);
|