diff --git a/OEPS/OEP-64.mediawiki b/OEPS/OEP-64.mediawiki new file mode 100644 index 0000000..3368a70 --- /dev/null +++ b/OEPS/OEP-64.mediawiki @@ -0,0 +1,208 @@ +
+  OEP: 64
+  Title: Governance Change Standard
+  Author:
+  Type: Standard
+  Status: Accepted
+  Created: 2018-07-03
+
+ +==Abstract== + +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 `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 `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. + + +==Motivation== + +'''Governance Change Standard''' interface allows the community to update the governance strategy of Ontology blockchain in order to adapt to new developments. + +==Specification== + +===Methods=== + +====listGovNodes==== + +
+fn list_gov_nodes() -> Vec
{} +
+ +Returns the address array that contains all the Governance nodes. + +====createTopic==== + +
+fn create_topic(gov_node_address: Address,topic_title: &[u8],topic_detail: &[u8],start_time: U128,end_time: U128) -> bool {}
+
+ +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 +|- +| gov_node_address +| Address +|- +| topic_title +| bytearray +|- +| topic_detail +| bytearray +|- +| start_time +| UNIX timestamp +|- +| end_time +| UNIX timestamp +|} + +====listTopics==== + +
+fn list_topic_hash() -> Vec {}
+
+ +Returns all the topic hashes. + +====getTopic==== + +
+fn get_topic(hash: &H256) -> Option{}
+
+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==== + +
+fn cancel_topic(hash: &H256) -> bool {}
+
+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==== + +
+fn get_topic_info(hash: &H256) -> Option {}
+
+ +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: + +* gov_node_addr: Creator of the topic +* topic_title: Topic title +* topic_detail: Topic details +* 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 +* hash: Topic hash + +====voteTopic==== + +
+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 `Gov` nodes. +The parameter approveOrReject is a boolean value, true implies approve, false implies reject. + + +====getVotedInfo==== + +
+fn get_voted_info(hash: &H256, voter: &Address) -> u8{}
+
+ +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==== + +
+fn get_voted_address(hash: &H256) -> Vec {}
+
+ +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==== + +
+fn get_topic_info_list_by_addr(gov_node_addr: &Address) -> Vec{}
+
+ +Users can invoke this method to query all topicInfo of a admin. +The parameter admin is the topic creator. + +Return value is array of topicInfo. + + +===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=== \ No newline at end of file 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