From 86006d0ecebe1f3f8a1fd35b89409c5c37c53df6 Mon Sep 17 00:00:00 2001 From: lucas7788 Date: Fri, 27 Dec 2019 12:08:23 +0800 Subject: [PATCH 01/11] add oep-11 --- OEPS/OEP-11.mediawiki | 136 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 OEPS/OEP-11.mediawiki diff --git a/OEPS/OEP-11.mediawiki b/OEPS/OEP-11.mediawiki new file mode 100644 index 0000000..61a89e3 --- /dev/null +++ b/OEPS/OEP-11.mediawiki @@ -0,0 +1,136 @@ +
+  OEP: 11
+  Title: Governance Change Standard
+  Author: luodanwg , tanyuan , zhoupw 
+  Type: Standard
+  Status: Accepted
+  Created: 2018-07-03
+
+ +==Abstract== + +The OEP-11 Proposal is a standard interface for Governance Change Standard. There will be three roles in the contract, SuperAdmin, Admin and Users. +SuperAdmin has the right to set who can be Admin. +Admin has the right to create a topic and set who can vote for the topic. +Users are topic voters from the Mortgage node address. + + +==Motivation== + +Governance Change Standard interface which allows Community update Governance Strategy of the Ontology blockchain to adapt the new development. + +==Specification== + +===Methods=== + +====init==== + +
+def init()
+
+ +SuperAdmin can invoke this method to Initialize the contract + +====setAdmin==== + +
+def setAdmin(admins)
+
+admins is address array, +SuperAdmin invoke this method to set who to be admins +The parameter admins must be a array with every element is a 20-byte address. If not, this method must throw an exception. + +====listAdmins==== + +
+def listAdmins()
+
+ +Returns all the admins. + +====createTopic==== + +
+def createTopic(admin, topic, startTime, endTime)
+
+Admin can invoke this method to create a new topic. +The parameter admin must be a 20-byte address. +The parameter topic should be a string. +The parameter startTime should be a unix timestamp. +The parameter endTime should be a unix timestamp. + +====setVoterForTopic==== + +
+def setVoterForTopic(hash, voters)
+
+the topic creator can invoke this method. +The parameter hash should be a 32-byte hash value of topic. +The parameter voters should be an address array. + +====listTopics==== + +
+def listTopics()
+
+ +Return all the topic hash + +====getTopic==== + +
+def getTopic(hash)
+
+
+ +Return the topic, for example, 'Update the Governance Strategy, Mortgage unlocking cycle changed from 2 months to 1 month' +The parameter hash should be the topic 32-byte hash + +====getTopicInfo==== + +
+def getTopicInfo(hash)
+
+ +Return the topicInfo which includes 'admin, topic, voter address,startTime, endTime, approve amount, reject amount'. +The parameter hash should be the topic 32-byte hash + +====getVoters==== + +
+def getVoters(hash)
+
+ +Return all the voters of the topic,every voter consists of voter address and voter weight. + +====voteTopic==== + +
+def voteTopic(hash, voter, approveOrReject)
+
+ +voters can invoke this method to approve or reject a topic. + +The parameter hash is topic hash. +The parameter voter one of the voters who set by admin. +The parameter approveOrReject is a boolean value, true mean approve, false mean reject. + +===Events=== + +====createTopic==== + +
+CreateTopicEvent = RegisterAction("createTopic", "hash", "topic")
+
+ +The event must be triggered when topic are created. + +====VoteTopicEvent==== + +
+VoteTopicEvent = RegisterAction("voteTopic", "hash", "voter")
+
+ +The event must be triggered on any successful calls to voteTopic. + +===Implementation=== From c67390c714d06ebf1275798fbda0bafffc93ed7f Mon Sep 17 00:00:00 2001 From: lucas7788 Date: Fri, 27 Dec 2019 14:25:26 +0800 Subject: [PATCH 02/11] update voter --- OEPS/OEP-11.mediawiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OEPS/OEP-11.mediawiki b/OEPS/OEP-11.mediawiki index 61a89e3..14d583f 100644 --- a/OEPS/OEP-11.mediawiki +++ b/OEPS/OEP-11.mediawiki @@ -66,7 +66,7 @@ def setVoterForTopic(hash, voters) the topic creator can invoke this method. The parameter hash should be a 32-byte hash value of topic. -The parameter voters should be an address array. +The parameter voters should be an address and weight array, for example: [['AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP',100000],['AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP',100000]] ====listTopics==== From 1d60677bd3d5a22d53ef6547248b8329942c8f31 Mon Sep 17 00:00:00 2001 From: lucas7788 Date: Fri, 27 Dec 2019 14:42:47 +0800 Subject: [PATCH 03/11] update --- OEPS/OEP-11.mediawiki | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/OEPS/OEP-11.mediawiki b/OEPS/OEP-11.mediawiki index 14d583f..541b264 100644 --- a/OEPS/OEP-11.mediawiki +++ b/OEPS/OEP-11.mediawiki @@ -29,16 +29,15 @@ Governance Change Standard interface which allows Community update Governance St def init() -SuperAdmin can invoke this method to Initialize the contract +SuperAdmin can invoke this method to Initialize the contract. ====setAdmin====
 def setAdmin(admins)
 
