EIPs Explained

ERC-4950 · Stagnant · ERC · 2022-03-28

ERC-4950: Entangled Tokens

Proposed an ERC-721 contract that mints exactly two "entangled" tokens and doubles as a wallet both holders can spend from, so trading either NFT trades shared access to that wallet.

What problem does it solve?

The authors wanted a simple way to share a wallet through NFTs: whoever owns the NFT gets to operate the funds behind it, and buying the NFT on any marketplace hands over that privilege. Their headline use case links an artist and a collector. The artist keeps one token and the other goes with the artwork, giving the two a permanent onchain connection that can be used to show authorship and could carry things like royalty distribution.

How it works

An entangled token contract is a normal ERC-721 contract with two extra properties:

  1. Exactly two tokens, ever. It mints tokenId 0 and tokenId 1 at deployment and can never mint again.
  2. It is also a wallet. The contract itself can hold ERC-20 tokens (and other assets), and the owners of the two NFTs can move them via:
function tokenTransfer(IERC20 token, address recipient, uint256 amount) public onlyOwners;

where onlyOwners simply checks that the caller holds at least one of the two tokens. Because the tokens are ordinary ERC-721s, they list and trade on existing marketplaces, and the buyer inherits wallet access.

Sample code

A minimal version using OpenZeppelin v5 (where _mint is not overridable, so the one-time mint lives in the constructor):

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

import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

contract EntangledTokens is ERC721 {
    using SafeERC20 for IERC20;

    constructor() ERC721("Entangled", "ENT") {
        _mint(msg.sender, 0);
        _mint(msg.sender, 1);
        // no other mint path exists, so supply is fixed at two
    }

    modifier onlyOwners() {
        require(balanceOf(msg.sender) > 0, "not an entangled owner");
        _;
    }

    function tokenTransfer(IERC20 token, address recipient, uint256 amount) public onlyOwners {
        token.safeTransfer(recipient, amount);
    }
}

Things to know

  • Status: Stagnant. The proposal was not finalised.
  • Either holder can drain the wallet alone; there is no co-signing, limit or dispute mechanism. Anyone buying one half is trusting whoever holds the other half.
  • The spec lists no security considerations, so treat the design as a sketch rather than a vetted wallet.
  • The spec's reference code overrides _mint, which no longer compiles against OpenZeppelin v5.
  • For the more general idea of an NFT that owns a wallet, see token bound accounts in ERC-6551, where a single NFT controls a dedicated account.

#nft #erc721 #wallet #shared-ownership

Details

Authors
Víctor Muñoz (@victormunoz), Josep Lluis de la Rosa (@peplluis7), Easy Innova (@easyinnova)
Status
Stagnant
Type
Standards Track / ERC
Created
2022-03-28
Requires

Machine-readable: Markdown · JSON