diff --git a/ethereum/package.json b/ethereum/package.json index 48f9291..a070033 100644 --- a/ethereum/package.json +++ b/ethereum/package.json @@ -6,7 +6,9 @@ "scripts": { "test": "hardhat test", "automatic-staking-local": "hardhat run --network localhost scripts/automatic-staking.js", - "automatic-staking-sepolia": "hardhat run --network sepolia scripts/automatic-staking.js" + "automatic-staking-sepolia": "hardhat run --network sepolia scripts/automatic-staking.js", + "deploy-local": "hardhat run --network localhost scripts/deploy.js", + "deploy-sepolia": "hardhat run --network sepolia scripts/deploy.js" }, "author": "", "license": "ISC", diff --git a/ethereum/scripts/deploy.js b/ethereum/scripts/deploy.js index b53a67d..278f38e 100644 --- a/ethereum/scripts/deploy.js +++ b/ethereum/scripts/deploy.js @@ -3,6 +3,8 @@ const fs = require('fs'); const contractAddresses = require('../../contract-addresses.json'); +const contractAddressesWritePath = '../contract-addresses.json'; + const network = process.env.HARDHAT_NETWORK; async function main() { @@ -19,7 +21,8 @@ async function main() { console.log(`Work1 deployed to ${work1.target}`); contractAddresses[network].Work1 = work1.target; - fs.writeFileSync('../../contract-addresses.json', JSON.stringify(contractAddresses, null, 2)); + fs.writeFileSync(contractAddressesWritePath, JSON.stringify(contractAddresses, null, 2)); + console.log('Wrote file', fs.realpathSync(contractAddressesWritePath)); } // We recommend this pattern to be able to use async/await everywhere