-admins is address array, -SuperAdmin invoke this method to set who to be admins -The parameter admins must be a array with every element is a 20-byte address. If not, this method must throw an exception. +SuperAdmin invoke this method to set who to be admins and admin can invoke 'createTopic' method to create a new topic. +The parameter admins should be a 20-byte address array. ====listAdmins==== @@ -46,7 +45,7 @@ The parameter admins must be a array with every element is a 20-byt def listAdmins() -Returns all the admins. +Returns all the admins that is a address array. ====createTopic==== @@ -113,7 +112,7 @@ voters can invoke this method to approve or reject a topic. The parameter hash is topic hash. The parameter voter one of the voters who set by admin. -The parameter approveOrReject is a boolean value, true mean approve, false mean reject. +The parameter approveOrReject is a boolean value, true means approve, false means reject. ===Events=== From d81585e88354584f2e93ce87f7f1afdcd7d73d59 Mon Sep 17 00:00:00 2001 From: lucas7788 Date: Fri, 27 Dec 2019 15:31:18 +0800 Subject: [PATCH 04/11] update --- OEPS/OEP-11.mediawiki | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OEPS/OEP-11.mediawiki b/OEPS/OEP-11.mediawiki index 541b264..cd2d2a7 100644 --- a/OEPS/OEP-11.mediawiki +++ b/OEPS/OEP-11.mediawiki @@ -83,7 +83,7 @@ def getTopic(hash) Return the topic, for example, 'Update the Governance Strategy, Mortgage unlocking cycle changed from 2 months to 1 month' -The parameter hash should be the topic 32-byte hash +The parameter hash should be the topic 32-byte hash ====getTopicInfo==== @@ -92,7 +92,7 @@ def getTopicInfo(hash) Return the topicInfo which includes 'admin, topic, voter address,startTime, endTime, approve amount, reject amount'. -The parameter hash should be the topic 32-byte hash +The parameter hash should be the topic 32-byte hash ====getVoters==== From e41eb856d52cb1a112dd2cf32b8a058be28adda5 Mon Sep 17 00:00:00 2001 From: lucas7788 Date: Fri, 3 Jan 2020 14:45:12 +0800 Subject: [PATCH 05/11] update --- OEPS/OEP-11.mediawiki | 73 ++++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 28 deletions(-) diff --git a/OEPS/OEP-11.mediawiki b/OEPS/OEP-11.mediawiki index cd2d2a7..03e7355 100644 --- a/OEPS/OEP-11.mediawiki +++ b/OEPS/OEP-11.mediawiki @@ -1,7 +1,7 @@
   OEP: 11
   Title: Governance Change Standard
-  Author: luodanwg , tanyuan , zhoupw 
+  Author:
   Type: Standard
   Status: Accepted
   Created: 2018-07-03
@@ -9,15 +9,15 @@
 
 ==Abstract==
 
-The OEP-11 Proposal is a standard interface for Governance Change Standard. There will be three roles in the contract, SuperAdmin, Admin and Users.
-SuperAdmin has the right to set who can be Admin.
-Admin has the right to create a topic and set who can vote for the topic.
+The OEP-11 proposal is a standard interface for the '''Governance Change Standard'''. There are three parties involved in the contract- '''SuperAdmin''', '''Admin''' and the '''Users'''.
+SuperAdmin has the authority to assign administrator privileges.
+Admin has the right to create topics and set the users who can vote for a topic.
 Users are topic voters from the Mortgage node address.
 
 
 ==Motivation==
 
-Governance Change Standard interface which allows Community update Governance Strategy of the Ontology blockchain to adapt the new development.
+'''Governance Change Standard''' interace allows the community to update the governace strategy of Ontology blockchain in order to adapt to new developments.
 
 ==Specification==
 
@@ -29,15 +29,16 @@ Governance Change Standard interface which allows Community update Governance St
 def init()
 
-SuperAdmin can invoke this method to Initialize the contract. +'''SuperAdmin''' can invoke this method to initialize the contract. ====setAdmin====
 def setAdmin(admins)
 
-SuperAdmin invoke this method to set who to be admins and admin can invoke 'createTopic' method to create a new topic. -The parameter admins should be a 20-byte address array. + +'''SuperAdmin''' can invoke this method to assign admin privileges. The admin can then invoke the createTopicmethod to create a new topic. +The parameter admins should be an array that contains 20-byte addresses. ====listAdmins==== @@ -45,27 +46,43 @@ The parameter admins should be a 20-byte address array. def listAdmins() -Returns all the admins that is a address array. +Returns the address array that contains all the admins. ====createTopic====
 def createTopic(admin, topic, startTime, endTime)
 
-Admin can invoke this method to create a new topic. -The parameter admin must be a 20-byte address. -The parameter topic should be a string. -The parameter startTime should be a unix timestamp. -The parameter endTime should be a unix timestamp. + +An admin can invoke this method to create a new topic. +The parameters are of the following type: + +{| class = "wikitable" +! style = "text-align:center;"| Parameter +! Type +|- +| admin +| 20 byte address +|- +| topic +| string +|- +| startTime +| UNIX timestamp +|- +| endTime +| UNIX timestamp +|} ====setVoterForTopic====
 def setVoterForTopic(hash, voters)
 
