Skip to content

Commit

Permalink
feat: add deployments to hardhat config
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Nov 29, 2023
1 parent 3e1cf7f commit e7e0572
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 23 deletions.
9 changes: 1 addition & 8 deletions deploy/009-configure-vaults.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import deployedContracts from "@venusprotocol/governance-contracts/deployments/deployments.json";
import { ethers } from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
Expand All @@ -15,13 +14,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { getNamedAccounts } = hre;
const { deployer } = await getNamedAccounts();

const chainId = (await hre.getChainId()) as keyof typeof deployedContracts;
const accessControlManager = hre.network.live
? await ethers.getContractAt(
"AccessControlManager",
deployedContracts[chainId][0].contracts.AccessControlManager.address,
)
: await ethers.getContract("AccessControlManager");
const accessControlManager = await ethers.getContract("AccessControlManager");

const xvs = await ethers.getContract("XVS");
const xvsVaultProxyDeployment = await ethers.getContract("XVSVaultProxy");
Expand Down
53 changes: 38 additions & 15 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ const config: HardhatUserConfig = {
bsctestnet: {
url: process.env.BSC_ARCHIVE_NODE_URL || "https://data-seed-prebsc-1-s1.binance.org:8545",
chainId: 97,
live: true,
accounts: {
mnemonic: process.env.MNEMONIC || "",
},
Expand Down Expand Up @@ -168,6 +169,28 @@ const config: HardhatUserConfig = {
artifacts: "node_modules/@venusprotocol/governance-contracts/artifacts",
},
],
deployments: {
bsctestnet: [
"node_modules/@venusprotocol/governance-contracts/deployments/bsctestnet",
"node_modules/@venusprotocol/venus-protocol/deployments/bsctestnet",
"node_modules/@venusprotocol/oracle/deployments/bsctestnet",
"node_modules/@venusprotocol/token-bridge/deployments/bsctestnet",
],
bscmainnet: [
"node_modules/@venusprotocol/governance-contracts/deployments/bscmainnet",
"node_modules/@venusprotocol/venus-protocol/deployments/bscmainnet",
"node_modules/@venusprotocol/oracle/deployments/bscmainnet",
"node_modules/@venusprotocol/token-bridge/deployments/bscmainnet",
],
sepolia: [
"node_modules/@venusprotocol/governance-contracts/deployments/sepolia",
"node_modules/@venusprotocol/oracle/deployments/sepolia",
"node_modules/@venusprotocol/token-bridge/deployments/sepolia",
],
ethereum: [
"node_modules/@venusprotocol/token-bridge/deployments/ethereum",
]
},
},
docgen: {
outputDir: "./docgen-docs",
Expand All @@ -179,22 +202,22 @@ const config: HardhatUserConfig = {
function isFork() {
return process.env.FORK_MAINNET === "true"
? {
allowUnlimitedContractSize: false,
loggingEnabled: false,
forking: {
url: process.env.BSC_ARCHIVE_NODE_URL || "",
blockNumber: 21068448,
},
accounts: {
accountsBalance: "1000000000000000000000",
},
live: false,
}
allowUnlimitedContractSize: false,
loggingEnabled: false,
forking: {
url: process.env.BSC_ARCHIVE_NODE_URL || "",
blockNumber: 21068448,
},
accounts: {
accountsBalance: "1000000000000000000000",
},
live: false,
}
: {
allowUnlimitedContractSize: true,
loggingEnabled: false,
live: false,
};
allowUnlimitedContractSize: true,
loggingEnabled: false,
live: false,
};
}

export default config;

0 comments on commit e7e0572

Please sign in to comment.