From ba0bbc65e6f4af1451b730da0031e11c7c06ae1a Mon Sep 17 00:00:00 2001 From: danielAlvess Date: Wed, 9 Dec 2020 13:24:57 +0700 Subject: [PATCH] feat/#64 add revoke code for old badge --- community/community.abi | 19 ++++++ community/community.wasm | Bin 343541 -> 351595 bytes community/include/community.hpp | 2 + community/src/community.cpp | 107 +++++++++++++++++++++++++++++--- 4 files changed, 121 insertions(+), 7 deletions(-) diff --git a/community/community.abi b/community/community.abi index b8ab306..08cc75b 100644 --- a/community/community.abi +++ b/community/community.abi @@ -467,6 +467,20 @@ } ] }, + { + "name": "migraterevok", + "base": "", + "fields": [ + { + "name": "community_account", + "type": "name" + }, + { + "name": "badge_id", + "type": "uint64" + } + ] + }, { "name": "nominatepos", "base": "", @@ -1323,6 +1337,11 @@ "type": "issuebadge", "ricardian_contract": "" }, + { + "name": "migraterevok", + "type": "migraterevok", + "ricardian_contract": "" + }, { "name": "nominatepos", "type": "nominatepos", diff --git a/community/community.wasm b/community/community.wasm index db52f4be709383f868bb88de19bf27fb993823be..0ca498713e7fea0ce859cfca33d82fcd2de8e815 100755 GIT binary patch delta 25157 zcmdUXcYKt^*8fh~^uR(WsjyjsCe(l=5c(oPkRqTW79dEIfE2L;x&aZX8dzYc(jiDU z!UKW|3JNwr!Aq6k1w}4G0s#VE_5GfCo=rA1z3+X0fBf)cW@qNinbYQ+Gc(WgT=}iS zzdop#9aGcpdF{2=Jhlvh(v~5qX3L;P4;llg9PMk^*rs-%$QKv9F9y~w6X0UiU9S5$ ztJT2elHQGh4L!o;VquM3_{W&5x{HUo(onGaETy_+Aud;AE*N9=15#Z0pQW&XloV$E zDXya_FeODaX~I$*)d6h%tIrrvl>Bp~xKddC>aNrVuKEqr(gK>M*qgZ;v-)ApQY5d= zcxsABDF^W8b~{gDshErYOHF0g-yoD4pOnF=DJdD!8b$m7dnPu@`**I3j zviTW)j2~g|v7h+I{MmhM7F)+o@?3s`9b|8_`TPp|ntj4H^B>uV{1O{E_#fi1I3kXU zV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L~2N5NB*wNU}@BaY6{mT6S diff --git a/community/include/community.hpp b/community/include/community.hpp index ba49a85..0554528 100644 --- a/community/include/community.hpp +++ b/community/include/community.hpp @@ -262,6 +262,8 @@ CONTRACT community : public contract asset init_cpu ); + ACTION migraterevok(name community_account, uint64_t badge_id); + private: void create_issue_badge_code( name community_account, diff --git a/community/src/community.cpp b/community/src/community.cpp index 13b6b42..7e2735d 100644 --- a/community/src/community.cpp +++ b/community/src/community.cpp @@ -2045,8 +2045,8 @@ ACTION community::configbadge( name community_account, uint64_t badge_id, uint8_t issue_type, - name update_badge_proposal_name) -{ + name update_badge_proposal_name +) { require_auth(community_account); v1_global_table config(_self, _self.value); @@ -2146,6 +2146,103 @@ ACTION community::configbadge( }); issue_badge_code_id = issue_badge_code_itr->code_id; } + + uint128_t revoke_badge_reference_id = build_reference_id(badge_id, CodeTypeEnum::BADGE_REVOKE); + auto revoke_badge_code_itr = getByCodeReferId.find(revoke_badge_reference_id); + + vector action_permission = {{community_account, "active"_n}}; + if (ram_payer == ram_payer_system) + action_permission.push_back({ram_payer_system, "active"_n}); + if (revoke_badge_code_itr == getByCodeReferId.end()) { + action( + action_permission, + get_self(), + "migraterevok"_n, + std::make_tuple(community_account, badge_id)) + .send(); + } +} + +ACTION community::migraterevok(name community_account, uint64_t badge_id) { + require_auth(community_account); + + v1_global_table config(_self, _self.value); + _config = config.exists() ? config.get() : v1_global{}; + const name ram_payer_system = _config.ram_payer_name; + + auto ram_payer = community_account; + if (has_auth(ram_payer_system)) + ram_payer = ram_payer_system; + + v1_code_table _codes(_self, community_account.value); + + v1_code_sole_decision_table _code_execution_rule(_self, community_account.value); + v1_amend_sole_decision_table _amend_execution_rule(_self, community_account.value); + + v1_code_collective_decision_table _code_vote_rule(_self, community_account.value); + v1_ammend_collective_decision_table _amend_vote_rule(_self, community_account.value); + + v1_position_table _positions(_self, community_account.value); + + auto getByCodeReferId = _codes.get_index<"by.refer.id"_n>(); + + vector code_actions; + code_actions.push_back("revokebadge"_n); + + uint128_t config_badge_reference_id = build_reference_id(badge_id, CodeTypeEnum::BADGE_CONFIG); + auto config_badge_code_itr = getByCodeReferId.find(config_badge_reference_id); + + check(config_badge_code_itr != getByCodeReferId.end(), "ERR::CONFIG_BADGE_CODE_NOT_EXISTED::Config badge code does not exist"); + + uint128_t revoke_badge_reference_id = build_reference_id(badge_id, CodeTypeEnum::BADGE_REVOKE); + auto revoke_badge_code_itr = getByCodeReferId.find(revoke_badge_reference_id); + + check(revoke_badge_code_itr == getByCodeReferId.end(), "ERR::REVOKE_BADGE_CODE_ALREADY_EXISTED::Revoke code has been already existed"); + + // save revoke badge code to the table + auto new_revoke_badge_code = _codes.emplace(ram_payer, [&](auto &row) { + row.code_id = _codes.available_primary_key(); + row.code_name = BA_Revoke; + row.contract_name = get_self(); + row.code_actions = code_actions; + row.code_exec_type = config_badge_code_itr->code_exec_type; + row.amendment_exec_type = ExecutionType::SOLE_DECISION; + row.code_type = {CodeTypeEnum::BADGE_REVOKE, badge_id}; + }); + + if (config_badge_code_itr->code_exec_type != ExecutionType::SOLE_DECISION) + { + auto config_badge_code_collective_decision = _code_vote_rule.find(config_badge_code_itr->code_id); + if (config_badge_code_collective_decision != _code_vote_rule.end()) + { + _code_vote_rule.emplace(ram_payer, [&](auto &row) { + row.code_id = new_revoke_badge_code->code_id; + row.right_proposer = config_badge_code_collective_decision->right_proposer; + row.right_approver = config_badge_code_collective_decision->right_approver; + row.right_voter = config_badge_code_collective_decision->right_voter; + row.approval_type = config_badge_code_collective_decision->approval_type; + row.pass_rule = config_badge_code_collective_decision->pass_rule; + row.vote_duration = config_badge_code_collective_decision->vote_duration; + }); + } + } + + if (config_badge_code_itr->code_exec_type != ExecutionType::COLLECTIVE_DECISION) + { + auto config_badge_code_sole_decision = _code_execution_rule.find(config_badge_code_itr->code_id); + if (config_badge_code_sole_decision != _code_execution_rule.end()) + { + _code_execution_rule.emplace(ram_payer, [&](auto &row) { + row.code_id = new_revoke_badge_code->code_id; + row.right_executor = config_badge_code_sole_decision->right_executor; + }); + } + } + + _amend_execution_rule.emplace(ram_payer, [&](auto &row) { + row.code_id = new_revoke_badge_code->code_id; + row.right_executor = admin_right_holder(); + }); } ACTION community::issuebadge(name community_account, name badge_propose_name) @@ -2265,8 +2362,6 @@ void community::create_issue_badge_code( v1_position_table _positions(_self, community_account.value); - auto getByCodeName = _codes.get_index<"by.code.name"_n>(); - name issue_badge_code_name; if (issue_type == BadgeIssueType::WITHOUT_CLAIM) { @@ -2392,7 +2487,6 @@ void community::create_config_badge_code_for_admin(name community_account, uint6 v1_position_table _positions(_self, community_account.value); - auto getByCodeName = _codes.get_index<"by.code.name"_n>(); auto getByCodeReferId = _codes.get_index<"by.refer.id"_n>(); vector code_actions; @@ -2462,7 +2556,6 @@ void community::create_revoke_badge_code_for_admin(name community_account, uint6 v1_position_table _positions(_self, community_account.value); - auto getByCodeName = _codes.get_index<"by.code.name"_n>(); auto getByCodeReferId = _codes.get_index<"by.refer.id"_n>(); vector code_actions; @@ -2901,4 +2994,4 @@ community::RightHolder community::admin_right_holder() #endif EOSIO_ABI_CUSTOM(community, - (setapprotype)(setvoter)(setapprover)(setaccess)(transfer)(createacc)(create)(initcode)(inputmembers)(initadminpos)(execcode)(createcode)(setverify)(createpos)(configpos)(nominatepos)(approvepos)(voteforcode)(voteforpos)(dismisspos)(setexectype)(appointpos)(proposecode)(execproposal)(verifyholder)(createbadge)(issuebadge)(configbadge)(revokebadge)(setsoleexec)(setproposer)(setvoterule)(setconfig)) + (setapprotype)(setvoter)(setapprover)(setaccess)(transfer)(createacc)(create)(initcode)(inputmembers)(initadminpos)(execcode)(createcode)(setverify)(createpos)(configpos)(nominatepos)(approvepos)(voteforcode)(voteforpos)(dismisspos)(setexectype)(appointpos)(proposecode)(execproposal)(verifyholder)(createbadge)(issuebadge)(configbadge)(revokebadge)(migraterevok)(setsoleexec)(setproposer)(setvoterule)(setconfig))