Navigate:
Uniswap v4 Core
~$V4UC0.2%

Uniswap v4 Core: Automated market maker protocol

Core smart contracts for Uniswap v4's extensible and customizable automated market maker pools.

LIVE RANKINGS • 03:41 AM • STEADY
OVERALL
#294
129
CRYPTO
#12
13
30 DAY RANKING TREND
ovr#294
·Crypt#12
STARS
2.4K
FORKS
1.3K
7D STARS
+6
7D FORKS
+1
Tags:
See Repo:
Share:

Learn more about Uniswap v4 Core

Uniswap v4 Core is an automated market maker protocol that provides extensible and customizable liquidity pools. The system uses a singleton-style architecture where all pool state is managed in the PoolManager.sol contract, with pool actions executed through an unlock/callback pattern. The protocol supports customizable hook contracts that can execute callbacks during pool lifecycle events like swaps, liquidity modifications, and donations. It is designed for creating decentralized exchange functionality with flexible integration patterns for developers.

Uniswap v4 Core

1

Singleton Architecture

All pool state is managed in a single PoolManager contract, with actions executed through an unlock/callback pattern that tracks net balance deltas.

2

Customizable Hooks

Pools can be initialized with hook contracts that implement callbacks during pool lifecycle events, providing extensible functionality.

3

Flexible Integration

The unlock and call style architecture allows multiple pool actions within a single transaction as long as net deltas reach zero.


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 pool actions
        poolManager.swap(...)
    }
}

error Unauthorized();


vv4.0.0

Uniswap Protocol v4



[ EXPLORE MORE ]

Related Repositories

Discover similar tools and frameworks used by developers