---
eip: 7590
label: ERC-7590
title: ERC-20 Holder Extension for NFTs
status: Review
type: Standards Track
category: ERC
created: 2024-01-05
requires: 20, 165, 721
official: https://eips.ethereum.org/EIPS/eip-7590
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7590.md
canonical: https://eips.huatuo.xyz/eip-7590/
lang: en
tldr: An ERC-721 extension that lets each NFT hold its own ERC-20 balances, so fungible tokens can be bundled inside an NFT and travel with it when it is sold or transferred.
tags: [nft, erc20, composability, token-holder, gaming]
---

# ERC-7590: ERC-20 Holder Extension for NFTs

> Extension to allow NFTs to receive and transfer ERC-20 tokens.

**TL;DR:** An ERC-721 extension that lets each NFT hold its own ERC-20 balances, so fungible tokens can be bundled inside an NFT and travel with it when it is sold or transferred.

## What problem does it solve?

Games and apps often want an NFT to carry fungible value with it: a character with its gold, a membership pass preloaded with reward points, a bundle sold as one item. With plain [ERC-721](/eip-721/), the tokens sit in the owner's wallet, not "in" the NFT, so they do not move when the NFT changes hands.

ERC-7590 adds a small interface so an NFT contract can track [ERC-20](/eip-20/) balances per token id. Whoever owns (or is approved for) the NFT controls the tokens inside it.

## How it works

The NFT contract itself custodies the ERC-20s and keeps an internal ledger per `(erc20Contract, tokenId)`:

- `transferERC20ToToken(erc20, tokenId, amount, data)`: pulls `amount` from `msg.sender` (who must have approved the NFT contract) and credits it to `tokenId`. Emits `ReceivedERC20`.
- `transferHeldERC20FromToken(erc20, tokenId, to, amount, data)`: sends tokens out of an NFT. Only the NFT owner or an approved operator may call it. Emits `TransferredERC20` and increments the token's nonce.
- `balanceOfERC20(erc20, tokenId)`: the balance held by that NFT.
- `erc20TransferOutNonce(tokenId)`: a counter that goes up on every transfer out.

The design uses a **pull** mechanism because ERC-20 has no standard transfer callback: there is no way for a contract receiving a plain `transfer` to know which NFT it was meant for. The authors also chose a granular ERC-20-only interface rather than a generic holder for every token type, since ERC-721 and ERC-1155 already have safe-transfer receiver hooks.

## Sample code

Interface:

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;

interface IERC7590 /* is IERC165, IERC721 */ {
    event ReceivedERC20(address indexed erc20Contract, uint256 indexed toTokenId, address indexed from, uint256 amount);
    event TransferredERC20(address indexed erc20Contract, uint256 indexed fromTokenId, address indexed to, uint256 amount);

    function balanceOfERC20(address erc20Contract, uint256 tokenId) external view returns (uint256);
    function transferHeldERC20FromToken(address erc20Contract, uint256 tokenId, address to, uint256 amount, bytes memory data) external;
    function transferERC20ToToken(address erc20Contract, uint256 tokenId, uint256 amount, bytes memory data) external;
    function erc20TransferOutNonce(uint256 tokenId) external view returns (uint256);
}
```

Loading tokens into NFT #7 (ethers v6):

```ts
await (await erc20.approve(nftAddress, amount)).wait();
await (await nft.transferERC20ToToken(erc20Address, 7n, amount, "0x")).wait();
console.log(await nft.balanceOfERC20(erc20Address, 7n));
```

## Things to know

- Status is **Review**, not yet Final.
- ERC-20 tokens sent directly to the NFT contract with a plain `transfer` are not credited to any NFT and are lost. Always use `transferERC20ToToken`.
- Implementations must pull from `msg.sender`, never from an arbitrary `from`, or approvals could be abused to move someone else's tokens into a different NFT.
- Marketplaces must record `erc20TransferOutNonce` when an NFT is listed and revert the sale if it changed, otherwise a seller can drain the bundled tokens just before the sale executes.
- Fee-on-transfer tokens can make credited and actual balances diverge; measure the contract's balance before and after.
- A different approach is [ERC-6551](/eip-6551/), which gives each NFT its own smart-contract account that can hold any asset.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-7590
