degenbot.uniswap.v3_functions¶

Uniswap V3 swap and burn amount calculations.

Module Contents¶

degenbot.uniswap.v3_functions.exchange_rate_from_sqrt_price_x96(sqrt_price_x96: int) → fractions.Fraction¶

Exchange rate from sqrt price x96.

Returns:

The exchange rate as a Fraction.

degenbot.uniswap.v3_functions.generate_v3_pool_address(deployer_address: str | bytes, token_addresses: collections.abc.Iterable[str | bytes], fee: degenbot.uniswap.v3_types.Pip, init_hash: str | bytes) → degenbot.types.chain.ChecksummedAddress¶

Get the deterministic V3 pool address generated by CREATE2.

Uses the token address and fee to generate the salt. The token addresses can be passed in any order.

Returns:

The checksummed pool address.

Adapted from https://github.com/Uniswap/v3-periphery/blob/0682387198a24c7cd63566a2c58398533860a5d1/contracts/libraries/PoolAddress.sol#L33