event_reader.conversion
Documentation for eth_defi.event_reader.conversion Python module.
Raw log event data conversion helpers.
Functions
|
Convert address to bytes32 for passing raw ABI packed payload. |
|
Convert raw uint256 from EncodedCall to address. |
|
Convert raw bytes32 blob to uint. |
|
Convert raw bytes32 from log data to addresses ints. |
Convert hex string or int to int. |
|
|
Load string from contract function call. |
Convert string to bytes32 for passing raw ABI packed payload. |
|
|
Convert uint256 to bytes32. |
Convert raw uin256 from log data to addresses. |
|
Convert raw uin256 from log data to address. |
|
|
Convert raw uint256 from log data to address. |
|
Convert raw uint256 from log data to int. |
|
Split data of a log to uin256 results |
Exceptions
Cannot convert to address. |
- exception BadAddressError
Bases:
ExceptionCannot convert to address.
- __init__(*args, **kwargs)
- __new__(**kwargs)
- add_note()
Exception.add_note(note) – add a note to the exception
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- decode_data(data)
Split data of a log to uin256 results
- convert_uin256_to_bytes(value)
Convert uint256 to bytes32.
- convert_uint256_bytes_to_address(raw)
Convert raw uin256 from log data to addresses.
Note
Ethereum address checksum might have a speed penalty for high speed operations.
- Parameters
raw (bytes | hexbytes.main.HexBytes) – Raw uint256 byte blob
- Returns
Checksummed Ethereum address
- Raises
BadAddressError – If the returned data does not lot look like an address.
- Return type
- convert_uint256_hex_string_to_address(hex)
Convert raw uin256 from log data to address.
- Parameters
hex (str) – Hex string byte blob
- Returns
Checksummed Ethereum address
- Return type
- convert_int256_bytes_to_int(bytes32, *, signed=False)
Convert raw bytes32 from log data to addresses ints.
- convert_uint256_string_to_address(bytes32)
Convert raw uint256 from log data to address.
Note
Ethereum address checksum might have a speed penalty for high speed operations.
- Parameters
bytes32 (str) – E.g. 0x00000000000000000000000006af07097c9eeb7fd685c692751d5c66db49c215
- Return type
- convert_bytes32_to_address(bytes32)
Convert raw uint256 from EncodedCall to address.
Note
Ethereum address checksum might have a speed penalty for high speed operations.
- Parameters
bytes32 (bytes) – E.g. b`0x00000000000000000000000006af07097c9eeb7fd685c692751d5c66db49c215`
- Return type
- convert_bytes32_to_uint(bytes32)
Convert raw bytes32 blob to uint.
- convert_uint256_string_to_int(bytes32, *, signed=False)
Convert raw uint256 from log data to int.
- convert_jsonrpc_value_to_int(val)
Convert hex string or int to int.
Depending on the used JSON-RPC node, they may return hex encoded values or JSON numbers in JSON-RPC type. We need to be able to support both node and do the compatibility hack here.
- convert_solidity_bytes_to_string(byte_data, max_length, errors='ignore')
Load string from contract function call.
Decodes UTF-8, sanitise input and chops to max length
- convert_string_to_bytes32(s)
Convert string to bytes32 for passing raw ABI packed payload.
- convert_address_to_bytes32(address)
Convert address to bytes32 for passing raw ABI packed payload.
- Returns
E.g. 0x00000000000000000000000006af07097c9eeb7fd685c692751d5c66db49c215
- Parameters
address (Union[str, eth_typing.evm.HexAddress]) –
- Return type