@venusprotocol/oracle 1.3.1 → 1.3.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.
Files changed (35) hide show
  1. package/artifacts/build-info/2fde13baf96aae3a4a0595eaa19cc540.json +1 -0
  2. package/artifacts/contracts/PriceOracle.sol/PriceOracle.dbg.json +1 -1
  3. package/artifacts/contracts/PriceOracle.sol/PriceOracle.json +0 -6
  4. package/contracts/PriceOracle.sol +4 -4
  5. package/deploy/oracles.d.ts +4 -0
  6. package/deploy/oracles.d.ts.map +1 -0
  7. package/deploy/oracles.js +118 -0
  8. package/deploy/oracles.js.map +1 -0
  9. package/package.json +2 -2
  10. package/README.md +0 -106
  11. package/artifacts/build-info/766f05630947fa6d366a667b66c1141b.json +0 -1
  12. package/deploy/oracles.ts +0 -104
  13. package/deployments/localhost/.chainId +0 -1
  14. package/deployments/localhost/BinanceOracle.json +0 -393
  15. package/deployments/localhost/BinanceOracle_Implementation.json +0 -305
  16. package/deployments/localhost/BinanceOracle_Proxy.json +0 -241
  17. package/deployments/localhost/BoundValidator.json +0 -457
  18. package/deployments/localhost/BoundValidator_Implementation.json +0 -428
  19. package/deployments/localhost/BoundValidator_Proxy.json +0 -237
  20. package/deployments/localhost/ChainlinkOracle.json +0 -370
  21. package/deployments/localhost/ChainlinkOracle_Implementation.json +0 -273
  22. package/deployments/localhost/ChainlinkOracle_Proxy.json +0 -237
  23. package/deployments/localhost/DefaultProxyAdmin.json +0 -257
  24. package/deployments/localhost/PivotTwapOracle.json +0 -393
  25. package/deployments/localhost/PivotTwapOracle_Implementation.json +0 -304
  26. package/deployments/localhost/PivotTwapOracle_Proxy.json +0 -241
  27. package/deployments/localhost/PythOracle.json +0 -393
  28. package/deployments/localhost/PythOracle_Implementation.json +0 -309
  29. package/deployments/localhost/PythOracle_Proxy.json +0 -241
  30. package/deployments/localhost/ResilientOracle.json +0 -700
  31. package/deployments/localhost/ResilientOracle_Implementation.json +0 -746
  32. package/deployments/localhost/ResilientOracle_Proxy.json +0 -241
  33. package/deployments/localhost/solcInputs/0e89febeebc7444140de8e67c9067d2c.json +0 -78
  34. package/deployments/localhost/solcInputs/468ec7a31e2db8855c82fb8141193271.json +0 -54
  35. package/deployments/localhost/solcInputs/50629170e50dc9fec79dac585e95ac05.json +0 -138
