From c38b4ea2f77842516691d53b8aca96f0ba3c70f0 Mon Sep 17 00:00:00 2001 From: Ladd Hoffman Date: Sat, 16 Mar 2024 14:02:45 -0500 Subject: [PATCH] fixup automatic staking --- ethereum/package.json | 4 ++-- ethereum/scripts/automatic-staking.js | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ethereum/package.json b/ethereum/package.json index d9cc49c..b761ac3 100644 --- a/ethereum/package.json +++ b/ethereum/package.json @@ -5,8 +5,8 @@ "main": "index.js", "scripts": { "test": "hardhat test", - "automatic-staking-local": "hardhat run --network localhost scripts/automatic-staking.js localhost", - "automatic-staking-sepolia": "hardhat run --network sepolia scripts/automatic-staking.js sepolia" + "automatic-staking-local": "hardhat run --network localhost scripts/automatic-staking.js", + "automatic-staking-sepolia": "hardhat run --network sepolia scripts/automatic-staking.js" }, "author": "", "license": "ISC", diff --git a/ethereum/scripts/automatic-staking.js b/ethereum/scripts/automatic-staking.js index f63b239..a75a31e 100644 --- a/ethereum/scripts/automatic-staking.js +++ b/ethereum/scripts/automatic-staking.js @@ -33,14 +33,11 @@ const fetchValidationPools = async () => { }; const initialize = async () => { - const network = process.argv[2]; - if (!network) { - throw new Error('please provide network name as first argument'); - } + const network = process.env.HARDHAT_NETWORK; if (!DAOAddress[network]) { throw new Error(`network '${network}' is unknown`); } - dao = await ethers.getContractAt('DAO', DAOAddress); + dao = await ethers.getContractAt('DAO', DAOAddress[network]); [account] = await ethers.getSigners(); const address = await account.getAddress(); console.log(`account: ${address}`);