degenbot.types.pool_type¶
PoolFamily and kind enums for pool type resolution.
Module Contents¶
- class degenbot.types.pool_type.PoolProbe¶
Bases:
enum.IntEnumThe on-chain probe outcome BotIo.probe_pool_type returns.
The Rust probe (pool_builder::builder) classifies a contract by which read-only call answers. The enum crosses the PyO3 seam as a 1-based u8 (auto() values, the curve_math try_from_u8 crossing convention); an unrecognized code is seam drift and must raise, never silently classify.
Member order is the wire contract - keep in lock-step with the PoolFamily match in py_bot_io.rs::probe_pool_type (a new Rust variant fails that match to compile until a code is assigned here).
- V2 = 1¶
- V3 = 2¶
- BALANCER_WEIGHTED = 3¶
- BALANCER_STABLE = 4¶
- STABLESWAP = 5¶
- class degenbot.types.pool_type.PoolFamily(*args, **kwds)¶
Bases:
enum.EnumThe mathematical family governing swap pricing.
Used for pool type identification (build_pool dispatch, DB kind derivation). Each DEX pool class belongs to exactly one family.
- CONSTANT_PRODUCT = 'constant_product'¶
- CONCENTRATED_LIQUIDITY = 'concentrated_liquidity'¶
- STABLESWAP = 'stableswap'¶
- WEIGHTED = 'weighted'¶
- class degenbot.types.pool_type.PoolVariant¶
Bases:
enum.StrEnumThe KNOWN pool-variant vocabulary — an intentionally OPEN set.
The variant is the DEX identity string carried on
PoolTypeDescriptorand persisted into the DBkind(viaderive_kind()). Third-party DEXes register their own spellings (PoolRegistration.variant, thevariantkey of deployments.json overlays), so the set cannot be closed: unknown strings surface asUNRECOGNIZEDat the conversion point (classify_pool_variant()) and raise loudly at the decision points that must act on variant semantics — never silently guessed.Members enumerate the variants shipped in this repository.
- BALANCER_STABLE = 'balancer_stable'¶
- BALANCER_WEIGHTED = 'balancer_weighted'¶
- AERODROME = 'aerodrome'¶
- CAMELOT = 'camelot'¶
- PANCAKESWAP = 'pancakeswap'¶
- SUSHISWAP = 'sushiswap'¶
- SWAPBASED = 'swapbased'¶
- UNRECOGNIZED = 'unrecognized'¶
- degenbot.types.pool_type.BALANCER_VARIANTS¶
- degenbot.types.pool_type.classify_pool_variant(variant: str | None) PoolVariant | None¶
Classify one raw variant string into the variant taxonomy — the ONE conversion point.
- Parameters:
variant – The descriptor’s raw variant string, or
Nonefor the canonical Uniswap / no-variant identity.- Returns:
NoneforNoneinput, the matchingPoolVariantmember for a known spelling, orPoolVariant.UNRECOGNIZEDfor an open-set string this process does not know.
- class degenbot.types.pool_type.PoolTypeDescriptor¶
Describes the resolved type of a pool.
Produced by the type resolver, consumed by the dispatch in build_pool.
- family: PoolFamily¶
- degenbot.types.pool_type.derive_kind(family: PoolFamily, variant: str | None) str¶
Derive the DB kind string from family + variant.
Examples
CONSTANT_PRODUCT + None → “uniswap_v2” CONCENTRATED_LIQUIDITY + “sushiswap” → “sushiswap_v3” CONSTANT_PRODUCT + “camelot” → “camelot_v2” STABLESWAP + None → “stableswap”
- Returns:
The computed value.