Skip to content

Commit

Permalink
feat: mock interop
Browse files Browse the repository at this point in the history
  • Loading branch information
hexshire committed Nov 27, 2024
0 parents commit bf17b76
Show file tree
Hide file tree
Showing 28 changed files with 4,279 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DEPLOYER_PK=
OWNER_ADDR=
CREATE2_SALT=
UNICHAIN_SEPOLIA_RPC=
OPTIMISM_SEPOLIA_RPC=
UNICHAIN_EXPLORER_API=
OPTIMISM_EXPLORER_API=
OPTIMISM_EXPLORER_API_KEY=
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sol linguist-language=Solidity
73 changes: 73 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Coverage Check

on: [push]

env:
COVERAGE_SENSITIVITY_PERCENT: 1

jobs:
upload-coverage:
name: Upload Coverage
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

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

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

- name: Run coverage
shell: bash
run: yarn coverage

- name: Setup LCOV
uses: hrishikesh-kadam/setup-lcov@v1

- name: Filter directories
run: lcov --remove lcov.info 'test/*' 'script/*' --output-file lcovNew.info --rc lcov_branch_coverage=1 --rc derive_function_end_line=0 --ignore-errors unused

- name: Capture coverage output
id: new-coverage
uses: zgosalvez/github-actions-report-lcov@v4
with:
coverage-files: lcovNew.info

- name: Retrieve previous coverage
uses: actions/download-artifact@v4
with:
name: coverage.info
continue-on-error: true

- name: Check if a previous coverage exists
run: |
if [ ! -f coverage.info ]; then
echo "Artifact not found. Initializing at 0"
echo "0" >> coverage.info
fi
- name: Compare previous coverage
run: |
old=$(cat coverage.info)
new=$(( ${{ steps.new-coverage.outputs.total-coverage }} + ${{ env.COVERAGE_SENSITIVITY_PERCENT }} ))
if [ "$new" -lt "$old" ]; then
echo "Coverage decreased from $old to $new"
exit 1
fi
mv lcovNew.info coverage.info
- name: Upload the new coverage
uses: actions/upload-artifact@v4
with:
name: coverage.info
path: ./coverage.info
73 changes: 73 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Coverage Check

on: [push]

env:
COVERAGE_SENSITIVITY_PERCENT: 1

jobs:
upload-coverage:
name: Upload Coverage
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

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

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

- name: Run coverage
shell: bash
run: yarn coverage

- name: Setup LCOV
uses: hrishikesh-kadam/setup-lcov@v1

- name: Filter directories
run: lcov --remove lcov.info 'test/*' 'script/*' --output-file lcovNew.info --rc lcov_branch_coverage=1 --rc derive_function_end_line=0 --ignore-errors unused

- name: Capture coverage output
id: new-coverage
uses: zgosalvez/github-actions-report-lcov@v4
with:
coverage-files: lcovNew.info

- name: Retrieve previous coverage
uses: actions/download-artifact@v4
with:
name: coverage.info
continue-on-error: true

- name: Check if a previous coverage exists
run: |
if [ ! -f coverage.info ]; then
echo "Artifact not found. Initializing at 0"
echo "0" >> coverage.info
fi
- name: Compare previous coverage
run: |
old=$(cat coverage.info)
new=$(( ${{ steps.new-coverage.outputs.total-coverage }} + ${{ env.COVERAGE_SENSITIVITY_PERCENT }} ))
if [ "$new" -lt "$old" ]; then
echo "Coverage decreased from $old to $new"
exit 1
fi
mv lcovNew.info coverage.info
- name: Upload the new coverage
uses: actions/upload-artifact@v4
with:
name: coverage.info
path: ./coverage.info
92 changes: 92 additions & 0 deletions .github/workflows/tests.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:
UNICHAIN_SEPOLIA_RPC: ${{ secrets.UNICHAIN_SEPOLIA_RPC }}
OPTIMISM_SEPOLIA_RPC: ${{ secrets.OPTIMISM_SEPOLIA_RPC }}

jobs:
unit-tests:
name: Run Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

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

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

- name: Precompile using 0.8.25 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@v4

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

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

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

- name: Precompile using 0.8.25 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@v4
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@v4
with:
node-version: 22.x
cache: 'yarn'

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

- run: yarn lint:check
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# General
yarn-error.log
node_modules
.DS_STORE
.vscode

# Foundry files
cache
out-via-ir

# Config files
.env
.notes

# Avoid ignoring gitkeep
!/**/.gitkeep

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

# Out dir
out
crytic-export

# Echidna corpus
test/invariants/fuzz/echidna_coverage
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no-install commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 1. Build the contracts
# 2. Stage build output
# 3. Lint and stage style improvements
yarn build && npx lint-staged
26 changes: 26 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": [
"warn"
],
"quotes": "off",
"func-visibility": [
"warn",
{
"ignoreConstructors": true
}
],
"no-inline-assembly": "off",
"no-empty-blocks": "off",
"private-vars-leading-underscore": [
"warn",
{
"strict": false
}
],
"ordering": "warn",
"avoid-low-level-calls": "off",
"named-parameters-mapping": "warn"
}
}
8 changes: 8 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The MIT License (MIT)
Copyright © 2023 Wonderland

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.
Loading

0 comments on commit bf17b76

Please sign in to comment.