-the topic creator can invoke this method. -The parameter hash should be a 32-byte hash value of topic. -The parameter voters should be an address and weight array, for example: [['AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP',100000],['AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP',100000]] + +A topic creator can invoke this method. +The hash parameter should be a 32-byte hash value of the topic. +The voters parameter should be an address and weight array, for example: [['AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP',100000], ['AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP',100000]] ====listTopics==== @@ -73,7 +90,7 @@ The parameter voters should be an address and weight array, for exa def listTopics() -Return all the topic hash +Returns all the topic hashes. ====getTopic==== @@ -82,8 +99,8 @@ def getTopic(hash) -Return the topic, for example, 'Update the Governance Strategy, Mortgage unlocking cycle changed from 2 months to 1 month' -The parameter hash should be the topic 32-byte hash +Returns the corresponding topic, for example, 'Update the Governance Strategy, mortgage unlocking cycle changed from 2 months to 1 month'. +The parameter hash should be a 32-byte hash that corresponds to a topic. ====getTopicInfo==== @@ -91,7 +108,7 @@ The parameter hash should be the topic 32-byte hash def getTopicInfo(hash) -Return the topicInfo which includes 'admin, topic, voter address,startTime, endTime, approve amount, reject amount'. +Return the topicInfo which includes 'admin, topic, voter address, startTime, endTime, approve amount, reject amount'. The parameter hash should be the topic 32-byte hash ====getVoters==== @@ -100,7 +117,7 @@ The parameter hash should be the topic 32-byte hash def getVoters(hash) -Return all the voters of the topic,every voter consists of voter address and voter weight. +Return all the voters of a topic, each voter record consists of voter address and voter weight. ====voteTopic==== @@ -108,11 +125,11 @@ Return all the voters of the topic,every voter consists of voter address and vot def voteTopic(hash, voter, approveOrReject) -voters can invoke this method to approve or reject a topic. +Voters can invoke this method to approve or reject a topic. -The parameter hash is topic hash. -The parameter voter one of the voters who set by admin. -The parameter approveOrReject is a boolean value, true means approve, false means reject. +The parameter hash is the topic hash. +The parameter voter is one of the voters set by an admin. +The parameter approveOrReject is a boolean value, true implies approve, false implies reject. ===Events=== @@ -130,6 +147,6 @@ The event must be triggered when topic are created. VoteTopicEvent = RegisterAction("voteTopic", "hash", "voter") -The event must be triggered on any successful calls to voteTopic. +The event must be triggered on any successful calls to voteTopic. -===Implementation=== +===Implementation=== \ No newline at end of file From 36ba6ef9cb0a01b4bd4e9ee8de6c2a66c5106a4c Mon Sep 17 00:00:00 2001 From: lucas7788 Date: Wed, 15 Jan 2020 14:49:44 +0800 Subject: [PATCH 06/11] update --- OEPS/{OEP-11.mediawiki => OEP-64.mediawiki} | 50 ++++++++++++++++++--- 1 file changed, 45 insertions(+), 5 deletions(-) rename OEPS/{OEP-11.mediawiki => OEP-64.mediawiki} (67%) diff --git a/OEPS/OEP-11.mediawiki b/OEPS/OEP-64.mediawiki similarity index 67% rename from OEPS/OEP-11.mediawiki rename to OEPS/OEP-64.mediawiki index 03e7355..7e64d50 100644 --- a/OEPS/OEP-11.mediawiki +++ b/OEPS/OEP-64.mediawiki @@ -1,5 +1,5 @@
-  OEP: 11
+  OEP: 64
   Title: Governance Change Standard
   Author:
   Type: Standard
@@ -9,7 +9,7 @@
 
 ==Abstract==
 
-The OEP-11 proposal is a standard interface for the '''Governance Change Standard'''. There are three parties involved in the contract- '''SuperAdmin''', '''Admin''' and the '''Users'''.
+The OEP-64 proposal is a standard interface for the '''Governance Change Standard'''. There are three parties involved in the contract- '''SuperAdmin''', '''Admin''' and the '''Users'''.
 SuperAdmin has the authority to assign administrator privileges.
 Admin has the right to create topics and set the users who can vote for a topic.
 Users are topic voters from the Mortgage node address.
@@ -51,7 +51,7 @@ Returns the address array that contains all the admins.
 ====createTopic====
 
 
-def createTopic(admin, topic, startTime, endTime)
+def createTopic(admin, topic, startTime, endTime, voters)
 
