Skip to content

Commit

Permalink
Merge pull request #30 from DemocracyEarth/deploy
Browse files Browse the repository at this point in the history
Deploy on a Testnet
  • Loading branch information
santisiri authored Jan 2, 2021
2 parents 97d27dd + 9c9b604 commit e7d0fa9
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ AVAILABLE TASKS:
You can run `npx hardhat help <task>` 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).
Expand Down
1 change: 1 addition & 0 deletions deployment-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
16 changes: 11 additions & 5 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,25 @@ 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 = {
networks: {
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"
Expand Down
9 changes: 8 additions & 1 deletion scripts/deploy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const deploymentParams = require('../deployment-params');

async function main() {

const [deployer] = await ethers.getSigners();
Expand All @@ -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);
}
Expand Down

0 comments on commit e7d0fa9

Please sign in to comment.