EIPs/EIPS/eip-2135.md
Micah Zoltu 15f61ed0fd
Adds rule to EIP-1 that references to other EIPs must use relative path format and the first reference must be linked. (#2947)
I have gone through and updated all existing EIPs to match this rule, including EIP-1.

In some cases, people were using markdown citations, I suspect because the long-form was a bit verbose to inline.  Since the relative path is quite short, I moved these to inline but I wouldn't be opposed to putting them back to citation format if that is desired by the authors.

In doing the migration/cleanup, I found some EIP references to EIPs that don't actually exist.  In these cases I tried to excise the reference from the EIP as best I could.

It is worth noting that the Readme actually already had this rule, it just wasn't expressed properly in EIP-1 and the "Citation Format" section of the readme I think caused people a bit of confusion (when citing externally, you should use the citation format).
2020-09-30 12:22:43 +08:00

80 lines
3.2 KiB
Markdown

---
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 [`ERC-721 Metadata`](./eip-721.md)
## 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](./eip-721.md)
## Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).