> Aztec.nr API reference, v6.0.0 (mainnet and testnet). Index: https://docs.aztec.network/aztec-nr-api/mainnet/llms.txt

# Function storage

Module: `noir_aztec::macros::storage`

```rust
pub comptime fn storage(s: TypeDefinition) -> Quoted
```

Declares the contract's storage.

This function:

- marks the contract as having storage, so that `macros::utils::module_has_storage` will return true,
- marks the struct `s` as the one describing the storage layout of a contract,
- generates an `impl` block for the storage struct with an `init` function (call to `init` is then injected at the beginning of every `#[external(...)]` and `#[internal]` contract function and the storage is then available as `self.storage`),
- creates a `StorageLayout` struct that is is exposed via the `abi(storage)` macro in the contract artifact.

Only a single struct in the entire contract should have this macro (or `storage_no_init`) applied to it, and the struct has to be called 'Storage'.
