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.BalancerBuilderBaseBuilds 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:
DegenbotValueError – If the operation fails.
BrokenPool – If the operation fails.