Skip to content

Commit

Permalink
Update MEP802 and MEP804.
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-lee-mxc committed Aug 7, 2024
1 parent f441d69 commit 3118b01
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 52 deletions.
18 changes: 18 additions & 0 deletions proposals/mep-802.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
82 changes: 30 additions & 52 deletions proposals/mep-804.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3118b01

Please sign in to comment.