Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into use-proper-tick-spa…
Browse files Browse the repository at this point in the history
…cing-range
  • Loading branch information
hyunchel committed Nov 15, 2023
2 parents 3f523f3 + 78aa23b commit de2a449
Show file tree
Hide file tree
Showing 138 changed files with 2,733 additions and 11,870 deletions.
7 changes: 7 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FOUNDRY_FUZZ_SEED=0x4444

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
export FOUNDRY_SOLC="./bin/solc-static-linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
export FOUNDRY_SOLC="./bin/solc-mac"
fi
Original file line number Diff line number Diff line change
@@ -1 +1 @@
85384
172021
2 changes: 1 addition & 1 deletion .forge-snapshots/cached dynamic fee, no hooks.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
82539
158656
2 changes: 1 addition & 1 deletion .forge-snapshots/donate gas with 1 token.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
95961
76947
2 changes: 1 addition & 1 deletion .forge-snapshots/donate gas with 2 tokens.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
153292
134745
1 change: 1 addition & 0 deletions .forge-snapshots/erc20 collect protocol fees.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
25033
2 changes: 1 addition & 1 deletion .forge-snapshots/gas overhead of no-op lock.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
58562
14918
2 changes: 1 addition & 1 deletion .forge-snapshots/initialize.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
38123
38101
2 changes: 1 addition & 1 deletion .forge-snapshots/mint with empty hook.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
307130
264055
2 changes: 1 addition & 1 deletion .forge-snapshots/mint with native token.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
275102
232085
2 changes: 1 addition & 1 deletion .forge-snapshots/mint.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
293738
250721
1 change: 1 addition & 0 deletions .forge-snapshots/native collect protocol fees.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
36699
1 change: 1 addition & 0 deletions .forge-snapshots/poolManager bytecode size.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24630
1 change: 1 addition & 0 deletions .forge-snapshots/simple swap native.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
132772
2 changes: 1 addition & 1 deletion .forge-snapshots/simple swap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
49771
129248
Original file line number Diff line number Diff line change
@@ -1 +1 @@
125033
106413
2 changes: 1 addition & 1 deletion .forge-snapshots/swap against liquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
109721
91101
1 change: 1 addition & 0 deletions .forge-snapshots/swap burn claim for input.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
107809
1 change: 1 addition & 0 deletions .forge-snapshots/swap mint output as claim.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
147831
2 changes: 1 addition & 1 deletion .forge-snapshots/swap with dynamic fee.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
84493
171256
2 changes: 1 addition & 1 deletion .forge-snapshots/swap with hooks.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
49742
91079
1 change: 0 additions & 1 deletion .forge-snapshots/swap with native.snap

This file was deleted.

2 changes: 1 addition & 1 deletion .forge-snapshots/update dynamic fee in before swap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
91231
177851
346 changes: 346 additions & 0 deletions .gas-snapshot

Large diffs are not rendered by default.

13 changes: 2 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,10 @@ jobs:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

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

- name: Compile
run: yarn prettier-check
- name: Lint
run: forge fmt --check
35 changes: 11 additions & 24 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,6 @@ on:
pull_request:

jobs:
unit-tests:
name: Hardhat Unit Tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

# This is required separately from yarn test because it generates the typechain definitions
- name: Compile
run: yarn compile

- name: Run unit tests
run: yarn test

forge-tests:
name: Forge Tests
runs-on: ubuntu-latest
Expand All @@ -52,7 +28,18 @@ jobs:
with:
version: nightly

- name: Build
run: forge build
env:
FOUNDRY_PROFILE: ci

- name: Run tests
run: forge test -vvv
env:
FOUNDRY_PROFILE: ci

- name: Run forge snapshots
run: forge snapshot --check --tolerance 25
env:
FOUNDRY_PROFILE: ci
FOUNDRY_FUZZ_SEED: "0x4444"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ crytic-export/
node_modules/
typechain/
foundry-out/
.vscode/
.vscode/
out/
22 changes: 9 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Finally, before opening a pull request please do the following:
- Run the tests and snapshots. Commands are outlined in the [tests](#tests) section.
- Document any new functions, structs, or interfaces following the natspec standard.
- Add tests! For smaller contributions, they should be tested with unit tests, and fuzz tests where possible. For bigger contributions, they should be tested with integration tests and invariant tests where possible.
- Make sure all commits are [signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification)
- Make sure all commits are [signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification)

## Standards

Expand All @@ -46,28 +46,24 @@ All contributions must follow the below standards. Maintainers will close out PR

## Setup

`yarn install` to install dependencies for hardhat

`yarn compile` to compile contracts for hardhat
Run `source .env` to set FOUNDRY_SOLC to the correct solc binary.

`forge build` to get contract artifacts and dependencies for forge

## Tests

This repo currently uses hardhat and forge tests. Please run both test suites before opening a PR.
If after running `source .env`, you continue to get the error `Function "tload" not found.` try running

`yarn snapshots` to update the hardhat gas snapshots
On MacOS:
`forge build --use ./bin/solc-mac`

`yarn test` to run hardhat tests
On Linux:
`forge build --use ./bin/solc-static-linux`

`yarn prettier` to run the formatter (runs both typescript and solidity formatting)
## Tests

`forge snapshot`to update the forge gas snapshots
`forge snapshot` to update the forge gas snapshots. Note these must use a static fuzz seed, so please run `source .env`, use `FOUNDRY_FUZZ_SEED=0x4444`, or use `just snapshots` when running forge snapshots.

`forge test` to run forge tests

Any new tests that you add should be written with forge, as the repo is undergoing a full migration to the forge test suite.

## Code of Conduct

Above all else, please be respectful of the people behind the code. Any kind of aggressive or disrespectful comments, issues, and language will be removed.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ If you’re interested in contributing please see our [contribution guidelines](

## Whitepaper

A more detailed description of Uniswap v4 Core can be found in the draft of the [Uniswap v4 Core Whitepaper](./whitepaper-v4-draft.pdf).
A more detailed description of Uniswap v4 Core can be found in the draft of the [Uniswap v4 Core Whitepaper](./docs/whitepaper-v4.pdf).

## Architecture

Expand All @@ -26,7 +26,7 @@ A more detailed description of Uniswap v4 Core can be found in the draft of the
- `settle`
- `mint`

Only the net balances owed to the pool (negative) or to the user (positive) are tracked throughout the duration of a lock. This is the `delta` field held in the lock state. Any number of actions can be run on the pools, as long as the deltas accumulated during the lock reach 0 by the lock’s release. This lock and call style architecture gives callers maximum flexibility in integrating with the core code.
Only the net balances owed to the pool (positive) or to the user (negative) are tracked throughout the duration of a lock. This is the `delta` field held in the lock state. Any number of actions can be run on the pools, as long as the deltas accumulated during the lock reach 0 by the lock’s release. This lock and call style architecture gives callers maximum flexibility in integrating with the core code.

Additionally, a pool may be initialized with a hook contract, that can implement any of the following callbacks in the lifecycle of pool actions:

Expand Down
Binary file added bin/solc-mac
Binary file not shown.
Binary file added bin/solc-static-linux
Binary file not shown.
50 changes: 0 additions & 50 deletions contracts/libraries/LockDataLibrary.sol

This file was deleted.

87 changes: 0 additions & 87 deletions contracts/test/BaseTestHooks.sol

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit de2a449

Please sign in to comment.