increased logging, added localhost config to hardhat for gas approximation

This commit is contained in:
mfahampshire
2022-01-25 19:10:17 +01:00
parent 0a2ce7fa6d
commit 147be7afd9
4 changed files with 14 additions and 14 deletions
@@ -1,12 +1 @@
{
"rinkeby": {
"NYM_ERC20":"",
"BANDWIDTH_GENERATOR":"",
"GRAVITY":"0xe58c12f8bA4a28e87841b10BdEdf80A47F86BA9B"
},
"mainnet": {
"NYM_ERC20":"0xCf6DeE9947fdDc958985E5283e63d41CBC83Ff61",
"BANDWIDTH_GENERATOR":"",
"GRAVITY":"0xa4108aA1Ec4967F8b52220a4f7e94A8201F2D906"
}
}
{"rinkeby":{"NYM_ERC20":"0xe58c12f8bA4a28e87841b10BdEdf80A47F86BA9B","BANDWIDTH_GENERATOR":"0x5FbDB2315678afecb367f032d93F642f64180aa3","GRAVITY":"0xe58c12f8bA4a28e87841b10BdEdf80A47F86BA9B"},"mainnet":{"NYM_ERC20":"0xCf6DeE9947fdDc958985E5283e63d41CBC83Ff61","BANDWIDTH_GENERATOR":"","GRAVITY":"0xa4108aA1Ec4967F8b52220a4f7e94A8201F2D906"}}
@@ -19,6 +19,9 @@ module.exports = {
// artifacts: "./artifacts/contracts"
// },
networks: {
localhost: {
url: "http://127.0.0.1:8545"
},
rinkeby: {
url: process.env.RINKEBY_URL, //Infura url with projectId
accounts: [process.env.PRIV_KEY], // private key of account used for contract interaction
@@ -4,20 +4,26 @@ const contracts = require("../../contractAddresses.json");
const fs = require('file-system');
async function main() {
const BandwidthGenerator = await ethers.getContractFactory("BandwidthGenerator");
console.log('preparing to deploy contract...')
// 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
);
console.log('...contract successfully deployed...');
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}`);
console.log(`...bandwidthGenerator.sol deployed at ${bandwidthGenerator.address}`);
}
main()
@@ -11,13 +11,15 @@ async function main() {
contracts.rinkeby.GRAVITY
);
console.log("deploying...");
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}`);
console.log(`...bandwidthGenerator.sol deployed at ${bandwidthGenerator.address}`);
}
main()