Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio.msig.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <sysio/binary_extension.hpp>
4#include <sysio/sysio.hpp>
5#include <sysio/ignore.hpp>
6#include <sysio/transaction.hpp>
7
8namespace sysio {
9
19 class [[sysio::contract("sysio.msig")]] multisig : public contract {
20 public:
21 using contract::contract;
22
40 void propose(ignore<name> proposer, ignore<name> proposal_name,
41 ignore<std::vector<permission_level>> requested, ignore<transaction> trx);
55 void approve( name proposer, name proposal_name, permission_level level,
56 const sysio::binary_extension<sysio::checksum256>& proposal_hash );
67 void unapprove( name proposer, name proposal_name, permission_level level );
80 void cancel( name proposer, name proposal_name, name canceler );
99 void exec( name proposer, name proposal_name, name executer );
106 [[sysio::action]]
107 void invalidate( name account );
108
109 using propose_action = sysio::action_wrapper<"propose"_n, &multisig::propose>;
110 using approve_action = sysio::action_wrapper<"approve"_n, &multisig::approve>;
111 using unapprove_action = sysio::action_wrapper<"unapprove"_n, &multisig::unapprove>;
112 using cancel_action = sysio::action_wrapper<"cancel"_n, &multisig::cancel>;
113 using exec_action = sysio::action_wrapper<"exec"_n, &multisig::exec>;
114 using invalidate_action = sysio::action_wrapper<"invalidate"_n, &multisig::invalidate>;
115
116 private:
117 struct [[sysio::table]] proposal {
118 name proposal_name;
119 std::vector<char> packed_transaction;
120
121 uint64_t primary_key()const { return proposal_name.value; }
122 };
123
124 typedef sysio::multi_index< "proposal"_n, proposal > proposals;
125
126 struct [[sysio::table]] old_approvals_info {
127 name proposal_name;
128 std::vector<permission_level> requested_approvals;
129 std::vector<permission_level> provided_approvals;
130
131 uint64_t primary_key()const { return proposal_name.value; }
132 };
133 typedef sysio::multi_index< "approvals"_n, old_approvals_info > old_approvals;
134
135 struct approval {
136 permission_level level;
137 time_point time;
138 };
139
140 struct [[sysio::table]] approvals_info {
141 uint8_t version = 1;
142 name proposal_name;
143 //requested approval doesn't need to cointain time, but we want requested approval
144 //to be of exact the same size ad provided approval, in this case approve/unapprove
145 //doesn't change serialized data size. So, we use the same type.
146 std::vector<approval> requested_approvals;
147 std::vector<approval> provided_approvals;
148
149 uint64_t primary_key()const { return proposal_name.value; }
150 };
151 typedef sysio::multi_index< "approvals2"_n, approvals_info > approvals;
152
153 struct [[sysio::table]] invalidation {
154 name account;
155 time_point last_invalidation_time;
156
157 uint64_t primary_key() const { return account.value; }
158 };
159
160 typedef sysio::multi_index< "invals"_n, invalidation > invalidations;
161 };
162}
std::string name
sysio::action_wrapper<"exec"_n, &multisig::exec > exec_action
sysio::action_wrapper<"unapprove"_n, &multisig::unapprove > unapprove_action
sysio::action_wrapper<"invalidate"_n, &multisig::invalidate > invalidate_action
sysio::action_wrapper<"cancel"_n, &multisig::cancel > cancel_action
sysio::action_wrapper<"propose"_n, &multisig::propose > propose_action
sysio::action_wrapper<"approve"_n, &multisig::approve > approve_action
uint32_t level
Type of a channel package.
Definition levels.hpp:37
unsigned char uint8_t
Definition stdint.h:124
unsigned __int64 uint64_t
Definition stdint.h:136
Immutable except for fc::from_variant.
Definition name.hpp:43