Skip to main content

storage

Attribute Macro storage 

Source
#[storage]
Expand description

Mark a struct as contract storage: generates From<Keypath> so each field is bound to a storage slot derived from the struct’s keypath.

Works on named-field structs (fields must themselves be storage types like NNInt, Map, Value, or nested storage structs) and on unit structs (struct Token;) for contracts that keep all state behind raw storage keys.

Accepts an optional domain = "..." argument to override the default domain (the struct’s bare identifier name).