-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1 | ||
ROPSTEN_URL=https://eth-ropsten.alchemyapi.io/v2/<YOUR ALCHEMY KEY> | ||
PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
artifacts | ||
cache | ||
coverage |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module.exports = { | ||
env: { | ||
browser: false, | ||
es2021: true, | ||
mocha: true, | ||
node: true, | ||
}, | ||
extends: [ | ||
"standard", | ||
"plugin:prettier/recommended", | ||
"plugin:node/recommended", | ||
], | ||
parserOptions: { | ||
ecmaVersion: 12, | ||
}, | ||
overrides: [ | ||
{ | ||
files: ["hardhat.config.js"], | ||
globals: { task: true }, | ||
}, | ||
{ | ||
files: ["scripts/**"], | ||
rules: { "no-process-exit": "off" }, | ||
}, | ||
{ | ||
files: ["hardhat.config.js", "scripts/**", "test/**"], | ||
rules: { "node/no-unpublished-require": "off" }, | ||
}, | ||
], | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules | ||
.env | ||
|
||
#Hardhat files | ||
cache | ||
artifacts |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
artifacts | ||
cache | ||
coverage* | ||
gasReporterOutput.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "solhint:recommended", | ||
"rules": { | ||
"compiler-version": ["error", "^0.8.0"], | ||
"func-visibility": ["warn", { "ignoreConstructors": true }] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,42 @@ | ||
# fluidstream | ||
# Advanced Sample Hardhat Project | ||
|
||
This project demonstrates an advanced Hardhat use case, integrating other tools commonly used alongside Hardhat in the ecosystem. | ||
|
||
The project comes with a sample contract, a test for that contract, a sample script that deploys that contract, and an example of a task implementation, which simply lists the available accounts. It also comes with a variety of other tools, preconfigured to work with the project code. | ||
|
||
Try running some of the following tasks: | ||
|
||
```shell | ||
npx hardhat accounts | ||
npx hardhat compile | ||
npx hardhat clean | ||
npx hardhat test | ||
npx hardhat node | ||
npx hardhat help | ||
REPORT_GAS=true npx hardhat test | ||
npx hardhat coverage | ||
npx hardhat run scripts/deploy.js | ||
node scripts/deploy.js | ||
npx eslint '**/*.js' | ||
npx eslint '**/*.js' --fix | ||
npx prettier '**/*.{json,sol,md}' --check | ||
npx prettier '**/*.{json,sol,md}' --write | ||
npx solhint 'contracts/**/*.sol' | ||
npx solhint 'contracts/**/*.sol' --fix | ||
``` | ||
|
||
# Etherscan verification | ||
|
||
To try out Etherscan verification, you first need to deploy a contract to an Ethereum network that's supported by Etherscan, such as Ropsten. | ||
|
||
In this project, copy the .env.template file to a file named .env, and then edit it to fill in the details. Enter your Etherscan API key, your Ropsten node URL (eg from Alchemy), and the private key of the account which will send the deployment transaction. With a valid .env file in place, first deploy your contract: | ||
|
||
```shell | ||
hardhat run --network ropsten scripts/deploy.js | ||
``` | ||
|
||
Then, copy the deployment address and paste it in to replace `DEPLOYED_CONTRACT_ADDRESS` in this command: | ||
|
||
```shell | ||
npx hardhat verify --network ropsten DEPLOYED_CONTRACT_ADDRESS "Hello, Hardhat!" | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//SPDX-License-Identifier: Unlicense | ||
pragma solidity ^0.8.0; | ||
|
||
import "hardhat/console.sol"; | ||
|
||
contract Greeter { | ||
string private greeting; | ||
|
||
constructor(string memory _greeting) { | ||
console.log("Deploying a Greeter with greeting:", _greeting); | ||
greeting = _greeting; | ||
} | ||
|
||
function greet() public view returns (string memory) { | ||
return greeting; | ||
} | ||
|
||
function setGreeting(string memory _greeting) public { | ||
console.log("Changing greeting from '%s' to '%s'", greeting, _greeting); | ||
greeting = _greeting; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { task } from "hardhat/config"; | ||
import * as dotenv from "dotenv"; | ||
import "@nomiclabs/hardhat-etherscan"; | ||
import "@nomiclabs/hardhat-waffle"; | ||
import "hardhat-gas-reporter"; | ||
import "solidity-coverage"; | ||
import "@typechain/hardhat"; | ||
import "@nomiclabs/hardhat-ethers"; | ||
import { HardhatUserConfig } from "hardhat/config"; | ||
|
||
dotenv.config(); | ||
|
||
// This is a sample Hardhat task. To learn how to create your own go to | ||
// https://hardhat.org/guides/create-task.html | ||
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => { | ||
const accounts = await hre.ethers.getSigners(); | ||
|
||
for (const account of accounts) { | ||
console.log(account.address); | ||
} | ||
}); | ||
|
||
// You need to export an object to set up your config | ||
// Go to https://hardhat.org/config/ to learn more | ||
|
||
/** | ||
* @type import('hardhat/config').HardhatUserConfig | ||
*/ | ||
const config: HardhatUserConfig = { | ||
solidity: "0.8.4", | ||
networks: { | ||
hardhat: { | ||
initialBaseFeePerGas: 0, // workaround from https://github.com/sc-forks/solidity-coverage/issues/652#issuecomment-896330136 . Remove when that issue is closed. | ||
}, | ||
ropsten: { | ||
url: process.env.ROPSTEN_URL || "", | ||
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, | ||
}, | ||
}; | ||
|
||
export default config; |