degenbot.exceptions.pool ======================== .. py:module:: degenbot.exceptions.pool .. autoapi-nested-parse:: Pool-related exceptions. Includes exceptions for: - Generic pool operations (LiquidityPoolError, BrokenPool, ...) - EVM execution (EVMRevertError, InvalidUint256) - Curve StableSwap (CurveError, MissingCurveData) - Pool trackers (TrackerError, PoolNotAssociated, ...) Module Contents --------------- .. py:class:: EVMRevertError(error: str | None = None) Bases: :py:obj:`degenbot.exceptions.base.DegenbotError` Raised when a simulated EVM contract operation would revert. .. py:attribute:: error :value: None .. py:class:: InvalidUint256 Bases: :py:obj:`EVMRevertError` InvalidUint256 class. .. py:class:: CurveError Bases: :py:obj:`degenbot.exceptions.base.DegenbotError` Base exception for Curve pool errors. .. py:class:: MissingCurveData(pool_address: str, data_type: str, message: str) Bases: :py:obj:`CurveError` Raised when on-chain data is needed but no fetcher is available. .. py:attribute:: pool_address .. py:attribute:: data_type .. py:class:: TrackerError Bases: :py:obj:`degenbot.exceptions.base.DegenbotError` Exception raised inside pool tracker helpers. .. py:class:: PoolNotAssociated(pool_address: str) Bases: :py:obj:`TrackerError` Raised by a pool tracker if a requested pool address is not associated with the DEX. .. py:class:: PoolCreationFailed Bases: :py:obj:`TrackerError` PoolCreationFailed class. .. py:class:: TrackerAlreadyInitialized Bases: :py:obj:`TrackerError` Raised by a pool tracker if a caller attempts to create from a known factory address. .. py:class:: LiquidityPoolError Bases: :py:obj:`degenbot.exceptions.base.DegenbotError` Exception raised inside liquidity pool helpers. .. py:class:: AddressMismatch Bases: :py:obj:`LiquidityPoolError` The expected pool address does not match the provided address. .. py:class:: LiquidityMapWordMissing(word: int) Bases: :py:obj:`LiquidityPoolError` A word bitmap is not included in the liquidity map. .. py:attribute:: word .. py:class:: BrokenPool Bases: :py:obj:`LiquidityPoolError` BrokenPool class. .. py:class:: ExternalUpdateError Bases: :py:obj:`LiquidityPoolError` Raised when an external update does not pass sanity checks. .. py:class:: IncompleteSwap(amount_in: int, amount_out: int) Bases: :py:obj:`LiquidityPoolError` Raised if a swap calculation would not consume the input or deliver the requested output. .. py:attribute:: amount_in .. py:attribute:: amount_out .. py:class:: LateUpdateError Bases: :py:obj:`LiquidityPoolError` Raised when an automatic update is attempted at a block prior to the last recorded update. .. py:class:: NoPoolStateAvailable(block: degenbot.types.aliases.BlockNumber) Bases: :py:obj:`LiquidityPoolError` Raised when a previous pool state is not available. This can occur, e.g. if a pool was created in a block at or after a re-organization. .. py:class:: InvalidSwapInputAmount Bases: :py:obj:`LiquidityPoolError` InvalidSwapInputAmount class. .. py:class:: PossibleInaccurateResult(amount_in: int, amount_out: int, *, message: str) Bases: :py:obj:`LiquidityPoolError` Raised when a swap calculation may not match the on-chain result. The computed ``amount_in`` and ``amount_out`` are available on the exception so callers can inspect or use the approximate values after explicitly catching this exception. Subclasses add domain-specific context (hooks, stale rates, etc.). .. py:attribute:: amount_in .. py:attribute:: amount_out .. py:class:: HookedPoolResult(amount_in: int, amount_out: int, hooks: set[degenbot.uniswap.v4_liquidity_pool.Hooks]) Bases: :py:obj:`PossibleInaccurateResult` Raised when a V4 pool has active hooks that may mutate the swap result. The pool's ``beforeSwap`` / ``afterSwap`` hooks can modify amounts or revert, so the pure-math result may differ from what the contract returns. The set of conflicting hooks is available on the ``hooks`` attribute. .. py:attribute:: hooks .. py:class:: StaleRateResult(amount_in: int, amount_out: int) Bases: :py:obj:`PossibleInaccurateResult` Raised when a Balancer ComposableStablePool's rate cache is stale. ComposableStablePools with time-varying rates (e.g. bb-a-* yield tokens) cache rates in ``_tokenRateCaches`` and refresh them before each swap via ``_beforeSwapJoinExit()``. Without a live ``BalancerRateProvider``, the pool uses construction-time rates that become stale as blocks pass. The computed amounts are available but may not match on-chain execution. .. py:class:: UnknownPool(pool: degenbot.types.chain.ChecksummedAddress) Bases: :py:obj:`LiquidityPoolError` Raised when an update is provided for a pool not in the snapshot. Such updates can lead to inconsistent state because the pool state prior to the update is unknown. .. py:class:: UnknownPoolId(pool_id: bytes | str) Bases: :py:obj:`LiquidityPoolError` Raised when an update is provided for a pool ID not in the snapshot. Such updates can lead to inconsistent state because the pool state prior to the update is unknown.