Function evm_disassembler::format_operations
source · pub fn format_operations(operations: Vec<Operation>) -> Result<String>Expand description
Converts a vector of decoded operations into a human readable formatted string
Operations are formatted on individual lines with the following format:
{offset}: {opcode} {bytes}
offset- The offset of the operation in the bytecode (as hex)opcode- The respective opcode (i.e. “PUSH1”, “ADD”)bytes- Additional bytes that are part of the operation (only for “PUSH” instructions)
Arguments
operations- A vector of decoded operations as returned bydisassemble_strordisassemble_bytes
Examples
use evm_disassembler::{disassemble_str, format_operations};
let bytecode = "0x608060405260043610603f57600035";
let instructions = disassemble_str(bytecode).unwrap();
println!("{}", format_operations(instructions).unwrap());