-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add foundry contracts for testing and examples * forge install: v4-core * forge install: v4-periphery * fix v4 deps * add no op example * no op swap example * linting
- Loading branch information
1 parent
78b8475
commit d991235
Showing
85 changed files
with
28,998 additions
and
78 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,6 @@ | ||
[submodule "contracts/lib/v4-core"] | ||
path = contracts/lib/v4-core | ||
url = https://github.com/uniswap/v4-core | ||
[submodule "contracts/lib/v4-periphery"] | ||
path = contracts/lib/v4-periphery | ||
url = https://github.com/uniswap/v4-periphery |
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,3 @@ | ||
cache | ||
out | ||
broadcast |
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,66 @@ | ||
## Foundry | ||
|
||
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** | ||
|
||
Foundry consists of: | ||
|
||
- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools). | ||
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. | ||
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network. | ||
- **Chisel**: Fast, utilitarian, and verbose solidity REPL. | ||
|
||
## Documentation | ||
|
||
https://book.getfoundry.sh/ | ||
|
||
## Usage | ||
|
||
### Build | ||
|
||
```shell | ||
$ forge build | ||
``` | ||
|
||
### Test | ||
|
||
```shell | ||
$ forge test | ||
``` | ||
|
||
### Format | ||
|
||
```shell | ||
$ forge fmt | ||
``` | ||
|
||
### Gas Snapshots | ||
|
||
```shell | ||
$ forge snapshot | ||
``` | ||
|
||
### Anvil | ||
|
||
```shell | ||
$ anvil | ||
``` | ||
|
||
### Deploy | ||
|
||
```shell | ||
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key> | ||
``` | ||
|
||
### Cast | ||
|
||
```shell | ||
$ cast <subcommand> | ||
``` | ||
|
||
### Help | ||
|
||
```shell | ||
$ forge --help | ||
$ anvil --help | ||
$ cast --help | ||
``` |
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 @@ | ||
[profile.default] | ||
src = "src" | ||
out = "out" | ||
libs = ["lib"] | ||
ffi = true | ||
fs_permissions = [{ access = "read-write", path = ".forge-snapshots/"}] | ||
cancun = true | ||
|
||
# For Linux/WSL2 systems, please change to `lib/v4-core/bin/solc-static-linux` | ||
solc = "lib/v4-core/bin/solc-mac" | ||
|
||
# See more config options https://github.com/foundry-rs/foundry/tree/master/config |
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,134 @@ | ||
name: CI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Foundry | ||
uses: onbjerg/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Print forge version | ||
run: forge --version | ||
|
||
# Backwards compatibility checks: | ||
# - the oldest and newest version of each supported minor version | ||
# - versions with specific issues | ||
- name: Check compatibility with latest | ||
if: always() | ||
run: | | ||
output=$(forge build --skip test) | ||
if echo "$output" | grep -q "Warning"; then | ||
echo "$output" | ||
exit 1 | ||
fi | ||
- name: Check compatibility with 0.8.0 | ||
if: always() | ||
run: | | ||
output=$(forge build --skip test --use solc:0.8.0) | ||
if echo "$output" | grep -q "Warning"; then | ||
echo "$output" | ||
exit 1 | ||
fi | ||
- name: Check compatibility with 0.7.6 | ||
if: always() | ||
run: | | ||
output=$(forge build --skip test --use solc:0.7.6) | ||
if echo "$output" | grep -q "Warning"; then | ||
echo "$output" | ||
exit 1 | ||
fi | ||
- name: Check compatibility with 0.7.0 | ||
if: always() | ||
run: | | ||
output=$(forge build --skip test --use solc:0.7.0) | ||
if echo "$output" | grep -q "Warning"; then | ||
echo "$output" | ||
exit 1 | ||
fi | ||
- name: Check compatibility with 0.6.12 | ||
if: always() | ||
run: | | ||
output=$(forge build --skip test --use solc:0.6.12) | ||
if echo "$output" | grep -q "Warning"; then | ||
echo "$output" | ||
exit 1 | ||
fi | ||
- name: Check compatibility with 0.6.2 | ||
if: always() | ||
run: | | ||
output=$(forge build --skip test --use solc:0.6.2) | ||
if echo "$output" | grep -q "Warning"; then | ||
echo "$output" | ||
exit 1 | ||
fi | ||
# via-ir compilation time checks. | ||
- name: Measure compilation time of Test with 0.8.17 --via-ir | ||
if: always() | ||
run: forge build --skip test --contracts test/compilation/CompilationTest.sol --use solc:0.8.17 --via-ir | ||
|
||
- name: Measure compilation time of TestBase with 0.8.17 --via-ir | ||
if: always() | ||
run: forge build --skip test --contracts test/compilation/CompilationTestBase.sol --use solc:0.8.17 --via-ir | ||
|
||
- name: Measure compilation time of Script with 0.8.17 --via-ir | ||
if: always() | ||
run: forge build --skip test --contracts test/compilation/CompilationScript.sol --use solc:0.8.17 --via-ir | ||
|
||
- name: Measure compilation time of ScriptBase with 0.8.17 --via-ir | ||
if: always() | ||
run: forge build --skip test --contracts test/compilation/CompilationScriptBase.sol --use solc:0.8.17 --via-ir | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Foundry | ||
uses: onbjerg/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Print forge version | ||
run: forge --version | ||
|
||
- name: Run tests | ||
run: forge test -vvv | ||
|
||
fmt: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Foundry | ||
uses: onbjerg/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Print forge version | ||
run: forge --version | ||
|
||
- name: Check formatting | ||
run: forge fmt --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,29 @@ | ||
name: Sync Release Branch | ||
|
||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
sync-release-branch: | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.event.release.tag_name, 'v1') | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: v1 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name github-actions[bot] | ||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
- name: Sync Release Branch | ||
run: | | ||
git fetch --tags | ||
git checkout v1 | ||
git reset --hard ${GITHUB_REF} | ||
git push --force |
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 @@ | ||
cache/ | ||
out/ | ||
.vscode | ||
.idea |
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,3 @@ | ||
[submodule "lib/ds-test"] | ||
path = lib/ds-test | ||
url = https://github.com/dapphub/ds-test |
Oops, something went wrong.