degenbot.registry.deployment_loader¶

Register DEX deployment records into the pool-type registry.

Companion layer (ADR-005): the data itself is read by degenbot.registry.deployment_records (a leaf module — it knows the JSON schema and the valid pool_type keys but resolves nothing to Python classes). This module owns the pool_type → Python class map, resolves the JSON string keys (pool_type → class, dex_variant → DexIdentity preset, family string → PoolFamily enum), and drives the registry’s low-level register().

The shipped deployments.json is the single source of deployment data (chain_id, factory → deployer / init_hash / variant / dex_identity preset). A user overlay path may be declared in config.toml under [deployments] → overlay; entries there override shipped entries on (chain_id, factory) conflict (user wins).

Module Contents¶

class degenbot.registry.deployment_loader.DeploymentRecord¶

A single deployment row loaded from JSON.

name: str¶
chain_id: int¶
pool_type: str¶
variant: str | None¶
dex_variant: str | None¶
family: str | None¶
factory: str¶
deployer: str | None¶
init_hash: str | None¶
implementation_address: str | None = None¶
degenbot.registry.deployment_loader.load_deployments(*, overlay_path: pathlib.Path | str | None = None) → list[DeploymentRecord]¶

Load deployment records from the shipped JSON, merged with an optional overlay.

The overlay is resolved in this order:

  1. The overlay_path argument (programmatic — used by tests).

  2. The [deployments] overlay setting in ~/.config/degenbot/config.toml.

Shipped defaults load first; overlay entries override on (chain_id, factory) conflict (overlay wins). The merged list preserves insertion order (shipped order, with overlays replacing in-place).

Returns:

The merged deployment records.

degenbot.registry.deployment_loader.load_json_deployments(path: pathlib.Path | str) → list[DeploymentRecord]¶

Load deployment records from an explicit JSON file path.

Convenience wrapper around the internal JSON reader — exposed for tests and programmatic callers that want to load a specific file without the shipped-defaults merge.

Returns:

The parsed deployment records.

degenbot.registry.deployment_loader.POOL_TYPE_MAP: dict[str, type[degenbot.types.abstract.AbstractLiquidityPool]]¶
degenbot.registry.deployment_loader.register_from_deployments(records: list[degenbot.registry.deployment_records.DeploymentRecord], registry: degenbot.registry.pool_type.PoolTypeRegistry) → None¶

Register deployment records into a PoolTypeRegistry.

Companion-layer orchestration (ADR-005): resolves the JSON string keys (pool_type → Python class, dex_variant → DexIdentity preset, family string → PoolFamily enum) and calls the registry’s low-level register() primitive for each record.

The dex_variant preset is resolved via dex_identity() and asserted non-None — a preset string in the JSON must resolve, otherwise the deployment data is inconsistent with the compiled DexIdentity presets (Rust-side).

Parameters:
  • records – The deployment records (typically from load_deployments()).

  • registry – The target registry (e.g. the pool_type_registry singleton).