Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysiobios::bios Class Reference

#include <sysio.bios.hpp>

Inheritance diagram for sysiobios::bios:
Collaboration diagram for sysiobios::bios:

Classes

struct  abi_hash
 

Public Types

typedef sysio::multi_index< "abihash"_n, abi_hashabi_hash_table
 
using newaccount_action = action_wrapper<"newaccount"_n, &bios::newaccount>
 
using updateauth_action = action_wrapper<"updateauth"_n, &bios::updateauth>
 
using deleteauth_action = action_wrapper<"deleteauth"_n, &bios::deleteauth>
 
using linkauth_action = action_wrapper<"linkauth"_n, &bios::linkauth>
 
using unlinkauth_action = action_wrapper<"unlinkauth"_n, &bios::unlinkauth>
 
using canceldelay_action = action_wrapper<"canceldelay"_n, &bios::canceldelay>
 
using setcode_action = action_wrapper<"setcode"_n, &bios::setcode>
 
using setabi_action = action_wrapper<"setabi"_n, &bios::setabi>
 
using setpriv_action = action_wrapper<"setpriv"_n, &bios::setpriv>
 
using setalimits_action = action_wrapper<"setalimits"_n, &bios::setalimits>
 
using setprods_action = action_wrapper<"setprods"_n, &bios::setprods>
 
using setparams_action = action_wrapper<"setparams"_n, &bios::setparams>
 
using reqauth_action = action_wrapper<"reqauth"_n, &bios::reqauth>
 
using activate_action = action_wrapper<"activate"_n, &bios::activate>
 
using reqactivated_action = action_wrapper<"reqactivated"_n, &bios::reqactivated>
 

Public Member Functions

void newaccount (name creator, name name, ignore< authority > owner, ignore< authority > active)
 
void updateauth (ignore< name > account, ignore< name > permission, ignore< name > parent, ignore< authority > auth)
 
void deleteauth (ignore< name > account, ignore< name > permission)
 
void linkauth (ignore< name > account, ignore< name > code, ignore< name > type, ignore< name > requirement)
 
void unlinkauth (ignore< name > account, ignore< name > code, ignore< name > type)
 
void canceldelay (ignore< permission_level > canceling_auth, ignore< checksum256 > trx_id)
 
void setcode (name account, uint8_t vmtype, uint8_t vmversion, const std::vector< char > &code)
 
void setabi (name account, const std::vector< char > &abi)
 
void onerror (ignore< uint128_t > sender_id, ignore< std::vector< char > > sent_trx)
 
void setpriv (name account, uint8_t is_priv)
 
void setalimits (name account, int64_t ram_bytes, int64_t net_weight, int64_t cpu_weight)
 
void setprods (const std::vector< sysio::producer_authority > &schedule)
 
void setparams (const sysio::blockchain_parameters &params)
 
void reqauth (name from)
 
void activate (const sysio::checksum256 &feature_digest)
 
void reqactivated (const sysio::checksum256 &feature_digest)
 

Detailed Description

The sysio.bios is the first sample of system contract provided by block.one through the EOSIO platform. It is a minimalist system contract because it only supplies the actions that are absolutely critical to bootstrap a chain and nothing more. This allows for a chain agnostic approach to bootstrapping a chain.

Just like in the sysio.system sample contract implementation, there are a few actions which are not implemented at the contract level (newaccount, updateauth, deleteauth, linkauth, unlinkauth, canceldelay, onerror, setabi, setcode), they are just declared in the contract so they will show in the contract's ABI and users will be able to push those actions to the chain via the account holding the sysio.system contract, but the implementation is at the EOSIO core level. They are referred to as EOSIO native actions.

Definition at line 74 of file sysio.bios.hpp.

Member Typedef Documentation

◆ abi_hash_table

sysio::multi_index< "abihash"_n, abi_hash > sysiobios::bios::abi_hash_table

Definition at line 264 of file sysio.bios.hpp.

◆ activate_action

using sysiobios::bios::activate_action = action_wrapper<"activate"_n, &bios::activate>

Definition at line 279 of file sysio.bios.hpp.

◆ canceldelay_action

using sysiobios::bios::canceldelay_action = action_wrapper<"canceldelay"_n, &bios::canceldelay>

Definition at line 271 of file sysio.bios.hpp.

◆ deleteauth_action

using sysiobios::bios::deleteauth_action = action_wrapper<"deleteauth"_n, &bios::deleteauth>

Definition at line 268 of file sysio.bios.hpp.

◆ linkauth_action

using sysiobios::bios::linkauth_action = action_wrapper<"linkauth"_n, &bios::linkauth>

Definition at line 269 of file sysio.bios.hpp.

◆ newaccount_action

using sysiobios::bios::newaccount_action = action_wrapper<"newaccount"_n, &bios::newaccount>

Definition at line 266 of file sysio.bios.hpp.

◆ reqactivated_action

using sysiobios::bios::reqactivated_action = action_wrapper<"reqactivated"_n, &bios::reqactivated>

Definition at line 280 of file sysio.bios.hpp.

◆ reqauth_action

