uniswap_v2.utils

Documentation for eth_defi.uniswap_v2.utils Python module.

Uniswap v2 helper functions.

Mostly lifted from Uniswap-v2-py MIT licensed by Asynctomatic.

Functions

pair_for(factory, token_a, token_b, magical_hash)

Deduct the Uniswap pair contract address

sort_tokens(token_a, token_b)

Put lower address first, as Uniswap wants.

sort_tokens(token_a, token_b)

Put lower address first, as Uniswap wants.

Parameters
Return type

Tuple[eth_typing.evm.HexAddress, eth_typing.evm.HexAddress]

pair_for(factory, token_a, token_b, magical_hash)

Deduct the Uniswap pair contract address

Parameters
Returns

Pair contract address

Return type

eth_typing.evm.HexAddress