From 56053067389dd7894716dc74b19c297e37c1473d Mon Sep 17 00:00:00 2001 From: superboyiii <573504781@qq.com> Date: Mon, 19 Apr 2021 18:56:58 +0800 Subject: [PATCH 1/9] nep for upgrade standard --- nep-19.mediawiki | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 nep-19.mediawiki diff --git a/nep-19.mediawiki b/nep-19.mediawiki new file mode 100644 index 00000000..f9ace099 --- /dev/null +++ b/nep-19.mediawiki @@ -0,0 +1,54 @@ +
+ NEP: + Title: Contract Update Standard + Author: Owen Zhang+ + +==Abstract== + +This proposal outlines a method standard for the NEO blockchain that will provide systems with a generalized interaction mechanism for smart contract update. + +==Motivation== + +As the NEO blockchain scales, Smart Contract Update will become increasingly important. Without a standard+ Type: Standard + Status: Draft + Created: 2021-04-19 + Replaces: 5 +
update
method, systems will be required to maintain a unique API for each contract, regardless of their similarity to other contracts which makes application development very inconvenient. This standard can unify all contracts to implement the same update method with the same types of parameters.
+
+==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.
+
+===Methods===
+
+====update====
+
++{ + "name": "update", + "safe": false, + "parameters": [ + { + "name": "nefFile", + "type": "ByteArray" + }, + { + "name": "manifest", + "type": "String" + }, + { + "name": "data", + "type": "Any" + } + ], + "returntype": "Void" +} ++ +Updating a smart contract MUST have nefFile and manifest.json. + +The parameters
data
can be any type of supported parameters.
+
+The function SHOULD check whether the signer
address equals the owner
hash of contract. The function SHOULD use the SYSCALL Neo.Runtime.CheckWitness
to verify the signer
.
From 9b3e0a73816074f8b654a1342e0731696818af7b Mon Sep 17 00:00:00 2001
From: superboyiii <573504781@qq.com>
Date: Mon, 19 Apr 2021 19:02:15 +0800
Subject: [PATCH 2/9] improve
---
nep-19.mediawiki | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/nep-19.mediawiki b/nep-19.mediawiki
index f9ace099..90557aff 100644
--- a/nep-19.mediawiki
+++ b/nep-19.mediawiki
@@ -5,10 +5,11 @@
Type: Standard
Status: Draft
Created: 2021-04-19
- Replaces: 5
+ Replaces: 0
+
==Abstract==
This proposal outlines a method standard for the NEO blockchain that will provide systems with a generalized interaction mechanism for smart contract update.
@@ -47,8 +48,8 @@ In the method definitions below, we provide both the definitions of the function
}
-Updating a smart contract MUST have nefFile and manifest.json.
+Updating a smart contract MUST have nefFile
and manifest.json
.
-The parameters data
can be any type of supported parameters.
+The parameters data
can be any type of supported parameters for additional purpose.
The function SHOULD check whether the signer
address equals the owner
hash of contract. The function SHOULD use the SYSCALL Neo.Runtime.CheckWitness
to verify the signer
.
From 417bff656995fd457bdf095bbe8f8a104450bf3a Mon Sep 17 00:00:00 2001
From: superboyiii <573504781@qq.com>
Date: Mon, 19 Apr 2021 19:04:16 +0800
Subject: [PATCH 3/9] fix
---
nep-19.mediawiki | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nep-19.mediawiki b/nep-19.mediawiki
index 90557aff..5a0ccff1 100644
--- a/nep-19.mediawiki
+++ b/nep-19.mediawiki
@@ -50,6 +50,6 @@ In the method definitions below, we provide both the definitions of the function
Updating a smart contract MUST have nefFile
and manifest.json
.
-The parameters data
can be any type of supported parameters for additional purpose.
+The parameter data
can be any type of supported parameters for additional message purpose.
The function SHOULD check whether the signer
address equals the owner
hash of contract. The function SHOULD use the SYSCALL Neo.Runtime.CheckWitness
to verify the signer
.
From 90b8bc2c7632b54d196ce26f2b55c81279571a2d Mon Sep 17 00:00:00 2001
From: superboyiii <573504781@qq.com>
Date: Tue, 20 Apr 2021 12:45:12 +0800
Subject: [PATCH 4/9] Shargon's advice.
---
nep-19.mediawiki | 104 +++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 100 insertions(+), 4 deletions(-)
diff --git a/nep-19.mediawiki b/nep-19.mediawiki
index 5a0ccff1..1c40c387 100644
--- a/nep-19.mediawiki
+++ b/nep-19.mediawiki
@@ -1,7 +1,7 @@
NEP: - Title: Contract Update Standard - Author: Owen Zhang+ Title: Contract Basic Methods Standard + Author: Owen Zhang , Fernando Díaz Toledano Type: Standard Status: Draft Created: 2021-04-19 @@ -10,13 +10,14 @@ + ==Abstract== -This proposal outlines a method standard for the NEO blockchain that will provide systems with a generalized interaction mechanism for smart contract update. +This proposal outlines a basic method standard for the NEO blockchain that will provide systems with a generalized interaction mechanism for smart contract initial deploy, update and destroy. ==Motivation== -As the NEO blockchain scales, Smart Contract Update will become increasingly important. Without a standard update
method, systems will be required to maintain a unique API for each contract, regardless of their similarity to other contracts which makes application development very inconvenient. This standard can unify all contracts to implement the same update method with the same types of parameters. +As the NEO blockchain scales, Smart Contract Initial Deploy, Update and Destroy will become increasingly important. Without standard for_deploy
,update
anddestroy
method, systems will be required to maintain a unique API for each contract, regardless of their similarity to other contracts which makes application development very inconvenient. This standard can unify all contracts to implement the same basic methods with the same types of parameters. ==Specification== @@ -24,6 +25,36 @@ In the method definitions below, we provide both the definitions of the function ===Methods=== +====_deploy==== + ++{ + "name": "_deploy", + "safe": false, + "parameters": [ + { + "name": "data", + "type": "Any" + }, + { + "name": "update", + "type": "Boolean" + } + ], + "returntype": "Void" +} ++ +This is an optional function which will be automatically executed when contract first deployed. + +The parameterdata
can be any type of supported parameters for additional message purpose. + +update
returns if it's the initial deployment of this contract. The function SHOULD check whetherupdate
returns true. If not, continue execution. If true, return. + +The function SHOULD check whether thesigner
address equals theowner
hash of contract. The function SHOULD use the SYSCALLNeo.Runtime.CheckWitness
to verify thesigner
. + +At the end of this function MUST trigger anInitialDeploy
event to show success state if it's executed successfully. + ====update====@@ -53,3 +84,68 @@ Updating a smart contract MUST havenefFile
andmanifest.json The parameter
data
can be any type of supported parameters for additional message purpose. The function SHOULD check whether thesigner
address equals theowner
hash of contract. The function SHOULD use the SYSCALLNeo.Runtime.CheckWitness
to verify thesigner
. + +====destroy==== + ++{ + "name": "destroy", + "safe": false, + "parameters": [], + "returntype": "Void" +} ++ +This function can delete all the storage of this contract. + +At the end of this function MUST trigger adestroy
event to show success state if it's executed successfully. + +===Events=== + +====InitialDeploy==== + ++{ + "name": "InitialDeploy", + "parameters": [ + { + "name": "success", + "type": "Boolean" + } + ] +} ++ +MUST trigger anInitialDeploy
event at the end of_deploy
method and set it to betrue
. + +====Update==== + ++{ + "name": "Update", + "parameters": [ + { + "name": "success", + "type": "Boolean" + } + ] +} ++ +MUST trigger aUpdate
event at the end ofupdate
method and set it to betrue
. + +====Destroy==== + ++{ + "name": "Destroy", + "parameters": [ + { + "name": "success", + "type": "Boolean" + } + ] +} ++ +MUST trigger aDestroy
event at the end ofdestroy
method and set it to betrue
. From 1cac0405e40935240c18dfb5034068793c62bca2 Mon Sep 17 00:00:00 2001 From: superboyiii <573504781@qq.com> Date: Tue, 20 Apr 2021 13:06:37 +0800 Subject: [PATCH 5/9] guideline --- nep-19.mediawiki | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nep-19.mediawiki b/nep-19.mediawiki index 1c40c387..6d8eaa1d 100644 --- a/nep-19.mediawiki +++ b/nep-19.mediawiki @@ -1,8 +1,8 @@NEP: - Title: Contract Basic Methods Standard + Title: Contract Basic Methods Guideline Author: Owen Zhang, Fernando Díaz Toledano - Type: Standard + Type: Informational Status: Draft Created: 2021-04-19 Replaces: 0 @@ -11,13 +11,14 @@ + ==Abstract== -This proposal outlines a basic method standard for the NEO blockchain that will provide systems with a generalized interaction mechanism for smart contract initial deploy, update and destroy. +This proposal outlines a basic method guideline for the NEO blockchain that will provide systems with a generalized interaction mechanism for smart contract initial deploy, update and destroy. ==Motivation== -As the NEO blockchain scales, Smart Contract Initial Deploy, Update and Destroy will become increasingly important. Without standard for _deploy
,update
anddestroy
method, systems will be required to maintain a unique API for each contract, regardless of their similarity to other contracts which makes application development very inconvenient. This standard can unify all contracts to implement the same basic methods with the same types of parameters. +As the NEO blockchain scales, Smart Contract Initial Deploy, Update and Destroy will become increasingly important. Without guideline for_deploy
,update
anddestroy
method, systems will be required to maintain a unique API for each contract, regardless of their similarity to other contracts which makes application development very inconvenient. This guideline can lead most contracts to implement the same basic methods with the same types of parameters but still accept diversity. ==Specification== From 8be7bfca8f20ea6f748cbcbd0375cf4b448a898a Mon Sep 17 00:00:00 2001 From: superboyiii <573504781@qq.com> Date: Tue, 20 Apr 2021 13:08:28 +0800 Subject: [PATCH 6/9] Erik --- nep-19.mediawiki | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nep-19.mediawiki b/nep-19.mediawiki index 6d8eaa1d..9d728b84 100644 --- a/nep-19.mediawiki +++ b/nep-19.mediawiki @@ -1,7 +1,7 @@NEP: Title: Contract Basic Methods Guideline - Author: Owen Zhang, Fernando Díaz Toledano + Author: Owen Zhang , Fernando Díaz Toledano , Erik Zhang Type: Informational Status: Draft Created: 2021-04-19 @@ -12,6 +12,7 @@ + ==Abstract== This proposal outlines a basic method guideline for the NEO blockchain that will provide systems with a generalized interaction mechanism for smart contract initial deploy, update and destroy. From 0c6aed3dbaca5738b87d6b3eb02d3c8ebed6f220 Mon Sep 17 00:00:00 2001 From: superboyiii <573504781@qq.com> Date: Wed, 21 Apr 2021 18:59:05 +0800 Subject: [PATCH 7/9] Fix and remove event --- nep-19.mediawiki | 55 +----------------------------------------------- 1 file changed, 1 insertion(+), 54 deletions(-) diff --git a/nep-19.mediawiki b/nep-19.mediawiki index 9d728b84..f31b37e0 100644 --- a/nep-19.mediawiki +++ b/nep-19.mediawiki @@ -55,8 +55,6 @@ The parameter data
can be any type of supported parameters for addi The function SHOULD check whether thesigner
address equals theowner
hash of contract. The function SHOULD use the SYSCALLNeo.Runtime.CheckWitness
to verify thesigner
. -At the end of this function MUST trigger anInitialDeploy
event to show success state if it's executed successfully. - ====update====@@ -97,57 +95,6 @@ The function SHOULD check whether thesigner
address equals the- This function can delete all the storage of this contract. -At the end of this function MUST trigger a destroy
event to show success state if it's executed successfully. - -===Events=== - -====InitialDeploy==== - --{ - "name": "InitialDeploy", - "parameters": [ - { - "name": "success", - "type": "Boolean" - } - ] -} -- -MUST trigger anInitialDeploy
event at the end of_deploy
method and set it to betrue
. - -====Update==== - --{ - "name": "Update", - "parameters": [ - { - "name": "success", - "type": "Boolean" - } - ] -} -- -MUST trigger aUpdate
event at the end ofupdate
method and set it to betrue
. - -====Destroy==== - --{ - "name": "Destroy", - "parameters": [ - { - "name": "success", - "type": "Boolean" - } - ] -} -- -MUST trigger aDestroy
event at the end ofdestroy
method and set it to betrue
. +The function SHOULD check whether thesigner
address equals theowner
hash of contract. The function SHOULD use the SYSCALLNeo.Runtime.CheckWitness
to verify thesigner
. \ No newline at end of file From 567feece5508e1e230eec47f21c85f691d308858 Mon Sep 17 00:00:00 2001 From: superboyiii <573504781@qq.com> Date: Wed, 21 Apr 2021 19:02:47 +0800 Subject: [PATCH 8/9] fix --- nep-19.mediawiki | 2 -- 1 file changed, 2 deletions(-) diff --git a/nep-19.mediawiki b/nep-19.mediawiki index f31b37e0..50c28353 100644 --- a/nep-19.mediawiki +++ b/nep-19.mediawiki @@ -53,8 +53,6 @@ The parameterdata
can be any type of supported parameters for addiupdate
returns if it's the initial deployment of this contract. The function SHOULD check whetherupdate
returns true. If not, continue execution. If true, return. -The function SHOULD check whether thesigner
address equals theowner
hash of contract. The function SHOULD use the SYSCALLNeo.Runtime.CheckWitness
to verify thesigner
. - ====update====From eee07aa140e3a9212a38f2920fa352e6ebdaa3db Mon Sep 17 00:00:00 2001 From: superboyiii <573504781@qq.com> Date: Mon, 26 Apr 2021 13:38:24 +0800 Subject: [PATCH 9/9] warning --- nep-19.mediawiki | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nep-19.mediawiki b/nep-19.mediawiki index 50c28353..30c5f027 100644 --- a/nep-19.mediawiki +++ b/nep-19.mediawiki @@ -95,4 +95,7 @@ The function SHOULD check whether thesigner
address equals theThis function can delete all the storage of this contract. -The function SHOULD check whether the signer
address equals theowner
hash of contract. The function SHOULD use the SYSCALLNeo.Runtime.CheckWitness
to verify thesigner
. \ No newline at end of file +The function SHOULD check whether thesigner
address equals theowner
hash of contract. The function SHOULD use the SYSCALLNeo.Runtime.CheckWitness
to verify thesigner
. + +If any token is in this contract asset, they MUST be transferred to another address beforedestroy
. +