abi

Documentation for eth_defi.abi Python module.

ABI loading from the precompiled bundle.

Provides functions to load ABI files and construct web3.contract.Contract types. The results are cached for the speedup.

We also provide some helper functions to deal with ABI encode/decode.

See Github for available contracts ABI files.

Functions

decode_function_args(func, data)

Decode binary CALL or CALLDATA to a Solidity function,

encode_function_args(func, args)

Mimic Solidity's abi.encodeWithSignature() in Python.

encode_function_call(func, args)

Encode function selector + its arguments as data payload.

encode_with_signature(function_signature, args)

Mimic Solidity's abi.encodeWithSignature() in Python.

get_abi_by_filename(fname)

Reads a embedded ABI file and returns it.

get_contract(web3, fname[, bytecode])

Create a Contract proxy class from our bundled contracts or filesystem..

get_deployed_contract(web3, fname, address)

Get a Contract proxy objec for a contract deployed at a specific address.

get_function_selector(func)

Get Solidity function selector.

get_linked_contract(web3, fname[, ...])

Create a Contract proxy class from our bundled contracts or filesystem and links it Solidity bytecode.

get_transaction_data_field(tx)

Get the "Data" payload of a transaction.

humanise_decoded_arg_data(args)

Make decoded arguments more human readable.

link_libraries_hardhat(bytecode, ...)

Link Solidity libraries based on Hardhat deployment.