pub trait ContractName {
    const NAME: &'static str;
}
Expand description

Stores the name of the ink! smart contract.

Note

The name is the identifier of the #[ink(storage)] annotated struct.

Usage

use ink_lang as ink;

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

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

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

use contract::Contract;

assert_eq!(
    <Contract as ContractName>::NAME,
    "Contract",
);

Required Associated Constants

The name of the ink! smart contract.

Implementors