An admin can invoke this method to create a new topic. @@ -72,6 +72,9 @@ The parameters are of the following type: |- | endTime | UNIX timestamp +|- +| voters +| all voter and voter weight of the Topic,it is array of voter and voter weight. |} ====setVoterForTopic==== @@ -99,7 +102,7 @@ def getTopic(hash)
-Returns the corresponding topic, for example, 'Update the Governance Strategy, mortgage unlocking cycle changed from 2 months to 1 month'. +Returns the corresponding [topicTitle,TopicDetail], for example, ['Update the Governance Strategy, mortgage unlocking cycle changed from 2 months to 1 month','Update the Governance Strategy, mortgage unlocking cycle changed from 2 months to 1 month']. The parameter hash should be a 32-byte hash that corresponds to a topic. ====getTopicInfo==== @@ -108,7 +111,7 @@ The parameter hash should be a 32-byte hash that corresponds to a t def getTopicInfo(hash) -Return the topicInfo which includes 'admin, topic, voter address, startTime, endTime, approve amount, reject amount'. +Return the topicInfo which includes 'admin, topicTitle, topicDetail, voter address, startTime, endTime, approve amount, reject amount, status, topicHash'. The parameter hash should be the topic 32-byte hash ====getVoters==== @@ -131,6 +134,43 @@ The parameter hash is the topic hash. The parameter voter is one of the voters set by an admin. The parameter approveOrReject is a boolean value, true implies approve, false implies reject. + +====getVotedInfo==== + +
+def getVotedInfo(hash, voter)
+
+ +Voters can invoke this method to query own voted Info, approve or reject. + +The parameter hash is the topic hash. +The parameter voter is one of the voters set by an admin. + +return value is 1 or 2, 1 means approve, 2 means reject, other means not voted + +====getVotedAddress==== + +
+def getVotedAddress(hash)
+
+ +all users can invoke this method to query all voted address and vote result of a topic. +The parameter hash is the topic hash. + +return value is array of all the address and vote result. + +====getTopicInfoListByAdmin==== + +
+def getTopicInfoListByAdmin(admin)
+
+ +all users can invoke this method to query all topicInfo of a admin. +The parameter hash is the topic hash. + +return value is array of topicInfo. + + ===Events=== ====createTopic==== From c7eb7104fc33ff49058918896711b4bf70740dd6 Mon Sep 17 00:00:00 2001 From: lucas7788 Date: Fri, 17 Jan 2020 16:35:51 +0800 Subject: [PATCH 07/11] update --- OEPS/OEP-64.mediawiki | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/OEPS/OEP-64.mediawiki b/OEPS/OEP-64.mediawiki index 7e64d50..0fb59ee 100644 --- a/OEPS/OEP-64.mediawiki +++ b/OEPS/OEP-64.mediawiki @@ -114,6 +114,20 @@ def getTopicInfo(hash) Return the topicInfo which includes 'admin, topicTitle, topicDetail, voter address, startTime, endTime, approve amount, reject amount, status, topicHash'. The parameter hash should be the topic 32-byte hash +return value + +* admin Topic的创建者 +* topic_title Topic标题 +* topic_detail Topic详细描述信息 +* voter address 所有的被授权投票的地址和权重的数组,例如:[['AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP',100000],['Ac9JHT6gFh6zxpfv4Q7ZPLD4xLhzcpRTWt',100000]] +* startTime 该Topic投票开始时间 +* endTime, 该Topic投票结束时间 +* approve amount, 该Topic赞成者的总量,是赞成者权重的累加 +* reject amount, 该Topic反对者的总量,是反对者权重的累加 +* status, 该Topic的状态,0表示已取消,1表示正常 +* topic hash + + ====getVoters====

From 997b0d2719f7a73868e13d2304419033a91d76b3 Mon Sep 17 00:00:00 2001
From: lucas7788 
Date: Fri, 17 Jan 2020 18:23:45 +0800
Subject: [PATCH 08/11] update

---
 OEPS/OEP-64.mediawiki | 57 ++++++++++++++++++++++++++-----------------
 1 file changed, 34 insertions(+), 23 deletions(-)

diff --git a/OEPS/OEP-64.mediawiki b/OEPS/OEP-64.mediawiki
index 0fb59ee..9395252 100644
--- a/OEPS/OEP-64.mediawiki
+++ b/OEPS/OEP-64.mediawiki
@@ -74,7 +74,7 @@ The parameters are of the following type:
 | UNIX timestamp
 |-
 | voters
-| all voter and voter weight of the Topic,it is array of voter and voter weight.
+| 2D array that contains all the voters and their respective voter_weight.
 |}
 
 ====setVoterForTopic====
@@ -83,9 +83,20 @@ The parameters are of the following type:
 def setVoterForTopic(hash, voters)
 
