COOPENOMICS  v1
Кооперативная Экономика
native.hpp
См. документацию.
1#pragma once
2
3#include <eosio/action.hpp>
4#include <eosio/binary_extension.hpp>
5#include <eosio/contract.hpp>
6#include <eosio/crypto.hpp>
7#include <eosio/fixed_bytes.hpp>
8#include <eosio/ignore.hpp>
9#include <eosio/print.hpp>
10#include <eosio/privileged.hpp>
11#include <eosio/producer_schedule.hpp>
12
13namespace eosiosystem {
14
15 using eosio::binary_extension;
16 using eosio::checksum256;
17 using eosio::ignore;
18 using eosio::name;
20 using eosio::public_key;
21
30 uint16_t weight;
31
32 // explicit serialization macro is not necessary, used here only to improve compilation time
33 EOSLIB_SERIALIZE( permission_level_weight, (permission)(weight) )
34 };
35
41 struct key_weight {
42 eosio::public_key key;
43 uint16_t weight;
44
45 // explicit serialization macro is not necessary, used here only to improve compilation time
46 EOSLIB_SERIALIZE( key_weight, (key)(weight) )
47 };
48
54 struct wait_weight {
55 uint32_t wait_sec;
56 uint16_t weight;
57
58 // explicit serialization macro is not necessary, used here only to improve compilation time
59 EOSLIB_SERIALIZE( wait_weight, (wait_sec)(weight) )
60 };
61
71 struct authority {
72 uint32_t threshold = 0;
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 EOSLIB_SERIALIZE( authority, (threshold)(keys)(accounts)(waits) )
79 };
80
94 struct block_header {
95 uint32_t timestamp;
97 uint16_t confirmed = 0;
98 checksum256 previous;
99 checksum256 transaction_mroot;
100 checksum256 action_mroot;
101 uint32_t schedule_version = 0;
102 std::optional<eosio::producer_schedule> new_producers;
103
104 // explicit serialization macro is not necessary, used here only to improve compilation time
107 };
108
114 struct [[eosio::table("abihash"), eosio::contract("eosio.system")]] abi_hash {
115 name owner;
116 checksum256 hash;
117 uint64_t primary_key()const { return owner.value; }
118
119 EOSLIB_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 [[eosio::contract("eosio.system")]] native : public eosio::contract {
129 public:
130
132
145 [[eosio::action]]
146 void newaccount( const name& creator,
147 const name& name,
148 ignore<authority> owner,
149 ignore<authority> active);
150
171 [[eosio::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 [[eosio::action]]
199 void deleteauth( name account,
200 name permission,
201 binary_extension<name> authorized_by ) {
202 check_auth_change(get_self(), account, authorized_by);
203 }
204
232 [[eosio::action]]
233 void linkauth( name account,
234 name code,
235 name type,
236 name requirement,
237 binary_extension<name> authorized_by ) {
238 check_auth_change(get_self(), account, authorized_by);
239 }
240
260 [[eosio::action]]
261 void unlinkauth( name account,
262 name code,
263 name type,
264 binary_extension<name> authorized_by ) {
265 check_auth_change(get_self(), account, authorized_by);
266 }
267
274 [[eosio::action]]
275 void canceldelay( ignore<permission_level> canceling_auth, ignore<checksum256> trx_id ) {}
276
285 [[eosio::action]]
286 void onerror( ignore<uint128_t> sender_id, ignore<std::vector<char>> sent_trx );
287
295 [[eosio::action]]
296 void setabi( const name& account, const std::vector<char>& abi, const binary_extension<std::string>& memo );
297
298 using newaccount_action = eosio::action_wrapper<"newaccount"_n, &native::newaccount>;
299 using updateauth_action = eosio::action_wrapper<"updateauth"_n, &native::updateauth>;
300 using deleteauth_action = eosio::action_wrapper<"deleteauth"_n, &native::deleteauth>;
301 using linkauth_action = eosio::action_wrapper<"linkauth"_n, &native::linkauth>;
302 using unlinkauth_action = eosio::action_wrapper<"unlinkauth"_n, &native::unlinkauth>;
303 using canceldelay_action = eosio::action_wrapper<"canceldelay"_n, &native::canceldelay>;
304 using setabi_action = eosio::action_wrapper<"setabi"_n, &native::setabi>;
305 };
306}
Definition: native.hpp:128
eosio::action_wrapper<"updateauth"_n, &native::updateauth > updateauth_action
Definition: native.hpp:299
void updateauth(name account, name permission, name parent, authority auth, binary_extension< name > authorized_by)
Definition: native.hpp:172
void linkauth(name account, name code, name type, name requirement, binary_extension< name > authorized_by)
Definition: native.hpp:233
void deleteauth(name account, name permission, binary_extension< name > authorized_by)
Definition: native.hpp:199
eosio::action_wrapper<"setabi"_n, &native::setabi > setabi_action
Definition: native.hpp:304
eosio::action_wrapper<"linkauth"_n, &native::linkauth > linkauth_action
Definition: native.hpp:301
void unlinkauth(name account, name code, name type, binary_extension< name > authorized_by)
Definition: native.hpp:261
eosio::action_wrapper<"canceldelay"_n, &native::canceldelay > canceldelay_action
Definition: native.hpp:303
eosio::action_wrapper<"newaccount"_n, &native::newaccount > newaccount_action
Definition: native.hpp:298
eosio::action_wrapper<"deleteauth"_n, &native::deleteauth > deleteauth_action
Definition: native.hpp:300
void newaccount(const name &creator, const name &name, ignore< authority > owner, ignore< authority > active)
Definition: eosio.system.cpp:565
eosio::action_wrapper<"unlinkauth"_n, &native::unlinkauth > unlinkauth_action
Definition: native.hpp:302
void canceldelay(ignore< permission_level > canceling_auth, ignore< checksum256 > trx_id)
Definition: native.hpp:275
void setabi(const name &account, const std::vector< char > &abi, const binary_extension< std::string > &memo)
Definition: eosio.system.cpp:626
const auto active
Definition: eosio.limitauth_tests.cpp:17
const auto owner
Definition: eosio.limitauth_tests.cpp:16
contract
Definition: eosio.msig_tests.cpp:977
permission_level
Definition: eosio.msig_tests.cpp:896
Definition: eosio.msig.hpp:34
Definition: rammarket.hpp:7
void check_auth_change(name contract, name account, const binary_extension< name > &authorized_by)
Definition: limit_auth_changes.cpp:51
action(permission_level{ _gateway, "active"_n}, _gateway, "adduser"_n, std::make_tuple(coopname, deposit->username, to_spread, to_circulation, eosio::current_time_point(), true)).send()
Структура, представляющая учетные записи аккаунтов.
Definition: accounts.hpp:60
Definition: native.hpp:114
name owner
Definition: native.hpp:115
checksum256 hash
Definition: native.hpp:116
uint64_t primary_key() const
Definition: native.hpp:117
Definition: native.hpp:71
std::vector< wait_weight > waits
Definition: native.hpp:75
uint32_t threshold
Definition: native.hpp:72
std::vector< key_weight > keys
Definition: native.hpp:73
std::vector< permission_level_weight > accounts
Definition: native.hpp:74
Definition: native.hpp:94
std::optional< eosio::producer_schedule > new_producers
Definition: native.hpp:102
uint16_t confirmed
Definition: native.hpp:97
uint32_t schedule_version
Definition: native.hpp:101
checksum256 action_mroot
Definition: native.hpp:100
checksum256 previous
Definition: native.hpp:98
uint32_t timestamp
Definition: native.hpp:95
name producer
Definition: native.hpp:96
checksum256 transaction_mroot
Definition: native.hpp:99
Definition: native.hpp:41
uint16_t weight
Definition: native.hpp:43
eosio::public_key key
Definition: native.hpp:42
Definition: native.hpp:28
uint16_t weight
Definition: native.hpp:30
permission_level permission
Definition: native.hpp:29
Definition: native.hpp:54
uint16_t weight
Definition: native.hpp:56
uint32_t wait_sec
Definition: native.hpp:55