Skip to main content

Module encoder

Module encoder 

Source
Expand description

ABI encoder — the inverse of the ABI decoder.

Converts NormalizedValue inputs into EVM ABI-encoded calldata. Supports function calls (with 4-byte selector prefix) and raw tuple encoding.

§Usage

let encoder = EvmEncoder::from_abi_json(ABI_JSON)?;
let calldata = encoder.encode_call("transfer", &[
    NormalizedValue::Address("0xd8dA...".into()),
    NormalizedValue::Uint(1_000_000),
])?;

Structs§

EvmEncoder
ABI encoder for EVM function calls.

Functions§

normalized_to_dyn_value
Convert a NormalizedValue to the alloy DynSolValue for the given expected type.