Description
tip: 404
title: TRC-404 Token Standard
author: [email protected]
status: Draft
type: TRC
category: TRC
created: 2025-02-14
Simple Summary
TRC-404 is a hybrid token standard that combines the features of TRC-20 and TRC-721, offering native liquidity and fractionalization.
Abstract
TRC-404 is a novel hybrid token standard that combines the fungibility of TRC-20 with the non-fungibility of TRC-721. It aims to provide native liquidity and fractionalization capabilities for the NFT. The design philosophy of this standard is inspired by Pandora, which addresses the limitations of traditional token standards in terms of liquidity and trading efficiency.
The core of TRC-404 lies in the inextricable creation/transfer of fungible tokens (TRC-20) and non-fungible tokens (TRC-721), tightly linking them under a predefined ratio. For example, a TRC-404 token contract can set a supply of 10,000 TRC-404 tokens and 10 TRC-404 NFTs. When users buy 1000 TRC-404 tokens, one associated NFT is transferred, ensuring a close relationship between the tokens and NFTs.
Motivation
Enhance NFTs with native liquidity and fractionalization capabilities.
-
Make NFTs as easy to trade as cash: Current NFTs function like complete property deeds that must be bought and sold as a whole, which is inconvenient. TRC-404 allows NFTs to be "broken into change" for trading, enabling collectors who can't afford the whole set to buy a 10% share. Users in urgent need of money can quickly sell part of their holdings, and trading platforms can price NFTs more easily.
-
Let tokens "transform" into collectibles: Traditional tokens resemble paper money, where each piece is identical. TRC-404 automatically grants token holders digital collectibles, merging the liquidity of tokens with the uniqueness of NFTs.
-
Create new financial possibilities: By blending the features of fungible tokens and NFTs, TRC-404 opens up innovative DeFi use cases, such as fractional NFT lending, NFT-based yield farming, and dynamic NFT collateralization.
-
Simplify NFT creation and management: TRC-404 introduces an automatic NFT generation mechanism tied to token balances, eliminating the need for separate minting processes and making NFT ownership more accessible to mainstream users.
Specification
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
Every TRC-404 compliant contract MUST implement the TRC-20 and TRC-721 interfaces. The implementation of overlapping interfaces between TRC-20 and TRC-721 must be compatible with both protocols and the compatibility can be categorized as follows:
- TRC-20 and TRC-721: Must be compatible with both TRC-20 and TRC-721.
- TRC-20 only: Only needs to be compatible with TRC-20.
- TRC-721 only: Only needs to be compatible with TRC-721.
Events
/// @dev Compatibility: TRC-20 and TRC-721
/// @dev Implementation: MUST treat `_valueOrTokenId` as tokenId if it <= current maxTokenId, amount of TRC-20 transferred otherwise.
event Transfer(address indexed _from, address indexed _to, uint256 _valueOrTokenId)
/// @dev Compatibility: TRC-20 and TRC-721
/// @dev Implementation: MUST treat `_valueOrTokenId` as tokenId if it <= current maxTokenId, amount of TRC-20 transferred otherwise.
event Approval(address indexed _owner, address indexed _spender, uint256 _valueOrTokenId)
/// @dev Compatibility: TRC-721 only
/// @dev Implementation: MUST comply with TRC-721.
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
Methods
/// 【TRC-20 and TRC-721 related methods】
/// @dev Compatibility: TRC-20 and TRC-721
/// @dev Implementation: SHALL comply with TRC-20 in priority.
/// @notice SHALL return the token balance of user in TRC-20 representation as a priority.
function balanceOf(address _owner) external view returns (uint256);
/// @dev Compatibility: TRC-20 and TRC-721
/// @dev Implementation: MUST treat `_valueOrTokenId` as tokenId if it <= current maxTokenId, otherwise treat it as TRC-20 amount to be transferred.
/// @notice Transfer amount of TRC-20 or TRC-721 NFT from `_from` to address`_to` and MUST fire `Transfer` event if tokens and/or NFTs are transferred.
function transferFrom(address _from, address _to, uint256 _valueOrTokenId) external payable;
/// @dev Compatibility: TRC-20 and TRC-721
/// @dev Implementation: MUST treat `_valueOrTokenId` as tokenId if it <= current maxTokenId, otherwise treat it as TRC-20 amount to be transferred.
/// @notice Change or reaffirm the spender's allowance or the approved address for an NFT.
function approve(address _spender, uint256 _valueOrTokenId) external payable;
/// 【TRC-20 only related methods】
/// @dev Compatibility: TRC-20 only
/// @dev Implementation: MUST comply with TRC-20.
/// @notice Query the name, symbol, decimals, and total supply of tokens in TRC-20 representation.
function name() public view returns (string)
function symbol() public view returns (string)
function decimals() public view returns (uint8)
function totalSupply() public view returns (uint256)
/// @dev Compatibility: TRC-20 only
/// @dev Implementation: MUST comply with TRC-20.
/// @notice Transfer `_value` amount of tokens to address `_to`, and MUST fire the `Transfer` event if tokens and/or NFTs are transferred.
function transfer(address _to, uint256 _value) public returns (bool success)
/// @dev Compatibility: TRC-20 only
/// @dev Implementation: MUST comply with TRC-20.
/// @notice Query the amount which` _spender` is allowed to withdraw from `_owner`.
function allowance(address _owner, address _spender) public view returns (uint256 remaining)
/// 【TRC-721 only related methods】
/// @dev Compatibility: TRC-721 only
/// @dev Implementation: MUST comply with TRC-721.
/// @notice Query the owner of a given TRC-721 NFT.
function ownerOf(uint256 _tokenId) external view returns (address);
/// @dev Compatibility: TRC-721 only
/// @dev Implementation: MUST comply with TRC-721.
/// @notice Transfers the ownership of an NFT from one address to another and MUST fire the `Transfer` event if tokens and/or NFTs are transferred.
function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;
function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external payable;
/// @dev Compatibility: TRC-721 only
/// @dev Implementation: MUST comply with TRC-721.
/// @notice Enable or disable approval for the `_operator`.
function setApprovalForAll(address _operator, bool _approved) external;
/// @dev Compatibility: TRC-721 only
/// @dev Implementation: MUST comply with TRC-721.
/// @notice Get the approved address for a single NFT
function getApproved(uint256 _tokenId) external view returns (address);
/// @dev Compatibility: TRC-721 only
/// @dev Implementation: MUST comply with TRC-721.
/// @notice Query if `_operator` is an authorized operator for `_owner`.
function isApprovedForAll(address _owner, address _operator) external view returns (bool);
Rationale
Transfer Mechanism
The transfer of TRC-404 tokens and associated NFTs is inextricable. When sufficient tokens are transferred, the associated NFTs should also be transferred, and vice versa.
Assuming the TRC-404 contract sets the ratio of tokens to NFTs at 1000:1, meaning 1000 tokens correspond to one NFT, the following examples apply:
- When transferring 900 tokens to Alice, 900/1000 = 0 NFTs should also be transferred to Alice. One TRC-20 Transfer event must be fired.
- When transferring 1000 tokens to Alice, 1000/1000 = 1 NFT should also be transferred to Alice. One TRC-20 and one TRC-721 Transfer event must be fired.
- When transferring 3100 tokens to Alice, 3100/1000 = 3 NFTs should also be transferred to Alice. One TRC-20 and three TRC-721 Transfer events must be fired.
- When transferring 2 NFT to Alice, 2*1000 = 2000 tokens should also be transferred to Alice. Two TRC-721 and one TRC-20 Transfer event must be fired.
Backwards Compatibility
Due to the overlap of specific interfaces between the TRC-20 and TRC-721 protocols, especially the Transfer
event and the balanceOf
method, the TRC-404 is not fully compatible with existing TRON infrastructures, for example, tronscan.org, TRONLink. In light of this, a compromise solution is proposed to maximize compatibility:
- When an NFT is transferred, the contract must emit the standard TRC-721
Transfer
event. - When tokens in TRC-20 representation are transferred, the contract should emit a non-standard
Transfer20
event instead of TRC-20Transfer
event. - Given points 1 and 2, the
balanceOf
method should return user's balance of tokens in TRC-20 representation.
The non-standard Transfer20
event is defined similarly to the TRC-20 Transfer
event, as follows:
event Transfer20(
address indexed from,
address indexed to,
uint256 value
);
Implementation
Paundora Lab has released a market-validated but not fully audited ERC-404 implementation.
References
Copyright
Copyright and related rights waived via CC0.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status