Contract API

class pab.contract.ContractData(name: str, address: str, abi: str)

Stores smart contract data

name: str
address: str
abi: str
class pab.contract.ContractManager(w3: Web3, root: Path)

Stores contract definitions (address and location of the abi file). Reads and returns contracts from the network.

_load_contracts() Dict[str, ContractData]

Reads and parses contracts.json.

_parse_contract_data(contracts_data: dict[str, dict]) Dict[str, ContractData]

Replaces the raw contract data from contracts.json with the ContractData dataclass.

_check_valid_contract_data(data: dict) None

Validates that the data loaded from contracts.json is valid.

_check_abifile_exists(abifile) None

Validates that all abifiles defined in contracts.json exist.

get(name: str) Contract

Returns contract by name. Contract must be defined in CONTRACTS_FILE and ABIS_DIR.

exception pab.contract.ContractDefinitionError