added mainnet deploy script + prettified contract addresses json

This commit is contained in:
mfahampshire
2022-01-11 13:43:46 +01:00
parent 55775b6e7b
commit 904caca9de
2 changed files with 40 additions and 1 deletions
@@ -1 +1,12 @@
{"rinkeby":{"NYM_ERC20":"","BANDWIDTH_GENERATOR":"","GRAVITY":"0xe58c12f8bA4a28e87841b10BdEdf80A47F86BA9B"}}
{
"rinkeby": {
"NYM_ERC20":"",
"BANDWIDTH_GENERATOR":"",
"GRAVITY":"0xe58c12f8bA4a28e87841b10BdEdf80A47F86BA9B"
},
"mainnet": {
"NYM_ERC20":"",
"BANDWIDTH_GENERATOR":"",
"GRAVITY":""
}
}
@@ -0,0 +1,28 @@
const { ethers } = require('hardhat');
const { constants } = require('@openzeppelin/test-helpers');
const contracts = require("../../contractAddresses.json");
const fs = require('file-system');
async function main() {
const BandwidthGenerator = await ethers.getContractFactory("BandwidthGenerator");
// if this is failing, check whether the ERC20 address has been manually added to the contract addresses json file
const bandwidthGenerator = await BandwidthGenerator.deploy(
contracts.mainnet.NYM_ERC20,
contracts.mainnet.GRAVITY
);
contracts.mainnet.BANDWIDTH_GENERATOR = bandwidthGenerator.address;
// the location of the json file is relative to where you are running the script from - run from root of directory
fs.writeFileSync('./contractAddresses.json', JSON.stringify(contracts), (err) => {
if (err) throw err;
});
console.log(`bandwidthGenerator.sol deployed at ${bandwidthGenerator.address}`);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});