Skip to main content
Version: 3.x


Applicable on struct definitions.

Applied on struct types in order to flag them for being the contract's storage definition. There can only be one ink! storage definition per contract.

There must be exactly one #[ink(storage)] struct.

This struct defines the layout of the storage that the ink! smart contract operates on. The user is able to use a variety of built-in facilities, combine them in various ways or even provide their own implementations of storage data structures.

For more information visit the ink_storage crate documentation.


use ink_lang as ink;

mod flipper {

pub struct Flipper {
value: bool,

impl Flipper {
pub fn construct() -> Self { Flipper { value: false } }

pub fn message(&self) {}