Skip to main content

Crate mfm_evm_core

Crate mfm_evm_core 

Source
Expand description

Low-level EVM ABI, hex, and RLP helpers used by runtime and collector crates.

This crate keeps encoding and decoding concerns separate from transport code so higher layers can assemble RPC requests, contract calls, and byte-oriented payloads without reimplementing Ethereum primitives.

§Examples

use mfm_evm_core::abi::function_selector;
use mfm_evm_core::encoding::{encode_erc20_decimals, normalize_address};

let selector = function_selector("balanceOf", &["address".to_string()]);
assert_eq!(selector, [0x70, 0xa0, 0x82, 0x31]);
assert_eq!(encode_erc20_decimals(), "0x313ce567");
assert_eq!(
    normalize_address("0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")?,
    "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
);

Modules§

abi
ABI parsing, selector derivation, and argument encoding helpers. ABI parsing and calldata construction helpers.
encoding
Ethereum JSON-RPC quantity, address, and ERC-20 call encoding helpers. EVM encoding helpers for common JSON-RPC and ERC-20 interactions.
hex
Hex-string normalization and decoding helpers. Hex normalization and byte-conversion helpers.
rlp
Minimal Recursive Length Prefix (RLP) encoding helpers. Minimal Recursive Length Prefix (RLP) encoders.
util_error
Lightweight error type shared by the utility modules. Shared lightweight error type for low-level EVM utilities.