diff --git a/contracts/basic-bandwidth-generation/scripts/deploy.js b/contracts/basic-bandwidth-generation/scripts/deploy.js deleted file mode 100644 index aa0943d76e..0000000000 --- a/contracts/basic-bandwidth-generation/scripts/deploy.js +++ /dev/null @@ -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); - }); diff --git a/contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-bandwidth-generator.js b/contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-bandwidth-generator.js new file mode 100644 index 0000000000..dfce8f78f8 --- /dev/null +++ b/contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-bandwidth-generator.js @@ -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); + }); diff --git a/contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-gravity.js b/contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-gravity.js new file mode 100644 index 0000000000..0a4f468c17 --- /dev/null +++ b/contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-gravity.js @@ -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); + });