---
eip: 7564
label: ERC-7564
title: Contract wallet management NFT
status: Draft
type: Standards Track
category: ERC
created: 2023-11-21
requires: 165
official: https://eips.ethereum.org/EIPS/eip-7564
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7564.md
canonical: https://eips.huatuo.xyz/eip-7564/
lang: en
tldr: "A draft interface that moves NFT approvals and transfers into the user's smart contract wallet, letting the wallet enforce its own rules for who may move which NFTs."
tags: [wallet, account-abstraction, nft, approval]
---

# ERC-7564: Contract wallet management NFT

> Focuses on NFT management within smart contract wallets, offering enhanced transaction flexibility and security

**TL;DR:** A draft interface that moves NFT approvals and transfers into the user's smart contract wallet, letting the wallet enforce its own rules for who may move which NFTs.

## What problem does it solve?

With [ERC-721](/eip-721/), approvals are stored inside each NFT contract. A `setApprovalForAll` given to a marketplace years ago stays live until you find that collection and revoke it, and the NFT contract decides what an approval means. An externally-owned account has no code, so it cannot add its own limits.

A smart contract wallet (for example one built on [ERC-4337](/eip-4337/)) can. ERC-7564 proposes that the wallet itself hold NFT permissions and perform the transfers, so the user's account, not each collection, is the place where approvals are granted, checked and revoked. It is the NFT counterpart of [ERC-7204](/eip-7204/) for fungible tokens.

## How it works

The wallet implements `IERC7564` and [ERC-165](/eip-165/). Permissions exist at three levels:

| Level | Set with | Read with |
| --- | --- | --- |
| One NFT (`asset`, `tokenId`) | `nftApprove(asset, operator, tokenId)` | `nftGetApproved(asset, operator, tokenId)` |
| All NFTs of one collection | `nftSetApprovalForOneAll(asset, operator, approved)` | `nftIsApprovedForOneAll(asset, operator)` |
| All NFTs in the wallet | `nftSetApprovalForAllAll(operator, approved)` | `nftIsApprovedForAllAll(operator)` |

Matching events `NftApproval`, `NftApprovalForOneAll` and `NftApprovalForAllAll` are emitted.

`nftTransfer(asset, to, tokenId)` calls the NFT contract's transfer from inside the wallet. If the caller is the wallet itself it proceeds; otherwise the wallet must check the caller's approval first and update it. Optional extras include batch operations, hooks before and after transfers, and an `nftReceive` function.

## Sample code

Core of a wallet-side transfer check (owner auth and ERC-165 omitted):

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

interface IERC721 { function transferFrom(address from, address to, uint256 id) external; }

contract NftWallet {
    mapping(address => mapping(address => mapping(uint256 => bool))) private _one; // asset=>op=>id
    mapping(address => mapping(address => bool)) private _collection;             // asset=>op
    mapping(address => bool) private _all;                                        // op

    function nftTransfer(address asset, address to, uint256 id) external returns (bool) {
        if (msg.sender != address(this)) {
            bool ok = _one[asset][msg.sender][id] || _collection[asset][msg.sender] || _all[msg.sender];
            require(ok, "not approved");
            _one[asset][msg.sender][id] = false; // single-NFT approval is used up
        }
        IERC721(asset).transferFrom(address(this), to, id);
        return true;
    }
}
```

## Things to know

- Status is **Draft**. The spec still has TODO placeholders and does not yet state the ERC-165 interface ID.
- Its Security Considerations section is empty; treat any implementation as unaudited.
- Approvals you granted directly on NFT contracts (`approve` / `setApprovalForAll`) remain in force; this scheme only covers transfers routed through `nftTransfer`.
- The spec names `transfer()` loosely; real ERC-721 contracts expose `transferFrom` / `safeTransferFrom`, as used above.


---

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