Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

This article examines ERC-7641, a proposal to integrate revenue sharing into ERC-20 tokens and support sustainable token models.

This article translates, summarizes, and expands on the following specification.

More EIP explainers:

Overview

The proposal extends ERC-20 tokens with an intrinsic revenue-sharing mechanism.

For an introduction to ERC-20, see:

https://chaldene.net/erc20

The interface retains ERC-20 functionality while supporting proportional revenue distribution among token holders. Its design centers on a pool that collects revenue from multiple sources.

Token holders can burn their tokens to redeem their proportional share of the redeemable pool. As long as that pool contains assets, the mechanism provides a proportional redemption entitlement, subject to the implementation's rules. It does not guarantee a token's market price.

Holders can also claim revenue at periodic intervals, providing an additional incentive to participate in the ecosystem.

Motivation

Revenue distribution to token holders

The proposal aims to support a sustainable token model with periodic revenue claims, greater liquidity, and long-term benefits for holders.

By retaining ERC-20 functionality, holders can trade their tokens. Where the optional burn mechanism is available, they can also redeem a share of pooled assets while reducing the token supply. A sustainable revenue-sharing ecosystem may encourage continued participation.

Funding different types of projects

The mechanism could support tokenization and funding for a range of projects. Contributors to open-source projects could participate in revenue sharing. One proposed use case is an Initial Model Offering (IMO), which could fund continued development of open-source AI models.

Many open-source AI model projects face difficulties monetizing contributions.

Projects using an open-source model could contribute funds to the revenue pool. Intrinsic RevShare token holders could receive proportional distributions. The proposed entitlement mechanism is intended to encourage long-term participation in open-source AI communities; actual returns depend on the revenue generated and applicable distribution rules.

Specification

Contracts conforming to IERC7641 must implement the following interface.

js
pragma solidity ^0.8.24;

/**
 * @dev An interface for ERC-7641, an ERC-20 extension that integrates a revenue-sharing mechanism, ensuring tokens intrinsically represent a share of a communal revenue pool
 */
interface IERC7641 is IERC20 {
    /**
     * @dev A function to calculate the amount of ETH claimable by a token holder at certain snapshot.
     * @param account The address of the token holder
     * @param snapshotId The snapshot id
     * @return The amount of revenue token claimable
     */
    function claimableRevenue(address account, uint256 snapshotId) external view returns (uint256);

    /**
     * @dev A function for token holder to claim ETH based on the token balance at certain snapshot.
     * @param snapshotId The snapshot id
     */
    function claim(uint256 snapshotId) external;

    /**
     * @dev A function to snapshot the token balance and the claimable revenue token balance
     * @return The snapshot id
     * @notice Should have `require` to avoid ddos attack
     */
    function snapshot() external returns (uint256);

    /**
     * @dev A function to calculate the amount of ETH redeemable by a token holder upon burn
     * @param amount The amount of token to burn
     * @return The amount of revenue ETH redeemable
     */
    function redeemableOnBurn(uint256 amount) external view returns (uint256);

    /**
     * @dev A function to burn tokens and redeem the corresponding amount of revenue token
     * @param amount The amount of token to burn
     */
    function burn(uint256 amount) external;
}

claimableRevenue

Calculates the amount of ETH that a token holder can claim for a particular snapshot.

  • account
    • The holder's address.
  • snapshotId
    • The snapshot identifier.
  • Returns
    • The claimable revenue amount in ETH.

claim

Allows a holder to claim ETH for a specified snapshot.

  • snapshotId
    • The snapshot identifier.

snapshot

Records token balances and the claimable revenue balance at a snapshot. Appropriate restrictions are required to prevent denial-of-service risks associated with unrestricted snapshot creation.

  • Returns
    • The snapshot identifier.

redeemableOnBurn

Calculates the ETH amount a holder can redeem by burning tokens.

  • amount
    • The amount of tokens to burn.
  • Returns
    • The redeemable amount of ETH.

burn

Burns tokens and distributes the corresponding redeemable revenue.

  • amount
    • The amount of tokens to burn.

Overall flow

  1. Create a snapshot
    • Call snapshot to record token balances and revenue balances.
  2. Claim revenue
    • Call claim to receive the ETH allocation associated with a specific snapshot.
  3. Burn tokens and redeem assets
    • Call burn to reduce the token supply and receive the corresponding redeemable revenue.

AltRevToken (optional)

AltRevToken is an optional extension that enables the revenue pool to accept ERC-20 tokens in addition to ETH.

js
pragma solidity ^0.8.24;

/**
 * @dev An optional extension of the ERC-7641 standard that accepts other ERC-20 revenue tokens into the contract with corresponding claim function
 */
interface IERC7641AltRevToken is IERC7641 {
    /**
     * @dev A function to calculate the amount of ERC-20 claimable by a token holder at certain snapshot.
     * @param account The address of the token holder
     * @param snapshotId The snapshot id
     * @param token The address of the revenue token
     * @return The amount of revenue token claimable
     */
    function claimableERC20(address account, uint256 snapshotId, address token) external view returns (uint256);

