Skip to content

Commit

Permalink
option for community to verify packed params before execute code (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
quocle108 authored and danielvo11 committed Dec 8, 2020
1 parent dcbfa57 commit 184ff5c
Show file tree
Hide file tree
Showing 4 changed files with 696 additions and 423 deletions.
52 changes: 52 additions & 0 deletions community/community.abi
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,28 @@
}
]
},
{
"name": "setverify",
"base": "",
"fields": [
{
"name": "community_account",
"type": "name"
},
{
"name": "code_id",
"type": "uint64"
},
{
"name": "is_verify_com_account",
"type": "bool"
},
{
"name": "is_verify_code_id",
"type": "bool"
}
]
},
{
"name": "setvoter",
"base": "",
Expand Down Expand Up @@ -883,6 +905,24 @@
}
]
},
{
"name": "v1_code_verify",
"base": "",
"fields": [
{
"name": "code_id",
"type": "uint64"
},
{
"name": "verify_com_account",
"type": "bool"
},
{
"name": "verify_code_id",
"type": "bool"
}
]
},
{
"name": "v1_collective_decision",
"base": "",
Expand Down Expand Up @@ -1314,6 +1354,11 @@
"type": "setsoleexec",
"ricardian_contract": ""
},
{
"name": "setverify",
"type": "setverify",
"ricardian_contract": ""
},
{
"name": "setvoter",
"type": "setvoter",
Expand Down Expand Up @@ -1411,6 +1456,13 @@
"key_names": [],
"key_types": []
},
{
"name": "v1.codevrf",
"type": "v1_code_verify",
"index_type": "i64",
"key_names": [],
"key_types": []
},
{
"name": "v1.community",
"type": "v1_community",
Expand Down
Binary file modified community/community.wasm
Binary file not shown.
17 changes: 17 additions & 0 deletions community/include/community.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ CONTRACT community : public contract
// Code Action
ACTION createcode(name community_account, name code_name, name contract_name, vector<name> code_actions);

// Set Verification for the code before execute it
ACTION setverify(name community_account, uint64_t code_id, bool is_verify_com_account, bool is_verify_code_id);

// Set excution type of code
ACTION setexectype(name community_account, uint64_t code_id, uint8_t exec_type, bool is_amend_code);

Expand Down Expand Up @@ -346,6 +349,20 @@ CONTRACT community : public contract
indexed_by< "by.refer.id"_n, const_mem_fun<v1_code, uint128_t, &v1_code::by_reference_id>>
> v1_code_table;

// table codes with type sole decision with scope is community_creator
TABLE v1_code_verify
{
uint64_t code_id;
bool verify_com_account = true;
bool verify_code_id = true;

uint64_t primary_key() const { return code_id; }

EOSLIB_SERIALIZE( v1_code_verify, (code_id)(verify_com_account)(verify_code_id));
};

typedef eosio::multi_index<"v1.codevrf"_n, v1_code_verify> v1_code_verify_table;

// table code collective rule with scope is community_creator
TABLE v1_collective_decision
{
Expand Down
Loading

0 comments on commit 184ff5c

Please sign in to comment.