OpenNameTag
Overview
OpenNameTag
is a smart contract that complies with the ERC-721 standard, allowing the issuance and management of unique NameTag NFTs (Non-Fungible Tokens) for addresses on the Silicon Network. Additionally, it uses the ERC-5192 standard to issue a token that manages information bound to a specific address. This allows users to manage metadata and attributes associated with their addresses, such as name, description, image, and even custom key-value pairs as attributes.
Code
Address
Mainnet: TBD
Key Features
Unlike Ethereum Name Service (ENS) on the Ethereum network, OpenNameTag on the Silicon Network offers the following features:
Compliance with ERC-721 Standard
OpenNameTag is an ERC-721 standard NFT token that supports token ownership, issuance, and querying ownership status. Each NameTag issued by users is minted as an NFT, meaning it can be seamlessly integrated into existing NFT systems.
Flexible Attribute Management
Each address can define, add, modify, and delete various attributes (key-value pairs) for their address. Token holders can manage metadata such as name, description, and image, as well as custom attributes.
Each address can specify basic user-defined metadata like
name
,description
, andimage
, which can be easily referenced on the blockchain.This flexible attribute management function allows users to manage attributes with key-value pairs.
Data such as name and image defined by each address can be considered official information about the address and can be utilized in various ways within the blockchain ecosystem. For instance, ERC-20 token contracts can directly provide their image and i18n resources.
1:1 Token Binding per Address
Each address is guaranteed to hold one NameTag, meaning there is no need to search for what attributes an address has assigned to itself.
OpenNameTag implements the ERC-5192 interface, permanently binding the token to the address.
Low Cost, Unlimited Expression
With OpenNameTag, anyone can freely define attributes by simply paying the transaction cost. There is no need to worry about uniqueness, and users don’t have to pay high costs for special words or reserved keywords.
Contract Variables
MAX_PROPERTY_COUNT
: The maximum number of attributes an address can have._name
&_symbol
: The name and symbol of the OpenNameTag token._tokens
: An array storing all issued tokens._ownerList
: A list of addresses that own tokens._tokenIds
: A mapping from owner addresses to the token IDs they own._owners
: A mapping from token IDs to the owner addresses._balances
: A mapping that tracks the token balances of each owner._metadata
: A mapping from token IDs to the metadata (NameTagMetadata structure) of each token._propertyCount
: A mapping that stores the number of attributes each token has._propertyKeyList
: A list that stores the attribute keys for each token._usedProperty
: A mapping that tracks the attributes used by each token._properties
: A mapping that stores the actual attributes (key-value pairs) for each token.
Events
Transfer: Triggered when a token is transferred. (Inherited from ERC-721)
MetadataUpdate: Triggered when a token's metadata is updated.
SetNameTagMetadata: Triggered when NameTag metadata is set.
AddProperty: Triggered when an attribute is added to a token.
RemoveProperty: Triggered when an attribute is removed from a token.
ModifyProperty: Triggered when an attribute of a token is modified.
External Functions
version(): Returns the version of the contract as a string.
ERC-5192 Interface
locked (uint256 tokenId): Always returns true, indicating that the token is permanently locked. This follows the ERC-5192 (Soulbound Token, SBT) standard.
ERC-721 Interface Functions
supportsInterface(bytes4 interfaceId): Checks if the contract supports a specific interface (following the ERC-165 standard).
totalMinted(): Returns the total number of minted tokens.
totalSupply(): Returns the total number of tokens in circulation.
balanceOf(address owner): Returns the number of tokens owned by a specific address.
getOwnerListLength(): Returns the number of unique owners.
getOwnerByIndex(uint256 idx): Returns the address of an owner at a specific index in _ownerList.
ownerOf(uint256 tokenId): Returns the address of the owner of a specific token ID.
tokenIdOf(address owner): Returns the token ID associated with a specific owner's address.
name(): Returns the name of the token collection.
symbol(): Returns the symbol of the token collection.
baseURI(): Returns the base URI for accessing token metadata.
tokenURI(uint256 tokenId): Returns the metadata URI of a specific token.
Metadata Functions
metadata(uint256 tokenId):
Returns the
NameTagMetadata
for a specific token, including thename
,description
, andimage
.
setNameTagMetadata(NameTagMetadata memory nameTagMetadata):
Allows a user to set or update the metadata of a specific token.
propertyCount(uint256 tokenId):
Returns the number of attributes associated with a specific token ID.
propertyKey(uint256 tokenId, uint256 idx):
Returns the attribute key at the idx-th position for a specific token ID.
property(uint256 tokenId, string memory key):
Returns the value of the idx-th attribute key for a specific token ID.
Attribute Management Functions
addProperty(string memory key, string memory value):
Adds a new attribute (key-value pair) to the address.
addPropertyBatch(string[] memory keys, string[] memory values):
Adds multiple attributes to the token in a single batch.
removeProperty(string memory key):
Removes a specific attribute key from the address.
modifyProperty(string memory key, string memory value):
Modifies the value of an existing attribute key for the address.
Last updated