This repository has been archived by the owner on Aug 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 417
/
eosio.bios.cpp
57 lines (46 loc) · 1.69 KB
/
eosio.bios.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <eosio.bios/eosio.bios.hpp>
namespace eosiobios {
void bios::setabi( name account, const std::vector<char>& abi ) {
abi_hash_table table(get_self(), get_self().value);
auto itr = table.find( account.value );
if( itr == table.end() ) {
table.emplace( account, [&]( auto& row ) {
row.owner = account;
row.hash = eosio::sha256(const_cast<char*>(abi.data()), abi.size());
});
} else {
table.modify( itr, eosio::same_payer, [&]( auto& row ) {
row.hash = eosio::sha256(const_cast<char*>(abi.data()), abi.size());
});
}
}
void bios::onerror( ignore<uint128_t>, ignore<std::vector<char>> ) {
check( false, "the onerror action cannot be called directly" );
}
void bios::setpriv( name account, uint8_t is_priv ) {
require_auth( get_self() );
set_privileged( account, is_priv );
}
void bios::setalimits( name account, int64_t ram_bytes, int64_t net_weight, int64_t cpu_weight ) {
require_auth( get_self() );
set_resource_limits( account, ram_bytes, net_weight, cpu_weight );
}
void bios::setprods( const std::vector<eosio::producer_authority>& schedule ) {
require_auth( get_self() );
set_proposed_producers( schedule );
}
void bios::setparams( const eosio::blockchain_parameters& params ) {
require_auth( get_self() );
set_blockchain_parameters( params );
}
void bios::reqauth( name from ) {
require_auth( from );
}
void bios::activate( const eosio::checksum256& feature_digest ) {
require_auth( get_self() );
preactivate_feature( feature_digest );
}
void bios::reqactivated( const eosio::checksum256& feature_digest ) {
check( is_feature_activated( feature_digest ), "protocol feature is not activated" );
}
}