[][src]Crate ssvm_evmc_declare

evmc-declare is an attribute-style procedural macro to be used for automatic generation of FFI code for the EVMC API with minimal boilerplate.

evmc-declare can be used by applying its attribute to any struct which implements the EvmcVm trait, from the evmc-vm crate.

The macro takes three arguments: a valid UTF-8 stylized VM name, a comma-separated list of capabilities, and a version string.


#[evmc_declare::evmc_declare_vm("This is an example VM name", "ewasm, evm", "1.2.3-custom")]
pub struct ExampleVM;

impl evmc_vm::EvmcVm for ExampleVM {
    fn init() -> Self {
            ExampleVM {}

    fn execute(&self, revision: evmc_vm::ffi::evmc_revision, code: &[u8], message: &evmc_vm::ExecutionMessage, context: &mut evmc_vm::ExecutionContext) -> evmc_vm::ExecutionResult {
            evmc_vm::ExecutionResult::success(1337, None)

Attribute Macros