    /**
     * @dev A function to calculate the amount of ERC-20 redeemable by a token holder upon burn
     * @param amount The amount of token to burn
     * @param token The address of the revenue token
     * @return The amount of revenue token redeemable
     */
    function redeemableERC20OnBurn(uint256 amount, address token) external view returns (uint256);
}

The extension defines interfaces for calculating claimable and redeemable amounts of alternative revenue tokens.

claimableERC20

Calculates the ERC-20 revenue amount a holder can claim for a specific snapshot.

  • account
    • The holder's address.
  • snapshotId
    • The snapshot identifier.
  • token
    • The revenue token's address.
  • Returns
    • The claimable amount of the ERC-20 revenue token.

redeemableERC20OnBurn

Calculates the amount of an ERC-20 revenue token redeemable when tokens are burned.

  • amount
    • The amount of tokens to burn.
  • token
    • The revenue token's address.
  • Returns
    • The redeemable amount of the ERC-20 revenue token.

Additional explanation

Revenue-sharing mechanism

The mechanism distributes revenue proportionally among token holders. Periodic snapshots record token balances and the revenue available for claims. Each holder's allocation can then be calculated from the distribution rules and the corresponding snapshot.

The snapshot interface

The snapshot interface records token balances and claimable revenue balances at defined points in time. This provides a consistent basis for tracking holdings and distributing revenue transparently.

It returns a unique snapshotId used to access the token and revenue balances associated with that snapshot.

The claimableRevenue interface

Calculates the ETH a holder can claim for a specified snapshot. Revenue is allocated between consecutive snapshots. For example, given revenue RR and a distribution ratio pp (0%–100%), the amount allocated to holders is pRpR.

Claimable ETH = pR×amounttotalAmount\frac{pR \times \text{amount}}{\text{totalAmount}}

Here, amount is the number of tokens held by a particular holder, and totalAmount is the total token amount used for the distribution.

The remaining revenue (1−p)R(1-p)R is retained in the revenue pool and can be redeemed through the burn mechanism.

The claim interface

Allows a holder to claim ETH according to their token balance at the relevant snapshot. Each holder can claim the allocation for a particular snapshot only once, preventing duplicate claims and supporting transparent distributions.

The burn mechanism

Holders can burn tokens to redeem a proportional share of the pool. This provides a redemption mechanism linked to pooled assets, while reducing the token supply. The mechanism does not guarantee price appreciation or a market price above the redemption value.

The redeemableOnBurn interface

Calculates the ETH a holder could redeem by burning tokens. This view function uses the amount of tokens to burn, as illustrated below.

redeemableETH=amount/totalSupply∗totalRedeemableETHredeemableETH = amount / totalSupply * totalRedeemableETH

totalSupply represents the token supply, and totalRedeemableETH represents the total ETH available for redemption in the pool.

The burn interface

Allows holders to burn tokens and receive the corresponding revenue allocation. Holders may burn their entire balance, reducing the total supply. Burned tokens no longer participate in future distributions; existing snapshot entitlements must be accounted for according to the implementation.

Compatibility

The proposal is compatible with ERC-20.

Reference implementation

js
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Snapshot.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./IERC7641.sol";

