forked from neo-project/proposals
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lllwvlvwlll
authored and
Erik Zhang
committed
Oct 9, 2017
1 parent
17c9b2d
commit fb19052
Showing
2 changed files
with
99 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |