This standard extends the SRC-20 standard to include a metadata function interface and a JSON schema for metadata.
Motivation
Memecoins have demonstrated the value of associating tokens with visual metadata. By standardizing a way to include metadata in SRC-20 tokens, developers can create more engaging and interactive tokens, fostering community engagement.
Specification
The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.
Every compliant contract must implement the ISRC7729, and SRC20 interfaces.
This standard includes the following interface:
pragmasolidity^0.8.0;interfaceISRC20MetadataisISRC20{/// @dev Returns the metadata URI associated with the token.
/// The URI may point to a JSON file that conforms to the "ERCX Metadata JSON Schema".
functionmetadata()externalviewreturns(stringmemory);}
This is the “SRC-7729 Metadata JSON Schema” referenced above.
{"title":"Token Metadata","type":"object","properties":{"name":{"type":"string","description":"Identifies the asset to which this token represents"},"description":{"type":"string","description":"Describes the asset to which this token represents"},"image":{"type":"string","description":"A URI pointing to a resource with mime type image/* representing the asset to which this token represents."}}}
Rationale
The metadata function was chosen based on existing implementations in standards and applications.
Backwards Compatibility
This standard is backward compatible with the SRC-20 as it extends the existing functionality with new interfaces.
The metadata URI could be manipulated to point to malicious content or phishing sites. Off-chain indexers should perform validation checks to ensure the security and integrity of the metadata URIs for users.