using sysiobios::bios::reqauth_action = action_wrapper<"reqauth"_n, &bios::reqauth>

Definition at line 278 of file sysio.bios.hpp.

◆ setabi_action

using sysiobios::bios::setabi_action = action_wrapper<"setabi"_n, &bios::setabi>

Definition at line 273 of file sysio.bios.hpp.

◆ setalimits_action

using sysiobios::bios::setalimits_action = action_wrapper<"setalimits"_n, &bios::setalimits>

Definition at line 275 of file sysio.bios.hpp.

◆ setcode_action

using sysiobios::bios::setcode_action = action_wrapper<"setcode"_n, &bios::setcode>

Definition at line 272 of file sysio.bios.hpp.

◆ setparams_action

using sysiobios::bios::setparams_action = action_wrapper<"setparams"_n, &bios::setparams>

Definition at line 277 of file sysio.bios.hpp.

◆ setpriv_action

using sysiobios::bios::setpriv_action = action_wrapper<"setpriv"_n, &bios::setpriv>

Definition at line 274 of file sysio.bios.hpp.

◆ setprods_action

using sysiobios::bios::setprods_action = action_wrapper<"setprods"_n, &bios::setprods>

Definition at line 276 of file sysio.bios.hpp.

◆ unlinkauth_action

using sysiobios::bios::unlinkauth_action = action_wrapper<"unlinkauth"_n, &bios::unlinkauth>

Definition at line 270 of file sysio.bios.hpp.

◆ updateauth_action

using sysiobios::bios::updateauth_action = action_wrapper<"updateauth"_n, &bios::updateauth>

Definition at line 267 of file sysio.bios.hpp.

Member Function Documentation

◆ activate()

void sysiobios::bios::activate ( const sysio::checksum256 & feature_digest)

Activate action, activates a protocol feature

Parameters
feature_digest- hash of the protocol feature to activate.

Definition at line 48 of file sysio.bios.cpp.

48 {
49 require_auth( get_self() );
50 preactivate_feature( feature_digest );
51}

◆ canceldelay()

void sysiobios::bios::canceldelay ( ignore< permission_level > canceling_auth,
ignore< checksum256 > trx_id )
inline

Cancel delay action cancels a deferred transaction.

Parameters
canceling_auth- the permission that authorizes this action,
trx_id- the deferred transaction id to be cancelled.

Definition at line 158 of file sysio.bios.hpp.

158{}

◆ deleteauth()

void sysiobios::bios::deleteauth ( ignore< name > account,
ignore< name > permission )
inline

Delete authorization action deletes the authorization for an account's permission.

Parameters
account- the account for which the permission authorization is deleted,
permission- the permission name been deleted.

Definition at line 115 of file sysio.bios.hpp.

116 {}

◆ linkauth()

void sysiobios::bios::linkauth ( ignore< name > account,
ignore< name > code,
ignore< name > type,
ignore< name > requirement )
inline

Link authorization action assigns a specific action from a contract to a permission you have created. Five system actions can not be linked updateauth, deleteauth, linkauth, unlinkauth, and canceldelay. This is useful because when doing authorization checks, the EOSIO based blockchain starts with the action needed to be authorized (and the contract belonging to), and looks up which permission is needed to pass authorization validation. If a link is set, that permission is used for authoraization validation otherwise then active is the default, with the exception of sysio.any. sysio.any is an implicit permission which exists on every account; you can link actions to sysio.any and that will make it so linked actions are accessible to any permissions defined for the account.

Parameters
account- the permission's owner to be linked and the payer of the RAM needed to store this link,
code- the owner of the action to be linked,
type- the action to be linked,
requirement- the permission to be linked.

Definition at line 134 of file sysio.bios.hpp.

137 {}

◆ newaccount()

void sysiobios::bios::newaccount ( name creator,
name name,
ignore< authority > owner,
ignore< authority > active )
inline

New account action, called after a new account is created. This code enforces resource-limits rules for new accounts as well as new account naming conventions.

  1. accounts cannot contain '.' symbols which forces all acccounts to be 12 characters long without '.' until a future account auction process is implemented which prevents name squatting.
  2. new accounts must stake a minimal number of tokens (as set in system parameters) therefore, this method will execute an inline buyram from receiver for newacnt in an amount equal to the current new account creation fee.

Definition at line 90 of file sysio.bios.hpp.

93 {}

◆ onerror()

void sysiobios::bios::onerror ( ignore< uint128_t > sender_id,
ignore< std::vector< char > > sent_trx )

On error action, notification of this action is delivered to the sender of a deferred transaction when an objective error occurs while executing the deferred transaction. This action is not meant to be called directly.

Parameters
sender_id- the id for the deferred transaction chosen by the sender,
sent_trx- the deferred transaction that failed.

Definition at line 20 of file sysio.bios.cpp.

20 {
21 check( false, "the onerror action cannot be called directly" );
22}

◆ reqactivated()

void sysiobios::bios::reqactivated ( const sysio::checksum256 & feature_digest)

Require activated action, asserts that a protocol feature has been activated

