-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: prepare for release * feat: use dynamic import * feat: do not have task at install * feat: add skip load to prepare script * feat: move tasks to dedicated folder * fix: fix remaining issues
- Loading branch information
Showing
13 changed files
with
23,804 additions
and
15,176 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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1 | ||
ROPSTEN_URL=https://eth-ropsten.alchemyapi.io/v2/<YOUR ALCHEMY KEY> | ||
PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1 | ||
|
||
ETHERSCAN_API_KEY= | ||
REPORT_GAS= | ||
COINMARKET_CAP_API_KEY= | ||
INFURA_PROJECT_ID= | ||
GOERLI_MNEMONIC= | ||
LOCALHOST_MNEMONIC= |
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,39 @@ | ||
name: Main Workflow | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: Compile and build | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16.x' | ||
cache: npm | ||
- run: npm install | ||
- run: npm run compile | ||
- run: npm run build | ||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
name: Release | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16.x' | ||
cache: npm | ||
- run: npm install | ||
- run: npm run compile | ||
- run: npm run build | ||
- name: Semantic release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: npx semantic-release | ||
|
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,17 @@ | ||
name: Pull Request Worflow | ||
on: | ||
pull_request: | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
name: Compile and build | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16.x' | ||
cache: npm | ||
- run: npm install | ||
- run: npm run compile | ||
- run: npm run build |
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,3 @@ | ||
{ | ||
"branches": ["main"] | ||
} |
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 |
---|---|---|
@@ -1,46 +1,60 @@ | ||
# 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.ts | ||
TS_NODE_FILES=true npx ts-node scripts/deploy.ts | ||
npx eslint '**/*.{js,ts}' | ||
npx eslint '**/*.{js,ts}' --fix | ||
npx prettier '**/*.{json,sol,md}' --check | ||
npx prettier '**/*.{json,sol,md}' --write | ||
npx solhint 'contracts/**/*.sol' | ||
npx solhint 'contracts/**/*.sol' --fix | ||
|
||
# Semaphore Demo Contracts | ||
|
||
:warning: This application has been developed for educational purposes and should not be considered as a serious product :warning: | ||
|
||
This repository contains the only and simple contract for this Semaphore demo app. The contract acts as a Semaphore group admin and allows anyone to join the managed group. | ||
|
||
## Local Development | ||
|
||
This repository is developped using [hardhat](https://hardhat.org/). One is free to directly use the available scripts from hardhat using `npx`, otherwise, a set of local script have been made in order to allow safe local development. | ||
|
||
### Setup | ||
|
||
#### Environment Variables | ||
|
||
Proper environment variables are needed in order to run the various scripts | ||
- `REPORT_GAS`: if truthy, the gas measurements of the tests will be translated in USD value. The `COINMARKET_CAP_API_KEY` environment variable will need to be set, | ||
- `COINMARKET_CAP_API_KEY`: an API key for CoinMarket Cap in order to retrieve USD value of ETH, | ||
- `ETHERSCAN_KEY`: an etherscan key used in order to verify the contracts on Etherscan, | ||
|
||
#### Nvm | ||
|
||
Use configured node and npm versions | ||
```console | ||
nvm use | ||
``` | ||
|
||
# Etherscan verification | ||
Nvm installation instructions may be found [here](https://github.com/nvm-sh/nvm); | ||
|
||
To try out Etherscan verification, you first need to deploy a contract to an Ethereum network that's supported by Etherscan, such as Ropsten. | ||
#### Dependencies | ||
|
||
In this project, copy the .env.example 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: | ||
Install dependencies | ||
```console | ||
npm install | ||
``` | ||
|
||
```shell | ||
hardhat run --network ropsten scripts/deploy.ts | ||
### Compile the smart contracts | ||
|
||
```console | ||
npm run compile | ||
``` | ||
|
||
Then, copy the deployment address and paste it in to replace `DEPLOYED_CONTRACT_ADDRESS` in this command: | ||
### Tests | ||
|
||
Run all the tests | ||
```console | ||
npm run test | ||
``` | ||
|
||
```shell | ||
npx hardhat verify --network ropsten DEPLOYED_CONTRACT_ADDRESS "Hello, Hardhat!" | ||
Obtain the test coverage | ||
```console | ||
npm run test:cover | ||
``` | ||
|
||
# Performance optimizations | ||
### Solhint | ||
|
||
For faster runs of your tests and scripts, consider skipping ts-node's type checking by setting the environment variable `TS_NODE_TRANSPILE_ONLY` to `1` in hardhat's environment. For more details see [the documentation](https://hardhat.org/guides/typescript.html#performance-optimizations). | ||
Run a security and practices analysis by [solhint](https://github.com/protofire/solhint) | ||
```console | ||
npm run solhint | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { MultiNetworkContractStore } from "contract-store"; | ||
import semaphoreDemoGoerli from "./deployments/goerli/SemaphoreDemo.json"; | ||
import semaphore from './artifacts/@semaphore-protocol/contracts/interfaces/ISemaphore.sol/ISemaphore.json'; | ||
|
||
export * from "./typechain"; | ||
|
||
enum Network { | ||
goerli = 5, | ||
} | ||
|
||
const SEMAPHORE_GOERLI_ADDRESS = "0x99aAb52e60f40AAC0BFE53e003De847bBDbC9611"; | ||
|
||
export const contractStore = new MultiNetworkContractStore([Network.goerli]); | ||
|
||
contractStore.registerContract(Network.goerli, "SEMAPHORE_DEMO", { | ||
abi: semaphoreDemoGoerli.abi, | ||
address: semaphoreDemoGoerli.address | ||
}); | ||
contractStore.registerContract(Network.goerli, "SEMAPHORE", { | ||
abi: semaphore.abi, | ||
address: SEMAPHORE_GOERLI_ADDRESS | ||
}); |
Oops, something went wrong.