Skip to content

Commit

Permalink
NEP: Token Standard (neo-project#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
lllwvlvwlll authored and Erik Zhang committed Oct 9, 2017
1 parent 17c9b2d commit fb19052
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ First review [[nep-1.mediawiki|NEP-1]]. Then clone the repository and add your N
| Standard
| Accepted
|-
| [https://github.com/neo-project/proposals/pull/4 5]
| [[nep-5.mediawiki|5]]
| Token Standard
| lllwvlvwlll, luodanwg, tanyuan, Alan Fong
| Standard
| Accepted
| Final
|-
|
| Wallet Standard
Expand Down
97 changes: 97 additions & 0 deletions nep-5.mediawiki
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<pre>
NEP: 5
Title: Token Standard
Author: lllwvlvwlll <lllwvlvwlll@gmail.com>, luodanwg <luodan.wg@gmail.com>, tanyuan <tanyuan666@gmail.com>, Alan Fong <anfn@umich.edu>
Type: Standard
Status: Final
Created: 2017-08-10
</pre>

==Abstract==

The NEP-5 Proposal outlines a token standard for the NEO blockchain that will provide systems with a generalized interaction mechanism for tokenized Smart Contracts. This mechanic, along with the justification for each feature are defined. A template and examples are also provided to enable the development community.

==Motivation==

As the NEO blockchain scales, Smart Contract deployment and invocation will become increasingly important. Without a standard interaction method, systems will be required to maintain a unique API for each contract, regardless of their similarity to other contracts. Tokenized contracts present themselves as a prime example of this need because their basic operating mechanism is the same. A standard method for interacting with these tokens relieves the entire ecosystem from maintaining a definition for basic operations that are required by every Smart Contract that employs a token.

==Specification==

In the method definitions below, we provide both the definitions of the functions as they are defined in the contract as well as the invoke parameters.

This standard defines two method types:

* '''(Required)''' : methods that are present on all NEP5 tokens.
* '''(Optional)''' : methods that are optionally implemented on NEP5 tokens. These method types are not required for standard interfacing, and most tokens should not use them. All optional methods must be enabled if choosing to use them.
===Methods===

====totalSupply====

* Syntax: <code>public static BigInteger totalSupply()</code>
* Remarks: "totalSupply" returns the total token supply deployed in the system.
====name====

* Syntax: <code>public static string name()</code>
* Remarks: "name" returns the token name.

====symbol====

* Syntax: <code>public static string symbol()</code>
* Remarks: "symbol" returns the token symbol.
====decimals====

* Syntax: <code>public static byte decimals()</code>
* Remarks: "decimals" returns the number of decimals used by the token.
====balanceOf====

* Syntax: <code>public static BigInteger balanceOf(byte[] account)</code>
* Remarks: "balanceOf" returns the token balance of the '''account'''.
====transfer====

* Syntax: <code>public static bool transfer(byte[] from, byte[] to, BigInteger amount)</code>
* Remarks: "transfer" will transfer an '''amount''' of tokens from the '''from''' account to the '''to''' account.
====allowance ''(optional)''====

* Syntax: <code>public static BigInteger allowance(byte[] from, byte[] to)</code>
* Remarks: "allowance" will return the amount of tokens that the '''to''' account can transfer from the '''from''' acount.
====transferFrom ''(optional)''====

* Syntax: <code>public static bool transferFrom(byte[] originator, byte[] from, byte[] to, BigInteger amount)</code>
* Remarks: "transferFrom" will transfer an '''amount''' from the '''from''' account to the '''to''' acount if the '''originator''' has been approved to transfer the requested '''amount'''.
====approve ''(optional)''====

* Syntax: <code>public static bool approve(byte[] originator, byte[] to, BigInteger amount)</code>
* Remarks: "approve" will approve the '''to''' account to transfer '''amount''' tokens from the '''originator''' acount.
===Events===

====transfer====

* Syntax: <code>public static event Action<byte[], byte[], BigInteger> transfer</code>
* Remarks: The "transfer" event is raised after a successful execution of the "transfer" method.
==Implementation==

*Woolong: https://github.com/lllwvlvwlll/Woolong
*ICO Template: https://github.com/neo-project/examples/tree/master/ICO_Template

0 comments on commit fb19052

Please sign in to comment.