Skip to content

Commit

Permalink
Add support for hardhat (paritytech#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
vgeddes committed May 22, 2021
1 parent 3da1b6b commit ceea587
Show file tree
Hide file tree
Showing 5 changed files with 1,381 additions and 51 deletions.
7 changes: 3 additions & 4 deletions ethereum/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
build**

build/
.env

node_modules/

ganache.log
artifacts/
cache/
2 changes: 1 addition & 1 deletion ethereum/contracts/test/TestToken.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;

import "../../node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract TestToken is ERC20 {
constructor(
Expand Down
46 changes: 46 additions & 0 deletions ethereum/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { config as dotenv } from "dotenv";
import { resolve } from "path";
dotenv({ path: resolve(__dirname, ".env") });

import "@nomiclabs/hardhat-truffle5";
import "@nomiclabs/hardhat-ethers";

const getenv = (name: string) => {
if (name in process.env) {
return process.env[name]
} else {
throw new Error(`Please set your ${name} in a .env file`);
}
}

const mnemonic = getenv("MNEMONIC");
const infuraKey = getenv("INFURA_PROJECT_ID");

export default {
networks: {
hardhat: {
},
localhost: {
url: "http://127.0.0.1:8545",
accounts: {
mnemonic: 'stone speak what ritual switch pigeon weird dutch burst shaft nature shove',
}
},
ropsten: {
chainId: 3,
url: `https://ropsten.infura.io/v3/${infuraKey}`,
accounts: {
mnemonic: mnemonic,
}
}
},
solidity: {
version: "0.7.6"
},
paths: {
sources: "contracts",
tests: "test",
cache: "cache",
artifacts: "artifacts"
},
};
11 changes: 10 additions & 1 deletion ethereum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,18 @@
"truffle": "^5.1.32",
"unique-filename": "^1.1.1",
"web3": "^1.2.9",
"web3-core-helpers": "^1.3.6",
"web3-core-promievent": "^1.3.6",
"web3-eth-abi": "^1.3.6",
"web3-utils": "^1.3.0"
},
"devDependencies": {
"@babel/core": "^7.11.6"
"@babel/core": "^7.11.6",
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-truffle5": "^2.0.0",
"@nomiclabs/hardhat-web3": "^2.0.0",
"hardhat": "^2.3.0",
"ts-node": "^9.1.1",
"typescript": "^4.2.4"
}
}
Loading

0 comments on commit ceea587

Please sign in to comment.