Open-source project
Uniswap/v4-core avatar
Uniswap/v4-core

uniswap-v4-core: the import path says contracts/, the tree says src/, and the example stops mid-comment

🦄 🦄 🦄 🦄 Core smart contracts of Uniswap v4

2,565 stars1,346 forksSolidityLicense varies

At a glance

What is it?
The singleton pool manager for Uniswap v4, released as draft code to be built in public, with one release tag from January 2025 and a branch pushed fifteen months later. Its architecture section is unusually clear; its integration example is unfinished.
Who is it for?
Judgment: this is the right repository to read if you are building on Uniswap v4, and the architecture section is the best part of it, because the delta invariant is stated in one sentence and the hook model is stated with its one irreversible choice named explicitly. Three things to check before you integrate.
Can I use it commercially?
Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
Is it still maintained?
Yes. The repository last received commits 23 days ago.
What is it written in?
Mainly Solidity, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • Uniswap/v4-core2,565 ★ · +29
Star history
Repository2026-09-302026-11-15
Uniswap/v4-core2.5k2.6k

29 Stars in the last 46 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The integration example ends mid-comment and the unlock call is an ellipsis

Here is the whole Solidity example the README offers for integrating with the core contracts:

solidity
import {IPoolManager} from 'v4-core/contracts/interfaces/IPoolManager.sol';
import {IUnlockCallback} from 'v4-core/contracts/interfaces/callback/IUnlockCallback.sol';

