degenbot.uniswap.v2_pool_state¶
State mixin for V2-style constant-product pools.
Holds all data attributes (immutable and mutable) and their properties. No calculation logic — calculations live in UniswapV2PoolCalc.
This mixin is designed to be composed with: - UniswapV2PoolCalc (calculation methods) - AbstractLiquidityPool (address, name, simulate_swap)
Pools with different state shapes (e.g., Aerodrome’s unidirectional fee and stable flag) define their own state mixin instead of using this one.
Module Contents¶
- class degenbot.uniswap.v2_pool_state.V2PoolState¶
State for V2-style constant-product pools with directional fees.
Matches the Uniswap V2 contract’s data model: - token0, token1: the paired ERC-20 tokens (immutable) - fee_token0, fee_token1: directional swap fees (immutable) - reserves_token0, reserves_token1: current reserves (mutable via external_update) - block: last update block number (mutable via external_update)
All attributes are set by the concrete pool’s __init__. Properties provide read access; mutation happens through external_update().
- property token0: degenbot.erc20.Erc20Token¶
Token0.
- property token1: degenbot.erc20.Erc20Token¶
Token1.
- property fee_token0: fractions.Fraction¶
Fee token0.
- property fee_token1: fractions.Fraction¶
Fee token1.
- property fee: tuple[fractions.Fraction, fractions.Fraction]¶
The pool fees as a tuple (fee_token0, fee_token1).
- property tokens: tuple[degenbot.erc20.Erc20Token, degenbot.erc20.Erc20Token]¶
Tokens.