degenbot.builders.balancer_builder¶

Balancer V2 pool builder.

Owns the full I/O choreography: RPC fetch → decode → construct → register. Pool type is determined via _detect_pool_type() which probes the contract for characteristics (has getNormalizedWeights → WEIGHTED, has getAmplificationParameter → STABLE). Raises a clear error for unknown types instead of defaulting to stable.

Module Contents¶

class degenbot.builders.balancer_builder.BalancerBuilder(ctx: degenbot.builders.context.BuilderContext)¶

Bases: degenbot.builders.balancer_builder_base.BalancerBuilderBase

Builds and updates Balancer V2 pools (weighted, stable, composable).

Owns the full I/O choreography: RPC fetch → decode → construct → register.

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

Fetch pool data from RPC and construct an I/O-free Balancer pool.

Returns:

The computed value.

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

Fetch new balances from Vault and update the pool.

Returns:

The computed value.

Raises:

TypeError – If the operation fails.