EncodedCall
Documentation for eth_defi.event_reader.multicall_batcher.EncodedCall Python class.
- class EncodedCall[source]
Multicall payload, minified implementation.
Designed for multiprocessing and historical reads
Only carry encoded data, not ABI etc. metadata
Contain
extra_data
which allows route to call results from several calls to one handler class
Example:
convert_to_shares_payload = eth_abi.encode(['uint256'], [share_probe_amount]) share_price_call = EncodedCall.from_keccak_signature( address=address, signature=Web3.keccak(text="convertToShares(uint256)")[0:4], function="convertToShares", data=convert_to_shares_payload, extra_data=None, )
Attributes summary
Store ABI function for debugging purposers
Contract address
Call ABI-encoded payload
Use this to match the reader
First block hint when doing historical multicall reading.
Methods summary
__init__
(func_name, address, data, extra_data)call
(web3, block_identifier[, from_, gas])Return raw results of the call.
from_contract_call
(call[, extra_data, ...])Create poller call from Web3.py Contract proxy object
from_keccak_signature
(address, function, ...)Create poller call directly from a raw function signature
get_curl_info
(block_number)Get human-readable details for debugging.
Get human-readable details for debugging.
is_valid_for_block
(block_number)- address: eth_typing.evm.HexAddress
Contract address
- first_block_number: int | None
First block hint when doing historical multicall reading.
Skip calls for blocks that are earlier than this block number.
- get_debug_info()[source]
Get human-readable details for debugging.
Punch into Tenderly simulator
Data contains both function signature and data payload
- Return type
- get_curl_info(block_number)[source]
Get human-readable details for debugging.
Punch into Tenderly simulator
Data contains both function signature and data payload
- static from_contract_call(call, extra_data=None, first_block_number=None)[source]
Create poller call from Web3.py Contract proxy object
- Parameters
- Return type
- static from_keccak_signature(address, function, signature, data, extra_data, first_block_number=None)[source]
Create poller call directly from a raw function signature
- Parameters
- Return type
- call(web3, block_identifier, from_='0x0000000000000000000000000000000000000000', gas=75000000)[source]
Return raw results of the call.
Example:
erc_7575_call = EncodedCall.from_keccak_signature( address=self.vault_address, signature=Web3.keccak(text="share()")[0:4], function="share", data=b"", extra_data=None, ) result = erc_7575_call.call(self.web3, block_identifier="latest") share_token_address = convert_uint256_bytes_to_address(result)
- Returns
Raw call results as bytes
- Raises
ValueError – If the call reverts
- Parameters
- Return type