Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replacing environment for foundry boilerplate #1

Merged
merged 3 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 0 additions & 113 deletions .circleci/config.yml

This file was deleted.

7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
MAINNET_RPC=
MAINNET_DEPLOYER_PK=

SEPOLIA_RPC=
SEPOLIA_DEPLOYER_PK=

ETHERSCAN_API_KEY=
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

19 changes: 0 additions & 19 deletions .eslintrc

This file was deleted.

1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

92 changes: 92 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: CI

on: [push]

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

env:
MAINNET_RPC: ${{ secrets.MAINNET_RPC }}
SEPOLIA_RPC: ${{ secrets.SEPOLIA_RPC }}

jobs:
unit-tests:
name: Run 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: 18.x
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: Run tests
shell: bash
run: yarn test:unit

integration-tests:
name: Run Integration 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: 18.x
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: Run tests
run: yarn test:integration

lint:
name: Lint Commit Messages
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: wagoid/commitlint-github-action@v5

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'

- name: Install dependencies
run: yarn --frozen-lockfile --network-concurrency 1

- run: yarn lint:check
Comment on lines +13 to +92

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wdyt about commenting out this in the meantime? So the CI does not fail.

27 changes: 20 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
build
node_modules
.idea/*
coverage.json
coverage/
# General
yarn-error.log
crytic-export
mcore_*
node_modules
.DS_STORE
.vscode

# Foundry files
cache
out-via-ir

# Config files
.env

# Avoid ignoring gitkeep
!/**/.gitkeep

# Keep the latest deployment only
broadcast/*/*/*

# Out dir
out
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/commit-msg
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
7 changes: 7 additions & 0 deletions .husky/pre-commit
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
8 changes: 0 additions & 8 deletions .solcover.js

This file was deleted.

18 changes: 13 additions & 5 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
{
"extends": "solhint:recommended",
"rules": {
"mark-callable-contracts": "off",
"event-name-camelcase": "off",
"const-name-snakecase": "off",
"max-line-length": ["warn", 120],
"indent": ["error", 4]
"compiler-version": ["off"],
"constructor-syntax": "warn",
"quotes": ["error", "single"],
"func-visibility": ["warn", { "ignoreConstructors": true }],
"not-rely-on-time": "off",
"no-inline-assembly": "off",
"no-empty-blocks": "off",
"private-vars-leading-underscore": ["warn", { "strict": false }],
"ordering": "warn",
"immutable-name-snakecase": "warn",
"avoid-low-level-calls": "off",
"no-console": "off",
"max-line-length": ["warn", 120]
}
}
25 changes: 25 additions & 0 deletions .solhint.tests.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": "solhint:recommended",
"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",
"definition-name-capwords": "off",
"named-parameters-function": "off",
"no-global-import": "off",
"max-states-count": "off",
"private-vars-leading-underscore": ["warn", { "strict": false }],
"ordering": "warn",
"immutable-name-snakecase": "warn",
"avoid-low-level-calls": "off",
"one-contract-per-file": "off",
"max-line-length": ["warn", 120]
}
}
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
36 changes: 36 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[fmt]
line_length = 120
tab_width = 2
bracket_spacing = false
int_types = 'long'
quote_style = 'single'
number_underscore = 'thousands'
multiline_func_header = 'params_first'
sort_imports = true

[profile.default]
solc_version = '0.5.12'
libs = ["node_modules", "lib"]
optimizer_runs = 10_000

[profile.optimized]
via_ir = true
out = 'out-via-ir'

[profile.test]
via_ir = true
out = 'out-via-ir'

[profile.docs]
src = 'src/interfaces/'

[fuzz]
runs = 1000

[rpc_endpoints]
mainnet = "${MAINNET_RPC}"
sepolia = "${SEPOLIA_RPC}"

[etherscan]
mainnet = { key = "${ETHERSCAN_API_KEY}", chain = "mainnet" }
sepolia = { key = "${ETHERSCAN_API_KEY}", chain = "sepolia" }
5 changes: 0 additions & 5 deletions migrations/1_initial_migration.js

This file was deleted.

Loading
Loading