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.
- 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:
The
overlay_pathargument (programmatic — used by tests).The
[deployments] overlaysetting 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→DexIdentitypreset,familystring →PoolFamilyenum) and calls the registry’s low-levelregister()primitive for each record.The
dex_variantpreset is resolved viadex_identity()and asserted non-None — a preset string in the JSON must resolve, otherwise the deployment data is inconsistent with the compiledDexIdentitypresets (Rust-side).- Parameters:
records – The deployment records (typically from
load_deployments()).registry – The target registry (e.g. the
pool_type_registrysingleton).