EIPs Explained

ERC-6105 · Final · ERC · 2022-12-02

ERC-6105: No Intermediary NFT Trading Protocol

Builds a marketplace directly into an ERC-721 contract, so NFTs can be listed, bought and offered on without a third-party exchange and with creator-defined royalty schemes.

What problem does it solve?

Selling an NFT usually means giving a marketplace contract setApprovalForAll over your whole collection. That approval is a standing risk: a marketplace bug or a phishing signature can drain it. Liquidity is also split across platforms, each charging fees, and each platform decides on its own whether to honor creator royalties or delist items.

ERC-6105 puts the trading logic inside the NFT contract itself. Owners list directly on the token contract, buyers pay the contract, and the contract enforces whatever royalty rule the creator chose. No intermediary needs approval over your tokens.

How it works

The core interface IERC6105 adds:

  • listItem(tokenId, salePrice, expires, supportedToken[, benchmarkPrice]): list or update a listing. salePrice must be non-zero, expires is a UNIX timestamp, and supportedToken is an ERC-20 address or the zero address for ETH.
  • delistItem(tokenId): remove the listing.
  • buyItem(tokenId, salePrice, supportedToken): payable. The buyer passes the price and token they expect, and the call must fail if they don't match the listing. This prevents a seller from front-running a purchase with a price change.
  • getListing(tokenId): returns (salePrice, expires, supportedToken, benchmarkPrice). A zero price or expiry means not for sale.
  • Events UpdateListing and Purchased (which reports royalties paid).

Two optional extensions add buyer-side orders: collection offers (makeCollectionOffer, acceptCollectionOffer, …: "I'll buy N tokens from this collection at X each") and item offers (makeItemOffer, acceptItemOffer, …) for a specific token. Offers are paid in ERC-20 tokens the buyer has approved to the NFT contract.

Royalties use ERC-2981's royaltyInfo, but the optional benchmarkPrice lets an implementation compute royalties on a "taxable price" other than the sale price. Examples from the spec: royalty only on profit over the previous price, a capped price, or a fixed amount per trade.

Sample code

Listing for 1 ETH and buying (ethers v6):

import { Contract, parseEther, ZeroAddress } from "ethers";

const abi = [
  "function listItem(uint256,uint256,uint64,address)",
  "function getListing(uint256) view returns (uint256,uint64,address,uint256)",
  "function buyItem(uint256,uint256,address) payable",
];

// Seller (owner or approved)
const nftSeller = new Contract(NFT_ADDRESS, abi, sellerSigner);
const expires = BigInt(Math.floor(Date.now() / 1000) + 7 * 24 * 3600);
await (await nftSeller.listItem(42n, parseEther("1"), expires, ZeroAddress)).wait();

// Buyer: read the listing, then pass the same price/token back
const nftBuyer = new Contract(NFT_ADDRESS, abi, buyerSigner);
const [price, , token] = await nftBuyer.getListing(42n);
await (await nftBuyer.buyItem(42n, price, token, { value: price })).wait();

Things to know

  • Status: Final. It is compatible with ERC-721 and ERC-2981; the NFT still trades on ordinary marketplaces unless the creator adds a blocklist, which the standard does not define.
  • Always pass the expected salePrice and supportedToken to buyItem / accept*Offer; that check is the front-running protection.
  • acceptCollectionOffer and acceptItemOffer move tokens and funds, so implementations must follow checks-effects-interactions or use a reentrancy guard.
  • Buyers making ERC-20 offers must approve the NFT contract. Approve only what the offer needs.

#nft #marketplace #royalties #erc721 #trading

Details

Authors
5660-eth (@5660-eth), Silvere Heraudeau (@lambdalf-dev), Martin McConnell (@offgridgecko), Abu <[email protected]>, Wizard Wang
Status
Final
Type
Standards Track / ERC
Created
2022-12-02
Requires

Machine-readable: Markdown · JSON