Skip to content

Commit

Permalink
fix: exclude external deployments when exporting
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Dec 11, 2023
1 parent 4027513 commit a778589
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 33 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@ jobs:
- name: Export deployments
run: |
for NETWORK in bsctestnet bscmainnet ethereum sepolia; do
yarn hardhat export --network ${NETWORK} --export ./deployments/${NETWORK}.json
EXPORT=true yarn hardhat export --network ${NETWORK} --export ./deployments/${NETWORK}.json
jq -M '{name, chainId, addresses: .contracts | map_values(.address)}' ./deployments/${NETWORK}.json > ./deployments/${NETWORK}_addresses.json
done
yarn prettier
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "feat: updating deployment files"
Expand Down
75 changes: 43 additions & 32 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,38 @@ import "@typechain/hardhat";
import dotenv from "dotenv";
import "hardhat-deploy";
import "hardhat-gas-reporter";
import { HardhatUserConfig, task } from "hardhat/config";
import { extendConfig, HardhatUserConfig, task } from "hardhat/config";
import { HardhatConfig } from "hardhat/types";
import "solidity-coverage";
import "solidity-docgen";

dotenv.config();

const DEPLOYER_PRIVATE_KEY = process.env.DEPLOYER_PRIVATE_KEY;

const externalDeployments = {
bsctestnet: [
"node_modules/@venusprotocol/venus-protocol/deployments/bsctestnet",
"node_modules/@venusprotocol/governance-contracts/deployments/bsctestnet",
],
sepolia: [
"node_modules/@venusprotocol/venus-protocol/deployments/sepolia",
"node_modules/@venusprotocol/governance-contracts/deployments/sepolia",
],
bscmainnet: [
"node_modules/@venusprotocol/venus-protocol/deployments/bscmainnet",
"node_modules/@venusprotocol/governance-contracts/deployments/bscmainnet",
],
}

extendConfig(
(config: HardhatConfig) => {
if (process.env.EXPORT !== 'true') {
config.external = { ...config.external, deployments: externalDeployments }
}
}
);

task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();

Expand All @@ -28,24 +52,24 @@ task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
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,
};
}

const config: HardhatUserConfig = {
Expand Down Expand Up @@ -161,20 +185,7 @@ const config: HardhatUserConfig = {
artifacts: "./artifacts",
},
external: {
deployments: {
bsctestnet: [
"node_modules/@venusprotocol/venus-protocol/deployments/bsctestnet",
"node_modules/@venusprotocol/governance-contracts/deployments/bsctestnet",
],
sepolia: [
"node_modules/@venusprotocol/venus-protocol/deployments/sepolia",
"node_modules/@venusprotocol/governance-contracts/deployments/sepolia",
],
bscmainnet: [
"node_modules/@venusprotocol/venus-protocol/deployments/bscmainnet",
"node_modules/@venusprotocol/governance-contracts/deployments/bscmainnet",
],
},
deployments: {}
},
mocha: {
timeout: 200000000,
Expand Down

0 comments on commit a778589

Please sign in to comment.