Parameters
feature_digest- hash of the protocol feature to check for activation.

Definition at line 53 of file sysio.bios.cpp.

53 {
54 check( is_feature_activated( feature_digest ), "protocol feature is not activated" );
55}

◆ reqauth()

void sysiobios::bios::reqauth ( name from)

Require authorization action, checks if the account name from passed in as param has authorization to access current action, that is, if it is listed in the action’s allowed permissions vector.

Parameters
from- the account name to authorize

Definition at line 44 of file sysio.bios.cpp.

44 {
45 require_auth( from );
46}

◆ setabi()

void sysiobios::bios::setabi ( name account,
const std::vector< char > & abi )

Set abi action sets the abi for contract identified by account name. Creates an entry in the abi_hash_table index, with account name as key, if it is not already present and sets its value with the abi hash. Otherwise it is updating the current abi hash value for the existing account key.

Parameters
account- the name of the account to set the abi for
abi- the abi hash represented as a vector of characters

Definition at line 5 of file sysio.bios.cpp.

5 {
6 abi_hash_table table(get_self(), get_self().value);
7 auto itr = table.find( account.value );
8 if( itr == table.end() ) {
9 table.emplace( account, [&]( auto& row ) {
10 row.owner = account;
11 row.hash = sysio::sha256(const_cast<char*>(abi.data()), abi.size());
12 });
13 } else {
14 table.modify( itr, sysio::same_payer, [&]( auto& row ) {
15 row.hash = sysio::sha256(const_cast<char*>(abi.data()), abi.size());
16 });
17 }
18}
sysio::multi_index< "abihash"_n, abi_hash > abi_hash_table
#define value
Definition pkcs11.h:157

◆ setalimits()

void sysiobios::bios::setalimits ( name account,
int64_t ram_bytes,
int64_t net_weight,
int64_t cpu_weight )

Sets the resource limits of an account

Parameters
account- name of the account whose resource limit to be set
ram_bytes- ram limit in absolute bytes
net_weight- fractionally proportionate net limit of available resources based on (weight / total_weight_of_all_accounts)
cpu_weight- fractionally proportionate cpu limit of available resources based on (weight / total_weight_of_all_accounts)

Definition at line 29 of file sysio.bios.cpp.

29 {
30 require_auth( get_self() );
31 set_resource_limits( account, ram_bytes, net_weight, cpu_weight );
32}

◆ setcode()

void sysiobios::bios::setcode ( name account,
uint8_t vmtype,
uint8_t vmversion,
const std::vector< char > & code )
inline

Set code action sets the contract code for an account.

Parameters
account- the account for which to set the contract code.
vmtype- reserved, set it to zero.
vmversion- reserved, set it to zero.
code- the code content to be set, in the form of a blob binary..

Definition at line 169 of file sysio.bios.hpp.

169{}

◆ setparams()

void sysiobios::bios::setparams ( const sysio::blockchain_parameters & params)

Set params action, sets the blockchain parameters. By tuning these parameters, various degrees of customization can be achieved.

Parameters
params- New blockchain parameters to set

Definition at line 39 of file sysio.bios.cpp.

39 {
40 require_auth( get_self() );
41 set_blockchain_parameters( params );
42}
account_query_db::get_accounts_by_authorizers_params params

◆ setpriv()

void sysiobios::bios::setpriv ( name account,
uint8_t is_priv )

Set privilege action allows to set privilege status for an account (turn it on/off).

Parameters
account- the account to set the privileged status for.
is_priv- 0 for false, > 0 for true.

Definition at line 24 of file sysio.bios.cpp.

24 {
25 require_auth( get_self() );
26 set_privileged( account, is_priv );
27}

◆ setprods()

void sysiobios::bios::setprods ( const std::vector< sysio::producer_authority > & schedule)

Set producers action, sets a new list of active producers, by proposing a schedule change, once the block that contains the proposal becomes irreversible, the schedule is promoted to "pending" automatically. Once the block that promotes the schedule is irreversible, the schedule will become "active".

Parameters
schedule- New list of active producers to set

Definition at line 34 of file sysio.bios.cpp.

34 {
35 require_auth( get_self() );
36 set_proposed_producers( schedule );
37}

◆ unlinkauth()

void sysiobios::bios::unlinkauth ( ignore< name > account,
ignore< name > code,
ignore< name > type )
inline

Unlink authorization action it's doing the reverse of linkauth action, by unlinking the given action.

Parameters
account- the owner of the permission to be unlinked and the receiver of the freed RAM,
code- the owner of the action to be unlinked,
type- the action to be unlinked.

Definition at line 147 of file sysio.bios.hpp.

149 {}

◆ updateauth()

void sysiobios::bios::updateauth ( ignore< name > account,
ignore< name > permission,
ignore< name > parent,
ignore< authority > auth )
inline

Update authorization action updates pemission for an account.

Parameters
account- the account for which the permission is updated,
pemission- the permission name which is updated,
parem- the parent of the permission which is updated,
aut- the json describing the permission authorization.

Definition at line 103 of file sysio.bios.hpp.

106 {}

The documentation for this class was generated from the following files: