Skip to content

Commit

Permalink
Fix deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
shahthepro committed Mar 4, 2024
1 parent 1fb49bb commit 1805822
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 18 deletions.
4 changes: 2 additions & 2 deletions contracts/deploy/085_deploy_l2_governance_proxies.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const main = async (hre) => {

const { deployerAddr } = await getNamedAccounts();

await impersonateAndFund(deployerAddr)
await impersonateAndFund(deployerAddr);

if (isArbitrumOneOrFork) {
// Deploy L2 Governor on Arbitrum One
Expand All @@ -31,6 +31,6 @@ const main = async (hre) => {

main.id = deployName;
main.skip = !(isArbitrumOneOrFork || isMainnetOrFork);
main.tags = ["arbitrum", "mainnet"];
main.tags = ["arbitrumOne", "mainnet"];

module.exports = main;
11 changes: 8 additions & 3 deletions contracts/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ task("accounts", "Prints the list of accounts", async (taskArguments, hre) => {
});

const isFork = process.env.FORK === "true";
const isArbitrum = process.env.FORK_NETWORK_NAME === "arbitrumOne";
const isArbitrumFork = process.env.FORK_NETWORK_NAME === "arbitrumOne";
const isForkTest = isFork && process.env.IS_TEST === "true";
const isArbForkTest = isForkTest && isArbitrum;
const isArbForkTest = isForkTest && isArbitrumFork;
const providerUrl = `${
process.env.LOCAL_PROVIDER_URL || process.env.PROVIDER_URL
}`;
Expand Down Expand Up @@ -124,7 +124,8 @@ module.exports = {
accounts: {
mnemonic,
},
chainId: isFork ? (isArbitrum ? 42161 : 1) : 1337,
chainId: isFork ? (isArbitrumFork ? 42161 : 1) : 1337,
...(isArbitrumFork ? { tags: ["arbitrumOne"] } : {}),
...(isForkTest
? {
timeout: 0,
Expand All @@ -144,6 +145,7 @@ module.exports = {
},
localhost: {
timeout: 0,
...(isArbitrumFork ? { tags: ["arbitrumOne"] } : {}),
},
mainnet: {
url: `${process.env.PROVIDER_URL}`,
Expand All @@ -159,6 +161,9 @@ module.exports = {
process.env.GOVERNOR_PK || privateKeys[0],
],
chainId: 42161,
tags: ["arbitrumOne"],
live: true,
saveDeployments: true,
// Fails if gas limit is anything less than 20M on Arbitrum One
gas: 20000000,
// initialBaseFeePerGas: 0,
Expand Down
10 changes: 3 additions & 7 deletions contracts/node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ main()
if [[ $FORK_NETWORK_NAME == "arbitrumOne" ]]; then
PROVIDER_URL=$ARBITRUM_PROVIDER_URL;
BLOCK_NUMBER=$ARBITRUM_BLOCK_NUMBER;
params+=("--no-deploy ");
params+=" --tags arbitrumOne"
fi
echo "Fork Network: $FORK_NETWORK_NAME"

Expand All @@ -50,7 +50,7 @@ main()

nodeOutput=$(mktemp "${TMPDIR:-/tmp/}$(basename 0).XXX")
# the --no-install is here so npx doesn't download some package on its own if it can not find one in the repo
FORK=true npx --no-install hardhat node --no-reset ${params[@]} > $nodeOutput 2>&1 &
FORK_NETWORK_NAME=$FORK_NETWORK_NAME FORK=true npx --no-install hardhat node --no-reset ${params[@]} > $nodeOutput 2>&1 &

tail -f $nodeOutput &

Expand All @@ -67,13 +67,9 @@ main()
done
printf "\n"

# if [[ $FORK_NETWORK_NAME == "arbitrumOne" ]]; then
# FORK=true npx hardhat deploy --network localhost --tags arbitrum
# fi

echo "🟢 Node initialized"

FORK=true npx hardhat fund --amount 100000 --network localhost --accountsfromenv true &
FORK_NETWORK_NAME=$FORK_NETWORK_NAME FORK=true npx hardhat fund --amount 100000 --network localhost --accountsfromenv true &

# wait for subprocesses to finish
for job in `jobs -p`
Expand Down
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"deploy": "rm -rf deployments/hardhat && npx hardhat deploy",
"deploy:mainnet": "npx hardhat deploy --network mainnet --verbose",
"deploy:arbitrum": "npx hardhat deploy --network arbitrumOne --tags arbitrum --verbose",
"deploy:arbitrum": "npx hardhat deploy --network arbitrumOne --tags arbitrumOne --verbose",
"abi:generate": "(rm -rf deployments/hardhat && mkdir -p dist/abi && npx hardhat deploy --export '../dist/network.json')",
"abi:dist": "find ./artifacts/contracts -name \"*.json\" -type f -exec cp {} ./dist/abi \\; && rm -rf dist/abi/*.dbg.json dist/abi/Mock*.json && cp ./abi.package.json dist/package.json && cp ./.npmrc.abi dist/.npmrc",
"node": "yarn run node:fork",
Expand Down
6 changes: 4 additions & 2 deletions contracts/test/_fixture-arb.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ const defaultArbitrumFixture = deployments.createFixture(async () => {
}

log(
`Before deployments with param "${isFork ? ["arbitrum"] : ["unit_tests"]}"`
`Before deployments with param "${
isFork ? ["arbitrumOne"] : ["unit_tests"]
}"`
);

// Run the contract deployments
await deployments.fixture(isFork ? ["arbitrum"] : ["unit_tests"], {
await deployments.fixture(isFork ? ["arbitrumOne"] : ["unit_tests"], {
keepExistingDeployments: true,
fallbackToGlobal: true,
});
Expand Down
2 changes: 1 addition & 1 deletion contracts/utils/delpoy-l2.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function deployOnArb(opts, fn) {
main.id = deployName;
main.dependencies = dependencies || [];

main.tags = ["arbitrum"];
main.tags = ["arbitrumOne"];

main.skip = () =>
!(
Expand Down
7 changes: 5 additions & 2 deletions contracts/utils/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const {
isForkTest,
getBlockTimestamp,
isArbitrumOneOrFork,
isArbitrumOne,
} = require("../test/helpers.js");

const {
Expand Down Expand Up @@ -90,7 +91,7 @@ const deployWithConfirmation = async (
);

// if upgrade happened on the mainnet save the new storage slot layout to the repo
if (isMainnet) {
if (isMainnet || isArbitrumOne) {
await storeStorageLayoutForContract(hre, contractName);
}

Expand Down Expand Up @@ -707,7 +708,9 @@ const submitProposalToOgvGovernance = async (
/**
* Sanity checks to perform before running the deploy
*/
const sanityCheckOgvGovernance = async ({ deployerIsProposer = false }) => {
const sanityCheckOgvGovernance = async ({
deployerIsProposer = false,
} = {}) => {
if (isMainnet) {
// only applicable when OGV governance is the governor
if (deployerIsProposer) {
Expand Down

0 comments on commit 1805822

Please sign in to comment.