---
eip: 3589
label: ERC-3589
title: Assemble assets into NFTs
status: Stagnant
type: Standards Track
category: ERC
created: 2021-05-24
requires: 721
official: https://eips.ethereum.org/EIPS/eip-3589
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-3589.md
canonical: https://eips.huatuo.xyz/eip-3589/
lang: en
tldr: "An ERC-721 extension that locks ETH, ERC-20, ERC-721 and ERC-1155 assets into a single 'assembly' NFT, so a bundle can be traded or swapped atomically as one token."
tags: [nft, erc721, bundle, swap, wrapper]
---

# ERC-3589: Assemble assets into NFTs

> This standard defines a ERC-721 token called assembly token which can represent a combination of assets.

**TL;DR:** An ERC-721 extension that locks ETH, ERC-20, ERC-721 and ERC-1155 assets into a single 'assembly' NFT, so a bundle can be traded or swapped atomically as one token.

## What problem does it solve?

Two collectors who want to swap several NFTs and tokens with each other have no easy, safe way to do it. Listing each item on a marketplace is slow and costs gas per item; handing everything to a trusted middleman is risky.

The safest swap is an atomic one-for-one exchange. ERC-3589 makes that possible by first **assembling** a bundle (some ETH, ERC-20 tokens, ERC-721 NFTs, ERC-1155 tokens) into one [ERC-721](/eip-721/) token. That single NFT can then be transferred, sold or swapped like any other, and burned to release the contents.

## How it works

The contract is an ERC-721 that holds the deposited assets. Its interface:

```solidity
event AssemblyAsset(address indexed firstHolder, uint256 indexed tokenId, uint256 salt,
                    address[] addresses, uint256[] numbers);

function hash(uint256 salt, address[] memory addresses, uint256[] memory numbers) external pure returns (uint256 tokenId);
function mint(address to, address[] memory addresses, uint256[] memory numbers) external payable returns (uint256 tokenId);
function safeMint(address to, address[] memory addresses, uint256[] memory numbers) external payable returns (uint256 tokenId);
function burn(address to, uint256 tokenId, uint256 salt, address[] calldata addresses, uint256[] calldata numbers) external;
```

Assets are described by two arrays. In the reference implementation:

- `addresses` = `[erc20…, erc721…, erc1155…]`
- `numbers` = `[ethAmount, n20, n721, n1155, erc20 amounts…, erc721 ids…, erc1155 ids…, erc1155 amounts…]`

Key points:

- **Token ID = hash of the contents.** `hash(salt, addresses, numbers)` must produce the token ID, so the ID itself commits to exactly what is inside. The salt (e.g. a contract nonce) keeps identical bundles distinct.
- `mint` pulls the assets in (ETH via `msg.value`) and mints the assembly NFT. `safeMint` is for fee-on-transfer tokens and records what was actually received.
- `burn` (callable by the NFT owner) takes the same salt and arrays, checks they hash to `tokenId`, burns the NFT and sends the assets to `to`.
- The `AssemblyAsset` event records the contents so wallets and indexers can show what a bundle holds.
- An assembly token can itself be put into another assembly.

## Sample code

Bundling 1 ETH, 500 USDC-like tokens and one NFT (ethers v6). Approvals for the ERC-20 and ERC-721 must be granted to the assembly contract first.

```ts
import { Contract, parseEther, parseUnits } from "ethers";

const assembly = new Contract(assemblyAddress, [
  "function mint(address,address[],uint256[]) payable returns (uint256)",
], signer);

const addresses = [erc20Address, erc721Address];          // erc20s | erc721s | erc1155s
const numbers = [
  parseEther("1"),          // ETH amount (must equal msg.value)
  1n, 1n, 0n,               // counts: 1 ERC-20, 1 ERC-721, 0 ERC-1155
  parseUnits("500", 6),     // ERC-20 amount
  42n,                      // ERC-721 token id
];

const tx = await assembly.mint(await signer.getAddress(), addresses, numbers, { value: numbers[0] });
await tx.wait();
```

## Things to know

- Status is **Stagnant**. There is no widely adopted deployment; treat it as a design reference.
- To unbundle you need the original `salt`, `addresses` and `numbers`. Keep them, or recover them from the `AssemblyAsset` event.
- A buyer of an assembly NFT should verify its contents from the event (or recompute the hash) before paying, since token IDs are opaque numbers.
- The array encoding is positional and easy to get wrong; a mistake makes `mint` revert or bundles the wrong items.
- Related approaches to composing NFTs include [ERC-998](/eip-998/) (composable NFTs) and [ERC-1155](/eip-1155/) batch transfers, which only cover tokens from one contract.


---

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