Macro fadroma::contract[][src]

macro_rules! contract {
    (
        // passed to `define_state_singleton!`
        [$State:ident]
        { $( $(#[$meta:meta])* $state_field:ident : $state_field_type:ty ),* }

        // Define the signature of the init message, how it's handled.
        //
        $(#[$InitMeta:meta])*
        [$Init:ident]
        ( $init_deps:ident, $init_env:ident, $init_msg:ident : $($init_msg_definition:tt)+
        ) $init_body:block

        // Define query messages and how they're handled:
        [$Q:ident]
        ( $q_deps:ident, $q_state:ident, $q_msg:ident $( : $ExtQ:ident)? )
        -> $QResponse:ident { $(
            $(#[$QVariantMeta:meta])* $QVariant:ident
            ($($q_arg:ident $(: $q_arg_type:ty)?),*) $q_body:tt
        )* }

        // Define possible responses:
        [$Response:ident] {
        $( $(#[$response_meta:meta])* $ResponseMsg:ident { $($resp_field:ident : $resp_field_type:ty),* } )* }

        // Define transaction messages and how they're handled:
        [$TX:ident]
        ( $tx_deps:ident, $tx_env:ident, $tx_state:ident, $tx_msg:ident $( : $ExtTX:ident)? )
        -> $TXResponse:ident { $(
            $(#[$TXVariantMeta:meta])* $TXVariant:ident
            ($($tx_arg:ident $(: $tx_arg_type:ty)?),*) $tx_body:tt
        )* }

    ) => { ... };
}

Define a smart contract