-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa71525
commit c71f7d1
Showing
43 changed files
with
13,754 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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,10 @@ | ||
# This CODEOWNERS file sets the individuals responsible for code in the zksync-contract-templates repository. | ||
|
||
# These users are the default owners for everything in the repo. | ||
# They will be requested for review when someone opens a pull request. | ||
* @matter-labs/devxp | ||
|
||
# You can also specify code owners for specific directories or files. | ||
# For example: | ||
# /src/ @developer1 @developer2 | ||
# /docs/ @documenter |
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,45 @@ | ||
--- | ||
name: Bug report | ||
about: Use this template for reporting issues | ||
title: "" | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
### 🐛 Bug Report for zkSync Contract Templates | ||
#### 📝 Description | ||
|
||
Provide a clear and concise description of the bug. | ||
|
||
#### 🔄 Reproduction Steps | ||
|
||
1. Step 1 | ||
2. Step 2 | ||
3. ... | ||
|
||
#### 🤔 Expected Behavior | ||
|
||
Describe what you expected to happen. | ||
|
||
#### 😯 Current Behavior | ||
|
||
Describe what actually happened. | ||
|
||
#### 🖥️ Environment | ||
|
||
- **Template used**: [e.g., Hardhat + Solidity] | ||
- **Node version**: [e.g., node v16.14.0] | ||
- **NPM/Yarn version**: [e.g., npm 8.3.1] | ||
- **Operating System & Version**: [e.g., Ubuntu 20.04] | ||
- **Other relevant environment details**: | ||
|
||
#### 📋 Additional Context | ||
|
||
Add any other context about the problem here. If applicable, add screenshots to help explain. | ||
|
||
#### 📎 Log Output | ||
|
||
``` | ||
Paste any relevant log output here. | ||
``` |
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,8 @@ | ||
blank_issues_enabled: true | ||
contact_links: | ||
- name: zksync-developers Discussion | ||
url: https://github.com/zkSync-Community-Hub/zkync-developers/discussions | ||
about: Please provide feedback, and ask questions here. | ||
- name: zkSync CLI documentation page | ||
url: https://era.zksync.io/docs/tools/zksync-cli | ||
about: Please refer to the documentation for immediate answers. |
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,26 @@ | ||
--- | ||
name: Feature request | ||
about: Use this template for requesting features | ||
title: "" | ||
labels: feat | ||
assignees: '' | ||
|
||
--- | ||
|
||
### 🌟 Feature Request | ||
|
||
#### 📝 Description | ||
|
||
Provide a clear and concise description of the feature you'd like to see. | ||
|
||
#### 🤔 Rationale | ||
|
||
Explain why this feature is important and how it benefits the project. | ||
|
||
#### 🖼️ Mockups/Examples | ||
|
||
If applicable, provide mockups or examples of how the feature would work. | ||
|
||
#### 📋 Additional Context | ||
|
||
Add any other context or information about the feature request here. |
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 @@ | ||
# What :computer: | ||
* First thing updated with this PR | ||
* Second thing updated with this PR | ||
* Third thing updated with this PR | ||
|
||
# Why :hand: | ||
* Reason why first thing was added to PR | ||
* Reason why second thing was added to PR | ||
* Reason why third thing was added to PR | ||
|
||
# Evidence :camera: | ||
Include screenshots, screen recordings, or `console` output here demonstrating that your changes work as intended | ||
|
||
<!-- All sections below are optional. You can erase any section not applicable to your Pull Request. --> | ||
|
||
# Notes :memo: | ||
* Any notes/thoughts that the reviewers should know prior to reviewing the code? |
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: Leaked Secrets Scan | ||
on: [pull_request] | ||
jobs: | ||
TruffleHog: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: TruffleHog OSS | ||
uses: trufflesecurity/trufflehog@0c66d30c1f4075cee1aada2e1ab46dabb1b0071a | ||
with: | ||
path: ./ | ||
base: ${{ github.event.repository.default_branch }} | ||
head: HEAD | ||
extra_args: --debug --only-verified |
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,31 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
run-tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- name: Solidity | ||
directory: 'templates/hardhat/solidity' | ||
- name: Vyper | ||
directory: 'templates/hardhat/vyper' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "lts/*" | ||
- name: Install dependencies for ${{ matrix.name }} | ||
run: cd ${{ matrix.directory }} && yarn install --frozen-lockfile | ||
- name: Run ${{ matrix.name }} tests | ||
run: cd ${{ matrix.directory }} && yarn test |
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 @@ | ||
.DS_Store |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Jack Hamer | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,12 @@ | ||
# zkSync Contract Templates | ||
|
||
Welcome to the `zkSync Contract Templates` repository. This collection is designed for developers eager to build smart contracts on zkSync, featuring templates for Hardhat with Solidity and Vyper. These templates provide a robust starting point for contract development, testing and deployment. | ||
|
||
## 📁 Available Templates | ||
|
||
Currently, the repository offers specific templates for Hardhat, an Ethereum development environment, tailored for both Solidity and Vyper: | ||
|
||
### Hardhat Templates | ||
|
||
- [Solidity Template](./templates/hardhat/solidity/) | ||
- [Vyper Template](./templates/hardhat/vyper/) |
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 @@ | ||
WALLET_PRIVATE_KEY= |
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,113 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.vscode | ||
|
||
# hardhat artifacts | ||
artifacts | ||
cache | ||
|
||
# zksync artifacts | ||
artifacts-zk | ||
cache-zk | ||
|
||
# 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/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# 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 | ||
.env.test | ||
|
||
# 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 |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Matter Labs | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,51 @@ | ||
# zkSync Hardhat project template | ||
|
||
This project was scaffolded with [zksync-cli](https://github.com/matter-labs/zksync-cli). | ||
|
||
## Project Layout | ||
|
||
- `/contracts`: Contains solidity smart contracts. | ||
- `/deploy`: Scripts for contract deployment and interaction. | ||
- `/test`: Test files. | ||
- `hardhat.config.ts`: Configuration settings. | ||
|
||
## How to Use | ||
|
||
- `npm run compile`: Compiles contracts. | ||
- `npm run deploy`: Deploys using script `/deploy/deploy.ts`. | ||
- `npm run interact`: Interacts with the deployed contract using `/deploy/interact.ts`. | ||
- `npm run test`: Tests the contracts. | ||
|
||
Note: Both `npm run deploy` and `npm run interact` are set in the `package.json`. You can also run your files directly, for example: `npx hardhat deploy-zksync --script deploy.ts` | ||
|
||
### Environment Settings | ||
|
||
To keep private keys safe, this project pulls in environment variables from `.env` files. Primarily, it fetches the wallet's private key. | ||
|
||
Rename `.env.example` to `.env` and fill in your private key: | ||
|
||
``` | ||
WALLET_PRIVATE_KEY=your_private_key_here... | ||
``` | ||
|
||
### Network Support | ||
|
||
`hardhat.config.ts` comes with a list of networks to deploy and test contracts. Add more by adjusting the `networks` section in the `hardhat.config.ts`. To make a network the default, set the `defaultNetwork` to its name. You can also override the default using the `--network` option, like: `hardhat test --network dockerizedNode`. | ||
|
||
### Local Tests | ||
|
||
Running `npm run test` by default runs the [zkSync In-memory Node](https://era.zksync.io/docs/tools/testing/era-test-node.html) provided by the [@matterlabs/hardhat-zksync-node](https://era.zksync.io/docs/tools/hardhat/hardhat-zksync-node.html) tool. | ||
|
||
Important: zkSync In-memory Node currently supports only the L2 node. If contracts also need L1, use another testing environment like Dockerized Node. Refer to [test documentation](https://era.zksync.io/docs/tools/testing/) for details. | ||
|
||
## Useful Links | ||
|
||
- [Docs](https://era.zksync.io/docs/dev/) | ||
- [Official Site](https://zksync.io/) | ||
- [GitHub](https://github.com/matter-labs) | ||
- [Twitter](https://twitter.com/zksync) | ||
- [Discord](https://join.zksync.dev/) | ||
|
||
## License | ||
|
||
This project is under the [MIT](./LICENSE) license. |
Oops, something went wrong.