3 releases

Uses old Rust 2015

0.1.3 Aug 23, 2017
0.1.2 Aug 4, 2017
0.1.1 Jul 31, 2017
0.1.0 Jul 31, 2017

#10 in #disassemble

MIT license

15KB
319 lines

evmasm

The evmasm crate aims to provide a simple interface for the conversion between evm bytecode and it's human readable form.

extern crate evmasm;
use evmasm::{BYTE_INST, instruction, arguments_size};

fn main() {
    for (&bc, _) in BYTE_INST.iter() {
        let inst = instruction(bc).ok().unwrap();
        println!("0x{:2x} - {} - needs {} bytes of arguments",
                 bc,
                 inst,
                 arguments_size(bc).ok().unwrap());
    }
}

lib.rs:

The evmasm crate aims to provide a simple interface for the conversion between evm bytecode and it's human readable form.

extern crate evmasm;
use evmasm::{assemble, disassemble};

fn main() {
    let bytecode = assemble("PUSH1 2 PUSH1 1 ADD").unwrap();
    println!("{:?}", bytecode);
    let code = disassemble(&bytecode).unwrap();
    for ln in code {
        println!("{}", ln);
    }
}
extern crate evmasm;
use evmasm::{BYTE_INST, instruction, arguments_size};

fn main() {
    for (&bc, _) in BYTE_INST.iter() {
        let inst = instruction(bc).ok().unwrap();
        println!("0x{:2x} - {} - needs {} bytes of arguments",
                 bc,
                 inst,
                 arguments_size(bc).ok().unwrap());
    }
}

Dependencies

~280KB