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 covers ERC7254, a proposal for allowing ERC20 token holders to earn rewards without taking additional steps, including automatic reward updates and withdrawals.
This article translates, summarizes, and supplements the material below.
I have also covered various other EIPs.
Overview
This project aims to increase the value of ERC20 tokens by offering their holders a distinctive set of features. Specifically, it provides a simple way to reward token holders without requiring them to lock, stake, or farm their tokens. Whenever a project generates profits, those profits are distributed among token holders.
For more information about ERC20, see the following article.
This concept is called Revenue Sharing and can be viewed as an extension of ERC20 tokens. Revenue Sharing introduces an additional payment mechanism for token holders, allowing their rewards to be updated and withdrawn.
Potential use cases include the following.
- Companies distributing dividends to token holders.
- Directly sharing revenue from business activities such as marketplaces, automated market makers (AMMs), and games.
This system allows token holders to benefit directly from a project's success, with rewards accruing automatically without additional action on their part. It is expected to strengthen the relationship between token holders and project operators and encourage long-term commitment to the project.
Specification
Methods
maxTokenReward
function maxTokenReward() public view returns (uint256)Overview
Returns the maximum token reward.
Details
This function returns the maximum amount of token rewards the contract can offer holders. The amount is based on the contract configuration and current revenue distribution rules.
Return value
uint256- Maximum amount of token rewards the contract can provide.
informationOf
function informationOf(address token, address account) public view returns (UserInformation memory)Overview
Returns information about a particular account.
Details
This function returns account information associated with the specified token and account address. It includes reward-related values inReward and outReward, as well as withdraw, the total amount of rewards withdrawn.
Parameters
address token- Address of the token to query.
address account- Address of the account to query.
Return value
UserInformation memory- A
UserInformationstruct containing information about the specified account.
- A
informationOfBatch
function informationOfBatch(address account) public view returns (UserInformation[] memory)Overview
Returns a list of account information records.
Details
This function returns multiple account information records associated with the specified account in a single call. Each record contains inReward, outReward, and withdraw, the total amount of rewards withdrawn.
Parameters
address account- Address of the account to query.
Return value
UserInformation[] memory- An array of
UserInformationstructs containing information associated with the specified account.
- An array of
tokenReward
function tokenReward() public view returns (address[] memory)Overview
Returns a list of reward token addresses.
Details
This function returns the addresses of the tokens configured as rewards, allowing callers to determine which tokens are included in the reward system.
Return value
address[] memory- List of token addresses configured as rewards.
updateReward
function updateReward(address[] memory token, uint256[] memory amount) publicOverview
Updates the rewardPerShare value for token rewards.
Details
This function updates the reward per share (rewardPerShare) for the specified tokens. The new value is calculated by adding the specified amount divided by the total token supply to the current value.
Parameters
address[] memory token- Array of token addresses to update.
uint256[] memory amount- Array of reward amounts to add for each token.
viewReward
function viewReward(address account) public view returns (uint256[] memory)Overview
Returns a list of reward amounts for an account.
Details
This function returns the rewards available to the specified account as a list of reward amounts for each token.
Parameters
address account- Address of the account whose rewards are being queried.
Return value
uint256[] memory- List of reward amounts for each token for the specified account.
getReward
function getReward(address[] memory token) publicOverview
Claims rewards for the listed tokens.
Details
This function claims rewards in the specified tokens and sends them to the calling account. These are the token rewards to which that account is entitled.
Parameters
address[] memory token- Array of token addresses for which to claim rewards.
getRewardPerShare
function getRewardPerShare(address token) public view returns (uint256)Overview
Returns the reward per share for a reward token.
Details
This function returns the reward amount per share (rewardPerShare) for the specified token. Token holders can use it to estimate rewards based on their holdings.
Parameters
address token- Address of the token whose reward per share is being queried.
Return value
uint256- Reward per share for the specified token.
existsTokenReward
function existsTokenReward(address token) public view returns (bool)Overview
Returns the status of a reward token.
Details
This function indicates whether the specified token exists in the reward system. Callers can use it to determine whether a particular token is available as a reward.
Parameters
address token- Address of the token whose status is being queried.
Return value
booltrueif the specified token exists in the reward system, otherwisefalse.
UserInformation
struct UserInformation {
uint256 inReward;
uint256 outReward;
uint256 withdraw;
}Overview
A struct that stores a user's reward information.
Details
This struct stores three key values related to a user's rewards. inReward is updated when the user's balance decreases, while outReward is updated when the user's balance increases. withdraw represents the total amount of reward tokens withdrawn by the user. Together, these values make it easier to track the user's reward history and current position.
Fields
inReward- Reward amount updated when the user's balance decreases.
outReward- Reward amount updated when the user's balance increases.
withdraw- Total amount of reward tokens withdrawn by the user.
Implementation
Citation
Quy Phan (@quyphandang), Quy Phan quy.phan@cryptoviet.info, "ERC-7254: Token Revenue Sharing [DRAFT]," Ethereum Improvement Proposals, no. 7254, June 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7254.
Closing Remarks
This article covered ERC7254, a proposal for allowing ERC20 token holders to earn rewards without additional steps through automatic reward updates and withdrawals. I hope it was helpful.
If you have any questions, feel free to reach out via Twitter DM.
I also publish on other platforms, which you can explore below.