contract MyContract is IUnlockCallback {
    IPoolManager poolManager;

    function doSomethingWithPools() {
        // this function will call `unlockCallback` below
        poolManager.unlock(...);
    }

    function unlockCallback(bytes calldata data) external returns (bytes memory) {
        // disallow arbitrary caller
        if (msg.sender != address(poolManager)) revert Unauthorized();
        // perform po

The function body is cut off at a comment that begins the words perform po and then stops. The unlock call is a literal ellipsis rather than an argument list. The callback takes a data parameter and returns a value, and neither appears in the shown body.

So the snippet is a shape, not something you can paste into a project and compile, which is a shame because the shape contains the one thing worth copying. That is the caller check: the callback verifies that the message sender is the pool manager and reverts otherwise, because anyone can call an unlock callback if you do not.

What the example does not say is the context it runs in. The callback executes while the manager is unlocked, so the integrator's own code is running inside that window, and the README describes no reentrancy guidance at all.

The import path says contracts and the tree says src

Both of those import statements point into a `contracts/` directory. The repository structure section, a few paragraphs earlier, says the opposite:

markdown
src/
----interfaces/
    | IPoolManager.sol
    | ...
----libraries/
    | Position.sol
    | Pool.sol
    | ...
----test
----PoolManager.sol
...
test/
----libraries/
    | Position.t.sol
    | Pool.t.sol

Every contract is in `v4-core/src`, and there is no `contracts` directory at the top level. So the two sections of the same file disagree about the path an integrator should write, and the example is the half you would copy first.

The repository does carry a remappings file, which is the Foundry mechanism for rewriting import prefixes, so a `contracts/` to `src/` remap is the kind of thing that could make both statements true. The file's contents are not shown here, which means anyone hitting an unresolved import has to go and read it rather than guess.

One thing the diagram does get right is the naming discipline: the library `Position.sol` has a test named `Position.t.sol` and `Pool.sol` has `Pool.t.sol`. In a tree with two directories both containing similarly named Solidity, that one-to-one convention is the only thing that makes it navigable.

One invariant holds the whole unlock together, and the action list mixes two granularities

The architecture is a singleton. All pool state lives in a single contract, and every action against any pool happens after an initial call to unlock. The integrator implements a callback and, inside it, may run any of seven actions:

swap, modifyLiquidity, donate, take, settle, mint, burn.

That list is two levels of abstraction wearing one bullet list. Swap and modifyLiquidity are the operations an integrator actually wants. Take and settle are the accounting legs that move value without being operations in their own right, and mint and burn sit between the two. Understanding the protocol means understanding both levels, and the README presents them as equals.

There is one documented exception, and it is the one you need first: pool initialisation can happen outside the context of unlocking the manager. So creating a pool is the only action that does not require an unlock.

The safety argument is one sentence and it is a good one. Only the net balance owed, positive to the user or negative to the pool, is tracked, and it lives in a delta field on the unlock state. Any number of actions may run, provided the accumulated deltas reach zero by the time the unlock is released.

That single condition is what makes the whole design safe, and it is also why an integrator that forgets a settle gets a revert rather than a drained pool.

A hook's code can change but its callback set cannot

A pool may be initialised with a hook contract, and the hook may implement ten callbacks, in five before and after pairs: initialise, add liquidity, remove liquidity, swap, and donate.

Two facts about that list matter more than the list itself.

The first is what is missing. There are no callbacks around take or settle, which are the two accounting primitives. A hook can watch and intervene on every value-moving lifecycle event the protocol defines, but it cannot observe or modify the settlement legs. Anyone building a hook that needs to see every balance change will not find one in this set.

The second is the immutability rule, and it is stated unusually precisely. The callback logic may be updated by the hooks depending on their implementation, but which callbacks are executed on a pool cannot change after pool initialisation.

So the identity of a pool's hooks is fixed at creation and the behaviour behind them is not. That is the deliberate design choice of the hook model, and it is also its risk surface: a pool's hook address cannot be swapped, but the code at that address can. Anyone reading a pool is reading two contracts, one of which can change its mind.

The licence is stated three different ways and each file has to be opened

Take the three places a licence is named and they do not agree.

The repository's own licence metadata is empty, so nothing is asserted there at all. The published package declares a single licence, the Business Source License 1.1, in its manifest field. The README says something different and longer: that the project is licensed under the Business Source License 1.1 and the MIT License, and that each file states the applicable licence type in its header.

Two licence files sit in a directory at the root of the tree, matching the two the README links to, which is consistent with the per-file claim and inconsistent with the package manifest recording only one.

The practical consequence is that you cannot answer a compliance question from the repository landing page or from npm. Which terms apply to a file you are about to vendor is decided by a header inside that file, and nothing in the tooling checks it for you.

It is also worth being clear that the README does not characterise the difference between the two. One is a source-available licence with use restrictions and one is a permissive open source licence, and the file treats them as a menu rather than explaining when each applies. If the distinction matters to your use, ask rather than infer it.

The npm package is 1.0.2 and the only protocol release is v4.0.0

There are two version lines in this repository and they do not meet.

The published package is scoped, versioned 1.0.2, and its manifest declares no dependencies and no scripts at all. It is a publication descriptor rather than a build: the thing you install from npm is metadata, and the thing you depend on is the Solidity.

The single GitHub release is tagged v4.0.0 and named Uniswap Protocol v4, published on 23 January 2025. So the npm line has reached 1.0.2 while the protocol line has sat at 4.0.0 since January, and neither number tells you anything about the other.

The default branch was pushed on 24 April 2026, fifteen months after that release. Combined with the README's own description of the contracts as early-stage draft code released so the protocol can be built in public, you have a repository that both claims to be a draft and carries a 1.0 tag.

Two details in the manifest are worth crediting. Publication is configured for public access with provenance enabled, which is supply-chain attestation rather than a promise, and the bug tracker field points at a bounty programme rather than at a tracker. Neither of those is common in a Solidity repository's package manifest.

The homepage is set to the README anchor, while the repository metadata homepage is a blog post about v4.

just test installs your dependencies first, and there is no lint recipe

The build tasks are short enough to read in full:

code
test *args: (test-forge args)
build *args: (build-forge args)
prep *args: fix (test-forge args)

test-forge *args: build-forge
    forge test --isolate {{args}}

build-forge *args: install-forge
    forge build {{args}}

install-forge:
    forge install

fix:
    forge fmt

Three things fall out of that dependency chain. Running the tests runs a build first, and a build runs forge install, so a test invocation fetches dependencies rather than using what is on disk. Both tasks, therefore, reach out to the network. And the prep task, which is the one a contributor should run before a pull request, formats and then runs the whole test suite.

The isolate flag on the test recipe is the detail worth knowing: each test runs in its own process, which is what lets tests share a deployment without leaking state into each other.

What is missing is a lint recipe. The tree has a Solidity linter configuration and a Prettier configuration, and the README carries a badge pointing at a lint workflow, but there is no local task that runs either. So the formatting and linting you would want before pushing are only available through continuous integration.

Also in the tree and not in the recipe file: a fuzzing configuration for property-based testing, a snapshots directory that presumably holds generated gas figures, and a set of test helper contracts kept inside the source directory rather than the test directory, so helpers ship alongside the code they help test.

Editorial conclusion

Judgment: this is the right repository to read if you are building on Uniswap v4, and the architecture section is the best part of it, because the delta invariant is stated in one sentence and the hook model is stated with its one irreversible choice named explicitly. Three things to check before you integrate. The integration example cannot be copied: it ends mid-comment, it calls the unlock function with a literal ellipsis, and its import paths point at a directory the repository does not have, so read the tree rather than the snippet. The licence is stated three different ways across the metadata, the published package and the README, and which one applies to a given file depends on a header you have to open. And the project describes itself as early draft code while carrying a v4.0.0 release tag, so pin by commit if you need reproducibility. There is no local lint recipe despite a lint workflow and a Solidity linter configuration, so wire that into your own pipeline before you trust a build.

Frequently asked questions

What is Uniswap v4-core and what does it contain?

It hosts the core pool logic for Uniswap v4, using a singleton architecture where all pool state is managed in a single PoolManager contract. The contracts live under `v4-core/src`, with interfaces, libraries and the manager itself, and the foundry tests live under `v4-core/test`. The repository describes itself as early-stage draft code released so the protocol can be built in public.

How do you call a Uniswap v4 pool from a smart contract?

You call unlock on the pool manager and implement a callback. Inside the callback you may run any number of actions, among them swap, modifyLiquidity, donate, take, settle, mint and burn. Only the net balance owed is tracked, in a delta field on the unlock state, and the accumulated deltas must reach zero by the time the unlock is released. Pool initialisation is the one action that can happen outside an unlock.

What licence is Uniswap v4-core under?

The README states two licences, the Business Source License 1.1 and the MIT License, and says each file declares which one applies in its header. The published npm package declares only the Business Source License 1.1, and the repository's licence metadata field is empty, so which terms govern a given file has to be determined by opening that file.

Official sources

  1. Issues
  2. Project website
  3. README
  4. Releases
  5. Uniswap/v4-core on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/uniswap-v4-core.svg)](https://hysenlabs.com/projects/uniswap-v4-core)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/uniswap-v4-core.svg)](https://hysenlabs.com/projects/uniswap-v4-core)

Was this useful?