degenbot.uniswap.v2_functions¶

Uniswap V2 constant-product swap math.

See: contract_reference/uniswap/V2/UniswapV2Factory.sol (UniswapV2Pair, UniswapV2Factory, Math, UQ112x112)

Module Contents¶

degenbot.uniswap.v2_functions.generate_v2_pool_address(deployer_address: str | bytes, token_addresses: collections.abc.Iterable[str | bytes], init_hash: str | bytes) → degenbot.types.chain.ChecksummedAddress¶

Get the deterministic V2 pool address generated by CREATE2.

Uses the token addresses sorted to generate the salt. The token addresses can be passed in any order.

Returns:

The checksummed pool address.

Adapted from https://github.com/Uniswap/universal-router/blob/59f1291d3760d2537a7bd1cbf37317922a49efb0/contracts/modules/uniswap/v2/UniswapV2Library.sol#L50