Crate foundry_common_fmt

Source
Expand description

Helpers for formatting Ethereum types.

Modulesยง

console ๐Ÿ”’
dynamic ๐Ÿ”’
exp ๐Ÿ”’
ui ๐Ÿ”’
Helper trait and functions to format Ethereum types.

Enumsยง

EthValue
Various numerical ethereum types used for pretty printing
FormatSpec
A format specifier.

Traitsยง

ConsoleFmt
Formats a value using a FormatSpec.
UIfmt
Helper trait to format Ethereum types.

Functionsยง

console_format
Formats a string using the input values.
format_int_exp
Formats a U256 number to string, adding an exponential notation hint.
format_token
Pretty-prints the given value into a string suitable for user output.
format_token_raw
Pretty-prints the given value into a string suitable for re-parsing as values later.
format_tokens
Pretty-prints a slice of tokens using format_token.
format_tokens_raw
Pretty-prints a slice of tokens using format_token_raw.
format_uint_exp
Formats a U256 number to string, adding an exponential notation hint if it is larger than 10_000, with a precision of 4 figures, and trimming the trailing zeros.
get_pretty_block_attr
Returns the UiFmt::pretty() formatted attribute of the given block
get_pretty_tx_attr
Returns the UiFmt::pretty() formatted attribute of the transactions
parse_tokens
Parses string input as Token against the expected ParamType
to_exp_notation
Returns the number expressed as a string in exponential notation with the given precision (number of significant figures), optionally removing trailing zeros from the mantissa.