Skip to content

Commit

Permalink
feat: conditionally exclude external deployments when exporting
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Jan 11, 2024
1 parent c0d0876 commit 8af5fe6
Showing 1 changed file with 44 additions and 34 deletions.
78 changes: 44 additions & 34 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,37 @@ import * as dotenv from "dotenv";
import { parseUnits } from "ethers/lib/utils";
import "hardhat-deploy";
import "hardhat-gas-reporter";
import { HardhatUserConfig } from "hardhat/config";
import { HardhatUserConfig, extendConfig } from "hardhat/config";
import { HardhatConfig } from "hardhat/types";
import "solidity-coverage";
import "solidity-docgen";

dotenv.config();

extendConfig((config: HardhatConfig) => {
if (process.env.EXPORT !== "true") {
config.external = {
...config.external,
deployments: {
bsctestnet: [
"node_modules/@venusprotocol/governance-contracts/deployments/bsctestnet",
"node_modules/@venusprotocol/venus-protocol/deployments/bsctestnet",
"node_modules/@venusprotocol/oracle/deployments/bsctestnet",
],
bscmainnet: [
"node_modules/@venusprotocol/governance-contracts/deployments/bscmainnet",
"node_modules/@venusprotocol/venus-protocol/deployments/bscmainnet",
"node_modules/@venusprotocol/oracle/deployments/bscmainnet",
],
sepolia: [
"node_modules/@venusprotocol/governance-contracts/deployments/sepolia",
"node_modules/@venusprotocol/oracle/deployments/sepolia",
],
}
};
}
});

const config: HardhatUserConfig = {
solidity: {
compilers: [
Expand Down Expand Up @@ -140,46 +165,31 @@ const config: HardhatUserConfig = {
templates: "./docgen-templates",
},
external: {
deployments: {
bsctestnet: [
"node_modules/@venusprotocol/governance-contracts/deployments/bsctestnet",
"node_modules/@venusprotocol/venus-protocol/deployments/bsctestnet",
"node_modules/@venusprotocol/oracle/deployments/bsctestnet",
],
bscmainnet: [
"node_modules/@venusprotocol/governance-contracts/deployments/bscmainnet",
"node_modules/@venusprotocol/venus-protocol/deployments/bscmainnet",
"node_modules/@venusprotocol/oracle/deployments/bscmainnet",
],
sepolia: [
"node_modules/@venusprotocol/governance-contracts/deployments/sepolia",
"node_modules/@venusprotocol/oracle/deployments/sepolia",
],
},
deployments: {},
},
};

function isFork() {
return process.env.FORK === "true"
? {
allowUnlimitedContractSize: false,
loggingEnabled: false,
forking: {
url:
process.env[`ARCHIVE_NODE_${process.env.FORKED_NETWORK}`] ||
"https://data-seed-prebsc-1-s1.binance.org:8545",
blockNumber: 21068448,
},
accounts: {
accountsBalance: "1000000000000000000",
},
live: false,
}
allowUnlimitedContractSize: false,
loggingEnabled: false,
forking: {
url:
process.env[`ARCHIVE_NODE_${process.env.FORKED_NETWORK}`] ||
"https://data-seed-prebsc-1-s1.binance.org:8545",
blockNumber: 21068448,
},
accounts: {
accountsBalance: "1000000000000000000",
},
live: false,
}
: {
allowUnlimitedContractSize: true,
loggingEnabled: false,
live: false,
};
allowUnlimitedContractSize: true,
loggingEnabled: false,
live: false,
};
}

export default config;

0 comments on commit 8af5fe6

Please sign in to comment.