Skip to content

Commit

Permalink
Merge pull request #98 from zama-ai/feature/hardhat-template
Browse files Browse the repository at this point in the history
feat() add hardhat test and template
  • Loading branch information
immortal-tofu authored Jul 28, 2023
2 parents 9ec1283 + e5fe1cc commit 49b8191
Show file tree
Hide file tree
Showing 29 changed files with 13,254 additions and 7,724 deletions.
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export INFURA_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
export MNEMONIC="adapt mosquito move limb mobile illegal tree voyage juice mosquito burger raise father hope layer"

# Block explorer API keys
export ARBISCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
export BSCSCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
export ETHERSCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
export OPTIMISM_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
export POLYGONSCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
export SNOWTRACE_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
21 changes: 21 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# directories
.coverage_artifacts
.coverage_cache
.coverage_contracts
artifacts
build
cache
coverage
dist
node_modules
types

# files
*.env
*.log
.DS_Store
.pnp.*
coverage.json
package-lock.json
pnpm-lock.yaml
yarn.lock
22 changes: 22 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
extends:
- "eslint:recommended"
- "plugin:@typescript-eslint/eslint-recommended"
- "plugin:@typescript-eslint/recommended"
- "prettier"
parser: "@typescript-eslint/parser"
parserOptions:
project: "tsconfig.json"
plugins:
- "@typescript-eslint"
root: true
rules:
"@typescript-eslint/no-floating-promises":
- error
- ignoreIIFE: true
ignoreVoid: true
"@typescript-eslint/no-inferrable-types": "off"
"@typescript-eslint/no-non-null-assertion": "off"
"@typescript-eslint/no-unused-vars":
- error
- argsIgnorePattern: "_"
varsIgnorePattern: "_"
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run test
- run: npm run build
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
with:
node-version: 18.x
- run: npm ci
- run: npm run build
- run: npm run compile
- uses: JS-DevTools/npm-publish@0f451a94170d1699fd50710966d48fb26194d939
with:
token: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: cp .env.example .env
- run: npm ci
- run: npm run test
- run: npm run build
140 changes: 127 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,132 @@
decrypt/target
decrypt/ciphertexts
res/
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
.venv
.vscode
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

node_modules
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
coverage
coverage.json
typechain
typechain-types
.env.test

# Hardhat files
cache
artifacts
# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
public/

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Python app
res/
.venv
.env

# Hardhat
artifacts
.coverage_artifacts
.coverage_cache
.coverage_contracts
coverage.json
build
cache
types
deployments
typechain
typechain-types
10 changes: 10 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
image: "gitpod/workspace-node:latest"

tasks:
- init: "pnpm install"

vscode:
extensions:
- "esbenp.prettier-vscode"
- "NomicFoundation.hardhat-solidity"
- "ritwickdey.LiveServer"
21 changes: 21 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# directories
.coverage_artifacts
.coverage_cache
.coverage_contracts
artifacts
build
cache
coverage
dist
node_modules
types

# files
*.env
*.log
.DS_Store
.pnp.*
coverage.json
package-lock.json
pnpm-lock.yaml
yarn.lock
23 changes: 23 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
bracketSpacing: true
plugins:
- "@trivago/prettier-plugin-sort-imports"
- "prettier-plugin-solidity"
printWidth: 120
proseWrap: "always"
singleQuote: false
tabWidth: 2
trailingComma: "all"

overrides:
- files: "*.sol"
options:
compiler: "0.8.17"
parser: "solidity-parse"
tabWidth: 4
- files: "*.ts"
options:
importOrder: ["<THIRD_PARTY_MODULES>", "^[./]"]
importOrderParserPlugins: ["typescript"]
importOrderSeparation: true
importOrderSortSpecifiers: true
parser: "typescript"
7 changes: 7 additions & 0 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
istanbulReporter: ["html", "lcov"],
providerOptions: {
mnemonic: process.env.MNEMONIC,
},
skipFiles: ["test"],
};
19 changes: 19 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"code-complexity": ["error", 8],
"compiler-version": ["error", ">=0.8.4"],
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 120],
"named-parameters-mapping": "warn",
"no-console": "off",
"not-rely-on-time": "off",
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
]
}
}
3 changes: 3 additions & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# directories
**/artifacts
**/node_modules
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 49b8191

Please sign in to comment.