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/#10 add issue badge and config badge code when create badge #11

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
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