Chain-agnostic addresses

This module contains tooling for chain-agnostic address types.

When trading on multiple blockchains, we need to be able to uniquely identify the same smart contract address on multiple chains.

There is an ongoing effort to standard cross-chain addresses. For more information see the CAIP project.

exception tradingstrategy.caip.BadChainAddressTuple

Something was wrong with the constructed chain - address tuple.

exception tradingstrategy.caip.InvalidChainId

Chain id was not an integer

exception tradingstrategy.caip.InvalidChecksum

Ethereum checksum of the address is invalid

class tradingstrategy.caip.ChainAddressTuple

Present one chain-agnostic address.

chain_id: int

See ChainId for more information - here we have just the raw int value

address: str

Could be checksummed or non-checksummed address

static parse_naive(v: str)

Parses chain_id and EVM address tuple.

Example tuple: 1:0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc - ETH-USDC on Uniswap v2

__init__(chain_id: int, address: str) None