@venusprotocol/isolated-pools 3.7.1-dev.1 → 3.8.0-dev.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/README.md +10 -0
- package/dist/deploy/001-deploy-mock-tokens.js +2 -1
- package/dist/deploy/004-swap-router.js +7 -7
- package/dist/deploy/006-deploy-pool-registry.js +3 -3
- package/dist/deploy/007-deploy-pool-lens.js +1 -1
- package/dist/deploy/008-deploy-comptrollers.js +4 -5
- package/dist/deploy/009-deploy-vtokens.js +3 -6
- package/dist/deploy/010-deploy-reward-distributors.js +5 -5
- package/dist/deploy/011-initial-liquidity.js +12 -15
- package/dist/deploy/012-transfer-pools-ownership.js +18 -18
- package/dist/deploy/013-vip-based-config.js +30 -30
- package/dist/deploy/014-shortfall-protocolshare.js +8 -3
- package/dist/deploy/018-native-token-gateway.js +3 -3
- package/dist/deploy/019-deploy-ir-models.js +3 -5
- package/dist/hardhat.config.js +44 -2
- package/dist/helpers/deploymentConfig.js +2 -2
- package/dist/helpers/deploymentUtils.d.ts +4 -5
- package/dist/helpers/deploymentUtils.js +9 -14
- package/dist/type-extensions.d.ts +6 -0
- package/dist/type-extensions.js +3 -0
- package/dist/typechain/factories/IVToken__factory.d.ts +5 -1
- package/dist/typechain/factories/IVToken__factory.js +201 -1
- package/package.json +1 -1
- package/typechain/IVToken.d.ts +341 -4
- package/typechain/factories/IVToken__factory.ts +201 -1
- package/dist/deploy/016-deploy-beacon-implementations.d.ts +0 -3
- package/dist/deploy/016-deploy-beacon-implementations.js +0 -32
- package/dist/deploy/017-update-pool-registry.d.ts +0 -3
- package/dist/deploy/017-update-pool-registry.js +0 -28
package/README.md
CHANGED
|
@@ -127,6 +127,16 @@ npx hardhat deploy
|
|
|
127
127
|
- In the deployment scripts you have added `tags` for example: - `func.tags = ["MockTokens"];`
|
|
128
128
|
- Once this is done, adding `--tags "<tag_name>,<tag_name>..."` to the deployment command will execute only the scripts containing the tags.
|
|
129
129
|
|
|
130
|
+
### Dry Run / Forked Deployments
|
|
131
|
+
|
|
132
|
+
To simulate what contracts would be deployed on a given network the deployment scripts support running on a forked network. To run the deployment scripts on a forked network the `HARDHAT_FORK_NETWORK` env variable needs to be set.
|
|
133
|
+
|
|
134
|
+
For example
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
HARDHAT_FORK_NETWORK=ethereum npx hardhat deploy
|
|
138
|
+
```
|
|
139
|
+
|
|
130
140
|
### Deployed Contracts
|
|
131
141
|
|
|
132
142
|
Deployed contract abis and addresses are exported in the `deployments` directory. To create a summary export of all contracts deployed to a network run
|
|
@@ -5,7 +5,7 @@ const func = async function (hre) {
|
|
|
5
5
|
const { deployments, getNamedAccounts } = hre;
|
|
6
6
|
const { deploy } = deployments;
|
|
7
7
|
const { deployer } = await getNamedAccounts();
|
|
8
|
-
const { tokensConfig } = await (0, deploymentConfig_1.getConfig)(hre.
|
|
8
|
+
const { tokensConfig } = await (0, deploymentConfig_1.getConfig)(hre.getNetworkName());
|
|
9
9
|
for (const token of tokensConfig) {
|
|
10
10
|
if (token.isMock) {
|
|
11
11
|
const contractName = `Mock${token.symbol}`;
|
|
@@ -21,4 +21,5 @@ const func = async function (hre) {
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
func.tags = ["MockTokens"];
|
|
24
|
+
func.skip = async (hre) => hre.network.live;
|
|
24
25
|
exports.default = func;
|
|
@@ -15,7 +15,7 @@ const func = async function (hre) {
|
|
|
15
15
|
const wBNBAddress = (await deployments.get("WBNB")).address;
|
|
16
16
|
const vbnbAddress = (await deployments.get("vBNB")).address;
|
|
17
17
|
// Pancake Factory doesn't exist on hardhat so we are using the testnet address
|
|
18
|
-
const pancakeFactoryAddress = hre.
|
|
18
|
+
const pancakeFactoryAddress = hre.getNetworkName() === "bscmainnet"
|
|
19
19
|
? bscmainnet_json_1.default.contracts.pancakeFactory.address
|
|
20
20
|
: bsctestnet_json_1.default.contracts.pancakeFactory.address;
|
|
21
21
|
await deploy("SwapRouter_DeFi", {
|
|
@@ -44,7 +44,7 @@ const func = async function (hre) {
|
|
|
44
44
|
autoMine: true,
|
|
45
45
|
skipIfAlreadyDeployed: true,
|
|
46
46
|
});
|
|
47
|
-
if (hre.
|
|
47
|
+
if (hre.getNetworkName() !== "bsctestnet") {
|
|
48
48
|
const comptrollerStablecoinsAddresses = (await deployments.get("Comptroller_Stablecoins")).address;
|
|
49
49
|
await deploy("SwapRouter_Stablecoins", {
|
|
50
50
|
contract: "SwapRouter",
|
|
@@ -86,9 +86,9 @@ const func = async function (hre) {
|
|
|
86
86
|
func.tags = ["SwapRouter", "il"];
|
|
87
87
|
// deploySwapRouter.skip = async (hre: HardhatRuntimeEnvironment) => hre.network.live;
|
|
88
88
|
// Pancake Factory is not deployed on the local network
|
|
89
|
-
func.skip = async (hre) => hre.
|
|
90
|
-
hre.
|
|
91
|
-
hre.
|
|
92
|
-
hre.
|
|
93
|
-
hre.
|
|
89
|
+
func.skip = async (hre) => hre.getNetworkName() === "sepolia" ||
|
|
90
|
+
hre.getNetworkName() === "hardhat" ||
|
|
91
|
+
hre.getNetworkName() === "opbnbtestnet" ||
|
|
92
|
+
hre.getNetworkName() === "opbnbmainnet" ||
|
|
93
|
+
hre.getNetworkName() === "ethereum";
|
|
94
94
|
exports.default = func;
|
|
@@ -6,9 +6,9 @@ const func = async function (hre) {
|
|
|
6
6
|
const { deployments, getNamedAccounts } = hre;
|
|
7
7
|
const { deploy } = deployments;
|
|
8
8
|
const { deployer } = await getNamedAccounts();
|
|
9
|
-
const { preconfiguredAddresses } = await (0, deploymentConfig_1.getConfig)(hre.
|
|
10
|
-
const accessControlManagerAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.AccessControlManager || "AccessControlManager"
|
|
11
|
-
const proxyOwnerAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.NormalTimelock || "account:deployer"
|
|
9
|
+
const { preconfiguredAddresses } = await (0, deploymentConfig_1.getConfig)(hre.getNetworkName());
|
|
10
|
+
const accessControlManagerAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.AccessControlManager || "AccessControlManager");
|
|
11
|
+
const proxyOwnerAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.NormalTimelock || "account:deployer");
|
|
12
12
|
// The reason for this is that the contracts `OptimizedTransparentUpgradeableProxy` and `DefaultProxyAdmin` that the hardhat-deploy
|
|
13
13
|
// plugin fetches from the artifact is not zk compatible causing the deployments to fail. So we bought it one level up to our repo,
|
|
14
14
|
// added them to compile using zksync compiler. It is compatible for all networks.
|
|
@@ -5,7 +5,7 @@ const func = async function (hre) {
|
|
|
5
5
|
const { deployments, getNamedAccounts } = hre;
|
|
6
6
|
const { deploy } = deployments;
|
|
7
7
|
const { deployer } = await getNamedAccounts();
|
|
8
|
-
const { isTimeBased, blocksPerYear } = (0, deploymentUtils_1.getBlockOrTimestampBasedDeploymentInfo)(hre.
|
|
8
|
+
const { isTimeBased, blocksPerYear } = (0, deploymentUtils_1.getBlockOrTimestampBasedDeploymentInfo)(hre.getNetworkName());
|
|
9
9
|
await deploy("PoolLens", {
|
|
10
10
|
from: deployer,
|
|
11
11
|
args: [isTimeBased, blocksPerYear],
|
|
@@ -7,10 +7,10 @@ const func = async function (hre) {
|
|
|
7
7
|
const { deployments, getNamedAccounts } = hre;
|
|
8
8
|
const { deploy } = deployments;
|
|
9
9
|
const { deployer } = await getNamedAccounts();
|
|
10
|
-
const deploymentConfig = await (0, deploymentConfig_1.getConfig)(hre.
|
|
10
|
+
const deploymentConfig = await (0, deploymentConfig_1.getConfig)(hre.getNetworkName());
|
|
11
11
|
const { poolConfig, preconfiguredAddresses } = deploymentConfig;
|
|
12
12
|
const poolRegistry = await hardhat_1.ethers.getContract("PoolRegistry");
|
|
13
|
-
const accessControlManagerAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.AccessControlManager || "AccessControlManager"
|
|
13
|
+
const accessControlManagerAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.AccessControlManager || "AccessControlManager");
|
|
14
14
|
const maxLoopsLimit = 100;
|
|
15
15
|
const comptrollerImpl = await deploy("ComptrollerImpl", {
|
|
16
16
|
contract: "Comptroller",
|
|
@@ -28,11 +28,10 @@ const func = async function (hre) {
|
|
|
28
28
|
autoMine: true,
|
|
29
29
|
skipIfAlreadyDeployed: true,
|
|
30
30
|
});
|
|
31
|
-
const unregisteredPools = await (0, deploymentUtils_1.getUnregisteredPools)(poolConfig
|
|
31
|
+
const unregisteredPools = await (0, deploymentUtils_1.getUnregisteredPools)(poolConfig);
|
|
32
32
|
for (const pool of unregisteredPools) {
|
|
33
|
-
// Deploying a proxy for Comptroller
|
|
34
|
-
console.log(`Deploying a proxy for Comptroller of the pool ${pool.name}`);
|
|
35
33
|
const Comptroller = await hardhat_1.ethers.getContractFactory("Comptroller");
|
|
34
|
+
// Deploying a proxy for Comptroller
|
|
36
35
|
await deploy(`Comptroller_${pool.id}`, {
|
|
37
36
|
from: deployer,
|
|
38
37
|
contract: "BeaconProxy",
|
|
@@ -19,11 +19,11 @@ const func = async function (hre) {
|
|
|
19
19
|
const { deployments, getNamedAccounts } = hre;
|
|
20
20
|
const { deploy } = deployments;
|
|
21
21
|
const { deployer } = await getNamedAccounts();
|
|
22
|
-
const { tokensConfig, poolConfig, preconfiguredAddresses } = await (0, deploymentConfig_1.getConfig)(hre.
|
|
22
|
+
const { tokensConfig, poolConfig, preconfiguredAddresses } = await (0, deploymentConfig_1.getConfig)(hre.getNetworkName());
|
|
23
23
|
const { isTimeBased, blocksPerYear } = (0, deploymentUtils_1.getBlockOrTimestampBasedDeploymentInfo)(hre.network.name);
|
|
24
24
|
const maxBorrowRateMantissa = (0, deploymentConfig_1.getMaxBorrowRateMantissa)(hre.network.name);
|
|
25
25
|
await (0, _001_source_timelocks_1.default)(hre);
|
|
26
|
-
const accessControlManagerAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.AccessControlManager || "AccessControlManager"
|
|
26
|
+
const accessControlManagerAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.AccessControlManager || "AccessControlManager");
|
|
27
27
|
// VToken Beacon
|
|
28
28
|
const vTokenImpl = await deploy("VTokenImpl", {
|
|
29
29
|
contract: "VToken",
|
|
@@ -41,7 +41,7 @@ const func = async function (hre) {
|
|
|
41
41
|
autoMine: true,
|
|
42
42
|
skipIfAlreadyDeployed: true,
|
|
43
43
|
});
|
|
44
|
-
const poolsWithUnregisteredVTokens = await (0, deploymentUtils_1.getUnregisteredVTokens)(poolConfig
|
|
44
|
+
const poolsWithUnregisteredVTokens = await (0, deploymentUtils_1.getUnregisteredVTokens)(poolConfig);
|
|
45
45
|
for (const pool of poolsWithUnregisteredVTokens) {
|
|
46
46
|
const comptrollerProxy = await hardhat_1.ethers.getContract(`Comptroller_${pool.id}`);
|
|
47
47
|
// Deploy Markets
|
|
@@ -59,7 +59,6 @@ const func = async function (hre) {
|
|
|
59
59
|
if (rateModel === deploymentConfig_2.InterestRateModels.JumpRate.toString()) {
|
|
60
60
|
const [b, m, j, k] = [baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink_].map(mantissaToBps);
|
|
61
61
|
const rateModelName = `JumpRateModelV2_base${b}bps_slope${m}bps_jump${j}bps_kink${k}bps`;
|
|
62
|
-
console.log(`Deploying interest rate model ${rateModelName}`);
|
|
63
62
|
const result = await deploy(rateModelName, {
|
|
64
63
|
from: deployer,
|
|
65
64
|
contract: "JumpRateModelV2",
|
|
@@ -81,7 +80,6 @@ const func = async function (hre) {
|
|
|
81
80
|
else {
|
|
82
81
|
const [b, m] = [baseRatePerYear, multiplierPerYear].map(mantissaToBps);
|
|
83
82
|
const rateModelName = `WhitePaperInterestRateModel_base${b}bps_slope${m}bps`;
|
|
84
|
-
console.log(`Deploying interest rate model ${rateModelName}`);
|
|
85
83
|
const result = await deploy(rateModelName, {
|
|
86
84
|
from: deployer,
|
|
87
85
|
contract: "WhitePaperInterestRateModel",
|
|
@@ -92,7 +90,6 @@ const func = async function (hre) {
|
|
|
92
90
|
});
|
|
93
91
|
rateModelAddress = result.address;
|
|
94
92
|
}
|
|
95
|
-
console.log(`Deploying VToken proxy for ${symbol}`);
|
|
96
93
|
const VToken = await hardhat_1.ethers.getContractFactory("VToken");
|
|
97
94
|
const underlyingDecimals = Number(await tokenContract.decimals());
|
|
98
95
|
const vTokenDecimals = 8;
|
|
@@ -8,12 +8,12 @@ const func = async function (hre) {
|
|
|
8
8
|
const { deploy } = deployments;
|
|
9
9
|
const { deployer } = await getNamedAccounts();
|
|
10
10
|
const maxLoopsLimit = 100;
|
|
11
|
-
const { tokensConfig, poolConfig, preconfiguredAddresses } = await (0, deploymentConfig_1.getConfig)(hre.
|
|
12
|
-
const { isTimeBased, blocksPerYear } = (0, deploymentUtils_1.getBlockOrTimestampBasedDeploymentInfo)(hre.
|
|
13
|
-
const accessControlAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.AccessControlManager || "AccessControlManager"
|
|
14
|
-
const proxyOwnerAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.NormalTimelock || "account:deployer"
|
|
11
|
+
const { tokensConfig, poolConfig, preconfiguredAddresses } = await (0, deploymentConfig_1.getConfig)(hre.getNetworkName());
|
|
12
|
+
const { isTimeBased, blocksPerYear } = (0, deploymentUtils_1.getBlockOrTimestampBasedDeploymentInfo)(hre.getNetworkName());
|
|
13
|
+
const accessControlAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.AccessControlManager || "AccessControlManager");
|
|
14
|
+
const proxyOwnerAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.NormalTimelock || "account:deployer");
|
|
15
15
|
const defaultProxyAdmin = await hre.artifacts.readArtifact("hardhat-deploy/solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol:ProxyAdmin");
|
|
16
|
-
const pools = await (0, deploymentUtils_1.getUnregisteredRewardsDistributors)(poolConfig
|
|
16
|
+
const pools = await (0, deploymentUtils_1.getUnregisteredRewardsDistributors)(poolConfig);
|
|
17
17
|
await deploy("RewardsDistributorImpl", {
|
|
18
18
|
contract: "RewardsDistributor",
|
|
19
19
|
from: deployer,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const ethers_1 = require("ethers");
|
|
4
|
+
const hardhat_1 = require("hardhat");
|
|
4
5
|
const deploymentConfig_1 = require("../helpers/deploymentConfig");
|
|
5
6
|
const deploymentUtils_1 = require("../helpers/deploymentUtils");
|
|
6
7
|
const sumAmounts = async (tokens) => {
|
|
@@ -10,9 +11,9 @@ const sumAmounts = async (tokens) => {
|
|
|
10
11
|
}
|
|
11
12
|
return amounts;
|
|
12
13
|
};
|
|
13
|
-
const faucetTokens = async (deploymentConfig
|
|
14
|
+
const faucetTokens = async (deploymentConfig) => {
|
|
14
15
|
const { poolConfig, tokensConfig } = deploymentConfig;
|
|
15
|
-
const unregisteredVTokens = await (0, deploymentUtils_1.getUnregisteredVTokens)(poolConfig
|
|
16
|
+
const unregisteredVTokens = await (0, deploymentUtils_1.getUnregisteredVTokens)(poolConfig);
|
|
16
17
|
const vTokenConfigs = unregisteredVTokens.map((p) => p.vtokens).flat();
|
|
17
18
|
const assetsToFaucet = vTokenConfigs
|
|
18
19
|
.map((v) => (0, deploymentConfig_1.getTokenConfig)(v.asset, tokensConfig))
|
|
@@ -30,15 +31,14 @@ const faucetTokens = async (deploymentConfig, hre) => {
|
|
|
30
31
|
const tx = await tokenContract.faucet(amount, { gasLimit: 5000000 });
|
|
31
32
|
await tx.wait(1);
|
|
32
33
|
}
|
|
34
|
+
return vTokensToFaucet;
|
|
33
35
|
};
|
|
34
|
-
const sendInitialLiquidityToTreasury = async (deploymentConfig,
|
|
35
|
-
if (
|
|
36
|
+
const sendInitialLiquidityToTreasury = async (deploymentConfig, tokensToFaucet) => {
|
|
37
|
+
if ((0, hardhat_1.getNetworkName)() == "bscmainnet" || (0, hardhat_1.getNetworkName)() == "ethereum") {
|
|
36
38
|
return;
|
|
37
39
|
}
|
|
38
|
-
const {
|
|
39
|
-
const
|
|
40
|
-
const vTokenConfigs = unregisteredVTokens.map((p) => p.vtokens).flat();
|
|
41
|
-
const amounts = vTokenConfigs.map((token) => ({
|
|
40
|
+
const { tokensConfig, preconfiguredAddresses } = deploymentConfig;
|
|
41
|
+
const amounts = tokensToFaucet.map((token) => ({
|
|
42
42
|
symbol: token.asset,
|
|
43
43
|
amount: ethers_1.BigNumber.from(token.initialSupply),
|
|
44
44
|
}));
|
|
@@ -46,18 +46,15 @@ const sendInitialLiquidityToTreasury = async (deploymentConfig, hre) => {
|
|
|
46
46
|
for (const [symbol, amount] of Object.entries(totalAmounts)) {
|
|
47
47
|
const tokenContract = await (0, deploymentUtils_1.getUnderlyingToken)(symbol, tokensConfig);
|
|
48
48
|
console.log(`Sending ${amount} ${symbol} to VTreasury`);
|
|
49
|
-
|
|
50
|
-
console.log(`Token Contract: ${amount.toString()}`);
|
|
51
|
-
const treasuryAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.VTreasury || "VTreasury", hre);
|
|
52
|
-
console.log(`Token Contract: ${treasuryAddress}`);
|
|
49
|
+
const treasuryAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.VTreasury || "VTreasury");
|
|
53
50
|
const tx = await tokenContract.transfer(treasuryAddress, amount, { gasLimit: 5000000 });
|
|
54
51
|
await tx.wait(1);
|
|
55
52
|
}
|
|
56
53
|
};
|
|
57
54
|
const func = async function (hre) {
|
|
58
|
-
const deploymentConfig = await (0, deploymentConfig_1.getConfig)(hre.
|
|
59
|
-
await faucetTokens(deploymentConfig
|
|
60
|
-
await sendInitialLiquidityToTreasury(deploymentConfig,
|
|
55
|
+
const deploymentConfig = await (0, deploymentConfig_1.getConfig)(hre.getNetworkName());
|
|
56
|
+
const assetsToFaucet = await faucetTokens(deploymentConfig);
|
|
57
|
+
await sendInitialLiquidityToTreasury(deploymentConfig, assetsToFaucet);
|
|
61
58
|
};
|
|
62
59
|
func.tags = ["InitialLiquidity", "il"];
|
|
63
60
|
exports.default = func;
|
|
@@ -2,24 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const hardhat_1 = require("hardhat");
|
|
4
4
|
const deploymentConfig_1 = require("../helpers/deploymentConfig");
|
|
5
|
-
const func = async function (hre) {
|
|
6
|
-
const { deployer } = await (0, hardhat_1.getNamedAccounts)();
|
|
7
|
-
const { poolConfig, preconfiguredAddresses } = await (0, deploymentConfig_1.getConfig)(hre.network.name);
|
|
8
|
-
const targetOwner = preconfiguredAddresses.NormalTimelock || deployer;
|
|
9
|
-
const rewardsDistributors = poolConfig
|
|
10
|
-
.map((pool) => {
|
|
11
|
-
const rewards = pool.rewards || [];
|
|
12
|
-
return rewards.map((_, idx) => `RewardsDistributor_${pool.id}_${idx}`);
|
|
13
|
-
})
|
|
14
|
-
.flat();
|
|
15
|
-
const comptrollers = poolConfig.map((pool) => `Comptroller_${pool.id}`);
|
|
16
|
-
const contracts = {
|
|
17
|
-
singleStepOwnership: ["ComptrollerBeacon", "VTokenBeacon"],
|
|
18
|
-
twoStepOwnership: ["PoolRegistry", ...comptrollers, ...rewardsDistributors],
|
|
19
|
-
};
|
|
20
|
-
await transferSingleStepOwnerships(contracts.singleStepOwnership, targetOwner);
|
|
21
|
-
await transfer2StepOwnerships(contracts.twoStepOwnership, targetOwner);
|
|
22
|
-
};
|
|
23
5
|
const transfer2StepOwnerships = async (contractNames, targetOwner) => {
|
|
24
6
|
const abi = [
|
|
25
7
|
"function owner() view returns (address)",
|
|
@@ -59,6 +41,24 @@ const transferSingleStepOwnerships = async (contractNames, targetOwner) => {
|
|
|
59
41
|
}
|
|
60
42
|
}
|
|
61
43
|
};
|
|
44
|
+
const func = async function (hre) {
|
|
45
|
+
const { deployer } = await (0, hardhat_1.getNamedAccounts)();
|
|
46
|
+
const { poolConfig, preconfiguredAddresses } = await (0, deploymentConfig_1.getConfig)(hre.getNetworkName());
|
|
47
|
+
const targetOwner = preconfiguredAddresses.NormalTimelock || deployer;
|
|
48
|
+
const rewardsDistributors = poolConfig
|
|
49
|
+
.map((pool) => {
|
|
50
|
+
const rewards = pool.rewards || [];
|
|
51
|
+
return rewards.map((_, idx) => `RewardsDistributor_${pool.id}_${idx}`);
|
|
52
|
+
})
|
|
53
|
+
.flat();
|
|
54
|
+
const comptrollers = poolConfig.map((pool) => `Comptroller_${pool.id}`);
|
|
55
|
+
const contracts = {
|
|
56
|
+
singleStepOwnership: ["ComptrollerBeacon", "VTokenBeacon"],
|
|
57
|
+
twoStepOwnership: ["PoolRegistry", ...comptrollers, ...rewardsDistributors],
|
|
58
|
+
};
|
|
59
|
+
await transferSingleStepOwnerships(contracts.singleStepOwnership, targetOwner);
|
|
60
|
+
await transfer2StepOwnerships(contracts.twoStepOwnership, targetOwner);
|
|
61
|
+
};
|
|
62
62
|
func.tags = ["TransferPoolsOwnership", "il"];
|
|
63
63
|
func.id = "transfer_pools_ownership"; // id required to prevent re-execution
|
|
64
64
|
exports.default = func;
|
|
@@ -34,14 +34,14 @@ const setRewardSpeed = async (pool, rewardsDistributor, rewardConfig) => {
|
|
|
34
34
|
value: 0,
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
-
const configureRewards = async (unregisteredRewardDistributors, owner
|
|
37
|
+
const configureRewards = async (unregisteredRewardDistributors, owner) => {
|
|
38
38
|
const commands = await Promise.all(unregisteredRewardDistributors.map(async (pool) => {
|
|
39
39
|
const rewards = pool.rewards || [];
|
|
40
40
|
const poolCommands = await Promise.all(rewards.map(async (rewardConfig, idx) => {
|
|
41
41
|
const contractName = `RewardsDistributor_${pool.id}_${idx}`;
|
|
42
42
|
const rewardsDistributor = await hardhat_1.ethers.getContract(contractName);
|
|
43
43
|
return [
|
|
44
|
-
...(await acceptOwnership(contractName, owner
|
|
44
|
+
...(await acceptOwnership(contractName, owner)),
|
|
45
45
|
await addRewardsDistributor(rewardsDistributor, pool, rewardConfig),
|
|
46
46
|
await setRewardSpeed(pool, rewardsDistributor, rewardConfig),
|
|
47
47
|
];
|
|
@@ -50,12 +50,12 @@ const configureRewards = async (unregisteredRewardDistributors, owner, hre) => {
|
|
|
50
50
|
}));
|
|
51
51
|
return commands.flat();
|
|
52
52
|
};
|
|
53
|
-
const acceptOwnership = async (contractName, targetOwner
|
|
54
|
-
if (!
|
|
53
|
+
const acceptOwnership = async (contractName, targetOwner) => {
|
|
54
|
+
if (!hardhat_1.network.live) {
|
|
55
55
|
return [];
|
|
56
56
|
}
|
|
57
57
|
const abi = ["function owner() view returns (address)"];
|
|
58
|
-
const deployment = await
|
|
58
|
+
const deployment = await hardhat_1.deployments.get(contractName);
|
|
59
59
|
const contract = await hardhat_1.ethers.getContractAt(abi, deployment.address);
|
|
60
60
|
if ((await contract.owner()) === targetOwner) {
|
|
61
61
|
return [];
|
|
@@ -98,20 +98,20 @@ const addPool = (poolRegistry, comptroller, pool) => {
|
|
|
98
98
|
value: 0,
|
|
99
99
|
};
|
|
100
100
|
};
|
|
101
|
-
const addPools = async (unregisteredPools, poolsOwner
|
|
101
|
+
const addPools = async (unregisteredPools, poolsOwner) => {
|
|
102
102
|
const poolRegistry = await hardhat_1.ethers.getContract("PoolRegistry");
|
|
103
103
|
const commands = await Promise.all(unregisteredPools.map(async (pool) => {
|
|
104
104
|
const comptroller = await hardhat_1.ethers.getContract(`Comptroller_${pool.id}`);
|
|
105
105
|
return [
|
|
106
|
-
...(await acceptOwnership(`Comptroller_${pool.id}`, poolsOwner
|
|
106
|
+
...(await acceptOwnership(`Comptroller_${pool.id}`, poolsOwner)),
|
|
107
107
|
await setOracle(comptroller, pool),
|
|
108
108
|
addPool(poolRegistry, comptroller, pool),
|
|
109
109
|
];
|
|
110
110
|
}));
|
|
111
111
|
return commands.flat();
|
|
112
112
|
};
|
|
113
|
-
const transferInitialLiquidity = async (vTokenConfig, deploymentConfig
|
|
114
|
-
if (!
|
|
113
|
+
const transferInitialLiquidity = async (vTokenConfig, deploymentConfig) => {
|
|
114
|
+
if (!hardhat_1.network.live) {
|
|
115
115
|
return [];
|
|
116
116
|
}
|
|
117
117
|
const { preconfiguredAddresses, tokensConfig } = deploymentConfig;
|
|
@@ -152,10 +152,10 @@ const approvePoolRegistry = async (poolRegistry, vTokenConfig, deploymentConfig)
|
|
|
152
152
|
},
|
|
153
153
|
];
|
|
154
154
|
};
|
|
155
|
-
const addMarket = async (poolRegistry, vTokenAddress, vTokenConfig
|
|
155
|
+
const addMarket = async (poolRegistry, vTokenAddress, vTokenConfig) => {
|
|
156
156
|
const { name, collateralFactor, liquidationThreshold, initialSupply, supplyCap, borrowCap } = vTokenConfig;
|
|
157
157
|
console.log("Adding a command to register " + name + " to PoolRegistry");
|
|
158
|
-
const receiver = await (0, deploymentUtils_1.toAddress)(vTokenConfig.vTokenReceiver
|
|
158
|
+
const receiver = await (0, deploymentUtils_1.toAddress)(vTokenConfig.vTokenReceiver);
|
|
159
159
|
return {
|
|
160
160
|
contract: poolRegistry.address,
|
|
161
161
|
signature: "addMarket((address,uint256,uint256,uint256,address,uint256,uint256))",
|
|
@@ -177,7 +177,7 @@ const setReduceReservesBlockDelta = async (vTokenAddress, vTokenConfig) => {
|
|
|
177
177
|
value: 0,
|
|
178
178
|
};
|
|
179
179
|
};
|
|
180
|
-
const addMarkets = async (unregisteredVTokens, deploymentConfig
|
|
180
|
+
const addMarkets = async (unregisteredVTokens, deploymentConfig) => {
|
|
181
181
|
const poolRegistry = await hardhat_1.ethers.getContract("PoolRegistry");
|
|
182
182
|
const poolCommands = await Promise.all(unregisteredVTokens.map(async (pool) => {
|
|
183
183
|
const vTokenCommands = await Promise.all(pool.vtokens.map(async (vTokenConfig) => {
|
|
@@ -185,10 +185,10 @@ const addMarkets = async (unregisteredVTokens, deploymentConfig, hre) => {
|
|
|
185
185
|
const vToken = await hardhat_1.ethers.getContract(`VToken_${symbol}`);
|
|
186
186
|
console.log("Adding market " + name + " to pool " + pool.name);
|
|
187
187
|
return [
|
|
188
|
-
...(await transferInitialLiquidity(vTokenConfig, deploymentConfig
|
|
188
|
+
...(await transferInitialLiquidity(vTokenConfig, deploymentConfig)),
|
|
189
189
|
...(await approvePoolRegistry(poolRegistry, vTokenConfig, deploymentConfig)),
|
|
190
190
|
await setReduceReservesBlockDelta(vToken.address, vTokenConfig),
|
|
191
|
-
await addMarket(poolRegistry, vToken.address, vTokenConfig
|
|
191
|
+
await addMarket(poolRegistry, vToken.address, vTokenConfig),
|
|
192
192
|
];
|
|
193
193
|
}));
|
|
194
194
|
return vTokenCommands.flat();
|
|
@@ -201,19 +201,19 @@ const makeRole = (mainnetBehavior, targetContract, method) => {
|
|
|
201
201
|
}
|
|
202
202
|
return hardhat_1.ethers.utils.keccak256(hardhat_1.ethers.utils.solidityPack(["address", "string"], [targetContract, method]));
|
|
203
203
|
};
|
|
204
|
-
const hasPermission = async (accessControl, targetContract, method, caller
|
|
205
|
-
const role = makeRole(
|
|
204
|
+
const hasPermission = async (accessControl, targetContract, method, caller) => {
|
|
205
|
+
const role = makeRole(hardhat_1.network.live, targetContract, method);
|
|
206
206
|
return accessControl.hasRole(role, caller);
|
|
207
207
|
};
|
|
208
|
-
const configureAccessControls = async (deploymentConfig
|
|
208
|
+
const configureAccessControls = async (deploymentConfig) => {
|
|
209
209
|
const { accessControlConfig, preconfiguredAddresses } = deploymentConfig;
|
|
210
|
-
const accessControlManagerAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.AccessControlManager || "AccessControlManager"
|
|
210
|
+
const accessControlManagerAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.AccessControlManager || "AccessControlManager");
|
|
211
211
|
const accessControlManager = await hardhat_1.ethers.getContractAt("AccessControlManager", accessControlManagerAddress);
|
|
212
212
|
const commands = await Promise.all(accessControlConfig.map(async (entry) => {
|
|
213
213
|
const { caller, target, method } = entry;
|
|
214
|
-
const callerAddress = await (0, deploymentUtils_1.toAddress)(caller
|
|
215
|
-
const targetAddress = await (0, deploymentUtils_1.toAddress)(target
|
|
216
|
-
if (await hasPermission(accessControlManager, targetAddress, method, callerAddress
|
|
214
|
+
const callerAddress = await (0, deploymentUtils_1.toAddress)(caller);
|
|
215
|
+
const targetAddress = await (0, deploymentUtils_1.toAddress)(target);
|
|
216
|
+
if (await hasPermission(accessControlManager, targetAddress, method, callerAddress)) {
|
|
217
217
|
return [];
|
|
218
218
|
}
|
|
219
219
|
return [
|
|
@@ -253,18 +253,18 @@ const executeCommands = async (commands, hre) => {
|
|
|
253
253
|
const func = async function (hre) {
|
|
254
254
|
const { getNamedAccounts } = hre;
|
|
255
255
|
const { deployer } = await getNamedAccounts();
|
|
256
|
-
const deploymentConfig = await (0, deploymentConfig_1.getConfig)(hre.
|
|
256
|
+
const deploymentConfig = await (0, deploymentConfig_1.getConfig)(hre.getNetworkName());
|
|
257
257
|
const { poolConfig, preconfiguredAddresses } = deploymentConfig;
|
|
258
|
-
const unregisteredPools = await (0, deploymentUtils_1.getUnregisteredPools)(poolConfig
|
|
259
|
-
const unregisteredVTokens = await (0, deploymentUtils_1.getUnregisteredVTokens)(poolConfig
|
|
260
|
-
const unregisteredRewardsDistributors = await (0, deploymentUtils_1.getUnregisteredRewardsDistributors)(poolConfig
|
|
258
|
+
const unregisteredPools = await (0, deploymentUtils_1.getUnregisteredPools)(poolConfig);
|
|
259
|
+
const unregisteredVTokens = await (0, deploymentUtils_1.getUnregisteredVTokens)(poolConfig);
|
|
260
|
+
const unregisteredRewardsDistributors = await (0, deploymentUtils_1.getUnregisteredRewardsDistributors)(poolConfig);
|
|
261
261
|
const owner = preconfiguredAddresses.NormalTimelock || deployer;
|
|
262
262
|
const commands = [
|
|
263
|
-
...(await configureAccessControls(deploymentConfig
|
|
264
|
-
...(await acceptOwnership("PoolRegistry", owner
|
|
265
|
-
...(await addPools(unregisteredPools, owner
|
|
266
|
-
...(await addMarkets(unregisteredVTokens, deploymentConfig
|
|
267
|
-
...(await configureRewards(unregisteredRewardsDistributors, owner
|
|
263
|
+
...(await configureAccessControls(deploymentConfig)),
|
|
264
|
+
...(await acceptOwnership("PoolRegistry", owner)),
|
|
265
|
+
...(await addPools(unregisteredPools, owner)),
|
|
266
|
+
...(await addMarkets(unregisteredVTokens, deploymentConfig)),
|
|
267
|
+
...(await configureRewards(unregisteredRewardsDistributors, owner)),
|
|
268
268
|
];
|
|
269
269
|
if (hre.network.live) {
|
|
270
270
|
console.log("Please propose a VIP with the following commands:");
|
|
@@ -11,14 +11,14 @@ const func = async function (hre) {
|
|
|
11
11
|
const { deployments, getNamedAccounts } = hre;
|
|
12
12
|
const { deploy } = deployments;
|
|
13
13
|
const { deployer } = await getNamedAccounts();
|
|
14
|
-
const { preconfiguredAddresses } = await (0, deploymentConfig_1.getConfig)(hre.
|
|
14
|
+
const { preconfiguredAddresses } = await (0, deploymentConfig_1.getConfig)(hre.getNetworkName());
|
|
15
15
|
const poolRegistry = await hardhat_1.ethers.getContract("PoolRegistry");
|
|
16
16
|
const deployerSigner = hardhat_1.ethers.provider.getSigner(deployer);
|
|
17
|
-
const accessControlManagerAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.AccessControlManager || "AccessControlManager"
|
|
17
|
+
const accessControlManagerAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.AccessControlManager || "AccessControlManager");
|
|
18
18
|
const proxyAdmin = await hardhat_1.ethers.getContract("DefaultProxyAdmin");
|
|
19
19
|
const owner = await proxyAdmin.owner();
|
|
20
20
|
const defaultProxyAdmin = await hre.artifacts.readArtifact("hardhat-deploy/solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol:ProxyAdmin");
|
|
21
|
-
const { isTimeBased, blocksPerYear } = (0, deploymentUtils_1.getBlockOrTimestampBasedDeploymentInfo)(hre.
|
|
21
|
+
const { isTimeBased, blocksPerYear } = (0, deploymentUtils_1.getBlockOrTimestampBasedDeploymentInfo)(hre.getNetworkName());
|
|
22
22
|
const riskFund = await hardhat_1.ethers.getContract("RiskFundV2");
|
|
23
23
|
await deploy("Shortfall", {
|
|
24
24
|
from: deployer,
|
|
@@ -54,4 +54,9 @@ const func = async function (hre) {
|
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
func.tags = ["Shortfall", "il"];
|
|
57
|
+
// RiskFund not deployed on these networks
|
|
58
|
+
func.skip = async (hre) => hre.getNetworkName() === "sepolia" ||
|
|
59
|
+
hre.getNetworkName() === "opbnbtestnet" ||
|
|
60
|
+
hre.getNetworkName() === "opbnbmainnet" ||
|
|
61
|
+
hre.getNetworkName() === "ethereum";
|
|
57
62
|
exports.default = func;
|
|
@@ -129,8 +129,8 @@ const func = async function (hre) {
|
|
|
129
129
|
const { deployments, getNamedAccounts } = hre;
|
|
130
130
|
const { deploy } = deployments;
|
|
131
131
|
const { deployer } = await getNamedAccounts();
|
|
132
|
-
const { preconfiguredAddresses } = await (0, deploymentConfig_1.getConfig)(hre.
|
|
133
|
-
const vWNativesInfo = getVWNativeTokens(hre.
|
|
132
|
+
const { preconfiguredAddresses } = await (0, deploymentConfig_1.getConfig)(hre.getNetworkName());
|
|
133
|
+
const vWNativesInfo = getVWNativeTokens(hre.getNetworkName());
|
|
134
134
|
for (const vWNativeInfo of vWNativesInfo) {
|
|
135
135
|
await deploy(`NativeTokenGateway_${vWNativeInfo.name}`, {
|
|
136
136
|
contract: "NativeTokenGateway",
|
|
@@ -142,7 +142,7 @@ const func = async function (hre) {
|
|
|
142
142
|
});
|
|
143
143
|
const nativeTokenGateway = await hardhat_1.ethers.getContract(`NativeTokenGateway_${vWNativeInfo.name}`);
|
|
144
144
|
const targetOwner = preconfiguredAddresses.NormalTimelock || deployer;
|
|
145
|
-
if (hre.network.live) {
|
|
145
|
+
if (hre.network.live && (await nativeTokenGateway.owner()) !== targetOwner) {
|
|
146
146
|
const tx = await nativeTokenGateway.transferOwnership(targetOwner);
|
|
147
147
|
await tx.wait();
|
|
148
148
|
console.log(`Transferred ownership of NativeTokenGateway_${vWNativeInfo.name} to Timelock`);
|
|
@@ -12,9 +12,9 @@ const func = async function (hre) {
|
|
|
12
12
|
const { deployments, getNamedAccounts } = hre;
|
|
13
13
|
const { deploy } = deployments;
|
|
14
14
|
const { deployer } = await getNamedAccounts();
|
|
15
|
-
const { poolConfig, preconfiguredAddresses } = await (0, deploymentConfig_1.getConfig)(hre.
|
|
16
|
-
const { isTimeBased, blocksPerYear } = (0, deploymentUtils_1.getBlockOrTimestampBasedDeploymentInfo)(hre.
|
|
17
|
-
const accessControlManagerAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.AccessControlManager || "AccessControlManager"
|
|
15
|
+
const { poolConfig, preconfiguredAddresses } = await (0, deploymentConfig_1.getConfig)(hre.getNetworkName());
|
|
16
|
+
const { isTimeBased, blocksPerYear } = (0, deploymentUtils_1.getBlockOrTimestampBasedDeploymentInfo)(hre.getNetworkName());
|
|
17
|
+
const accessControlManagerAddress = await (0, deploymentUtils_1.toAddress)(preconfiguredAddresses.AccessControlManager || "AccessControlManager");
|
|
18
18
|
for (const pool of poolConfig) {
|
|
19
19
|
// Deploy IR Models
|
|
20
20
|
for (const vtoken of pool.vtokens) {
|
|
@@ -22,7 +22,6 @@ const func = async function (hre) {
|
|
|
22
22
|
if (rateModel === deploymentConfig_2.InterestRateModels.JumpRate.toString()) {
|
|
23
23
|
const [b, m, j, k] = [baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink_].map(mantissaToBps);
|
|
24
24
|
const rateModelName = `JumpRateModelV2_base${b}bps_slope${m}bps_jump${j}bps_kink${k}bps`;
|
|
25
|
-
console.log(`Deploying interest rate model ${rateModelName}`);
|
|
26
25
|
await deploy(rateModelName, {
|
|
27
26
|
from: deployer,
|
|
28
27
|
contract: "JumpRateModelV2",
|
|
@@ -43,7 +42,6 @@ const func = async function (hre) {
|
|
|
43
42
|
else {
|
|
44
43
|
const [b, m] = [baseRatePerYear, multiplierPerYear].map(mantissaToBps);
|
|
45
44
|
const rateModelName = `WhitePaperInterestRateModel_base${b}bps_slope${m}bps`;
|
|
46
|
-
console.log(`Deploying interest rate model ${rateModelName}`);
|
|
47
45
|
await deploy(rateModelName, {
|
|
48
46
|
from: deployer,
|
|
49
47
|
contract: "WhitePaperInterestRateModel",
|
package/dist/hardhat.config.js
CHANGED
|
@@ -40,54 +40,90 @@ require("solidity-docgen");
|
|
|
40
40
|
const utils_1 = require("./helpers/utils");
|
|
41
41
|
dotenv.config();
|
|
42
42
|
const DEPLOYER_PRIVATE_KEY = process.env.DEPLOYER_PRIVATE_KEY;
|
|
43
|
+
const getRpcUrl = (networkName) => {
|
|
44
|
+
let uri;
|
|
45
|
+
if (networkName) {
|
|
46
|
+
uri = process.env[`ARCHIVE_NODE_${networkName}`];
|
|
47
|
+
}
|
|
48
|
+
if (!uri) {
|
|
49
|
+
throw new Error(`invalid uri or network not supported by node provider : ${uri}`);
|
|
50
|
+
}
|
|
51
|
+
return uri;
|
|
52
|
+
};
|
|
53
|
+
(0, config_1.extendEnvironment)(hre => {
|
|
54
|
+
hre.getNetworkName = () => process.env.HARDHAT_FORK_NETWORK || hre.network.name;
|
|
55
|
+
});
|
|
43
56
|
(0, config_1.extendConfig)((config) => {
|
|
44
57
|
if (process.env.EXPORT !== "true") {
|
|
45
58
|
config.external = {
|
|
46
59
|
...config.external,
|
|
47
60
|
deployments: {
|
|
61
|
+
hardhat: [],
|
|
48
62
|
bsctestnet: [
|
|
49
63
|
"node_modules/@venusprotocol/oracle/deployments/bsctestnet",
|
|
50
64
|
"node_modules/@venusprotocol/venus-protocol/deployments/bsctestnet",
|
|
51
65
|
"node_modules/@venusprotocol/protocol-reserve/deployments/bsctestnet",
|
|
66
|
+
"node_modules/@venusprotocol/governance-contracts/deployments/bsctestnet",
|
|
52
67
|
],
|
|
53
68
|
sepolia: [
|
|
54
69
|
"node_modules/@venusprotocol/oracle/deployments/sepolia",
|
|
55
70
|
"node_modules/@venusprotocol/venus-protocol/deployments/sepolia",
|
|
56
71
|
"node_modules/@venusprotocol/protocol-reserve/deployments/sepolia",
|
|
72
|
+
"node_modules/@venusprotocol/governance-contracts/deployments/sepolia",
|
|
57
73
|
],
|
|
58
74
|
ethereum: [
|
|
59
75
|
"node_modules/@venusprotocol/oracle/deployments/ethereum",
|
|
60
76
|
"node_modules/@venusprotocol/venus-protocol/deployments/ethereum",
|
|
61
77
|
"node_modules/@venusprotocol/protocol-reserve/deployments/ethereum",
|
|
78
|
+
"node_modules/@venusprotocol/governance-contracts/deployments/ethereum",
|
|
62
79
|
],
|
|
63
80
|
bscmainnet: [
|
|
64
81
|
"node_modules/@venusprotocol/oracle/deployments/bscmainnet",
|
|
65
82
|
"node_modules/@venusprotocol/venus-protocol/deployments/bscmainnet",
|
|
66
83
|
"node_modules/@venusprotocol/protocol-reserve/deployments/bscmainnet",
|
|
84
|
+
"node_modules/@venusprotocol/governance-contracts/deployments/bscmainnet",
|
|
67
85
|
],
|
|
68
86
|
opbnbmainnet: [
|
|
69
87
|
"node_modules/@venusprotocol/oracle/deployments/opbnbmainnet",
|
|
70
88
|
"node_modules/@venusprotocol/protocol-reserve/deployments/opbnbmainnet",
|
|
89
|
+
"node_modules/@venusprotocol/governance-contracts/deployments/opbnbmainnet",
|
|
71
90
|
],
|
|
72
91
|
opbnbtestnet: [
|
|
73
92
|
"node_modules/@venusprotocol/oracle/deployments/opbnbtestnet",
|
|
74
93
|
"node_modules/@venusprotocol/protocol-reserve/deployments/opbnbtestnet",
|
|
94
|
+
"node_modules/@venusprotocol/governance-contracts/deployments/opbnbtestnet",
|
|
75
95
|
],
|
|
76
96
|
arbitrumsepolia: [
|
|
77
97
|
"node_modules/@venusprotocol/oracle/deployments/arbitrumsepolia",
|
|
78
98
|
"node_modules/@venusprotocol/protocol-reserve/deployments/arbitrumsepolia",
|
|
99
|
+
"node_modules/@venusprotocol/governance-contracts/deployments/arbitrumsepolia",
|
|
100
|
+
],
|
|
101
|
+
arbitrumone: [
|
|
102
|
+
"node_modules/@venusprotocol/oracle/deployments/arbitrumone",
|
|
103
|
+
"node_modules/@venusprotocol/protocol-reserve/deployments/arbitrumone",
|
|
104
|
+
"node_modules/@venusprotocol/governance-contracts/deployments/arbitrumsepolia",
|
|
79
105
|
],
|
|
80
|
-
arbitrumone: ["node_modules/@venusprotocol/protocol-reserve/deployments/arbitrumone"],
|
|
81
106
|
basesepolia: [
|
|
82
107
|
"node_modules/@venusprotocol/oracle/deployments/basesepolia",
|
|
83
108
|
"node_modules/@venusprotocol/protocol-reserve/deployments/basesepolia",
|
|
109
|
+
"node_modules/@venusprotocol/governance-contracts/deployments/basesepolia",
|
|
84
110
|
],
|
|
85
111
|
basemainnet: [
|
|
86
112
|
"node_modules/@venusprotocol/oracle/deployments/basemainnet",
|
|
87
113
|
"node_modules/@venusprotocol/protocol-reserve/deployments/basemainnet",
|
|
114
|
+
"node_modules/@venusprotocol/governance-contracts/deployments/basemainnet",
|
|
88
115
|
],
|
|
89
116
|
},
|
|
90
117
|
};
|
|
118
|
+
if (process.env.HARDHAT_FORK_NETWORK) {
|
|
119
|
+
config.external.deployments.hardhat = [
|
|
120
|
+
`./deployments/${process.env.HARDHAT_FORK_NETWORK}`,
|
|
121
|
+
`node_modules/@venusprotocol/oracle/deployments/${process.env.HARDHAT_FORK_NETWORK}`,
|
|
122
|
+
`node_modules/@venusprotocol/venus-protocol/deployments/${process.env.HARDHAT_FORK_NETWORK}`,
|
|
123
|
+
`node_modules/@venusprotocol/protocol-reserve/deployments/${process.env.HARDHAT_FORK_NETWORK}`,
|
|
124
|
+
`node_modules/@venusprotocol/governance-contracts/deployments/${process.env.HARDHAT_FORK_NETWORK}`,
|
|
125
|
+
];
|
|
126
|
+
}
|
|
91
127
|
}
|
|
92
128
|
});
|
|
93
129
|
// This is a sample Hardhat task. To learn how to create your own go to
|
|
@@ -223,7 +259,13 @@ const config = {
|
|
|
223
259
|
hardhat: {
|
|
224
260
|
allowUnlimitedContractSize: true,
|
|
225
261
|
loggingEnabled: false,
|
|
226
|
-
live:
|
|
262
|
+
live: !!process.env.HARDHAT_FORK_NETWORK,
|
|
263
|
+
forking: process.env.HARDHAT_FORK_NETWORK
|
|
264
|
+
? {
|
|
265
|
+
url: getRpcUrl(process.env.HARDHAT_FORK_NETWORK),
|
|
266
|
+
blockNumber: process.env.HARDHAT_FORK_NUMBER ? parseInt(process.env.HARDHAT_FORK_NUMBER) : undefined,
|
|
267
|
+
}
|
|
268
|
+
: undefined,
|
|
227
269
|
},
|
|
228
270
|
development: {
|
|
229
271
|
url: "http://127.0.0.1:8545/",
|