Brief explanation of ERC7201: <NAMESPACE_ID> naming convention


I would appreciate a brief explanation of how to name or select <NAMESPACE_ID> id in @custom:storage-location erc7201:<NAMESPACE_ID>.

Is it based on the struct identifier, contract name, domain name, or a preferred combination.

The implementation given in ERC7201 wasn't clear for me.

Thanks in advance

pragma solidity ^0.8.20;

contract Example {
    /// @custom:storage-location erc7201:example.main
    struct MainStorage {
        uint256 x;
        uint256 y;

Upgrades solidity Support Smart Contracts

It must be something that uniquely identifies your namespace within your contract and its inherited contracts. The Upgrades Plugins help to check that you do not have duplicate namespaces in a contract or its inheritance list.

OpenZeppelin Contracts uses namespace IDs based on contract name, such as and

If you are writing your own contracts with namespaces, you can use your own convention for your namespace IDs as long as they are different from each other and anything that you inherit.

1 Like

Tysm. Perfect and brief.