updated scripts to be network specific

This commit is contained in:
mfahampshire
2022-01-10 14:44:14 +01:00
parent 6d09e6fa7c
commit 08a2bc5c8d
3 changed files with 58 additions and 30 deletions
@@ -1,30 +0,0 @@
const { ethers } = require('hardhat');
const contracts = require('../contractAddresses.json');
async function main() {
const [deployer] = await ethers.getSigners();
console.log("Deploying contracts with the account:", deployer.address);
// console.log("Account balance:", (await deployer.getBalance()).toString());
const balance = await provider.getBalance(deployer.address);
console.log(balance)
// const BurnableToken = await ethers.getContractFactory("BurnableToken");
// const burnToken = await BurnableToken.deploy("BURNTOKEN","B4A");
// console.log(`token deployed at ${burnToken.address}`);
// const BurnForAccess = await ethers.getContractFactory("BurnForAccess");
// const burn4access = await BurnForAccess.deploy(burnToken.address);
// const burn4access = await BurnForAccess.deploy(contracts.Rinkeby.BurnableToken);
// console.log(`Burn4Access contract deployed at ${burn4access.address}`);
// TODO automatically update contractAddresses.json
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
@@ -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.rinkeby.NYM_ERC20,
contracts.rinkeby.GRAVITY
);
contracts.rinkeby.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);
});
@@ -0,0 +1,30 @@
const { ethers } = require('hardhat');
const { constants } = require('@openzeppelin/test-helpers');
const contracts = require("../../contractAddresses.json");
const fs = require('file-system');
async function main() {
const [deployer] = await ethers.getSigners();
const Gravity = await ethers.getContractFactory("Gravity");
// deploy with args from unit tests
const gravity = await Gravity.deploy(
constants.ZERO_BYTES32,
[deployer.address],
[2863311531]
);
contracts.rinkeby.GRAVITY = gravity.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(`gravity.sol deployed at ${gravity.address}`);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});