For the complete documentation index, see llms.txt. This page is also available as Markdown.

Discovering Pools

POE supports an unbounded number of pools — one per ordered (tokenX, tokenY) pair. Integrators do not have to hard-code each market: the Factory keeps a registry, so you can enumerate pools or look them up by pair on-chain.

The Factory address is the same on every supported chain (see POE Contracts):

Factory: 0x78120F2C0EBF0cc8B7E7749e62D36e6523dD711D

Factory Lookup API

interface IFactory {
    // Total number of pools ever created.
    function getPoolsLength() external view returns (uint256);

    // Index-based access. `poolId` is in [0, getPoolsLength()).
    function getPoolAt(uint256 poolId) external view returns (address);

    // Look up a pool by its ordered token pair. Returns address(0) if no pool exists.
    function getPool(address tokenX, address tokenY) external view returns (address);

    event PoolCreated(
        uint256 indexed poolId,
        address indexed pool,
        address tokenX,
        address tokenY,
        bytes data
    );
}

The pair ordering matters — getPool(tokenY, tokenX) is a different (typically non-existent) entry from getPool(tokenX, tokenY). Use the same ordering the pool was created with.

Listing every pool

Enumerate [0, getPoolsLength()) and resolve each pool to its token pair:

The pool exposes the pair via getTokens() (returns the same (tokenX, tokenY) tuple the pool was initialized with) and its current balances via getBalances(). See Tracking Liquidity for the full pool read API.

TypeScript

Python

Looking up a specific pair

If you already know the ordered pair, skip enumeration:

The first ordering you try may not match — pool creation pins a single direction. If getPool(a, b) returns zero, try getPool(b, a) before concluding the pair isn't listed.

Reacting to new pools

Pool creation emits a PoolCreated event from the Factory. Indexers and integrators can subscribe to this to discover new markets without polling:

poolId is the index used by getPoolAt; data is the per-pool initialization blob (currently maxValue (12 bytes) | oracle (20 bytes)).

Last updated