Skip to content

Commit

Permalink
Merge pull request #11 from canfoundation/feat/#10-add-issue-badge-an…
Browse files Browse the repository at this point in the history
…d-config-badge-code-when-create-badge

feat/#10 add issue badge and config badge code when create badge
  • Loading branch information
quocle108 authored Feb 24, 2020
2 parents fd8d255 + 0396126 commit c3401b9
Show file tree
Hide file tree
Showing 5 changed files with 512 additions and 29 deletions.
2 changes: 1 addition & 1 deletion community/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ $ cleos get table governance23 community241 codeexecrule
```bash
// last parameter is identify set for amendment code (1 is set for amendment code, 0 is set for code)
$ cleos convert pack_action_data governance23 setexectype '["community241", 2, 1, 0]'
108af0d94d2d254504000000000000000100
208af0d94d2d254529000000000000000000
```

2. pack `setapprotype` action data to set approval type of code proposal (approval type 1 is approval consensus):
Expand Down
131 changes: 131 additions & 0 deletions community/community.abi
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,76 @@
}
]
},
{
"name": "configbadge",
"base": "",
"fields": [
{
"name": "community_account",
"type": "name"
},
{
"name": "badge_id",
"type": "uint64"
},
{
"name": "issue_type",
"type": "uint8"
},
{
"name": "update_badge_proposal_name",
"type": "name"
},
{
"name": "issue_exec_type",
"type": "uint8"
},
{
"name": "issue_sole_right_accounts",
"type": "name[]"
},
{
"name": "issue_sole_right_pos_ids",
"type": "uint64[]"
},
{
"name": "issue_proposer_right_accounts",
"type": "name[]"
},
{
"name": "issue_proposer_right_pos_ids",
"type": "uint64[]"
},
{
"name": "issue_approval_type",
"type": "uint8"
},
{
"name": "issue_approver_right_accounts",
"type": "name[]"
},
{
"name": "issue_approver_right_pos_ids",
"type": "uint64[]"
},
{
"name": "issue_voter_right_accounts",
"type": "name[]"
},
{
"name": "issue_voter_right_pos_ids",
"type": "uint64[]"
},
{
"name": "issue_pass_rule",
"type": "float64"
},
{
"name": "issue_vote_duration",
"type": "uint64"
}
]
},
{
"name": "configpos",
"base": "",
Expand Down Expand Up @@ -377,9 +447,65 @@
"name": "community_account",
"type": "name"
},
{
"name": "badge_id",
"type": "uint64"
},
{
"name": "issue_type",
"type": "uint8"
},
{
"name": "badge_propose_name",
"type": "name"
},
{
"name": "issue_exec_type",
"type": "uint8"
},
{
"name": "issue_sole_right_accounts",
"type": "name[]"
},
{
"name": "issue_sole_right_pos_ids",
"type": "uint64[]"
},
{
"name": "issue_proposer_right_accounts",
"type": "name[]"
},
{
"name": "issue_proposer_right_pos_ids",
"type": "uint64[]"
},
{
"name": "issue_approval_type",
"type": "uint8"
},
{
"name": "issue_approver_right_accounts",
"type": "name[]"
},
{
"name": "issue_approver_right_pos_ids",
"type": "uint64[]"
},
{
"name": "issue_voter_right_accounts",
"type": "name[]"
},
{
"name": "issue_voter_right_pos_ids",
"type": "uint64[]"
},
{
"name": "issue_pass_rule",
"type": "float64"
},
{
"name": "issue_vote_duration",
"type": "uint64"
}
]
},
Expand Down Expand Up @@ -1059,6 +1185,11 @@
"type": "approvepos",
"ricardian_contract": ""
},
{
"name": "configbadge",
"type": "configbadge",
"ricardian_contract": ""
},
{
"name": "configpos",
"type": "configpos",
Expand Down
Binary file modified community/community.wasm
Binary file not shown.
43 changes: 42 additions & 1 deletion community/include/community.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ CONTRACT community : public contract
BADGE,
};

enum BadgeIssueType {
WITHOUT_CLAIM = 0,
CLAIM_APPROVE_BY_ISSUER,
};

struct permission_level_weight {
permission_level permission;
uint16_t weight;
Expand Down Expand Up @@ -193,7 +198,43 @@ CONTRACT community : public contract

ACTION dismisspos(name community_account, uint64_t pos_id, name holder, const string& dismissal_reason);

ACTION createbadge(name community_account, name badge_propose_name);
ACTION createbadge(
name community_account,
uint64_t badge_id,
uint8_t issue_type,
name badge_propose_name,
uint8_t issue_exec_type,
vector<name> issue_sole_right_accounts,
vector<uint64_t> issue_sole_right_pos_ids,
vector<name> issue_proposer_right_accounts,
vector<uint64_t> issue_proposer_right_pos_ids,
uint8_t issue_approval_type,
vector<name> issue_approver_right_accounts,
vector<uint64_t> issue_approver_right_pos_ids,
vector<name> issue_voter_right_accounts,
vector<uint64_t> issue_voter_right_pos_ids,
double issue_pass_rule,
uint64_t issue_vote_duration
);

ACTION configbadge(
name community_account,
uint64_t badge_id,
uint8_t issue_type,
name update_badge_proposal_name,
uint8_t issue_exec_type,
vector<name> issue_sole_right_accounts,
vector<uint64_t> issue_sole_right_pos_ids,
vector<name> issue_proposer_right_accounts,
vector<uint64_t> issue_proposer_right_pos_ids,
uint8_t issue_approval_type,
vector<name> issue_approver_right_accounts,
vector<uint64_t> issue_approver_right_pos_ids,
vector<name> issue_voter_right_accounts,
vector<uint64_t> issue_voter_right_pos_ids,
double issue_pass_rule,
uint64_t issue_vote_duration
);

ACTION issuebadge(name community_account, name badge_propose_name);

Expand Down
Loading

0 comments on commit c3401b9

Please sign in to comment.