EIPs Explained

ERC-7595 · Draft · ERC · 2023-03-13

ERC-7595: Collateralized NFT

A draft ERC-721 extension ("Envious" NFTs) that lets each NFT hold ETH and ERC-20 collateral that only its current owner can withdraw, giving the token an on-chain verifiable floor value.

What problem does it solve?

NFT lending and pricing usually rely on a collection's market floor price. That number is volatile, set by thin markets, and can be manipulated. There is no way to look at a token on-chain and say "this NFT is backed by at least X".

ERC-7595 lets an NFT carry real assets inside it. Anyone can deposit ETH or ERC-20 tokens as collateral for a specific token ID, and only whoever owns that NFT can take them out. The collateral travels with the NFT when it is sold, so its value has a verifiable lower bound. The authors call such collections Envious.

How it works

The IERC721Envious interface extends ERC-721 with:

  • collateralize(tokenId, amounts[], tokens[]): deposit several assets into one NFT in one transaction. The native coin is identified by the zero address. collateralBalances(tokenId, token) and collateralTokens(tokenId, i) show what each NFT holds.
  • uncollateralize(tokenId, amounts[], tokens[]): withdraw collateral; only the NFT owner may call it.
  • disperse(amounts[], tokens[]): deposit collateral for the whole collection at once; each token ID can later claim its share (tracked by disperseBalance, disperseTaken, etc.).
  • Commissions and harvest: commissions(0) and commissions(1) are fees taken on collateralize and uncollateralize (3-decimal precision, so 1000 = 1 %). Fees accumulate in a community pool. Holders of the collection's communityToken can harvest them; the community tokens spent are sent to a blackHole contract that can never send them out, taking them out of circulation. getAmount quotes a harvest.
  • Events: Collateralized, Uncollateralized, Dispersed, Harvested.

For collections that are already deployed and cannot change, the spec defines IEnviousHouse, a separate contract that offers the same functions with an extra collection parameter, after the collection is added with registerCollection.

The spec also mentions optional presets (dynamic tokenURI based on collateral, royalties, and distributing collateral with Chainlink VRF).

Sample code

Backing an NFT with ETH and USDC, then checking its balance (ethers v6):

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

const envious = new Contract(collection, [
  "function collateralize(uint256,uint256[],address[]) payable",
  "function uncollateralize(uint256,uint256[],address[])",
  "function collateralBalances(uint256,address) view returns (uint256)",
], signer);

const tokenId = 7n;
const ethAmt = parseEther("0.5");
const usdcAmt = parseUnits("100", 6);

// approve USDC to the collection contract first, then:
await (await envious.collateralize(tokenId, [ethAmt, usdcAmt], [ZeroAddress, usdcAddress],
  { value: ethAmt })).wait();

console.log(await envious.collateralBalances(tokenId, ZeroAddress)); // ETH held by NFT #7

Things to know

  • Status is Draft.
  • This standard uses the zero address for the native coin. ERC-7528 instead recommends 0xEeee…EEeE for the same purpose, so integrators should check which convention a contract follows.
  • Collateral belongs to whoever owns the NFT at withdrawal time. A buyer should check collateralBalances before purchase, and a seller loses access on transfer.
  • As with any ERC-721 extension, hidden logic in functions such as burn can put the collateral at risk. Burning an NFT that still holds collateral could lock those assets, depending on the implementation.
  • Commission and harvest rules are set per collection; read them before depositing.

#nft #collateral #nftfi #erc721 #erc20

Details

Authors
571nKY (@571nKY), Cosmos (@Cosmos4k), f4t50 (@f4t50), Harpocrates (@harpocrates555)
Status
Draft
Type
Standards Track / ERC
Created
2023-03-13
Requires

Machine-readable: Markdown · JSON