What is DN-404? A 5-Minute Explainer

What is DN-404? A 5-Minute Explainer

Non-fungible tokens (NFTs) are vital in the evolution of digital ownership, allowing verifiable authenticity and transparency of unique assets. 

However, in pursuing scarcity and uniqueness, NFT markets were reduced to a market of speculation rather than utility. Thin order books and lack of liquidity mean the masses find it hard to adopt NFTs.

DN-404 is a novel NFT mechanic that couples unique NFTs with interoperable ERC-20 tokens. The non-fungibility of NFTs proves ownership and uniqueness, while the ERC-20 element facilitates on-chain interactions.

In this article, we'll explain what DN-404 is, how it works, and its potential benefits and drawbacks. 

What is DN-404?

DN-404 is an experimental Ethereum token standard that combines the functionalities of the popular ERC-20 and ERC-721 standards. It enables native fractionalization of NFTs and enhances their liquidity while integrating smoothly with existing protocols. 

Although fractionalized NFTs exist, they remain abstracted from the user — the NFTs are locked into a smart contract or custodial wallet, and users get tokens representing the NFT fraction they own. In other words, the existing system of fractionalizing NFTs introduces friction and over-reliance on third-party protocols.

DN-404 aims to solve this issue by allowing multiple wallets to own a single NFT directly. 

The Pandora NFT project

Pandora is one of the first projects to adopt the DN-404 standard, featuring a collection of 10,000 unique NFTs called Replicants. These NFTs are intrinsically linked to the PANDORA tokens. These tokens enable the fractionalization of Replicant NFTs, allowing each token to represent a share of ownership in the NFT. 

Owners can trade PANDORA tokens and, if they accumulate all tokens corresponding to an NFT, can redeem the complete Replicant NFT. 

Pandora also includes a liquidity pool to facilitate the trading of PANDORA tokens. The project introduces dynamic NFTs whose appearances change as tokens are traded, adding a novel aspect to NFT ownership.

How does DN-404 work?

ERC-721 tokens are inherently non-fungible, designed to represent unique and indivisible assets. Ownership is expressed in whole units; a token's balance reflects this (1 for ownership, 0 upon transfer). 

In contrast, DN-404 introduces a hybrid model by incorporating fungibility into the NFT structure itself. Each NFT is composed of base units (similar to how ETH is divided into wei), which are defined by the number of decimals specified in the smart contract. If the number of decimals is set to 2, it means the token can be divided into 10^2 parts or 100 parts. 

The base unit is also the smallest indivisible unit of the NFT and the minimum token amount a user must acquire to mint an NFT

Here’s a simple infographic to explain the working better:

But where does DN-404 acquire its hybrid functionality from? To understand this, we need to understand how its code works. 



DN-404 contract code explained 

Let's dive into three functions — 'Approval', 'transferFrom', and the 'transfer' — within the DN-404 code to understand how it operates as a token and NFT.  

'Approval'

The 'if condition' within the approval function determines if the contract is executing an ERC-721 approval or an ERC-20 approval. But to understand this logic, let's first understand the two components, namely `amountOrId` and 'minted'.

  • `amountOrId`: Refers to the uint256 value being approved, which can either represent an ERC721 token ID or an ERC20 allowance amount.
  • 'minted': Represents the total number of ERC-721 tokens (NFTs) that have been created (or "minted") in the contract. 

The 'minted' count traditionally applies to NFTs with distinct token IDs, so it functions as a logical separator within DN-404. 

Let's analyze the 'if condition' to understand this concept better:

  • If `amountOrId` is less than or equal to the `minted` value and greater than 0, it's assumed to be an ERC 721 approval. 

The amountOrId is treated as a token ID. And if it is within the range of 1 to the total number of minted ERC-721 tokens, it's considered a valid NFT ID. This makes sense in the context of NFTs, where each token has a unique ID.

  • If `amountOrId` is higher than the `minted` value or equal to 0, it is treated as an ERC20 approval.

Since ERC-20 tokens don't have a distinct token ID like NFTs, the logic assumes that any 'amountOrId' greater than the number of 'minted' NFTs must be a token. 

'transferFrom'

The 'if condition' within the 'transferFrom' function uses the logic mentioned above to determine if it should execute an NFT or token transfer. 

When it comes to NFT transfers, the logic is straightforward and standard. The function verifies ownership, authorizes the transfer, checks for approvals, and updates the contract state to reflect the transfer.

However, unlike traditional NFT transfers, where balances change incrementally by 1, DN-404 adjusts balances with the help of the _getUnit() function, determining the base units being transferred.

‘transfer’

Things get a little complicated when it comes to transferring base unit tokens as it involves the minting or burning of NFTs. 

For starters, it requires tracking the token supply and maintaining a list of every token owned by an account on-chain. The code block below does this: 

Next, let’s take a look at this snippet; it checks the number of tokens the user will have before and after the transfer, rounds the balance and decides whether an NFT is going to be minted or burnt. 

If the number of tokens will be less than the base unit after the transfer is complete, the last NFT in the ‘owned’ list will be burnt. But if the balance goes up by a unit, an NFT is minted.

Potential benefits of DN-404

DN-404 can open up new benefits across various sectors thanks to the native fractionalization.

  • Fractional ownership: Allows more people to participate in owning high-value digital collectibles or artwork, increasing accessibility and potential market growth.
  • New revenue streams: An artist could create an NFT representing a music track, film, or piece of writing. The smart contract within the DN-404 NFT could be programmed to automatically distribute a percentage of royalties generated from the work to whoever holds the fractional tokens.
  • Improved liquidity: Unlike whole NFTs that often require marketplaces or direct peer-to-peer transactions, the fungible fractions are easily tradable on typical decentralized exchanges (DEXs) designed for ERC-20 tokens, improving liquidity. 

Drawbacks of DN-404

While DN-404 offers new possibilities, it's essential to be aware of its potential drawbacks and challenges:

  • Unofficial standard: DN-404 is still an experimental standard. That means the code has the potential for unforeseen bugs and vulnerabilities as the contract is still unaudited.
  • Infinite re-rolls: The 'mint' function in the DN-404 contract allows the user to mint and burn as many NFTs as they want for the cost of gas. Everybody can keep burning their NFTs until they end up with a rare one. 
  • Higher gas costs: Since the DN-404 contract maintains a list of all the tokens maintained by an on-chain account, the gas costs associated with transferring an DN-404 NFT to another wallet are enormous. 

The future of DN-404: what lies ahead?

DN-404 blends the functionalities of an NFT and token to offer fractional ownership, enhanced liquidity, and dynamic NFT features. Although an unofficial, experimental standard, it has enjoyed a meteoric rise within the crypto community. 

It has also sparked the creation of other unofficial standards like the DN404 and the ERC 20721, which aim to address the current limitations of NFTs. 

All in all, standards like DN-404, although unofficial, demonstrate the potential for new use cases within the Ethereum ecosystem. 

thirdweb: The complete web3 development platform
Build web3 apps easily with thirdweb’s powerful SDKs, audited smart contracts, and developer tools—for Ethereum & 700+ EVM chains. Try now.

We hope this blog helps you better understand how DN-404 works, as well as its advantages and drawbacks. 

If you have any questions, join 40,000+ other builders in our Discord community or reach out to the team directly for more info on how to get started with building using DN-404.