@@ -0,0 +1 @@
1
+ {"id":"2fde13baf96aae3a4a0595eaa19cc540","_format":"hh-sol-build-info-1","solcVersion":"0.8.13","solcLongVersion":"0.8.13+commit.abaa5c0e","input":{"language":"Solidity","sources":{"contracts/PriceOracle.sol":{"content":"pragma solidity >=0.5.16;\n\nabstract contract PriceOracle {\n /// @notice Indicator that this is a PriceOracle contract (for inspection)\n bool public constant isPriceOracle = true;\n\n /**\n * @notice Get the underlying price of a vToken asset\n * @param vToken The vToken address to get the underlying price of\n * @return The underlying asset price mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function getUnderlyingPrice(address vToken) external view virtual returns (uint256);\n\n function updatePrice(address vToken) external virtual;\n}\n"}},"settings":{"optimizer":{"enabled":true,"runs":200},"outputSelection":{"*":{"*":["storageLayout","abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata","devdoc","userdoc","evm.gasEstimates"],"":["ast"]}},"metadata":{"useLiteralContent":true}}},"output":{"errors":[{"component":"general","errorCode":"1878","formattedMessage":"Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing \"SPDX-License-Identifier: <SPDX-License>\" to each source file. Use \"SPDX-License-Identifier: UNLICENSED\" for non-open-source code. Please see https://spdx.org for more information.\n--> contracts/PriceOracle.sol\n\n","message":"SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing \"SPDX-License-Identifier: <SPDX-License>\" to each source file. Use \"SPDX-License-Identifier: UNLICENSED\" for non-open-source code. Please see https://spdx.org for more information.","severity":"warning","sourceLocation":{"end":-1,"file":"contracts/PriceOracle.sol","start":-1},"type":"Warning"}],"sources":{"contracts/PriceOracle.sol":{"ast":{"absolutePath":"contracts/PriceOracle.sol","exportedSymbols":{"PriceOracle":[19]},"id":20,"nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity",">=","0.5",".16"],"nodeType":"PragmaDirective","src":"0:25:0"},{"abstract":true,"baseContracts":[],"canonicalName":"PriceOracle","contractDependencies":[],"contractKind":"contract","fullyImplemented":false,"id":19,"linearizedBaseContracts":[19],"name":"PriceOracle","nameLocation":"45:11:0","nodeType":"ContractDefinition","nodes":[{"constant":true,"documentation":{"id":2,"nodeType":"StructuredDocumentation","src":"63:74:0","text":"@notice Indicator that this is a PriceOracle contract (for inspection)"},"functionSelector":"66331bba","id":5,"mutability":"constant","name":"isPriceOracle","nameLocation":"163:13:0","nodeType":"VariableDeclaration","scope":19,"src":"142:41:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":3,"name":"bool","nodeType":"ElementaryTypeName","src":"142:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":{"hexValue":"74727565","id":4,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"179:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"true"},"visibility":"public"},{"documentation":{"id":6,"nodeType":"StructuredDocumentation","src":"190:254:0","text":" @notice Get the underlying price of a vToken asset\n @param vToken The vToken address to get the underlying price of\n @return The underlying asset price mantissa (scaled by 1e18).\n Zero means the price is unavailable."},"functionSelector":"fc57d4df","id":13,"implemented":false,"kind":"function","modifiers":[],"name":"getUnderlyingPrice","nameLocation":"458:18:0","nodeType":"FunctionDefinition","parameters":{"id":9,"nodeType":"ParameterList","parameters":[{"constant":false,"id":8,"mutability":"mutable","name":"vToken","nameLocation":"485:6:0","nodeType":"VariableDeclaration","scope":13,"src":"477:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":7,"name":"address","nodeType":"ElementaryTypeName","src":"477:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"476:16:0"},"returnParameters":{"id":12,"nodeType":"ParameterList","parameters":[{"constant":false,"id":11,"mutability":"mutable","name":"","nameLocation":"-1:-1:-1","nodeType":"VariableDeclaration","scope":13,"src":"524:7:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":10,"name":"uint256","nodeType":"ElementaryTypeName","src":"524:7:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"523:9:0"},"scope":19,"src":"449:84:0","stateMutability":"view","virtual":true,"visibility":"external"},{"functionSelector":"96e85ced","id":18,"implemented":false,"kind":"function","modifiers":[],"name":"updatePrice","nameLocation":"548:11:0","nodeType":"FunctionDefinition","parameters":{"id":16,"nodeType":"ParameterList","parameters":[{"constant":false,"id":15,"mutability":"mutable","name":"vToken","nameLocation":"568:6:0","nodeType":"VariableDeclaration","scope":18,"src":"560:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":14,"name":"address","nodeType":"ElementaryTypeName","src":"560:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"559:16:0"},"returnParameters":{"id":17,"nodeType":"ParameterList","parameters":[],"src":"592:0:0"},"scope":19,"src":"539:54:0","stateMutability":"nonpayable","virtual":true,"visibility":"external"}],"scope":20,"src":"27:568:0","usedErrors":[]}],"src":"0:596:0"},"id":0}},"contracts":{"contracts/PriceOracle.sol":{"PriceOracle":{"abi":[{"inputs":[{"internalType":"address","name":"vToken","type":"address"}],"name":"getUnderlyingPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPriceOracle","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vToken","type":"address"}],"name":"updatePrice","outputs":[],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{"getUnderlyingPrice(address)":{"params":{"vToken":"The vToken address to get the underlying price of"},"returns":{"_0":"The underlying asset price mantissa (scaled by 1e18). Zero means the price is unavailable."}}},"version":1},"evm":{"bytecode":{"functionDebugData":{},"generatedSources":[],"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"deployedBytecode":{"functionDebugData":{},"generatedSources":[],"immutableReferences":{},"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"gasEstimates":null,"methodIdentifiers":{"getUnderlyingPrice(address)":"fc57d4df","isPriceOracle()":"66331bba","updatePrice(address)":"96e85ced"}},"metadata":"{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"vToken\",\"type\":\"address\"}],\"name\":\"getUnderlyingPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isPriceOracle\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"vToken\",\"type\":\"address\"}],\"name\":\"updatePrice\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"getUnderlyingPrice(address)\":{\"params\":{\"vToken\":\"The vToken address to get the underlying price of\"},\"returns\":{\"_0\":\"The underlying asset price mantissa (scaled by 1e18). Zero means the price is unavailable.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getUnderlyingPrice(address)\":{\"notice\":\"Get the underlying price of a vToken asset\"},\"isPriceOracle()\":{\"notice\":\"Indicator that this is a PriceOracle contract (for inspection)\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/PriceOracle.sol\":\"PriceOracle\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/PriceOracle.sol\":{\"content\":\"pragma solidity >=0.5.16;\\n\\nabstract contract PriceOracle {\\n /// @notice Indicator that this is a PriceOracle contract (for inspection)\\n bool public constant isPriceOracle = true;\\n\\n /**\\n * @notice Get the underlying price of a vToken asset\\n * @param vToken The vToken address to get the underlying price of\\n * @return The underlying asset price mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function getUnderlyingPrice(address vToken) external view virtual returns (uint256);\\n\\n function updatePrice(address vToken) external virtual;\\n}\\n\",\"keccak256\":\"0x31c6ebcceac600f9e86e22dbd7fac338d43a58979efdd14b0840fb9649f4b75e\"}},\"version\":1}","storageLayout":{"storage":[],"types":null},"userdoc":{"kind":"user","methods":{"getUnderlyingPrice(address)":{"notice":"Get the underlying price of a vToken asset"},"isPriceOracle()":{"notice":"Indicator that this is a PriceOracle contract (for inspection)"}},"version":1}}}}}}
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../build-info/766f05630947fa6d366a667b66c1141b.json"
3
+ "buildInfo": "../../build-info/2fde13baf96aae3a4a0595eaa19cc540.json"
4
4
  }
