degenbot.exceptions.pool¶

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¶

class degenbot.exceptions.pool.EVMRevertError(error: str | None = None)¶

Bases: degenbot.exceptions.base.DegenbotError

Raised when a simulated EVM contract operation would revert.

error = None¶
class degenbot.exceptions.pool.InvalidUint256¶

Bases: EVMRevertError

InvalidUint256 class.

class degenbot.exceptions.pool.CurveError¶

Bases: degenbot.exceptions.base.DegenbotError

Base exception for Curve pool errors.

class degenbot.exceptions.pool.MissingCurveData(pool_address: str, data_type: str, message: str)¶

Bases: CurveError

Raised when on-chain data is needed but no fetcher is available.

pool_address¶
data_type¶
class degenbot.exceptions.pool.TrackerError¶

Bases: degenbot.exceptions.base.DegenbotError

Exception raised inside pool tracker helpers.

class degenbot.exceptions.pool.PoolNotAssociated(pool_address: str)¶

Bases: TrackerError

Raised by a pool tracker if a requested pool address is not associated with the DEX.

class degenbot.exceptions.pool.PoolCreationFailed¶

Bases: TrackerError

PoolCreationFailed class.

class degenbot.exceptions.pool.TrackerAlreadyInitialized¶

Bases: TrackerError

Raised by a pool tracker if a caller attempts to create from a known factory address.

class degenbot.exceptions.pool.LiquidityPoolError¶

Bases: degenbot.exceptions.base.DegenbotError

Exception raised inside liquidity pool helpers.

class degenbot.exceptions.pool.AddressMismatch¶

Bases: LiquidityPoolError

The expected pool address does not match the provided address.

class degenbot.exceptions.pool.LiquidityMapWordMissing(word: int)¶

Bases: LiquidityPoolError

A word bitmap is not included in the liquidity map.

word¶
class degenbot.exceptions.pool.BrokenPool¶

Bases: LiquidityPoolError

BrokenPool class.

class degenbot.exceptions.pool.ExternalUpdateError¶

Bases: LiquidityPoolError

Raised when an external update does not pass sanity checks.

class degenbot.exceptions.pool.IncompleteSwap(amount_in: int, amount_out: int)¶

Bases: LiquidityPoolError

Raised if a swap calculation would not consume the input or deliver the requested output.

amount_in¶
amount_out¶
class degenbot.exceptions.pool.LateUpdateError¶

Bases: LiquidityPoolError

Raised when an automatic update is attempted at a block prior to the last recorded update.

class degenbot.exceptions.pool.NoPoolStateAvailable(block: degenbot.types.aliases.BlockNumber)¶

Bases: 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.

class degenbot.exceptions.pool.InvalidSwapInputAmount¶

Bases: LiquidityPoolError

InvalidSwapInputAmount class.

class degenbot.exceptions.pool.PossibleInaccurateResult(amount_in: int, amount_out: int, *, message: str)¶

Bases: 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.).

amount_in¶
amount_out¶
class degenbot.exceptions.pool.HookedPoolResult(amount_in: int, amount_out: int, hooks: set[degenbot.uniswap.v4_liquidity_pool.Hooks])¶

Bases: 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.

hooks¶
class degenbot.exceptions.pool.StaleRateResult(amount_in: int, amount_out: int)¶

Bases: 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.

class degenbot.exceptions.pool.UnknownPool(pool: degenbot.types.chain.ChecksummedAddress)¶

Bases: 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.

class degenbot.exceptions.pool.UnknownPoolId(pool_id: bytes | str)¶

Bases: 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.