Skip to content

Latest commit

 

History

History
110 lines (74 loc) · 3.49 KB

mep-801.md

File metadata and controls

110 lines (74 loc) · 3.49 KB
  MEP: 801
  Title: ISO Application Contract
  Status: Draft
  Type: Standards
  Created: 2023-04-19
  Updated: 2023-12-12

MEP-801: ISO Application Contract

Simple Summary

Specification allowing users to create ISO applications on-chain.

Abstract

ISO applications are projects that enable the caller to create ISOs (Initial Sensor Offerings). The applications created on this contract prove that the ownership of a particular sensor application belongs to the transaction signer.

An on-chain application links a given ISO project with the set of smart contracts deployed afterwards.

Motivation

The goal is to allow the setup of an ISO applications.

Terminology

  • ISO Application - A project which the Business owner creates in order to start a ISO (Initial Sensor Offering), create devices and device profiles

Specification

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-801 compliant contract must implement the following interface:

pragma solidity ^0.8.18;

/// @title MEP801 (ISO Applications)
interface MEP801 {
    /// @dev This event gets emitted when a application added
    ///  The parameters is the index of app, owner and name.
    event ApplicationCreated(uint256 idx, address owner, string name);

    /// @dev This event gets emitted when a application renamed
    ///  The parameters is the index of app, owner and name.
    event ApplicationRenamed(uint256 idx, address owner, string name);

    /// @dev This event gets emitted when a reward contract set
    ///  The parameters is the index of app, owner and contract address.
    event RewardContractChanged(
        uint256 idx,
        address owner,
        address rewardContract
    );

    /// @notice Return the name of contract, use to identiry the version of the contract
    function name() external view returns (string memory);

    /// @notice Create a application
    /// @param _name The name of of the application
    function createApplication(string memory _name) external returns (uint256);

    /// @notice rename a application
    /// @param _idx The application index
    /// @param _name The name of of the application
    function renameApplication(uint256 _idx, string memory _name) external;

    /// @notice Set the reward contract for the application
    /// @param _idx The application index
    /// @param _rewardContract The MEP804 reward contract address of of the application
    function setRewardContract(uint256 _idx, address _rewardContract) external;

    /// @notice Return the number of app belong to the sender.
    function ownerAppIdxCount() external view returns (uint256);
}

And this public accessible state values:

struct Application {
    string name;
    address owner;
    address rewardContract;
    bool active;
}

contract Storage1 {
    using Counters for Counters.Counter;
    
    /// @notice Applicaiton list
    mapping (uint256 => Application) public applicationList;
    Counters.Counter public applicationCount;

    /// @notice Application idx list for each owner
    mapping (address => uint256[]) public ownerAppIdxList;
}

Rationale

To create an application in ISO Application, the application is created at the point of calling the createApplication() interface and event is emitted containing the application index, application name and business owner address.