@@ -4,7 +4,6 @@
4
4
  "sourceName": "contracts/PriceOracle.sol",
5
5
  "abi": [
6
6
  {
7
- "constant": true,
8
7
  "inputs": [
9
8
  {
10
9
  "internalType": "address",
@@ -20,12 +19,10 @@
20
19
  "type": "uint256"
21
20
  }
22
21
  ],
23
- "payable": false,
24
22
  "stateMutability": "view",
25
23
  "type": "function"
26
24
  },
27
25
  {
28
- "constant": true,
29
26
  "inputs": [],
30
27
  "name": "isPriceOracle",
31
28
  "outputs": [
@@ -35,12 +32,10 @@
35
32
  "type": "bool"
36
33
  }
37
34
  ],
38
- "payable": false,
39
35
  "stateMutability": "view",
40
36
  "type": "function"
41
37
  },
42
38
  {
43
- "constant": false,
44
39
  "inputs": [
45
40
  {
46
41
  "internalType": "address",
@@ -50,7 +45,6 @@
50
45
  ],
51
46
  "name": "updatePrice",
52
47
  "outputs": [],
53
- "payable": false,
54
48
  "stateMutability": "nonpayable",
55
49
  "type": "function"
56
50
  }
@@ -1,6 +1,6 @@
1
- pragma solidity ^0.5.16;
1
+ pragma solidity >=0.5.16;
2
2
 
3
- contract PriceOracle {
3
+ abstract contract PriceOracle {
4
4
  /// @notice Indicator that this is a PriceOracle contract (for inspection)
5
5
  bool public constant isPriceOracle = true;
6
6
 
@@ -10,7 +10,7 @@ contract PriceOracle {
10
10
  * @return The underlying asset price mantissa (scaled by 1e18).
11
11
  * Zero means the price is unavailable.
12
12
  */
13
- function getUnderlyingPrice(address vToken) external view returns (uint256);
13
+ function getUnderlyingPrice(address vToken) external view virtual returns (uint256);
14
14
 
15
- function updatePrice(address vToken) external;
15
+ function updatePrice(address vToken) external virtual;
16
16
  }
@@ -0,0 +1,4 @@
1
+ import { DeployFunction } from "hardhat-deploy/dist/types";
2
+ declare const func: DeployFunction;
3
+ export default func;
4
+ //# sourceMappingURL=oracles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oracles.d.ts","sourceRoot":"","sources":["../../deploy/oracles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAgB3D,QAAA,MAAM,IAAI,EAAE,cA+FX,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const mainnet_json_1 = __importDefault(require("@venusprotocol/venus-protocol/networks/mainnet.json"));
16
+ const testnet_json_1 = __importDefault(require("@venusprotocol/venus-protocol/networks/testnet.json"));
17
+ const hardhat_1 = __importDefault(require("hardhat"));
18
+ const ADDRESSES = {
19
+ bsctestnet: {
20
+ vBNBAddress: testnet_json_1.default.Contracts.vBNB,
21
+ pythOracleAddress: "0xd7308b14BF4008e7C7196eC35610B1427C5702EA",
22
+ binanceFeedRegistryAddress: "0x999DD49FeFdC043fDAC4FE12Bb1e4bb31cB4c47B",
23
+ },
24
+ bscmainnet: {
25
+ vBNBAddress: mainnet_json_1.default.Contracts.vBNB,
26
+ pythOracleAddress: "",
27
+ binanceFeedRegistryAddress: "",
28
+ },
29
+ };
30
+ const func = function ({ getNamedAccounts, deployments, network }) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ const { deploy } = deployments;
33
+ const { deployer } = yield getNamedAccounts();
34
+ const networkName = network.name === "bscmainnet" ? "bscmainnet" : "bsctestnet";
35
+ yield deploy("BoundValidator", {
36
+ from: deployer,
37
+ log: true,
38
+ deterministicDeployment: false,
39
+ proxy: {
40
+ proxyContract: "OptimizedTransparentProxy",
41
+ execute: {
42
+ methodName: "initialize",
43
+ args: [],
44
+ },
45
+ },
46
+ });
47
+ const boundValidator = yield hardhat_1.default.ethers.getContract("BoundValidator");
48
+ yield deploy("ResilientOracle", {
49
+ from: deployer,
50
+ log: true,
51
+ deterministicDeployment: false,
52
+ proxy: {
53
+ proxyContract: "OptimizedTransparentProxy",
54
+ execute: {
55
+ methodName: "initialize",
56
+ args: [boundValidator.address],
57
+ },
58
+ },
59
+ });
60
+ yield deploy("ChainlinkOracle", {
61
+ contract: network.live ? "ChainlinkOracle" : "MockChainlinkOracle",
62
+ from: deployer,
63
+ log: true,
64
+ deterministicDeployment: false,
65
+ proxy: {
66
+ proxyContract: "OptimizedTransparentProxy",
67
+ execute: {
68
+ methodName: "initialize",
69
+ args: [],
70
+ },
71
+ },
72
+ });
73
+ const vBNBAddress = ADDRESSES[networkName].vBNBAddress;
74
+ yield deploy("PivotTwapOracle", {
75
+ contract: network.live ? "PivotTwapOracle" : "MockTwapOracle",
76
+ from: deployer,
77
+ log: true,
78
+ deterministicDeployment: false,
79
+ proxy: {
80
+ proxyContract: "OptimizedTransparentProxy",
81
+ execute: {
82
+ methodName: "initialize",
83
+ args: [vBNBAddress],
84
+ },
85
+ },
86
+ });
87
+ const pythOracleAddress = ADDRESSES[networkName].pythOracleAddress;
88
+ yield deploy("PythOracle", {
89
+ contract: network.live ? "PythOracle" : "MockPythOracle",
90
+ from: deployer,
91
+ log: true,
92
+ deterministicDeployment: false,
93
+ proxy: {
94
+ proxyContract: "OptimizedTransparentProxy",
95
+ execute: {
96
+ methodName: "initialize",
97
+ args: [pythOracleAddress],
98
+ },
99
+ },
100
+ });
101
+ const binanceFeedRegistryAddress = ADDRESSES[networkName].binanceFeedRegistryAddress;
102
+ yield deploy("BinanceOracle", {
103
+ contract: network.live ? "BinanceOracle" : "MockBinanceOracle",
104
+ from: deployer,
105
+ log: true,
106
+ deterministicDeployment: false,
107
+ proxy: {
108
+ proxyContract: "OptimizedTransparentProxy",
109
+ execute: {
110
+ methodName: "initialize",
111
+ args: [binanceFeedRegistryAddress],
112
+ },
113
+ },
114
+ });
115
+ });
116
+ };
117
+ exports.default = func;
118
+ //# sourceMappingURL=oracles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oracles.js","sourceRoot":"","sources":["../../de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AE,CAAC,iBAAiB,CAAC;iBAC1B;aACF;SACF,CAAC,CAAC;QAEH,MAAM,0BAA0B,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,0BAA0B,CAAC;QAErF,MAAM,MAAM,CAAC,eAAe,EAAE;YAC5B,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,mBAAmB;YAC9D,IAAI,EAAE,QAAQ;YACd,GAAG,EAAE,IAAI;YACT,uBAAuB,EAAE,KAAK;YAC9B,KAAK,EAAE;gBACL,aAAa,EAAE,2BAA2B;gBAC1C,OAAO,EAAE;oBACP,UAAU,EAAE,YAAY;oBACxB,IAAI,EAAE,CAAC,0BAA0B,CAAC;iBACnC;aACF;SACF,CAAC,CAAC;IACL,CAAC;CAAA,CAAC;AAEF,kBAAe,IAAI,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@venusprotocol/oracle",
3
3
  "description": "Venus Protocol Price Oracle",
