Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
native.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <sysio/action.hpp>
4#include <sysio/binary_extension.hpp>
5#include <sysio/contract.hpp>
6#include <sysio/crypto.hpp>
7#include <sysio/fixed_bytes.hpp>
8#include <sysio/ignore.hpp>
9#include <sysio/print.hpp>
10#include <sysio/privileged.hpp>
11#include <sysio/producer_schedule.hpp>
12
13namespace sysiosystem {
14
15 using sysio::binary_extension;
16 using sysio::checksum256;
17 using sysio::ignore;
18 using sysio::name;
21
31
32 // explicit serialization macro is not necessary, used here only to improve compilation time
33 SYSLIB_SERIALIZE( permission_level_weight, (permission)(weight) )
34 };
35
41 struct key_weight {
44
45 // explicit serialization macro is not necessary, used here only to improve compilation time
46 SYSLIB_SERIALIZE( key_weight, (key)(weight) )
47 };
48
54 struct wait_weight {
57
58 // explicit serialization macro is not necessary, used here only to improve compilation time
59 SYSLIB_SERIALIZE( wait_weight, (wait_sec)(weight) )
60 };
61
71 struct authority {
73 std::vector<key_weight> keys;
74 std::vector<permission_level_weight> accounts;
75 std::vector<wait_weight> waits;
76
77 // explicit serialization macro is not necessary, used here only to improve compilation time
78 SYSLIB_SERIALIZE( authority, (threshold)(keys)(accounts)(waits) )
79 };
80
94 struct block_header {
98 checksum256 previous;
99 checksum256 transaction_mroot;
100 checksum256 action_mroot;
102 std::optional<sysio::producer_schedule> new_producers;
103
104 // explicit serialization macro is not necessary, used here only to improve compilation time
107 };
108
114 struct [[sysio::table("abihash"), sysio::contract("sysio.system")]] abi_hash {
116 checksum256 hash;
117 uint64_t primary_key()const { return owner.value; }
118
119 SYSLIB_SERIALIZE( abi_hash, (owner)(hash) )
120 };
121
122 void check_auth_change(name contract, name account, const binary_extension<name>& authorized_by);
123
124 // Method parameters commented out to prevent generation of code that parses input data.
128 class [[sysio::contract("sysio.system")]] native : public sysio::contract {
129 public:
130
131 using sysio::contract::contract;
132
145 [[sysio::action]]
146 void newaccount( const name& creator,
147 const name& name,
148 ignore<authority> owner,
149 ignore<authority> active);
150
171 [[sysio::action]]
172 void updateauth( name account,
173 name permission,
174 name parent,
175 authority auth,
176 binary_extension<name> authorized_by ) {
177 check_auth_change(get_self(), account, authorized_by);
178 }
179
198 [[sysio::action]]
199 void deleteauth( name account,
200 name permission,
201 binary_extension<name> authorized_by ) {
202
203 if (permission == name("auth.ext")) require_recipient(name("auth.msg")); // Sig EM auth.ext catch: only auth.msg can remove auth.ext permission
204 else check_auth_change(get_self(), account, authorized_by);
205 }
206
234 [[sysio::action]]
235 void linkauth( name account,
236 name code,
237 name type,
238 name requirement,
239 binary_extension<name> authorized_by ) {
240 check_auth_change(get_self(), account, authorized_by);
241 }
242
262 [[sysio::action]]
263 void unlinkauth( name account,
264 name code,
265 name type,
266 binary_extension<name> authorized_by ) {
267 check_auth_change(get_self(), account, authorized_by);
268 }
269
276 [[sysio::action]]
277 void canceldelay( ignore<permission_level> canceling_auth, ignore<checksum256> trx_id ) {}
278
287 [[sysio::action]]
288 void onerror( ignore<uint128_t> sender_id, ignore<std::vector<char>> sent_trx );
289
297 [[sysio::action]]
298 void setabi( const name& account, const std::vector<char>& abi, const binary_extension<std::string>& memo );
299
309 [[sysio::action]]
310 void setcode( const name& account, uint8_t vmtype, uint8_t vmversion, const std::vector<char>& code,
311 const binary_extension<std::string>& memo ) {}
312
313 using newaccount_action = sysio::action_wrapper<"newaccount"_n, &native::newaccount>;
314 using updateauth_action = sysio::action_wrapper<"updateauth"_n, &native::updateauth>;
315 using deleteauth_action = sysio::action_wrapper<"deleteauth"_n, &native::deleteauth>;
316 using linkauth_action = sysio::action_wrapper<"linkauth"_n, &native::linkauth>;
317 using unlinkauth_action = sysio::action_wrapper<"unlinkauth"_n, &native::unlinkauth>;
318 using canceldelay_action = sysio::action_wrapper<"canceldelay"_n, &native::canceldelay>;
319 using setcode_action = sysio::action_wrapper<"setcode"_n, &native::setcode>;
320 using setabi_action = sysio::action_wrapper<"setabi"_n, &native::setabi>;
321 };
322}
std::string name
contains only the public point of an elliptic curve key.
void setcode(const name &account, uint8_t vmtype, uint8_t vmversion, const std::vector< char > &code, const binary_extension< std::string > &memo)
Definition native.hpp:310
sysio::action_wrapper<"updateauth"_n, &native::updateauth > updateauth_action
Definition native.hpp:314
sysio::action_wrapper<"canceldelay"_n, &native::canceldelay > canceldelay_action
Definition native.hpp:318
sysio::action_wrapper<"unlinkauth"_n, &native::unlinkauth > unlinkauth_action
Definition native.hpp:317
sysio::action_wrapper<"deleteauth"_n, &native::deleteauth > deleteauth_action
Definition native.hpp:315
void unlinkauth(name account, name code, name type, binary_extension< name > authorized_by)
Definition native.hpp:263
sysio::action_wrapper<"setcode"_n, &native::setcode > setcode_action
Definition native.hpp:319
void linkauth(name account, name code, name type, name requirement, binary_extension< name > authorized_by)
Definition native.hpp:235
sysio::action_wrapper<"setabi"_n, &native::setabi > setabi_action
Definition native.hpp:320
void deleteauth(name account, name permission, binary_extension< name > authorized_by)
Definition native.hpp:199
void canceldelay(ignore< permission_level > canceling_auth, ignore< checksum256 > trx_id)
Definition native.hpp:277
void updateauth(name account, name permission, name parent, authority auth, binary_extension< name > authorized_by)
Definition native.hpp:172
sysio::action_wrapper<"linkauth"_n, &native::linkauth > linkauth_action
Definition native.hpp:316
sysio::action_wrapper<"newaccount"_n, &native::newaccount > newaccount_action
Definition native.hpp:313
void check_auth_change(name contract, name account, const binary_extension< name > &authorized_by)
unsigned short uint16_t
Definition stdint.h:125
unsigned int uint32_t
Definition stdint.h:126
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
uint64_t primary_key() const
Definition native.hpp:117
std::vector< wait_weight > waits
Definition native.hpp:75
std::vector< key_weight > keys
Definition native.hpp:73
std::vector< permission_level_weight > accounts
Definition native.hpp:74
checksum256 transaction_mroot
Definition native.hpp:99
std::optional< sysio::producer_schedule > new_producers
Definition native.hpp:102
sysio::public_key key
Definition native.hpp:42