diff --git a/README.md b/README.md index 2dbd676..885afc8 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,21 @@ AVAILABLE TASKS: You can run `npx hardhat help ` to get help about each tasks and their parameters. +## Deploy + +1. On `hardhat.config.js` configure the following constants for the `kovan` testnet: + + ``` + INFURA_API_KEY + KOVAN_PRIVATE_KEY + ``` + +2. Deploy on Ethereum `kovan` testnet: + + ```sh + $ npx hardhat run scripts/deploy.js --network kovan + ``` + ## Contribute These contracts are free, open source and censorship resistant. Support us via [Open Collective](https://opencollective.com/democracyearth). diff --git a/deployment-params.js b/deployment-params.js index aaef596..8843cf3 100644 --- a/deployment-params.js +++ b/deployment-params.js @@ -3,3 +3,4 @@ module.exports.INITIAL_SUPPLY = '10000000000000000000000000' module.exports.TOKEN_NAME = "Universal Basic Income" module.exports.TOKEN_SYMBOL = "UBI" module.exports.ACCRUED_PER_SECOND = '100000000' +module.exports.PROOF_OF_HUMANITY_KOVAN = '0x413752ADd5ff51CC1928FA73BEFA65b37dEB8730' diff --git a/hardhat.config.js b/hardhat.config.js index bc7a026..94c81a5 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -7,9 +7,15 @@ require("solidity-coverage"); require("./scripts/tasks"); +// Go to https://infura.io/ and create a new project +// Replace this with your Infura project ID const INFURA_API_KEY = ""; -const MAINNET_PRIVATE_KEY = ""; -const ROPSTEN_PRIVATE_KEY = ""; + +// Replace this private key with your Kovan account private key +// To export your private key from Metamask, open Metamask and +// go to Account Details > Export Private Key +// Be aware of NEVER putting real Ether into testing accounts +const KOVAN_PRIVATE_KEY = ""; const ETHERSCAN_API_KEY = ""; module.exports = { @@ -17,9 +23,9 @@ module.exports = { develop: { url: "http://localhost:8545", }, - ropsten: { - url: `https://ropsten.infura.io/v3/${INFURA_API_KEY}`, - accounts: [`0x${ROPSTEN_PRIVATE_KEY}`] + kovan: { + url: `https://kovan.infura.io/v3/${INFURA_API_KEY}`, + accounts: [`0x${KOVAN_PRIVATE_KEY}`] }, coverage: { url: "http://localhost:8555" diff --git a/scripts/deploy.js b/scripts/deploy.js index 2d62619..1d23894 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -1,3 +1,5 @@ +const deploymentParams = require('../deployment-params'); + async function main() { const [deployer] = await ethers.getSigners(); @@ -10,7 +12,12 @@ async function main() { console.log("Account balance:", (await deployer.getBalance()).toString()); const Token = await ethers.getContractFactory("UBI"); - const token = await Token.deploy(); + const token = await Token.deploy( + deploymentParams.INITIAL_SUPPLY, + deploymentParams.TOKEN_NAME, + deploymentParams.TOKEN_SYMBOL, + deploymentParams.ACCRUED_PER_SECOND, + deploymentParams.PROOF_OF_HUMANITY_KOVAN); console.log("Token address:", token.address); }