PoolAddress

Functions for computing deterministic pool addresses.

Source: contracts/periphery/libraries/PoolAddress.sol

Overview

Pools are deployed using CREATE2, making their addresses deterministic and computable off-chain.

Structs

PoolKey

struct PoolKey {
    address token0;
    address token1;
    uint24 fee;
}

Functions

getPoolKey

function getPoolKey(
    address tokenA,
    address tokenB,
    uint24 fee
) internal pure returns (PoolKey memory)

Returns the PoolKey with tokens sorted (token0 < token1).

computeAddress

Computes the pool address for the given factory and pool key.

Note: Requires the correct POOL_INIT_CODE_HASH constant.

JavaScript Implementation

Getting Init Code Hash

Deploy the PoolInitHelper and call it:

Usage Example

Last updated