Developers Forum for XinFin XDC Network

Cover image for [Informative] Understanding XRC404 which is EVM Compatible (ERC404): Bridging Fungible Tokens and NFTs
Vinn
Vinn

Posted on • Updated on

[Informative] Understanding XRC404 which is EVM Compatible (ERC404): Bridging Fungible Tokens and NFTs

In the fast-evolving landscape of blockchain technology, the quest for interoperability and enhanced utility has led to the development of innovative standards like ERC404. This standard aims to bridge the worlds of fungible tokens and non-fungible tokens (NFTs), bringing together the benefits of both in a seamless manner. In this article, we delve into the intricacies of XRC404, exploring how it facilitates the convergence of fungibility and uniqueness within the realm of digital assets.

Image description

What is XRC404?

XRC404 is a EVM Compatible protocol standard built on the XinFin XDC Network, designed to enable the interoperability of fungible tokens and NFTs. It draws inspiration from the ERC-404 standard and introduces a set of guidelines and specifications for the creation and management of hybrid assets that possess both fungible and non-fungible characteristics.

Key Features and Functionality:

Hybrid Asset Creation: XRC404 allows developers to create hybrid assets that combine the properties of fungible tokens and NFTs. These assets can exhibit both divisibility and uniqueness, offering a wide range of use cases across various industries.

Interoperability: One of the primary objectives of XRC404 is to facilitate interoperability between fungible tokens(FTs) and NFTs. Through this standard, different types of digital assets can seamlessly interact within the XinFin ecosystem, unlocking new possibilities for decentralized applications (DApps) and smart contracts.

Enhanced Utility: By merging fungibility and uniqueness, XRC404 enhances the utility of digital assets. Users can leverage these hybrid tokens for applications such as gaming, digital collectibles, supply chain management, and more, enjoying the benefits of both liquidity and scarcity.

Benefits of XRC404:

Versatility: XRC404 opens up a world of possibilities by offering versatile digital assets that can cater to a wide range of use cases.

Efficiency: The standard streamlines asset management and transactions, improving overall efficiency within the blockchain ecosystem.

Innovation: XRC404 fosters innovation by encouraging the development of novel DApps and solutions that leverage the unique capabilities of hybrid tokens.

Use Cases:

Gaming: XRC404 tokens can be utilized within gaming ecosystems to represent both fungible in-game currency and rare collectible items, enhancing the gaming experience for players.

Art and Collectibles: Artists and creators can tokenize their works using XRC404, allowing for the creation of limited-edition digital art pieces that possess inherent value and scarcity.

Supply Chain Management: Hybrid tokens can be employed in supply chain management to track and verify the authenticity of high-value goods, ensuring transparency and trust throughout the supply chain.

How Does XRC-404 Work?

Currently, ERC-404 works by linking every issued token to an NFT, which acts as the source of truth for the token’s state and ownership. The NFT can have a base unit, which defines the minimum amount of tokens that can be transferred or exchanged. The XDC Network, being EVM compatible and deployed on the XDC Apothem Network, mirrors this functionality seamlessly.

For example, if the base unit is 100, then the token can be divided into 100 fractions, each representing 1% of the NFT. The token can also have a total supply, which defines the maximum number of tokens that can be issued for the NFT. For example, if the total supply is 1000, then the token can be minted up to 1000 times, each representing 0.1% of the NFT.

The standard defines the primary functions within the token contract:
Mint: This function empowers the token creator to generate new tokens for a designated NFT, adhering to the total supply limit. It validates the existence of the NFT and verifies the creator’s ownership.

Burn: Token holders wield the authority to destroy tokens, thereby reducing the total supply. The function ensures that the token holder possesses sufficient tokens for burning and confirms the existence of the associated NFT.

Transfer: Token holders can transfer tokens to another address, subject to ownership verification and adequate token balance. Importantly, this function updates the NFT ownership in accordance with the token balance, facilitating seamless transfer of ownership.

Let’s Deploy ERC404 contract on XDC Apothem Network

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
/**
* @title ERC404 Non-Fungible Token Standard basic implementation
* @dev see https://github.com/Pandora-Labs-Org/erc404
*/
contract ERC404 is ERC721 {
constructor() ERC721("XRC404", "NFT") {}
function mint(address to, uint256 tokenId) external {
_mint(to, tokenId);
}
function burn(uint256 tokenId) external {
_burn(tokenId);
}
}
Enter fullscreen mode Exit fullscreen mode

This contract inherits from OpenZeppelin’s ERC721 implementation, providing the core functionality required for an NFT (Non-Fungible Token) contract. It includes methods for minting new tokens (mint) and burning tokens (burn). Additionally, the constructor sets the name and symbol of the token to “XRC404” and “NFT’’ respectively.

Flattening the Contract:
First, we need to flatten the contract code to remove any import statements.

Adjusting Solidity Version:
Before compiling the flattened contract, ensure that the Solidity version is compatible. Change the version from 0.8.20 to 0.8.18 as follows:

pragma solidity ^0.8.18;
Enter fullscreen mode Exit fullscreen mode

Compiling the Contract:
Now, compile the modified contract to ensure it compiles successfully without any errors. This step verifies the integrity of the contract code and prepares it for deployment.

Deploying the Contract:
Once the contract is successfully compiled, it’s time to deploy it on the XDC Apothem Network. Make sure you have sufficient XDC tokens in your wallet to cover the deployment costs.

Image description

Conclusion:

ERC404 stands at the forefront of blockchain innovation, offering a unique solution for bridging the gap between fungible tokens and NFTs. By introducing hybrid assets that blend liquidity with scarcity, this standard paves the way for new possibilities in digital asset management, decentralized finance, and beyond. Leveraging the power of semi-fungible tokens, asset fractionalization, and smart contracts, XRC404 represents a transformative solution for trade finance on the XDC Network. It promises unparalleled efficiency, liquidity, and accessibility, revolutionizing how trade assets are tokenized, traded, and financed. As the blockchain ecosystem evolves, XRC404 is poised to play a pivotal role in shaping the future of digital finance and decentralized applications, unlocking new opportunities for growth, efficiency, and resilience within the global trade ecosystem.

Discussion (0)