Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
ERC-7629 proposes a unified token interface that combines ERC-20 and ERC-721 functionality and supports conversion between the two representations.
This article translates, summarizes, and expands on the following proposal.
More EIP explainers:
Overview
ERC-7629 defines an interface for managing fungible tokens (ERC-20) and non-fungible tokens (ERC-721) within a common token architecture.
It provides operations applicable to both representations so that developers can interact with fungible balances and individual NFTs through a unified interface.
For ERC-20, see the following article.
For ERC-721, see the following article.
Motivation
The proposal addresses demand for assets that combine the liquidity associated with fungible tokens and the individual characteristics of NFTs.
Traditional ERC-20 and ERC-721 interfaces represent different ownership models.
Other hybrid token designs, including DN404 and ERC404, also combine fungible and non-fungible representations. They are distinct approaches and should not be treated as interchangeable standards.
ERC-7629 aims to make conversions between the two representations available through a common interface.
Specification
The proposal introduces the following features:
- A contract architecture combining ERC-20 and ERC-721 functionality.
- Conversion operations between fungible and non-fungible representations.
- Functions and events for transfers, conversions, and information queries.
- Efficient fungible-token operations, with ordinary ERC-20 transfer costs as a design objective rather than a guaranteed gas figure.
The original article reproduces the following proposed interface.
pragma solidity ^0.8.0;
/**
* @title ERC-7629 Unify Token Interface
* @dev This interface defines the ERC-7629 Unify Token, which unifies ERC-721 and ERC-20 assets.
*/
interface IERC7629 is IERC165 {
// ERC-20 Transfer event
event ERC20Transfer(
address indexed from,
address indexed to,
uint256 amount
);
// ERC-721 Transfer event
event ERC721Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
// ERC-721 Transfer event
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
// Approval event for ERC-20 and ERC-721
event Approval(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);
// Approval event for ERC-20 and ERC-721
event Approval(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);
// Approval event for ERC-20
event ERC20Approval(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);
// ApprovalForAll event for ERC-721
event ApprovalForAll(
address indexed owner,
address indexed operator,
bool approved
);
// ERC-20 to ERC-721 Conversion event
event ERC20ToERC721(address indexed to, uint256 amount, uint256 tokenId);
// ERC-721 to ERC-20 Conversion event
event ERC20ToERC721(address indexed to, uint256 amount, uint256[] tokenIds);
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the number of decimals used in the token.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the total supply of the ERC-20 tokens.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the balance of an address for ERC-20 tokens.
* @param owner The address to query the balance of.
*/
function balanceOf(address owner) external view returns (uint256);
/**
* @dev Returns the total supply of ERC-20 tokens.
*/
function erc20TotalSupply() external view returns (uint256);
/**
* @dev Returns the balance of an address for ERC-20 tokens.
* @param owner The address to query the balance of.
*/
function erc20BalanceOf(address owner) external view returns (uint256);
/**
* @dev Returns the total supply of ERC-721 tokens.
*/
function erc721TotalSupply() external view returns (uint256);
/**
* @dev Returns the balance of an address for ERC-721 tokens.
* @param owner The address to query the balance of.
*/
function erc721BalanceOf(address owner) external view returns (uint256);
/**
* @notice Get the approved address for a single NFT
* @dev Throws if `tokenId` is not a valid NFT.
* @param tokenId The NFT to find the approved address for
* @return The approved address for this NFT, or the zero address if there is none
*/
function getApproved(uint256 tokenId) external view returns (address);
/**
* @dev Checks if an operator is approved for all tokens of a given owner.
* @param owner The address of the token owner.
* @param operator The address of the operator to check.
*/
function isApprovedForAll(
address owner,
address operator
) external view returns (bool);
/**
* @dev Returns the remaining number of tokens that spender will be allowed to spend on behalf of owner.
* @param owner The address of the token owner.
* @param spender The address of the spender.
*/
function allowance(
address owner,
address spender
) external view returns (uint256);
/**
* @dev Returns the array of ERC-721 token IDs owned by a specific address.
* @param owner The address to query the tokens of.
*/
function owned(address owner) external view returns (uint256[] memory);
/**
* @dev Returns the address that owns a specific ERC-721 token.
* @param tokenId The token ID.
*/
function ownerOf(uint256 tokenId) external view returns (address erc721Owner);
/**
* @dev Returns the URI for a specific ERC-721 token.
* @param tokenId The token ID.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
/**
* @dev Approve or disapprove the operator to spend or transfer all of the sender's tokens.
* @param spender The address of the spender.
* @param amountOrId The amount of ERC-20 tokens or ID of ERC-721 tokens.
*/
function approve(
address spender,
uint256 amountOrId
) external returns (bool);
/**
* @dev Set or unset the approval of an operator for all tokens.
* @param operator The address of the operator.
* @param approved The approval status.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Transfer ERC-20 tokens or ERC-721 token from one address to another.
* @param from The address to transfer ERC-20 tokens or ERC-721 token from.
* @param to The address to transfer ERC-20 tokens or ERC-721 token to.
* @param amountOrId The amount of ERC-20 tokens or ID of ERC-721 tokens to transfer.
*/
function transferFrom(
address from,
address to,
uint256 amountOrId
) external returns (bool);
/**
* @notice Transfers the ownership of an NFT from one address to another address
* @dev Throws unless `msg.sender` is the current owner, an authorized
* operator, or the approved address for this NFT. Throws if `_rom` is
* not the current owner. Throws if `_to` is the zero address. Throws if
* `tokenId` is not a valid NFT. When transfer is complete, this function
* checks if `to` is a smart contract (code size > 0). If so, it calls
* `onERC721Received` on `to` and throws if the return value is not
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`.
* @param from The current owner of the NFT
* @param to The new owner
* @param tokenId The NFT to transfer
* @param data Additional data with no specified format, sent in call to `to`
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external payable;
/**
* @notice Transfers the ownership of an NFT from one address to another address
* @dev This works identically to the other function with an extra data parameter,
* except this function just sets data to "".
* @param from The current owner of the NFT
* @param to The new owner
* @param tokenId The NFT to transfer
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external payable;
/**
* @dev Transfer ERC-20 tokens to an address.
* @param to The address to transfer ERC-20 tokens to.
* @param amount The amount of ERC-20 tokens to transfer.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Retrieves the unit value associated with the token.
* @return The unit value.
*/
function getUnit() external view returns (uint256);
/**
* @dev Converts ERC-721 token to ERC-20 tokens.
* @param tokenId The unique identifier of the ERC-721 token.
*/
function erc721ToERC20(uint256 tokenId) external;
/**
* @dev Converts ERC-20 tokens to an ERC-721 token.
* @param amount The amount of ERC-20 tokens to convert.
*/
function erc20ToERC721(uint256 amount) external;
}The excerpt is retained unchanged. It includes duplicate Approval declarations and differently parameterized events both named ERC20ToERC721, despite comments describing opposite conversion directions. Developers should reconcile these inconsistencies with the applicable specification before compiling or implementing the interface.
getUnit
/**
* @dev Retrieves the unit value associated with the token.
* @return The unit value.
*/
function getUnit() external view returns (uint256);Returns the conversion unit used to associate a quantity of fungible tokens with an individual NFT.
erc721ToERC20
/**
* @dev Converts ERC-721 token to ERC-20 tokens.
* @param tokenId The unique identifier of the ERC-721 token.
*/
function erc721ToERC20(uint256 tokenId) external;Converts the NFT identified by tokenId into the corresponding fungible-token representation, subject to the implementation's conversion and authorization rules.
erc20ToERC721
/**
* @dev Converts ERC-20 tokens to an ERC-721 token.
* @param amount The amount of ERC-20 tokens to convert.
*/
function erc20ToERC721(uint256 amount) external;Converts the specified quantity of fungible tokens into a non-fungible representation. The implementation must define the applicable conversion unit, handling of any remainder, and resulting token IDs.
Rationale
Unified interface
A shared interface exposes operations for both fungible and non-fungible assets, reducing the need for entirely separate integration logic. Applications still need to distinguish the two forms of accounting.
Transfers
Both ERC-20 and ERC-721 define transferFrom, but the final uint256 argument represents an amount in ERC-20 and a token ID in ERC-721.
A unified implementation must distinguish these semantics unambiguously. The identical function selector alone cannot identify which meaning the caller intends.
Minting and burning
Mint and burn operations allow tokens to be issued or destroyed as required by the asset model.
Conversion logic must define how balances and NFT ownership change together so that conversions do not unintentionally create or destroy economic value.
Balance and ownership queries
Fungible-token balances represent quantities, whereas NFT balances represent counts of individually identified tokens.
The interface provides separate queries where needed, including ownership lookup through ownerOf and distinct balance queries for fungible and non-fungible representations.
Compatibility and extensibility
Reusing concepts from ERC-20 and ERC-721 can help developers integrate hybrid tokens. However, differences in the actual ABI and operation semantics mean existing integrations may need changes, as discussed below.
Additional functionality can be exposed through further interfaces.
Security considerations
Implementations should protect conversion and transfer operations against reentrancy, inconsistent accounting, and arithmetic errors.
OpenZeppelin provides ReentrancyGuard for applications requiring a reentrancy guard.
Solidity introduced checked arithmetic by default in version 0.8.0, not 0.8.20. Unchecked blocks, explicit narrowing conversions, and other operations can still require special care.
For further background on reentrancy and integer arithmetic, see the following articles.
https://chaldene.net/solidity-reentrancy-attack
https://chaldene.net/solidity-overflow-underflow
Compatibility
ERC-20 and ERC-721 both expose balanceOf(address), but its meaning differs between the two standards.
The proposed interface distinguishes erc20BalanceOf from erc721BalanceOf. This avoids ambiguity within the unified interface but means that ordinary clients expecting the existing balanceOf function cannot necessarily use it unchanged.
The original proposal discussion considers whether a more general balanceOf operation could be used. Any such design must define its meaning and account for compatibility with both types of clients.
Security
A unified token architecture must clearly document how its two representations interact. Ambiguous transfer semantics, conversion rules, or supply accounting can lead to inconsistent implementations.
Conversions should preserve the intended accounting invariants and enforce the relevant ownership and allowance requirements. Developers should also consider rounding, token-ID allocation, callbacks, and external interactions.
The interface excerpts above are reproduced from the original article and have not been independently compiled, tested, or audited.
Citation
0xZeus1111 (@0xZeus1111), Nvuwa (@Nvuwa), "ERC-7629: ERC-20/ERC-721 Unified Token Interface [DRAFT]," Ethereum Improvement Proposals, no. 7629, February 2024. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7629.
Conclusion
ERC-7629 proposes a common interface for fungible and non-fungible token operations, including explicit conversion between the two representations.
Its main implementation challenges concern compatibility with existing token interfaces, unambiguous operation semantics, and consistent accounting across conversions.
Questions are welcome via Twitter @cardene777.
Other publications:




