Expand description
ABI related helper functions.
Re-exportsΒ§
use alloy_chains::Chain;πuse alloy_dyn_abi::DecodedEvent;πuse alloy_dyn_abi::DynSolType;πuse alloy_dyn_abi::DynSolValue;πuse alloy_dyn_abi::FunctionExt;πuse alloy_dyn_abi::JsonAbiExt;πuse alloy_dyn_abi::Specifier;πuse alloy_json_abi::Error;πuse alloy_json_abi::Event;πuse alloy_json_abi::Function;πuse alloy_json_abi::Param;πuse alloy_primitives::Address;πuse alloy_primitives::LogData;πuse alloy_primitives::hex;πuse alloy_primitives::hex;πuse eyre::Context;πuse eyre::ContextCompat;πuse eyre::Result;πuse foundry_block_explorers::Client;πuse foundry_block_explorers::contract::ContractMetadata;πuse foundry_block_explorers::errors::EtherscanError;πuse std::pin::Pin;π
FunctionsΒ§
- abi_
decode_ calldata - Decodes the calldata of the function
- abi_
decode_ event_ data - ABI-decodes the non-indexed parameters (the log data) of an event.
- coerce_
value - Helper function to coerce a value to a [DynSolValue] given a type string
- encode_
args - encode_
function_ args - Given a function and a vector of string arguments, it proceeds to convert the args to alloy [DynSolValue]s and then ABI encode them, prefixes the encoded data with the function selector.
- encode_
function_ args_ packed - Given a function and a vector of string arguments, it proceeds to convert the args to alloy [DynSolValue]s and encode them using the packed encoding.
- encode_
function_ args_ raw - Given a function and a vector of string arguments, it proceeds to convert the args to alloy [DynSolValue]s and then ABI encode them. Doesnβt prefix the function selector.
- find_
source - If the code at
addressis a proxy, recurse until we find the implementation. - get_
error - Given an error signature string, it tries to parse it as a
Error - get_
event - Given an event signature string, it tries to parse it as a
Event - get_
func - Given a function signature string, it tries to parse it as a
Function - get_
func_ etherscan - Given a function name, address, and args, tries to parse it as a
Functionby fetching the abi from etherscan. If the address is a proxy, fetches the ABI of the implementation contract. - get_
indexed_ event - Given an event without indexed parameters and a rawlog, it tries to return the event with the proper indexed parameters. Otherwise, it returns the original event.
- reconstruct_
event_ params - Restore the order of the params of a decoded event, as Alloy returns the indexed and unindexed params separately.