-A topic creator can invoke this method. -The hash parameter should be a 32-byte hash value of the topic. -The voters parameter should be an address and weight array, for example: [['AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP',100000], ['AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP',100000]] +A topic creator can invoke this method to assign the voters eligible to vote fora topic. + +{| class = "wikitable" +! style = "text-align:center;" | Parameter +! Type +|- +| hash +| 32-byte hash value +|- +| voters +| 2D array that contains all the voters and their respective voter_weight. +|} + +Example: [['AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP', 100000], ['AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP',100000]] ====listTopics==== @@ -102,7 +113,7 @@ def getTopic(hash) -Returns the corresponding [topicTitle,TopicDetail], for example, ['Update the Governance Strategy, mortgage unlocking cycle changed from 2 months to 1 month','Update the Governance Strategy, mortgage unlocking cycle changed from 2 months to 1 month']. +Returns the corresponding [topicTitle,topicDetail], for example, ['Update the Governance Strategy, mortgage unlocking cycle changed from 2 months to 1 month','Update the Governance Strategy, mortgage unlocking cycle changed from 2 months to 1 month']. The parameter hash should be a 32-byte hash that corresponds to a topic. ====getTopicInfo==== @@ -111,22 +122,22 @@ The parameter hash should be a 32-byte hash that corresponds to a t def getTopicInfo(hash) -Return the topicInfo which includes 'admin, topicTitle, topicDetail, voter address, startTime, endTime, approve amount, reject amount, status, topicHash'. -The parameter hash should be the topic 32-byte hash +Returns the topicInfo which includes 'admin, topicTitle, topicDetail, voter address, startTime, endTime, approve amount, reject amount, status, topicHash'. -return value +The parameter hash should be the 32-byte hash of the topic name. -* admin Topic的创建者 -* topic_title Topic标题 -* topic_detail Topic详细描述信息 -* voter address 所有的被授权投票的地址和权重的数组,例如:[['AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP',100000],['Ac9JHT6gFh6zxpfv4Q7ZPLD4xLhzcpRTWt',100000]] -* startTime 该Topic投票开始时间 -* endTime, 该Topic投票结束时间 -* approve amount, 该Topic赞成者的总量,是赞成者权重的累加 -* reject amount, 该Topic反对者的总量,是反对者权重的累加 -* status, 该Topic的状态,0表示已取消,1表示正常 -* topic hash +Response description: +* admin: Creator of the topic +* topic_title: Topic title +* topic_detail: Topic details +* voter: A 2D array containing the addresses and weight for all the authorized voters, for e.g., [['AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP',100000],['Ac9JHT6gFh6zxpfv4Q7ZPLD4xLhzcpRTWt',100000]] +* startTime: Start time for voting on the topic +* endTime:End time for voting on the topic +* approve amount: Total number of voters that approve the topic, sum of the weights of approving voters +* reject amount: Total number of voters that reject the topic, sum of the weights of rejecting voters +* status: Status of the topic, 0 represents cancelled, 1 represents normal +* topicHash: Topic hash ====getVoters==== @@ -160,7 +171,7 @@ Voters can invoke this method to query own voted Info, approve or reject. The parameter hash is the topic hash. The parameter voter is one of the voters set by an admin. -return value is 1 or 2, 1 means approve, 2 means reject, other means not voted +Return value is 1 or 2, 1 means approve, 2 means reject, other means not voted ====getVotedAddress==== @@ -168,10 +179,10 @@ return value is 1 or 2, 1 means approve, 2 means reject, other means not voted def getVotedAddress(hash) -all users can invoke this method to query all voted address and vote result of a topic. +Users can invoke this method to query all voted address and vote result of a topic. The parameter hash is the topic hash. -return value is array of all the address and vote result. +Return value is array of all the address and vote result. ====getTopicInfoListByAdmin==== @@ -179,10 +190,10 @@ return value is array of all the address and vote result. def getTopicInfoListByAdmin(admin) -all users can invoke this method to query all topicInfo of a admin. +Users can invoke this method to query all topicInfo of a admin. The parameter hash is the topic hash. -return value is array of topicInfo. +Return value is array of topicInfo. ===Events=== From bc4d0b32de52716060fb203606ad2e51b193d1b2 Mon Sep 17 00:00:00 2001 From: lucas7788 Date: Wed, 24 Jun 2020 12:51:30 +0800 Subject: [PATCH 09/11] update --- OEPS/OEP-64.mediawiki | 78 ++++++++++++------------------------------- 1 file changed, 21 insertions(+), 57 deletions(-) diff --git a/OEPS/OEP-64.mediawiki b/OEPS/OEP-64.mediawiki index 9395252..c4cb409 100644 --- a/OEPS/OEP-64.mediawiki +++ b/OEPS/OEP-64.mediawiki @@ -9,10 +9,15 @@ ==Abstract== -The OEP-64 proposal is a standard interface for the '''Governance Change Standard'''. There are three parties involved in the contract- '''SuperAdmin''', '''Admin''' and the '''Users'''. -SuperAdmin has the authority to assign administrator privileges. -Admin has the right to create topics and set the users who can vote for a topic. -Users are topic voters from the Mortgage node address. +The OEP-64 proposal is a standard interface for the '''Governance Change Standard'''. +All consensus nodes and candidate nodes can participate in the governance of ontology by creating and voting on topics. +The admin node will be used instead of all consensus nodes and candidate nodes. +`Topic` is used to represent a major update of ontology, including the initiator address, topic title, topic detail, start voting time and end voting time. +The admin node can create a topic. All the admin nodes can approve or reject the topic. Non admin nodes cannot create or participate in the topic voting. +The voting weight of the admin node is expressed by the number of ont pledged by the node. +`Topic` needs to be approved by most nodes before it is updated to the Ontology main network. During the voting process, the number of votes for and against will be counted. +The number of votes in favor is greater than the number of votes in opposition and the number of votes in favor is more than 50%, + the update of the Topic representative will be updated to the Ontology main network. ==Motivation== @@ -23,23 +28,6 @@ Users are topic voters from the Mortgage node address. ===Methods=== -====init==== - -
-def init()
-
- -'''SuperAdmin''' can invoke this method to initialize the contract. - -====setAdmin==== - -
-def setAdmin(admins)
-
- -'''SuperAdmin''' can invoke this method to assign admin privileges. The admin can then invoke the createTopicmethod to create a new topic. -The parameter admins should be an array that contains 20-byte addresses. - ====listAdmins====
@@ -51,7 +39,7 @@ Returns the address array that contains all the admins.
 ====createTopic====
 
 
