-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(test): migrate from truffle to hardhat
- Loading branch information
1 parent
7f2640b
commit ec6d6bc
Showing
16 changed files
with
455 additions
and
477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,8 @@ build | |
coverage.json | ||
|
||
.env | ||
|
||
#Hardhat files | ||
artifacts | ||
cache | ||
typechain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import * as dotenv from "dotenv"; | ||
|
||
const { HD_WALLET_API_URL, MNEMONIC, ETHERSCAN_API_KEY } = process.env; | ||
|
||
import { HardhatUserConfig, task } from "hardhat/config"; | ||
import "@nomiclabs/hardhat-etherscan"; | ||
import "@nomiclabs/hardhat-waffle"; | ||
import "@nomiclabs/hardhat-truffle5"; | ||
import "@typechain/hardhat"; | ||
import "hardhat-gas-reporter"; | ||
import "solidity-coverage"; | ||
|
||
dotenv.config(); | ||
|
||
// You need to export an object to set up your config | ||
// Go to https://hardhat.org/config/ to learn more | ||
|
||
const config: HardhatUserConfig = { | ||
solidity: '0.8.10', | ||
networks: { | ||
hardhat: { | ||
// If chainId is omitted, then there is no chain id validation | ||
accounts: [ | ||
'0xc8209c2200f920b11a460733c91687565c712b40c6f0350e9ad4138bf3193e47', | ||
'0x915334f048736c64127e91a1dc35dad86c91e59081cdc12cd060103050e2f3b1', | ||
'0x80bf357dd53e61db0e68acbb270e16fd42645903b51329c856cf3cb36f180a3e', | ||
'0xdf231d240ce40f844d56cea3a7663b4be8c373fdd6a4fe69cacaaa68c698c590', | ||
'0x71ce3f6c92d687ebbdc9b632744178707f39228ae1001a2de66f8b98de36ca07', | ||
'0xca4e687f97b8c64705cddb53c92454994c83abcb4218c7c62955bac292c3bc9e', | ||
'0x0755057fc0113fdc174e919622f237d30044a4c1c47f3663608b9ee9e8a1a58a', | ||
'0x1a4002a3e2d0c18c058265600838cff40ba24303f6e60cd1c74821e8251f84d5', | ||
'0x6d276292b8f5047b54db5b2179b5f7050636feaccf6c97a2978200d41d9d3374', | ||
'0xace7201611ba195f85fb2e25b53e0f9869e57e2267d1c5eef63144c75dee5142' | ||
].map((key) => ({ | ||
privateKey: key, | ||
balance: '200000000000000000000000000', | ||
})), | ||
loggingEnabled: false, | ||
}, | ||
ropsten: { | ||
url: process.env.ROPSTEN_URL || '', | ||
// gasPrice: 5800000, | ||
gasPrice: 875000000, | ||
accounts: | ||
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [] | ||
} | ||
}, | ||
gasReporter: { | ||
enabled: process.env.REPORT_GAS !== undefined, | ||
currency: 'USD' | ||
}, | ||
etherscan: { | ||
apiKey: process.env.ETHERSCAN_API_KEY | ||
}, | ||
mocha: { | ||
timeout: 100000, | ||
} | ||
}; | ||
|
||
export default config; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// We require the Hardhat Runtime Environment explicitly here. This is optional | ||
// but useful for running the script in a standalone fashion through `node <script>`. | ||
// | ||
// When running the script with `npx hardhat run <script>` you'll find the Hardhat | ||
// Runtime Environment's members available in the global scope. | ||
import { ethers } from "hardhat"; | ||
|
||
async function main() { | ||
// Hardhat always runs the compile task when running scripts with its command | ||
// line interface. | ||
// | ||
// If this script is run directly using `node` you may want to call compile | ||
// manually to make sure everything is compiled | ||
// await hre.run('compile'); | ||
|
||
// We get the contract to deploy | ||
const Greeter = await ethers.getContractFactory("Greeter"); | ||
const greeter = await Greeter.deploy("Hello, Hardhat!"); | ||
|
||
await greeter.deployed(); | ||
|
||
console.log("Greeter deployed to:", greeter.address); | ||
} | ||
|
||
// We recommend this pattern to be able to use async/await everywhere | ||
// and properly handle errors. | ||
main().catch((error) => { | ||
console.error(error); | ||
process.exitCode = 1; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.