Skip to content

Commit

Permalink
Merge 4b3e940 into 69443fe
Browse files Browse the repository at this point in the history
  • Loading branch information
mfw78 committed Jun 3, 2024
2 parents 69443fe + 4b3e940 commit 6b082ce
Show file tree
Hide file tree
Showing 10 changed files with 164 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "Foundry + Node",
"image": "mcr.microsoft.com/devcontainers/base:0",
"features": {
"ghcr.io/nlordell/features/foundry": {},
"ghcr.io/devcontainers/features/node:1": {}
},
"customizations": {
"vscode" : {
"extensions": [
"JuanBlanco.solidity"
]
}
}
}
1 change: 1 addition & 0 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TestNoOp:test_noOp() (gas: 122)
43 changes: 43 additions & 0 deletions .github/workflows/gas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Gas

on:
pull_request:
paths:
- '**.sol'
- '**.yml'
push:
branches:
- main
paths:
- '**.sol'
- '**.yml'

env:
FOUNDRY_PROFILE: ci

jobs:
gas:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions/setup-node@v4
- id: yarn-cache
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-
- run: yarn --frozen-lockfile

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

- name: Check gas snapshots
run: forge snapshot --check
56 changes: 56 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Test

on:
workflow_dispatch:
pull_request:
paths:
- '**.sol'
- '**.yml'
push:
branches:
- main
paths:
- '**.sol'
- '**.yml'

env:
FOUNDRY_PROFILE: ci

jobs:
test:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions/setup-node@v4
- id: yarn-cache
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-
- run: yarn --frozen-lockfile

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

- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv
id: test
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,15 @@ yarn-error.log
*.tgz
state.json
.mocharc.json

# Compiler files
cache/
out/

# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/

# Dotenv file
.env
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[solidity]": {
"editor.defaultFormatter": "JuanBlanco.solidity"
},
"solidity.compileUsingRemoteVersion": "v0.7.6+commit.7338295f",
}
20 changes: 20 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[profile.default]
src = "src"
out = "out"
libs = ["node_modules", "lib"]
remappings = [
"@ensdomains/=node_modules/@ensdomains/",
"@gnosis.pm/=node_modules/@gnosis.pm/",
"@openzeppelin/=node_modules/@openzeppelin/",
"@uniswap/=node_modules/@uniswap/",
"canonical-weth/=node_modules/canonical-weth/",
"eth-gas-reporter/=node_modules/eth-gas-reporter/",
"hardhat-deploy/=node_modules/hardhat-deploy/",
"hardhat/=node_modules/hardhat/",
]

# Compiler settings
solc = "0.7.6"
via_ir = false
optimizer = true
optimizer_runs = 1000000
1 change: 1 addition & 0 deletions lib/forge-std
Submodule forge-std added at 978ac6
7 changes: 7 additions & 0 deletions test/TestNoOp.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.7.6;

/// @dev No-op contract for start of forgifying contracts. Delete this!
contract TestNoOp {
function test_noOp() external pure {}
}

0 comments on commit 6b082ce

Please sign in to comment.