-def createTopic(admin, topic, startTime, endTime, voters)
+def createTopic(admin, topic, startTime, endTime)
 
An admin can invoke this method to create a new topic. @@ -72,32 +60,8 @@ The parameters are of the following type: |- | endTime | UNIX timestamp -|- -| voters -| 2D array that contains all the voters and their respective voter_weight. |} -====setVoterForTopic==== - -
-def setVoterForTopic(hash, voters)
-
- -A topic creator can invoke this method to assign the voters eligible to vote fora topic. - -{| class = "wikitable" -! style = "text-align:center;" | Parameter -! Type -|- -| hash -| 32-byte hash value -|- -| voters -| 2D array that contains all the voters and their respective voter_weight. -|} - -Example: [['AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP', 100000], ['AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP',100000]] - ====listTopics====
@@ -110,12 +74,21 @@ Returns all the topic hashes.
 
 
 def getTopic(hash)
-
 
Returns the corresponding [topicTitle,topicDetail], for example, ['Update the Governance Strategy, mortgage unlocking cycle changed from 2 months to 1 month','Update the Governance Strategy, mortgage unlocking cycle changed from 2 months to 1 month']. The parameter hash should be a 32-byte hash that corresponds to a topic. +====cancelTopic==== + +
+def cancelTopic(hash)
+
+only the Topic creator has the right to invoke this method. + +The parameter hash should be the 32-byte hash of the topic name. + + ====getTopicInfo====
@@ -131,7 +104,6 @@ Response description:
 * admin: Creator of the topic
 * topic_title: Topic title
 * topic_detail: Topic details
-* voter: A 2D array containing the addresses and weight for all the authorized voters, for e.g., [['AbtTQJYKfQxq4UdygDsbLVjE8uRrJ2H3tP',100000],['Ac9JHT6gFh6zxpfv4Q7ZPLD4xLhzcpRTWt',100000]]
 * startTime: Start time for voting on the topic
 * endTime:End time for voting on the topic
 * approve amount: Total number of voters that approve the topic, sum of the weights of approving voters
@@ -139,14 +111,6 @@ Response description:
 * status: Status of the topic, 0 represents cancelled, 1 represents normal
 * topicHash: Topic hash
 
-====getVoters====
-
-
-def getVoters(hash)
-
- -Return all the voters of a topic, each voter record consists of voter address and voter weight. - ====voteTopic====
@@ -191,7 +155,7 @@ def getTopicInfoListByAdmin(admin)
 
Users can invoke this method to query all topicInfo of a admin. -The parameter hash is the topic hash. +The parameter admin is the topic creator. Return value is array of topicInfo. From d69c6a8f20aca10abec3fce257b8cc742785fa64 Mon Sep 17 00:00:00 2001 From: lucas7788 Date: Sun, 28 Jun 2020 15:40:53 +0800 Subject: [PATCH 10/11] update --- OEPS/OEP-64.mediawiki | 93 ++++++++++++++++++++++++++++--------------- 1 file changed, 60 insertions(+), 33 deletions(-) diff --git a/OEPS/OEP-64.mediawiki b/OEPS/OEP-64.mediawiki index c4cb409..3368a70 100644 --- a/OEPS/OEP-64.mediawiki +++ b/OEPS/OEP-64.mediawiki @@ -11,10 +11,10 @@ The OEP-64 proposal is a standard interface for the '''Governance Change Standard'''. All consensus nodes and candidate nodes can participate in the governance of ontology by creating and voting on topics. -The admin node will be used instead of all consensus nodes and candidate nodes. +The `GOV` node will be used instead of all consensus nodes and candidate nodes. `Topic` is used to represent a major update of ontology, including the initiator address, topic title, topic detail, start voting time and end voting time. -The admin node can create a topic. All the admin nodes can approve or reject the topic. Non admin nodes cannot create or participate in the topic voting. -The voting weight of the admin node is expressed by the number of ont pledged by the node. +The `GOV` node can create a topic. All the `GOV` nodes can approve or reject the topic. Non `GOV` nodes cannot create or participate in the topic voting. +The voting weight of the `GOV` node is expressed by the number of ont pledged by the node. `Topic` needs to be approved by most nodes before it is updated to the Ontology main network. During the voting process, the number of votes for and against will be counted. The number of votes in favor is greater than the number of votes in opposition and the number of votes in favor is more than 50%, the update of the Topic representative will be updated to the Ontology main network. @@ -22,50 +22,55 @@ The number of votes in favor is greater than the number of votes in opposition a ==Motivation== -'''Governance Change Standard''' interace allows the community to update the governace strategy of Ontology blockchain in order to adapt to new developments. +'''Governance Change Standard''' interface allows the community to update the governance strategy of Ontology blockchain in order to adapt to new developments. ==Specification== ===Methods=== -====listAdmins==== +====listGovNodes====
-def listAdmins()
+fn list_gov_nodes() -> Vec
{}
-Returns the address array that contains all the admins. +Returns the address array that contains all the Governance nodes. ====createTopic====
-def createTopic(admin, topic, startTime, endTime)
+fn create_topic(gov_node_address: Address,topic_title: &[u8],topic_detail: &[u8],start_time: U128,end_time: U128) -> bool {}
 
