Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amend NEP-3 #109

Merged
merged 1 commit into from
Mar 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.