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.DegenbotErrorRaised when a simulated EVM contract operation would revert.
- error = None¶
- class degenbot.exceptions.pool.InvalidUint256¶
Bases:
EVMRevertErrorInvalidUint256 class.
- class degenbot.exceptions.pool.CurveError¶
Bases:
degenbot.exceptions.base.DegenbotErrorBase exception for Curve pool errors.
- class degenbot.exceptions.pool.MissingCurveData(pool_address: str, data_type: str, message: str)¶
Bases:
CurveErrorRaised when on-chain data is needed but no fetcher is available.
- pool_address¶
- data_type¶
- class degenbot.exceptions.pool.TrackerError¶
Bases:
degenbot.exceptions.base.DegenbotErrorException raised inside pool tracker helpers.
- class degenbot.exceptions.pool.PoolNotAssociated(pool_address: str)¶
Bases:
TrackerErrorRaised by a pool tracker if a requested pool address is not associated with the DEX.
- class degenbot.exceptions.pool.PoolCreationFailed¶
Bases:
TrackerErrorPoolCreationFailed class.
- class degenbot.exceptions.pool.TrackerAlreadyInitialized¶
Bases:
TrackerErrorRaised by a pool tracker if a caller attempts to create from a known factory address.
- class degenbot.exceptions.pool.LiquidityPoolError¶
Bases:
degenbot.exceptions.base.DegenbotErrorException raised inside liquidity pool helpers.
- class degenbot.exceptions.pool.AddressMismatch¶
Bases:
LiquidityPoolErrorThe expected pool address does not match the provided address.
- class degenbot.exceptions.pool.LiquidityMapWordMissing(word: int)¶
Bases:
LiquidityPoolErrorA word bitmap is not included in the liquidity map.
- word¶
- class degenbot.exceptions.pool.BrokenPool¶
Bases:
LiquidityPoolErrorBrokenPool class.
- class degenbot.exceptions.pool.ExternalUpdateError¶
Bases:
LiquidityPoolErrorRaised when an external update does not pass sanity checks.
- class degenbot.exceptions.pool.IncompleteSwap(amount_in: int, amount_out: int)¶
Bases:
LiquidityPoolErrorRaised if a swap calculation would not consume the input or deliver the requested output.
- amount_in¶
- amount_out¶
- class degenbot.exceptions.pool.LateUpdateError¶
Bases:
LiquidityPoolErrorRaised 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:
LiquidityPoolErrorRaised 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:
LiquidityPoolErrorInvalidSwapInputAmount class.
- class degenbot.exceptions.pool.PossibleInaccurateResult(amount_in: int, amount_out: int, *, message: str)¶
Bases:
LiquidityPoolErrorRaised when a swap calculation may not match the on-chain result.
The computed
amount_inandamount_outare 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:
PossibleInaccurateResultRaised when a V4 pool has active hooks that may mutate the swap result.
The pool’s
beforeSwap/afterSwaphooks 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 thehooksattribute.- hooks¶
- class degenbot.exceptions.pool.StaleRateResult(amount_in: int, amount_out: int)¶
Bases:
PossibleInaccurateResultRaised when a Balancer ComposableStablePool’s rate cache is stale.
ComposableStablePools with time-varying rates (e.g. bb-a-* yield tokens) cache rates in
_tokenRateCachesand refresh them before each swap via_beforeSwapJoinExit(). Without a liveBalancerRateProvider, 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:
LiquidityPoolErrorRaised 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:
LiquidityPoolErrorRaised 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.