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
|
Deduct the Uniswap pair contract address |
|
Put lower address first, as Uniswap wants. |
- sort_tokens(token_a, token_b)
Put lower address first, as Uniswap wants.
- Parameters
token_a (eth_typing.evm.HexAddress) –
token_b (eth_typing.evm.HexAddress) –
- Return type
- pair_for(factory, token_a, token_b, magical_hash)
Deduct the Uniswap pair contract address
- Parameters
factory (eth_typing.evm.HexAddress) – Factory contract address
token_a (eth_typing.evm.HexAddress) – Base token
token_b (eth_typing.evm.HexAddress) – Quote token
magical_hash (eth_typing.encoding.HexStr) – Init code hash of the Uniswap instance. Set None to use the default Sushiswap hash.
- Returns
Pair contract address
- Return type