pub trait ContractDispatchableMessages<const AMOUNT: usize> {
    const IDS: [u32; AMOUNT];
}
Expand description

Reflects the sequence of all dispatchable ink! messages of the ink! smart contract.

Note

This is automatically implemented by all ink! smart contracts.

Usage

use ink_lang as ink;

#[ink::contract]
pub mod contract {
    #[ink(storage)]
    pub struct Contract {}

    impl Contract {
        #[ink(constructor)]
        pub fn constructor1() -> Self { Contract {} }

        #[ink(message, selector = 1234)]
        pub fn message1(&self) {}

        #[ink(message, selector = 0xC0DECAFE)]
        pub fn message2(&self) {}

        #[ink(message)]
        pub fn message3(&self) {}
    }
}

use contract::Contract;

fn main() {
    assert_eq!(
        <Contract as ContractDispatchableMessages<{
            <Contract as ContractAmountDispatchables>::MESSAGES
        }>>::IDS,
        [1234, 0xC0DECAFE, selector_id!("message3")],
    );
}

Required Associated Constants

The sequence stores selector IDs of all ink! messages dispatchable by the ink! smart contract.

Implementors