Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

AbiDecodeTrait

Fully qualified path: alexandria_evm::decoder::AbiDecodeTrait

pub trait AbiDecodeTrait

Trait functions

decode

Decodes EVM calldata for the specified types into a Span of felt252 values.

This function is the primary entry point for decoding EVM calldata in Starknet Cairo. It accepts a list of EVM-compatible types and decodes values from calldata accordingly. The resulting span of felt252 values can be directly used in Starknet’s call_syscall.

This function is typically implemented as a dispatcher that calls appropriate decoding routines (e.g., decode_uint, decode_tuple, decode_array, etc.) based on the types passed in.

Arguments

  • self - Reference to EVMCalldata context which maintains the calldata byte array, current offset, and relative offset for dynamic type resolution.
  • types - A list (Span) of EVMTypes to decode from the current calldata position.

Returns

  • Span<felt252> - A Cairo Span containing the decoded values as felt252

Fully qualified path: alexandria_evm::decoder::AbiDecodeTrait::decode

fn decode(ref self: EVMCalldata, types: Span<EVMTypes>) -> Span<felt252>