From 3118b01fa72abc982d62714eadb1a2ab2615a1c5 Mon Sep 17 00:00:00 2001 From: ian_lee Date: Wed, 7 Aug 2024 17:02:04 +0200 Subject: [PATCH] Update MEP802 and MEP804. --- proposals/mep-802.md | 18 ++++++++++ proposals/mep-804.md | 82 ++++++++++++++++---------------------------- 2 files changed, 48 insertions(+), 52 deletions(-) diff --git a/proposals/mep-802.md b/proposals/mep-802.md index 5228231..fbae48a 100644 --- a/proposals/mep-802.md +++ b/proposals/mep-802.md @@ -170,6 +170,24 @@ interface MEP802 /* is IERC721 */ { uint8 _isJson ) external; + /// @notice Get pidZkevmHash by Token ID + /// @param _tokenId Token ID + function getPidZkevmHash( + uint256 _tokenId + ) external returns (uint256); + + /// @notice Get Token ID by pidZkevmHash + /// @param _pidZkevmHash The PID hash (for zkevm) of the sensor + function getTokenId( + uint256 _pidZkevmHash + ) external returns (uint256); + + /// @notice Get token owner by pidZkevmHash + /// @param _pidZkevmHash The PID hash (for zkevm) of the sensor + function pidZkevmHashOwner( + uint256 _pidZkevmHash + ) external returns (address); + /// @notice Set Token URI /// @param _pidZkevmHash The PID hash (for zkevm) of the sensor /// @param _uri The Token URI diff --git a/proposals/mep-804.md b/proposals/mep-804.md index 6782aa3..27e0d22 100644 --- a/proposals/mep-804.md +++ b/proposals/mep-804.md @@ -36,58 +36,36 @@ pragma solidity ^0.4.20; /// @title MEP-804 Reward Token Contract interface IMEP804 /* is IERC20 */ { - /// @notice Gets fired when the reward formula is set up - /// @param _appContractAddress Contract address of the application - event FormularSetup(address _appContractAddress) - - /// @notice Gets fired when reward is submitted - /// @param _appContractAddress Contract address of the application - /// @param _sensorDataContractAddress Contract address of the sensor data - /// @param caller the msg.sender - event RewardSubmitted(address _appContractAddress, address _sensorDataContractAddress, address caller); - - /// @notice Gets fired when reward is claimed - /// @param _appContractAddress Contract address of the application - /// @param _sensorDataContractAddress Contract address of the sensor data - /// @param claimer the beneficiary - event claimRewardClaimed(address _appContractAddress, address _sensorDataContractAddress, address claimer) - - // Formula Setup - /// @notice Sets up the reward formula and its parameters for the application - /// @param _appContractAddress Contract address of the application - /// @param _formulaMetadata JSON format metadata containing formula parameters - function setupFormula(address _appContractAddress, string memory _formulaMetadata) external; - - /// @notice Adds a sensor profile specific to an application and tier - /// @param _appContractAddress Contract address of the application - /// @param _tier Tier of the sensor profile - /// @param _sensorDataContractAddress Contract address of the sensor data - function addSensorProfile(address _appContractAddress, uint256 _tier, address _sensorDataContractAddress) external; - - // Submit Rewards - /// @notice Submits the data of the end users and calculates the rewards - /// @param _appContractAddress Contract address of the application - /// @param _sensorDataContractAddress Contract address of the sensor data - /// @param _minableData JSON format data sent by the sensor - function submitRewards(address _appContractAddress, address _sensorDataContractAddress, string memory _minableData) external; - - // Claim Rewards - /// @notice Allows the end user to claim their earned rewards - /// @param _appContractAddress Contract address of the application - /// @param _sensorDataContractAddress Contract address of the sensor data - function claimRewards(address _appContractAddress, address _sensorDataContractAddress) external; - - - /// @notice Calculates the health factor based on the sensor's fuel and fuel tank size - /// @param _sensorDataContractAddress Contract address of the sensor data - /// @return The health factor - function calculateHealth(address _sensorDataContractAddress) external view returns (uint256); - - /// @notice Calculates the mining power of the sensor for the current cycle - /// @param _sensorDataContractAddress Contract address of the sensor data - /// @param _minableData JSON format data sent by the sensor - /// @return The mining power - function calculateMiningPower(address _sensorDataContractAddress, string memory _minableData) external view returns (uint256); + /// @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 {