MEP: 804 Title: Reward Token Contract Status: Draft Type: Standards Created: 2023-07-19
The MEP-804 Reward Token Contract is a smart contract that can create, distribute, and administer reward tokens. These token are used to reward users for connecting sensors and taking part in other ecosystem-wide activities.
The MEP-804 Reward Token Contract is intended to make it possible for users and sensors within the ecosystem to share and claim reward tokens in an efficient manner. To guarantee compatibility and consistency among many applications that implement the Reward Calculation Ecosystem, it adheres to the rules outlined in this specification.
The MEP-804 Reward Token Contract was created primarily to establish a standardized method for managing reward tokens within the ecosystem. This standard contract enables uniform and predictable interactions between various applications and smart contracts and the reward token. As a result, incentives may be earned and transparently redeemed across a wide range of use cases in a single ecosystem.
- Reward Tokens: Digital tokens issued as incentives for users and sensors participating in the ecosystem.
- MEP-804: The smart contract implementing the Reward Token Contract standard.
- ERC20: The Ethereum token standard that MEP-804 complies with.
- Fuel tank - coefficient of "mining power"; calculated as the ratio between the address' current balance and total accumulated balance fuel_tank = (currentBal / accumulatedBal) * 100
- Pool - allocation of tokens from which particular rewards will be distributed
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.
Every MEP-804 compliant contract must implement the ERC20
interface:
pragma solidity ^0.4.20;
/// @title MEP-804 Reward Token Contract
interface IMEP804 /* is IERC20 */ {
/// @dev This event gets emitted when claim reward done.
event ClaimRewardDone(uint256 amount);
/// @dev This event gets emitted when data is feeded.
event DataReceived(string memo);
/// @notice Return the name of contract, use to identiry the version of the contract
function name2() external view returns (string memory);
/// @notice Get amount wait for claim
function amountForClaim() external returns (uint256);
/// @notice Claim reward
function claimReward() external returns (uint256);
/// @notice Feed data (onlyOwner)
/// @param _pidZkevmHash The PID hash (for zkevm) of the sensor
/// @param _rewardTo Reward will send to this address
/// @param _rewardAmount Amount of the reward
/// @param _memo MEP-3355 memo
function feedData(
uint256 _pidZkevmHash,
address _rewardTo,
uint256 _rewardAmount,
string memory _memo
) external;
/// @notice Mint more (onlyOwner)
/// @param _amount Amount to mint
function mintMore(uint256 _amount) external;
}
interface IERC20 {
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function totalSupply() external view returns (uint256);
function balanceOf(address _account) external view returns (uint256);
function transfer(address _to, uint256 _amount) external returns (bool);
function allowance(address _owner, address _spender) external view returns (uint256);
function approve(address _spender, uint256 _amount) external returns (bool);
function transferFrom(address _from, address _to, uint256 _amount) external returns (bool);
}
The MEP-804 Reward Token Contract standard is designed to ensure compatibility and uniformity across diverse applications. Developers that follow this standard can design interoperable smart contracts, facilitating smooth reward token distribution and claiming procedures. The ERC20 compliance also enables simple integration with already-existing wallets and applications that are based on Ethereum. In general, the MEP-804 standard helps to create a vibrant and financially rewarding ecosystem for users, sensors, and application developers.