4
- "version": "1.3.1",
4
+ "version": "1.3.3",
5
5
  "author": "",
6
6
  "files": [
7
7
  "artifacts",
@@ -96,4 +96,4 @@
96
96
  "@nomiclabs/hardhat-ethers": "node_modules/hardhat-deploy-ethers",
97
97
  "@nomiclabs/hardhat-ethers/types": "hardhat-deploy-ethers/types"
98
98
  }
99
- }
99
+ }
package/README.md DELETED
@@ -1,106 +0,0 @@
1
- # Venus Oracle
2
-
3
- ## Usage
4
-
5
- ### Pre Requisites
6
-
7
- Before running any command, you need to create a `.env` file and set a BIP-39 compatible mnemonic as an environment
8
- variable. Follow the example in `.env.example`. If you don't already have a mnemonic, use this [website](https://iancoleman.io/bip39/) to generate one.
9
-
10
- Then, proceed with installing dependencies:
11
-
12
- ```sh
13
- $ yarn install
14
- ```
15
-
16
- ### Compile
17
-
18
- Compile the smart contracts with Hardhat:
19
-
20
- ```sh
21
- $ yarn compile
22
- ```
23
-
24
- ### TypeChain
25
-
26
- Compile the smart contracts and generate TypeChain artifacts:
27
-
28
- ```sh
29
- $ yarn typechain
30
- ```
31
-
32
- ### Lint Solidity
33
-
34
- Lint the Solidity code:
35
-
36
- ```sh
37
- $ yarn lint:sol
38
- ```
39
-
40
- ### Lint TypeScript
41
-
42
- Lint the TypeScript code:
43
-
44
- ```sh
45
- $ yarn lint:ts
46
- ```
47
-
48
- ### Test
49
-
50
- Run the Mocha tests:
51
-
52
- ```sh
53
- $ yarn test
54
- ```
55
-
56
- ### Coverage
57
-
58
- Generate the code coverage report:
59
-
60
- ```sh
61
- $ yarn coverage
62
- ```
63
-
64
- ### Report Gas
65
-
66
- See the gas usage per unit test and average gas per method call:
67
-
68
- ```sh
69
- $ REPORT_GAS=true yarn test
70
- ```
71
-
72
- ### Clean
73
-
74
- Delete the smart contract artifacts, the coverage reports and the Hardhat cache:
75
-
76
- ```sh
77
- $ yarn clean
78
- ```
79
-
80
- ### Deploy
81
-
82
- Deploy the contracts to Hardhat Network:
83
-
84
- ```sh
85
- $ yarn deploy --greeting "Bonjour, le monde!" --network bsctestnet
86
- ```
87
-
88
- ### Verify
89
-
90
- Verify the contracts through `hardhat-deploy`
91
-
92
- ```sh
93
- $ yarn etherscan-verify --network bsctestnet
94
- ```
95
-
96
- ## Syntax Highlighting
97
-
98
- If you use VSCode, you can enjoy syntax highlighting for your Solidity code via the [hardhat-vscode](https://github.com/NomicFoundation/hardhat-vscode) extension.
99
-
100
- ## Caveats
101
-
102
- ### Ethers and Waffle
103
-
104
- If you can't get the [Waffle matchers](https://ethereum-waffle.readthedocs.io/en/latest/matchers.html) to work, try to
105
- make your `ethers` package version match the version used by the `@ethereum-waffle/chai` package. Seem
106
- [#111](https://github.com/paulrberg/solidity-template/issues/111) for more details.
@@ -1 +0,0 @@
1
- {"id":"766f05630947fa6d366a667b66c1141b","_format":"hh-sol-build-info-1","solcVersion":"0.5.16","solcLongVersion":"0.5.16+commit.9c3226ce","input":{"language":"Solidity","sources":{"contracts/PriceOracle.sol":{"content":"pragma solidity ^0.5.16;\n\ncontract PriceOracle {\n /// @notice Indicator that this is a PriceOracle contract (for inspection)\n bool public constant isPriceOracle = true;\n\n /**\n * @notice Get the underlying price of a vToken asset\n * @param vToken The vToken address to get the underlying price of\n * @return The underlying asset price mantissa (scaled by 1e18).\n * Zero means the price is unavailable.\n */\n function getUnderlyingPrice(address vToken) external view returns (uint256);\n\n function updatePrice(address vToken) external;\n}\n"}},"settings":{"optimizer":{"enabled":true,"runs":200},"outputSelection":{"*":{"*":["storageLayout","abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata","devdoc","userdoc","evm.gasEstimates"],"":["ast"]}},"metadata":{"useLiteralContent":true}}},"output":{"sources":{"contracts/PriceOracle.sol":{"ast":{"absolutePath":"contracts/PriceOracle.sol","exportedSymbols":{"PriceOracle":[17]},"id":18,"nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity","^","0.5",".16"],"nodeType":"PragmaDirective","src":"0:24:0"},{"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":false,"id":17,"linearizedBaseContracts":[17],"name":"PriceOracle","nodeType":"ContractDefinition","nodes":[{"constant":true,"id":4,"name":"isPriceOracle","nodeType":"VariableDeclaration","scope":17,"src":"132:41:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":2,"name":"bool","nodeType":"ElementaryTypeName","src":"132:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":{"argumentTypes":null,"hexValue":"74727565","id":3,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"169:4:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"true"},"visibility":"public"},{"body":null,"documentation":"@notice Get the underlying price of a vToken asset\n@param vToken The vToken address to get the underlying price of\n@return The underlying asset price mantissa (scaled by 1e18).\n Zero means the price is unavailable.","id":11,"implemented":false,"kind":"function","modifiers":[],"name":"getUnderlyingPrice","nodeType":"FunctionDefinition","parameters":{"id":7,"nodeType":"ParameterList","parameters":[{"constant":false,"id":6,"name":"vToken","nodeType":"VariableDeclaration","scope":11,"src":"467:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":5,"name":"address","nodeType":"ElementaryTypeName","src":"467:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"value":null,"visibility":"internal"}],"src":"466:16:0"},"returnParameters":{"id":10,"nodeType":"ParameterList","parameters":[{"constant":false,"id":9,"name":"","nodeType":"VariableDeclaration","scope":11,"src":"506:7:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":8,"name":"uint256","nodeType":"ElementaryTypeName","src":"506:7:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"505:9:0"},"scope":17,"src":"439:76:0","stateMutability":"view","superFunction":null,"visibility":"external"},{"body":null,"documentation":null,"id":16,"implemented":false,"kind":"function","modifiers":[],"name":"updatePrice","nodeType":"FunctionDefinition","parameters":{"id":14,"nodeType":"ParameterList","parameters":[{"constant":false,"id":13,"name":"vToken","nodeType":"VariableDeclaration","scope":16,"src":"542:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":12,"name":"address","nodeType":"ElementaryTypeName","src":"542:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"value":null,"visibility":"internal"}],"src":"541:16:0"},"returnParameters":{"id":15,"nodeType":"ParameterList","parameters":[],"src":"566:0:0"},"scope":17,"src":"521:46:0","stateMutability":"nonpayable","superFunction":null,"visibility":"external"}],"scope":18,"src":"26:543:0"}],"src":"0:570:0"},"id":0}},"contracts":{"contracts/PriceOracle.sol":{"PriceOracle":{"abi":[{"constant":true,"inputs":[{"internalType":"address","name":"vToken","type":"address"}],"name":"getUnderlyingPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isPriceOracle","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"}],"name":"updatePrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}],"devdoc":{"methods":{"getUnderlyingPrice(address)":{"params":{"vToken":"The vToken address to get the underlying price of"},"return":"The underlying asset price mantissa (scaled by 1e18). Zero means the price is unavailable."}}},"evm":{"bytecode":{"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"deployedBytecode":{"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"gasEstimates":null,"methodIdentifiers":{"getUnderlyingPrice(address)":"fc57d4df","isPriceOracle()":"66331bba","updatePrice(address)":"96e85ced"}},"metadata":"{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"vToken\",\"type\":\"address\"}],\"name\":\"getUnderlyingPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isPriceOracle\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"vToken\",\"type\":\"address\"}],\"name\":\"updatePrice\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{\"getUnderlyingPrice(address)\":{\"params\":{\"vToken\":\"The vToken address to get the underlying price of\"},\"return\":\"The underlying asset price mantissa (scaled by 1e18). Zero means the price is unavailable.\"}}},\"userdoc\":{\"methods\":{\"getUnderlyingPrice(address)\":{\"notice\":\"Get the underlying price of a vToken asset\"}}}},\"settings\":{\"compilationTarget\":{\"contracts/PriceOracle.sol\":\"PriceOracle\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/PriceOracle.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\ncontract PriceOracle {\\n /// @notice Indicator that this is a PriceOracle contract (for inspection)\\n bool public constant isPriceOracle = true;\\n\\n /**\\n * @notice Get the underlying price of a vToken asset\\n * @param vToken The vToken address to get the underlying price of\\n * @return The underlying asset price mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function getUnderlyingPrice(address vToken) external view returns (uint256);\\n\\n function updatePrice(address vToken) external;\\n}\\n\",\"keccak256\":\"0x14017666d40093a9e36f1ccd77e3569a0d239285ebcb862be53457b7dd3de998\"}},\"version\":1}","storageLayout":{"storage":[],"types":null},"userdoc":{"methods":{"getUnderlyingPrice(address)":{"notice":"Get the underlying price of a vToken asset"}}}}}}}}
package/deploy/oracles.ts DELETED
@@ -1,104 +0,0 @@
1
- // npx hardhat deploy --network bsctestnet
2
- import networks from "@venusprotocol/venus-protocol/networks/mainnet.json";
3
- import hre from "hardhat";
4
- import { DeployFunction } from "hardhat-deploy/dist/types";
5
- import { HardhatRuntimeEnvironment } from "hardhat/types";
6
-
7
- const func: DeployFunction = async function ({ getNamedAccounts, deployments, network }: HardhatRuntimeEnvironment) {
8
- const { deploy } = deployments;
9
- const { deployer } = await getNamedAccounts();
10
-
11
- await deploy("BoundValidator", {
12
- from: deployer,
13
- log: true,
14
- deterministicDeployment: false,
15
- proxy: {
16
- proxyContract: "OptimizedTransparentProxy",
17
- execute: {
18
- methodName: "initialize",
19
- args: [],
20
- },
21
- },
22
- });
23
-
24
- const boundValidator = await hre.ethers.getContract("BoundValidator");
25
-
26
- await deploy("ResilientOracle", {
27
- from: deployer,
28
- log: true,
29
- deterministicDeployment: false,
30
- proxy: {
31
- proxyContract: "OptimizedTransparentProxy",
32
- execute: {
33
- methodName: "initialize",
34
- args: [boundValidator.address],
35
- },
36
- },
37
- });
38
-
39
- await deploy("ChainlinkOracle", {
40
- contract: network.live ? "ChainlinkOracle" : "MockChainlinkOracle",
41
- from: deployer,
42
- log: true,
43
- deterministicDeployment: false,
44
- proxy: {
45
- proxyContract: "OptimizedTransparentProxy",
46
- execute: {
47
- methodName: "initialize",
48
- args: [],
49
- },
50
- },
51
- });
52
-
53
- const vBNBAddress = networks.Contracts.vBNB;
54
-
55
- await deploy("PivotTwapOracle", {
56
- contract: network.live ? "PivotTwapOracle" : "MockTwapOracle",
57
- from: deployer,
58
- log: true,
59
- deterministicDeployment: false,
60
- proxy: {
61
- proxyContract: "OptimizedTransparentProxy",
62
- execute: {
63
- methodName: "initialize",
64
- args: [vBNBAddress],
65
- },
66
- },
67
- });
68
-
69
- // @todo: just testnet address, will be replaced to mainnet version in the future
70
- const actualPythOracleAddress = "0xd7308b14BF4008e7C7196eC35610B1427C5702EA";
71
-
72
- await deploy("PythOracle", {
73
- contract: network.live ? "PythOracle" : "MockPythOracle",
74
- from: deployer,
75
- log: true,
76
- deterministicDeployment: false,
77
- proxy: {
78
- proxyContract: "OptimizedTransparentProxy",
79
- execute: {
80
- methodName: "initialize",
81
- args: [actualPythOracleAddress],
82
- },
83
- },
84
- });
85
-
86
- // @todo: just testnet address, will be replaced to mainnet version in the future
87
- const actualBinanceFeedRegistryAddress = "0x999DD49FeFdC043fDAC4FE12Bb1e4bb31cB4c47B";
88
-
89
- await deploy("BinanceOracle", {
90
- contract: network.live ? "BinanceOracle" : "MockBinanceOracle",
91
- from: deployer,
92
- log: true,
93
- deterministicDeployment: false,
94
- proxy: {
95
- proxyContract: "OptimizedTransparentProxy",
96
- execute: {
97
- methodName: "initialize",
98
- args: [actualBinanceFeedRegistryAddress],
99
- },
100
- },
101
- });
102
- };
103
-
104
- export default func;
@@ -1 +0,0 @@
1
- 31337