contract ERC7641 is ERC20Snapshot, IERC7641 {
    /**
     * @dev last snapshotted block
     */
    uint256 private _lastSnapshotBlock;

    /**
     * @dev percentage claimable
     */
    uint256 immutable public percentClaimable;

    /**
     * @dev mapping from snapshot id to address to the amount of ETH claimable at the snapshot.
     */
    mapping (uint256 => uint256) private _claimableAtSnapshot;

    /**
     * @dev mapping from snapshot id to a boolean indicating whether the address has claimed the revenue.
     */
    mapping (uint256 => mapping (address => bool)) private _claimedAtSnapshot;

    /**
     * @dev claim pool
     */
    uint256 private _claimPool;

    /**
     * @dev burn pool
     */
    uint256 private _burnPool;

    /**
     * @dev burned from new revenue
     */
    uint256 private _burned;

    /**
     * @dev Constructor for the ERC7641 contract, premint the total supply to the contract creator.
     * @param name The name of the token
     * @param symbol The symbol of the token
     * @param supply The total supply of the token
     */
    constructor(string memory name, string memory symbol, uint256 supply, uint256 _percentClaimable) ERC20(name, symbol) {
        require(_percentClaimable <= 100, "ERC7641: percentage claimable should be less than 100");
        percentClaimable = _percentClaimable;
        _lastSnapshotBlock = block.number;
        _mint(msg.sender, supply);
    }

    /**
     * @dev A function to calculate the amount of ETH claimable by a token holder at certain snapshot.
     * @param account The address of the token holder
     * @param snapshotId The snapshot id
     * @return The amount of revenue token claimable
     */
    function claimableRevenue(address account, uint256 snapshotId) public view returns (uint256) {
        uint256 balance = balanceOfAt(account, snapshotId);
        uint256 totalSupply = totalSupplyAt(snapshotId);
        uint256 ethClaimable = _claimableAtSnapshot[snapshotId];
        return _claimedAtSnapshot[snapshotId][account] ? 0 : balance * ethClaimable / totalSupply;
    }

    /**
     * @dev A function for token holder to claim revenue token based on the token balance at certain snapshot.
     * @param snapshotId The snapshot id
     */
    function claim(uint256 snapshotId) public {
        uint256 claimableETH = claimableRevenue(msg.sender, snapshotId);
        require(claimableETH > 0, "ERC7641: no claimable ETH");

        _claimedAtSnapshot[snapshotId][msg.sender] = true;
        _claimPool -= claimableETH;
        (bool success, ) = msg.sender.call{value: claimableETH}("");
        require(success, "ERC7641: claim failed");
    }
    
    /**
     * @dev A function to claim by a list of snapshot ids.
     * @param snapshotIds The list of snapshot ids
     */
    function claimBatch(uint256[] memory snapshotIds) public {
        for (uint256 i = 0; i < snapshotIds.length; i++) {
            claim(snapshotIds[i]);
        }
    }
    
    /**
     * @dev A snapshot function that also records the deposited ETH amount at the time of the snapshot.
     * @return The snapshot id
     * @notice example requirement: only 1000 blocks after the last snapshot
     */
    function snapshot() public returns (uint256) {
        require(block.number - _lastSnapshotBlock > 1000, "ERC7641: snapshot interval is too short");
        uint256 snapshotId = _snapshot();
        _lastSnapshotBlock = block.number;
        
        uint256 newRevenue = address(this).balance + _burned - _claimPool - _burnPool;

        uint256 claimableETH = newRevenue * percentClaimable / 100;
        _claimableAtSnapshot[snapshotId] = claimableETH;
        _claimPool += claimableETH;
        _burnPool += newRevenue - claimableETH - _burned;
        _burned = 0;

        return snapshotId;
    }

    /**
     * @dev A function to calculate the amount of ETH redeemable by a token holder upon burn
     * @param amount The amount of token to burn
     * @return The amount of revenue ETH redeemable
     */
    function redeemableOnBurn(uint256 amount) public view returns (uint256) {
        uint256 totalSupply = totalSupply();
        uint256 newRevenue = address(this).balance + _burned - _claimPool - _burnPool;
        uint256 burnableFromNewRevenue = amount * (newRevenue * (100 - percentClaimable) - _burned * 100) / 100 / totalSupply;
        uint256 burnableFromPool = amount * _burnPool / totalSupply;
        return burnableFromNewRevenue + burnableFromPool;
    }

    /**
     * @dev A function to burn tokens and redeem the corresponding amount of revenue token
     * @param amount The amount of token to burn
     */
    function burn(uint256 amount) public {
        uint256 totalSupply = totalSupply();
        uint256 newRevenue = address(this).balance + _burned - _claimPool - _burnPool;
        uint256 burnableFromNewRevenue = amount * (newRevenue * (100 - percentClaimable) - _burned * 100)  / 100 / totalSupply;
        uint256 burnableFromPool = amount * _burnPool / totalSupply;
        _burnPool -= burnableFromPool;
        _burned += burnableFromNewRevenue;
        _burn(msg.sender, amount);
        (bool success, ) = msg.sender.call{value: burnableFromNewRevenue + burnableFromPool}("");
        require(success, "ERC7641: burn failed");
    }

    receive() external payable {}
}

Security

Deflationary economic model

Continually burning tokens can reduce liquidity. Reduced liquidity may increase price volatility and the risk of price manipulation rather than necessarily increasing value.

Stress testing and market simulations are useful for evaluating the economic implications.

Spam revenue tokens

The AltRevToken extension can introduce multiple revenue tokens, including tokens with little or no economic value. This may increase gas costs for burning and claiming, discouraging participation.

A governance process for approving and adding revenue tokens can help ensure that only useful, suitable tokens are included.

Example review process:

  1. Community voting
    • Require a community decision before adding a new revenue token.
  2. Security review
    • Review the token's behavior and risks before inclusion.
  3. Gas-cost assessment
    • Evaluate how adding the token affects claiming and redemption costs.

Citation

Conway (@0x1cc), Cathie So (@socathie), Xiaohang Yu (@xhyumiracle), Suning Yao (@fewwwww), Kartin kartin@hyperoracle.io, "ERC-7641: Intrinsic RevShare Token [DRAFT]," Ethereum Improvement Proposals, no. 7641, February 2024. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7641.

Conclusion

ERC-7641 integrates revenue distribution into ERC-20-compatible tokens through snapshots, claims, and proportional redemption.

If you have questions, feel free to contact me on Twitter.

Twitter @cardene777

I also publish material on the following platforms.

https://chaldene.net/