-An admin can invoke this method to create a new topic. +Only `Gov` node can invoke this method to create a new topic. + + The parameters are of the following type: {| class = "wikitable" ! style = "text-align:center;"| Parameter ! Type |- -| admin -| 20 byte address +| gov_node_address +| Address |- -| topic -| string +| topic_title +| bytearray |- -| startTime +| topic_detail +| bytearray +|- +| start_time | UNIX timestamp |- -| endTime +| end_time | UNIX timestamp |} ====listTopics====
-def listTopics()
+fn list_topic_hash() -> Vec {}
 
Returns all the topic hashes. @@ -73,16 +78,22 @@ Returns all the topic hashes. ====getTopic====
-def getTopic(hash)
+fn get_topic(hash: &H256) -> Option{}
 
- -Returns the corresponding [topicTitle,topicDetail], for example, ['Update the Governance Strategy, mortgage unlocking cycle changed from 2 months to 1 month','Update the Governance Strategy, mortgage unlocking cycle changed from 2 months to 1 month']. +Return value data type is `Option`, `option` means this value maybe null. +`Topic` is defined as follows: +``` +pub struct Topic { + pub topic_title: Vec, + pub topic_detail: Vec, +} +``` The parameter hash should be a 32-byte hash that corresponds to a topic. ====cancelTopic====
-def cancelTopic(hash)
+fn cancel_topic(hash: &H256) -> bool {}
 
only the Topic creator has the right to invoke this method. @@ -92,42 +103,58 @@ The parameter hash should be the 32-byte hash of the topic name. ====getTopicInfo====
-def getTopicInfo(hash)
+fn get_topic_info(hash: &H256) -> Option {}
 
-Returns the topicInfo which includes 'admin, topicTitle, topicDetail, voter address, startTime, endTime, approve amount, reject amount, status, topicHash'. - -The parameter hash should be the 32-byte hash of the topic name. +Return value data type is `Option`,`option` means this value maybe null. + +TopicInfo is defined as follows: +``` +pub struct TopicInfo { + pub gov_node_addr: Address, + pub topic_title: Vec, + pub topic_detail: Vec, + pub voters: Vec, + pub start_time: u64, + pub end_time: u64, + pub approve: u64, + pub reject: u64, + pub status: u8, + pub hash: H256, +} +``` + +The parameter hash should be the 32-byte hash of the topic hash. Response description: -* admin: Creator of the topic +* gov_node_addr: Creator of the topic * topic_title: Topic title * topic_detail: Topic details -* startTime: Start time for voting on the topic -* endTime:End time for voting on the topic +* start_time: Start time for voting on the topic +* end_time:End time for voting on the topic * approve amount: Total number of voters that approve the topic, sum of the weights of approving voters * reject amount: Total number of voters that reject the topic, sum of the weights of rejecting voters * status: Status of the topic, 0 represents cancelled, 1 represents normal -* topicHash: Topic hash +* hash: Topic hash ====voteTopic====
-def voteTopic(hash, voter, approveOrReject)
+fn vote_topic(hash: &H256, voter: Address, approve_or_reject: bool) -> bool {}
 
Voters can invoke this method to approve or reject a topic. The parameter hash is the topic hash. -The parameter voter is one of the voters set by an admin. +The parameter voter is one of the `Gov` nodes. The parameter approveOrReject is a boolean value, true implies approve, false implies reject. ====getVotedInfo====
-def getVotedInfo(hash, voter)
+fn get_voted_info(hash: &H256, voter: &Address) -> u8{}
 
Voters can invoke this method to query own voted Info, approve or reject. @@ -140,7 +167,7 @@ Return value is 1 or 2, 1 means approve, 2 means reject, other means not voted ====getVotedAddress====
-def getVotedAddress(hash)
+fn get_voted_address(hash: &H256) -> Vec {}
 
Users can invoke this method to query all voted address and vote result of a topic. @@ -151,7 +178,7 @@ Return value is array of all the address and vote result. ====getTopicInfoListByAdmin====
-def getTopicInfoListByAdmin(admin)
+fn get_topic_info_list_by_addr(gov_node_addr: &Address) -> Vec{}
 
