mirror of https://github.com/status-im/EIPs.git
Check-In first draft of EIP-2135 (#2171)
* Update the minimized eip-1202 to get ready of publication
* Add eip-2135 init draft
* Update EIP-2135 at 6e4e401118/eip-2135.md
This commit is contained in:
parent
1529796d3a
commit
0b1c7f75bd
|
@ -0,0 +1,79 @@
|
|||
---
|
||||
eip: 2135
|
||||
title: Consumable Interface
|
||||
author: Zainan Victor Zhou (@xinbenlv)
|
||||
discussions-to: https://github.com/ethereum/EIPs/issues/2135
|
||||
status: Draft
|
||||
type: Standards Track
|
||||
category: ERC
|
||||
created: 2019-06-23
|
||||
---
|
||||
|
||||
## Simple Summary
|
||||
An interface marking certain digital assets being consumable.
|
||||
|
||||
## Abstract
|
||||
The interface identifies functions and events needed for creating a contract to be able to mark a digital asset as "consumable", and react to the request of "consumption".
|
||||
|
||||
## Motivation
|
||||
Being a digital assets sometimes means a consumable power. One most common seen examples would be a concert ticket. It will be "consumed" at the moment the ticket-holder uses the ticket to get access to enter a concert.
|
||||
|
||||
By having a standard ERC interface, the Ethereum ecosystem can interoperate to provide services, clients, UI, and inter-contract functionalities on top of this very general use-case.
|
||||
|
||||
## Specification
|
||||
The standard will mainly contain the following interface.
|
||||
|
||||
### The required interface
|
||||
|
||||
```solidity
|
||||
pragma solidity ^0.5.8;
|
||||
|
||||
contract EIP2135 {
|
||||
// The main consume function
|
||||
function consume(uint256 assetId) public returns(bool success);
|
||||
|
||||
// The interface to check whether an asset is consumable.
|
||||
function isConsumable(uint256 assetId) public view returns (bool consumable);
|
||||
|
||||
// The interface to check whether an asset is consumable.
|
||||
event OnConsumption(uint256 indexed assetId);
|
||||
}
|
||||
```
|
||||
|
||||
## Rationale
|
||||
|
||||
The function `consume` performs the consume action. Being an interface standard,
|
||||
this EIP does not impose any assumption of
|
||||
|
||||
- who has the power to perform such activity.
|
||||
- under what condition such consumption can occur.
|
||||
|
||||
It does, however, assume the asset can be identified in a `uint256` assetId as in th parameter. A design convention and compatibility consideration is put in place to follow the ERC-721
|
||||
|
||||
The event notifies subscribers whoever are interested to learn an asset is being consumed. The boolean function of `isConsumable` can be used to check whether an asset is still consumable.
|
||||
|
||||
To keep it simple, this standard *intentionally* contains no functions or events related to creation of a consumable asset. This is because the creation of a consumable asset will need to make assumption of the nature of an actual use-case. If we see some common use-case of creation, we can have another follow up standard.
|
||||
|
||||
We also left out metadata associated to the consumables from the standard. If necessary, related metadata can be created with a separate metadata extension interface like [`ERC721Metadata`](https://eips.ethereum.org/EIPS/eip-721)
|
||||
|
||||
## Backwards Compatibility
|
||||
|
||||
This interface is designed to be compatible with ERC-721.
|
||||
|
||||
## Implementation
|
||||
|
||||
A reference implementation accompany with tests of **ERC-721 based ticket** contract is built and you can found it [here](https://github.com/xinbenlv/eip-2135/blob/master/impl/contracts/Ticket721.sol).
|
||||
|
||||
See [Github/xinbenlv/eip-2135/impl](https://github.com/xinbenlv/eip-2135/tree/master/impl)
|
||||
|
||||
## Test Cases
|
||||
|
||||
See [Github/xinbenlv/eip-2135/impl/test](https://github.com/xinbenlv/eip-2135/tree/master/impl/test)
|
||||
|
||||
## Reference
|
||||
|
||||
### Standards
|
||||
- [ERC-721](https://eips.ethereum.org/EIPS/eip-721)
|
||||
|
||||
## Copyright
|
||||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
|
Loading…
Reference in New Issue