Skip to content

Commit

Permalink
Amend NEP-3 (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang authored Mar 15, 2020
1 parent a8f46cc commit 712c660
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions nep-3.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,13 @@ The NeoContract ABI is defined by JSON format, which has the following basic str
<pre>
{
"hash": "0x562851057d8afbc08fabc8c438d7cc771aef2195",
"entryPoint": {},
"methods": [],
"events": []
}
</pre>

<code>hash</code> is the script hash of the contract. It is encoded as a hexadecimal string in big-endian.

<code>entryPoint</code> is a Method object which describe the details of the entrypoint of the contract.

<code>methods</code> is an array of Method objects which describe the details of each method in the contract.

<code>events</code> is an array of Event objects which describe the details of each event in the contract.
Expand All @@ -53,13 +50,16 @@ Method object has the following structure:
<pre>
{
"name": "transfer",
"offset": 0,
"parameters": [],
"returntype": "Boolean"
}
</pre>

<code>name</code> is the name of the method, which can be any valid identifier.

<code>offset</code> is the offset of this method in the script.

<code>parameters</code> is an array of Parameter objects which describe the details of each parameter in the method.

<code>returntype</code> indicates the return type of the method. It can be one of the following values: <code>Signature</code>, <code>Boolean</code>, <code>Integer</code>, <code>Hash160</code>, <code>Hash256</code>, <code>ByteArray</code>, <code>PublicKey</code>, <code>String</code>, <code>Array</code>, <code>InteropInterface</code>, <code>Void</code>.
Expand Down Expand Up @@ -138,26 +138,3 @@ ParameterType enum has the following values:
| Void
| Void means that the method has no return value. This value cannot be the type of a parameter.
|}

===EntryPoint===

It is strongly recommended that each contract have the following entry point:

<pre>
{
"name": "main",
"parameters": [
{
"name": "operation",
"type": "String"
},
{
"name": "args",
"type": "Array"
}
],
"returntype": "Any"
}
</pre>

In this way, the caller can easily access the methods through the entry point, specifying the name of the method to be invoked with the first parameter, and specifying the parameters of the method with the second parameter.

0 comments on commit 712c660

Please sign in to comment.