Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ERC6909Metadata

Inherits: ERC6909, IERC6909Metadata

Implementation of the Metadata extension defined in ERC6909. Exposes the name, symbol, and decimals of each token id.

State Variables

_tokenMetadata

mapping(uint256 id => TokenMetadata) private _tokenMetadata;

Functions

name

Returns the name of the token of type id.

function name(uint256 id) public view virtual override returns (string memory);

symbol

Returns the ticker symbol of the token of type id.

function symbol(uint256 id) public view virtual override returns (string memory);

decimals

Returns the number of decimals for the token of type id.

function decimals(uint256 id) public view virtual override returns (uint8);

_setName

Sets the name for a given token of type id. Emits an ERC6909NameUpdated event.

function _setName(uint256 id, string memory newName) internal virtual;

_setSymbol

Sets the symbol for a given token of type id. Emits an ERC6909SymbolUpdated event.

function _setSymbol(uint256 id, string memory newSymbol) internal virtual;

_setDecimals

Sets the decimals for a given token of type id. Emits an ERC6909DecimalsUpdated event.

function _setDecimals(uint256 id, uint8 newDecimals) internal virtual;

Events

ERC6909NameUpdated

The name of the token of type id was updated to newName.

event ERC6909NameUpdated(uint256 indexed id, string newName);

ERC6909SymbolUpdated

The symbol for the token of type id was updated to newSymbol.

event ERC6909SymbolUpdated(uint256 indexed id, string newSymbol);

ERC6909DecimalsUpdated

The decimals value for token of type id was updated to newDecimals.

event ERC6909DecimalsUpdated(uint256 indexed id, uint8 newDecimals);

Structs

TokenMetadata

struct TokenMetadata {
    string name;
    string symbol;
    uint8 decimals;
}