ERC-7649 Built-in NFT bonding curve liquidity (Bonding curve-embedded liquidity for NFTs)

Draft · NFTs & multi-token · created 2024-02-28

A standard that, without modifying ERC-721 itself, attaches a separate 'TradeableShares' contract to an NFT so that shares in it can be bought and sold according to a bonding curve formula. Every trade guarantees a fee to the creator.

Why it is needed

The ERC-721 standard has no official way to attach bonding curve based liquidity to an NFT. A bonding curve is a structure in which price is automatically determined by a formula as the issued amount increases, but if every project that wants to use this builds it differently, wallets and apps cannot handle it consistently, and directly modifying ERC-721 means tampering with an already widely used standard. There is also no common mechanism guaranteeing that creators receive fees from trading activity centered on their own NFTs. This proposal aims to leave the NFT untouched while defining a standard framework for attaching a liquidity contract alongside it, so that NFTs can attract liquidity and creators can receive fees in places such as AI model marketplaces or allocation of decentralized GPU or storage resources.

What to implement

In depth

The ERC-721 non-modification principle

Bonding curve liquidity SHOULD be attached to an NFT via a separate contract and MUST NOT be built into or require modifying the ERC-721 standard itself. The bonding curve contract MUST manage the liquidity of the linked NFT through the curve mechanism. The existing NFT contract is left untouched, and all liquidity functionality is handled entirely by the external contract.

Bonding curve mechanism

The curve determines the price of the NFT's 'keys' (also called shares) as a function of supply, and this formula drives liquidity providers' buying and selling. getPrice(supply, amount) in the BondingCurve interface is the definition of the curve function, calculating the price of amount shares given the current total supply. Implementations MAY allow creators to customize not only parameters such as slope and intercept but also the shape (formula) of the curve itself.

The nature of TradeableShares

Shares are an asset similar to a fungible token in that they cannot be transferred but can be bought and sold. The only counterparty in a trade is the shares contract itself, and the price is predetermined by the bonding curve function. Shares are bound to an NFT defined by the SharesSubject struct (tokenAddress, tokenId), and that NFT's owner acts as the issuer, receiving the subject fee generated on every buy and sell. The subject and fee rate are immutable and clients may cache them, but the issuer address returned by getSharesIssuer() changes over time as NFT ownership transfers and can be a target of front-running attacks, so off-chain apps must not rely on it.

The price lookup function system

Price lookups are organized along two axes. There is a pure version that takes supply as an argument (e.g. getBuyPrice(supply, amount)) and a view version that uses the current supply (e.g. getBuyPrice(amount)), and each has a fee-exclusive and a fee-inclusive (AfterFee) variant. The fee-inclusive versions reflect three fee rates: protocolFeePercent, holdersFeePercent, and subjectFeePercent. The buyer must pay getBuyPriceAfterFee(amount), and the seller receives getSellPriceAfterFee(amount).

Buy and sell rules

In buyShares·buySharesTo, only the current issuer can buy the first share, and in sellShares·sellSharesTo, the last share cannot be sold. buySharesTo and sellSharesTo let a third party (beneficiary) receive the shares or payment. In implementations where settlement is an ERC-20 token, any incoming ETH must be rejected, effectively making the function behave as non-payable. Every trade is recorded via a Trade event, and getTradeVolume() returns the cumulative sum of all trade amounts. This value does not decrease over time.

Creator fee guarantee

The implementation MUST include a mechanism that guarantees fees for the NFT creator, meaning the creator is guaranteed to receive a fixed percentage of the buy/sell trade fees generated by the built-in liquidity contract. Leaving the fee rate definition up to the creator is optional (MAY). The cumulative fee rate returned by getFeePercent() is denominated in 18 decimals, where 10^18 equals 100%, and can be the sum of multiple fees going to different destinations.

Payment method

The built-in liquidity contract MUST support at least one of ERC-20 tokens or native ETH as a payment method, and MAY support both. The source Rationale explains that this implementation-agnostic approach is meant to let developers freely choose the liquidity mechanism that fits their project's needs.

Proposal status

This proposal is in Draft status, created in February 2024. Its content may change or stall, so its current status should be checked before implementation.

Things to watch out for

Original ERC · ← ERCs