Users can invoke this method to query all topicInfo of a admin. From de12344e49067fb891eb063855e2bd3857f87dd9 Mon Sep 17 00:00:00 2001 From: lucas7788 Date: Tue, 28 Jul 2020 20:01:30 +0800 Subject: [PATCH 11/11] add oep --- OEPS/OEP-69.mediawiki | 273 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 273 insertions(+) create mode 100644 OEPS/OEP-69.mediawiki diff --git a/OEPS/OEP-69.mediawiki b/OEPS/OEP-69.mediawiki new file mode 100644 index 0000000..0367de8 --- /dev/null +++ b/OEPS/OEP-69.mediawiki @@ -0,0 +1,273 @@ +
+  OEP: 69
+  Title: DDXF Marketplace Standard
+  Author:
+  Type: Standard
+  Status: Accepted
+  Created: 2018-07-03
+
+ +==Abstract== + + + +==Motivation== + + +==Specification== + +===Methods=== + +====init==== + +
+fn init(dtoken: Address, split_policy: Address) -> bool
+
+ +this method will store the default dtoken contract address and split_policy contract address. +only the admin has the right to invoke this method. + +The parameters are of the following type: + +{| class = "wikitable" +! style = "text-align:center;"| Parameter +! Type +|- +| dtoken +| Address +|- +| split_policy +| Address +|} + +====dtokenSellerPublish==== + +
+pub fn dtoken_seller_publish(
+    resource_id: &[u8],
+    resource_ddo_bytes: &[u8],
+    item_bytes: &[u8],
+    split_policy_param_bytes: &[u8],
+) -> bool
+
+ +The seller publishes goods on the chain by calling this method. + + +The parameters are of the following type: + +{| class = "wikitable" +! style = "text-align:center;"| Parameter +! Type +! Desc +|- +| resource_id +| &[u8] +| used to mark the only commodity in the chain +|- +| resource_ddo_bytes +| &[u8] +| the result of ResourceDDO struct serialization +|- +| item_bytes +| &[u8] +| the result of DTokenItem struct serialization +|- +| split_policy_param_bytes +| &[u8] +| the result of RegisterParam struct serialization +|} + +event + +["dtokenSellerPublish", resource_id, resource_ddo_bytes, item_bytes, split_policy_param_bytes] + +====update==== + +
+fn update(
+    resource_id: &[u8],
+    resource_ddo_bytes: &[u8],
+    item_bytes: &[u8],
+    split_policy_param_bytes: &[u8],
+) -> bool
+
+ +The seller calls this method to update the information of the goods on the chain. + +{| class = "wikitable" +! style = "text-align:center;"| Parameter +! Type +! Desc +|- +| resource_id +| &[u8] +| used to mark the only commodity in the chain +|- +| resource_ddo_bytes +| &[u8] +| the result of ResourceDDO struct serialization +|- +| item_bytes +| &[u8] +| the result of DTokenItem struct serialization +|- +| split_policy_param_bytes +| &[u8] +| the result of RegisterParam struct serialization +|} + + +event + +["update", resource_id, resource_ddo_bytes, item_bytes, split_policy_param_bytes] + + +====delete==== + +
+pub fn delete(resource_id: &[u8]) -> bool
+
+ +Sellers delete items on the chain + +{| class = "wikitable" +! style = "text-align:center;"| Parameter +! Type +! Desc +|- +| resource_id +| &[u8] +| used to mark the only commodity in the chain +|} + + +event + +["delete", resource_id] + + + +====buyDToken==== + +
+pub fn buy_dtoken(resource_id: &[u8], n: U128, buyer_account: &Address, payer: &Address) -> bool
+
+ +The buyer calls this method to purchase the goods on the chain + + +{| class = "wikitable" +! style = "text-align:center;"| Parameter +! Type +! Desc +|- +| resource_id +| &[u8] +| used to mark the only commodity in the chain +|- +| n +| U128 +| the number of purchases +|- +| buyer_account +| &Address +| buyer's address +|- +| payer +| &Address +| Address to pay for the purchase +|} + +event + +["buyDToken", resource_id, n, buyer_account, payer] + +====buyDTokens==== + +
+pub fn buy_dtokens(
+    resource_ids: Vec>,
+    ns: Vec,
+    buyer_account: &Address,
+    payer: &Address,
+) -> bool
+
+ +buy more than one dtoken at a time + +{| class = "wikitable" +! style = "text-align:center;"| Parameter +! Type +! Desc +|- +| resource_ids +| Vec> +| array of resource_id which used to mark the only commodity in the chain +|- +| ns +| Vec +| array of n which is the number of purchases. the length of resource_ids must be the same with the length of ns. +|- +| buyer_account +| &Address +| buyer's address +|- +| payer +| &Address +| Address to pay for the purchase +|} + +event + +[ +["buyDToken", resource_id, n, buyer_account, payer], +] + +====buyDTokenReward==== + +
+pub fn buy_dtoken_reward(
+    resource_id: &[u8],
+    n: U128,
+    buyer_account: &Address,
+    payer: &Address,
+    unit_price: U128,
+) -> bool
+
+ +This method can only be called for items that the fee.count is 0, The buyer can reward the seller with any number of tokens. + +{| class = "wikitable" +! style = "text-align:center;"| Parameter +! Type +! Desc +|- +| resource_id +| &[u8] +| used to mark the only commodity in the chain +|- +| n +| U128 +| the number of purchases +|- +| buyer_account +| &Address +| buyer's address +|- +| payer +| &Address +| Address to pay for the purchase +|- +| unit_price +| U128 +| unit price the buyer is willing to pay +|} + +event + +["buyDToken", resource_id, n, buyer_account, payer, unit_price] + +===Implementation=== + +[oep-69](https://github.com/ont-bizsuite/ddxf-contract-suite/tree/master/contracts/marketplace) \ No newline at end of file