degenbot.builders.protocol¶

Protocol for pool construction and state updates.

Each builder owns: - The I/O choreography (Rust-backed metadata lookup → RPC fetch → decode → construct) - Pool registration in the Pool Registry - State updates via pool.external_update()

Builders do NOT own: - Pool type resolution (Bot’s job) - I/O routing (received via BotIo — the single Rust-backed executor) - Database I/O (owned by the Rust ConstructionIo handle attached to Bot)

Module Contents¶

class degenbot.builders.protocol.PoolBuilder¶

Bases: Protocol

Protocol for pool construction and state updates.

Builders must accept address as the first positional-or-keyword parameter in build(), and pool as the first positional-or-keyword parameter in update(). Optional parameters are forwarded via request: BuildPoolRequest — builders read the fields they recognize and ignore the rest.

The io argument is a BotIo — the single construction-I/O executor (Rust-backed, 65 methods). There is no sync/async fork; AsyncBot and the async builders are retired.

build(address: str, *, chain_id: int | None = None, io: degenbot._ffi.BotIo, request: degenbot.builders.request.BuildRequest) → degenbot.types.abstract.liquidity_pool.AbstractLiquidityPool¶

Build a pool from on-chain data.

static update(pool: degenbot.types.abstract.liquidity_pool.AbstractLiquidityPool, *, io: degenbot._ffi.BotIo | None = None, block_number: int | None = None) → bool¶

Update the pool state from on-chain data.