Skip to main content

neo_contract

Attribute Macro neo_contract 

Source
#[neo_contract]
Expand description

Neo N3 Contract macro

This macro generates the necessary boilerplate for a Neo N3 smart contract.

§Example

use neo_devpack::*;

#[neo_contract]
pub struct MyContract {
    name: NeoString,
    value: NeoInteger,
}

impl MyContract {
    #[neo_method]
    pub fn get_name(&self) -> NeoResult<NeoString> {
        Ok(self.name.clone())
    }

    #[neo_method]
    pub fn set_value(&mut self, value: NeoInteger) -> NeoResult<()> {
        self.value = value;
        Ok(())
    }
}