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

Feat/#63 add revoke code for new badge #66

Merged
merged 4 commits into from
Dec 10, 2020
Merged
Show file tree
Hide file tree
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
21 changes: 20 additions & 1 deletion community/community.abi
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,20 @@
}
]
},
{
"name": "revokebadge",
"base": "",
"fields": [
{
"name": "community_account",
"type": "name"
},
{
"name": "revoke_badge_propose_name",
"type": "name"
}
]
},
{
"name": "setaccess",
"base": "",
Expand Down Expand Up @@ -1319,6 +1333,11 @@
"type": "proposecode",
"ricardian_contract": ""
},
{
"name": "revokebadge",
"type": "revokebadge",
"ricardian_contract": ""
},
{
"name": "setaccess",
"type": "setaccess",
Expand Down Expand Up @@ -1429,7 +1448,7 @@
"key_types": []
},
{
"name": "v1.cert",
"name": "v1.certs",
"type": "v1_cert",
"index_type": "i64",
"key_names": [],
Expand Down
Binary file modified community/community.wasm
Binary file not shown.
25 changes: 24 additions & 1 deletion community/include/community.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ CONTRACT community : public contract
POSITION_DISMISS,
BADGE_CONFIG,
BADGE_ISSUE,
BADGE_REVOKE,
};

enum BadgeIssueType {
Expand Down Expand Up @@ -247,6 +248,8 @@ CONTRACT community : public contract

ACTION issuebadge(name community_account, name badge_propose_name);

ACTION revokebadge(name community_account, name revoke_badge_propose_name);

ACTION setconfig(
name community_creator_name,
name cryptobadge_contract_name,
Expand All @@ -260,6 +263,25 @@ CONTRACT community : public contract
);

private:
void create_issue_badge_code(
name community_account,
uint64_t badge_id,
uint8_t issue_type,
uint8_t issue_exec_type,
RightHolder right_issue_sole_executor,
RightHolder right_issue_proposer,
uint8_t issue_approval_type,
RightHolder right_issue_approver,
RightHolder right_issue_voter,
double issue_pass_rule,
uint64_t issue_vote_duration,
name ram_payer
);

void create_config_badge_code_for_admin(name community_account, uint64_t badge_id, name ram_payer);

void create_revoke_badge_code_for_admin(name community_account, uint64_t badge_id, name ram_payer);

bool verify_approver(name community_account, name voter, uint64_t code_id, bool is_ammnend_code);

bool verify_voter(name community_account, name voter, uint64_t code_id, bool is_amend_code);
Expand Down Expand Up @@ -552,7 +574,7 @@ CONTRACT community : public contract
}
};

typedef eosio::multi_index<"v1.cert"_n, v1_cert,
typedef eosio::multi_index<"v1.certs"_n, v1_cert,
eosio::indexed_by<"badgeid"_n, eosio::const_mem_fun<v1_cert, uint64_t, &v1_cert::by_badge_id>>,
eosio::indexed_by<"owner"_n, eosio::const_mem_fun<v1_cert, uint64_t, &v1_cert::by_owner>>> v1_cert_table;

Expand All @@ -577,6 +599,7 @@ CONTRACT community : public contract
((v1.amenexec)(v1_sole_decision)(v1_amend_sole_decision_table))
((v1.filling)(v1_election_rule)(v1_election_table))
((v1.pproposal)(v1_pos_proposal)(v1_posproposal_table))
((v1.cproposal)(v1_code_proposal)(v1_code_proposals_table))
((v1.candidate)(v1_pos_candidate)(v1_poscandidate_table))
)
#endif
Expand Down
Loading