generated from defi-wonderland/solidity-foundry-boilerplate
-
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.
- Loading branch information
0 parents
commit f34cf53
Showing
22 changed files
with
3,461 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
MAINNET_RPC= | ||
MAINNET_DEPLOYER_PK= | ||
|
||
GOERLI_RPC= | ||
GOERLI_DEPLOYER_PK= | ||
|
||
ETHERSCAN_API_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 @@ | ||
*.sol linguist-language=Solidity |
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,46 @@ | ||
name: Linting | ||
|
||
on: [push] | ||
|
||
concurrency: | ||
group: ${{github.workflow}}-${{github.ref}} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
commitlint: | ||
name: Lint Commit Messages | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: wagoid/commitlint-github-action@v5 | ||
|
||
lint: | ||
name: Run Linters | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'yarn' | ||
|
||
- name: Install dependencies | ||
run: yarn --frozen-lockfile --network-concurrency 1 | ||
|
||
- run: yarn lint:check |
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,52 @@ | ||
name: Export Interfaces And Contracts | ||
|
||
on: [push] | ||
|
||
jobs: | ||
export: | ||
name: Generate Interfaces And Contracts | ||
# Remove the following line if you wish to export your Solidity contracts and interfaces and publish them to NPM | ||
if: false | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
export_type: ["interfaces", "contracts"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- name: Install dependencies | ||
run: yarn --frozen-lockfile | ||
|
||
- name: Build project and generate out directory | ||
run: yarn build | ||
|
||
- name: Update version | ||
run: yarn version --new-version "0.0.0-${GITHUB_SHA::8}" --no-git-tag-version | ||
|
||
- name: Export Solidity - ${{ matrix.export_type }} | ||
uses: defi-wonderland/[email protected] | ||
with: | ||
# Update package_name with your package name | ||
package_name: "my-cool-project" | ||
out: "out" | ||
interfaces: "solidity/interfaces" | ||
contracts: "solidity/contracts" | ||
export_type: "${{ matrix.export_type }}" | ||
|
||
- name: Publish to NPM - ${{ matrix.export_type }} | ||
# Update `my-cool-project` with your package name | ||
run: cd export/my-cool-project-${{ matrix.export_type }} && npm publish --access public | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
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,88 @@ | ||
name: Tests | ||
|
||
on: [push] | ||
|
||
concurrency: | ||
group: ${{github.workflow}}-${{github.ref}} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
forge: | ||
name: Run Unit and E2E Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "yarn" | ||
|
||
- name: Install dependencies | ||
run: yarn --frozen-lockfile --network-concurrency 1 | ||
|
||
- name: Precompile using 0.8.14 and via-ir=false | ||
run: yarn build | ||
|
||
- name: "Create env file" | ||
run: | | ||
touch .env | ||
echo MAINNET_RPC="${{ secrets.MAINNET_RPC }}" >> .env | ||
echo GOERLI_RPC="${{ secrets.GOERLI_RPC }}" >> .env | ||
cat .env | ||
- name: Run tests | ||
shell: bash | ||
run: yarn test | ||
|
||
forge-optimized: | ||
name: Run Optimized Unit Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "yarn" | ||
|
||
- name: Install dependencies | ||
run: yarn --frozen-lockfile --network-concurrency 1 | ||
|
||
- name: Precompile using 0.8.14 and via-ir=true | ||
run: yarn build:optimized | ||
|
||
- name: Run tests | ||
run: yarn test:unit | ||
# coverage: | ||
# name: Run Coverage Tests | ||
# runs-on: ubuntu-latest | ||
# strategy: | ||
# matrix: | ||
# node-version: [16.x] | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - name: Use Node.js | ||
# uses: actions/setup-node@v3 | ||
# with: | ||
# node-version: ${{ matrix.node-version }} | ||
# cache: "yarn" | ||
# - run: yarn install | ||
# - run: yarn build | ||
# - run: yarn coverage | ||
# - uses: codecov/codecov-action@v3 | ||
# with: | ||
# files: ./coverage/lcov.info | ||
# flags: production |
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,20 @@ | ||
# General | ||
yarn-error.log | ||
node_modules | ||
.DS_STORE | ||
|
||
# Foundry files | ||
cache | ||
out-via-ir | ||
|
||
# Config files | ||
.env | ||
|
||
# Avoid ignoring gitkeep | ||
!/**/.gitkeep | ||
|
||
# Keep the latest deployment only | ||
broadcast/*/*/* | ||
|
||
# Out dir | ||
out |
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 @@ | ||
_ |
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,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx --no-install commitlint --edit $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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
# 1. Build the contracts | ||
# 2. Stage build output | ||
# 2. Lint and stage style improvements | ||
yarn build && npx lint-staged |
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,29 @@ | ||
{ | ||
"extends": "solhint:recommended", | ||
"plugins": ["defi-wonderland"], | ||
"rules": { | ||
"compiler-version": ["off"], | ||
"constructor-syntax": "warn", | ||
"quotes": ["error", "single"], | ||
"func-visibility": ["warn", { "ignoreConstructors": true }], | ||
"not-rely-on-time": "off", | ||
"func-name-mixedcase": "off", | ||
"var-name-mixedcase": "off", | ||
"const-name-snakecase": "off", | ||
"no-inline-assembly": "off", | ||
"no-empty-blocks": "off", | ||
"private-vars-leading-underscore": ["warn", { "strict": false }], | ||
"defi-wonderland/non-state-vars-leading-underscore": ["warn"], | ||
"defi-wonderland/contract-data-order": ["warn"], | ||
"defi-wonderland/enum-name-camelcase": ["warn"], | ||
"defi-wonderland/immutable-name-snakecase": ["warn"], | ||
"defi-wonderland/import-statement-format": ["warn"], | ||
"defi-wonderland/interface-member-order": ["warn"], | ||
"defi-wonderland/interface-starts-with-i": ["warn"], | ||
"defi-wonderland/named-return-values": ["warn"], | ||
"defi-wonderland/struct-name-camelcase": ["warn"], | ||
"defi-wonderland/wonder-var-name-mixedcase": ["warn"], | ||
"avoid-low-level-calls": "off", | ||
"no-console": "off" | ||
} | ||
} |
Oops, something went wrong.