Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysiosystem::native Class Reference

#include <native.hpp>

Inheritance diagram for sysiosystem::native:
Collaboration diagram for sysiosystem::native:

Public Types

using newaccount_action = sysio::action_wrapper<"newaccount"_n, &native::newaccount>
 
using updateauth_action = sysio::action_wrapper<"updateauth"_n, &native::updateauth>
 
using deleteauth_action = sysio::action_wrapper<"deleteauth"_n, &native::deleteauth>
 
using linkauth_action = sysio::action_wrapper<"linkauth"_n, &native::linkauth>
 
using unlinkauth_action = sysio::action_wrapper<"unlinkauth"_n, &native::unlinkauth>
 
using canceldelay_action = sysio::action_wrapper<"canceldelay"_n, &native::canceldelay>
 
using setcode_action = sysio::action_wrapper<"setcode"_n, &native::setcode>
 
using setabi_action = sysio::action_wrapper<"setabi"_n, &native::setabi>
 

Public Member Functions

void newaccount (const name &creator, const name &name, ignore< authority > owner, ignore< authority > active)
 
void updateauth (name account, name permission, name parent, authority auth, binary_extension< name > authorized_by)
 
void deleteauth (name account, name permission, binary_extension< name > authorized_by)
 
void linkauth (name account, name code, name type, name requirement, binary_extension< name > authorized_by)
 
void unlinkauth (name account, name code, name type, binary_extension< name > authorized_by)
 
void canceldelay (ignore< permission_level > canceling_auth, ignore< checksum256 > trx_id)
 
void onerror (ignore< uint128_t > sender_id, ignore< std::vector< char > > sent_trx)
 
void setabi (const name &account, const std::vector< char > &abi, const binary_extension< std::string > &memo)
 
void setcode (const name &account, uint8_t vmtype, uint8_t vmversion, const std::vector< char > &code, const binary_extension< std::string > &memo)
 

Detailed Description

The EOSIO core native contract that governs authorization and contracts' abi.

Definition at line 128 of file native.hpp.

Member Typedef Documentation

◆ canceldelay_action

using sysiosystem::native::canceldelay_action = sysio::action_wrapper<"canceldelay"_n, &native::canceldelay>

Definition at line 318 of file native.hpp.

◆ deleteauth_action

using sysiosystem::native::deleteauth_action = sysio::action_wrapper<"deleteauth"_n, &native::deleteauth>

Definition at line 315 of file native.hpp.

◆ linkauth_action

using sysiosystem::native::linkauth_action = sysio::action_wrapper<"linkauth"_n, &native::linkauth>

Definition at line 316 of file native.hpp.

◆ newaccount_action

using sysiosystem::native::newaccount_action = sysio::action_wrapper<"newaccount"_n, &native::newaccount>

Definition at line 313 of file native.hpp.

◆ setabi_action

using sysiosystem::native::setabi_action = sysio::action_wrapper<"setabi"_n, &native::setabi>

Definition at line 320 of file native.hpp.

◆ setcode_action

using sysiosystem::native::setcode_action = sysio::action_wrapper<"setcode"_n, &native::setcode>

Definition at line 319 of file native.hpp.

◆ unlinkauth_action

using sysiosystem::native::unlinkauth_action = sysio::action_wrapper<"unlinkauth"_n, &native::unlinkauth>

Definition at line 317 of file native.hpp.

◆ updateauth_action

using sysiosystem::native::updateauth_action = sysio::action_wrapper<"updateauth"_n, &native::updateauth>

Definition at line 314 of file native.hpp.

Member Function Documentation

◆ canceldelay()

void sysiosystem::native::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 277 of file native.hpp.

277{}

◆ deleteauth()

void sysiosystem::native::deleteauth ( name account,
name permission,
binary_extension< name > authorized_by )
inline

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

This contract enforces additional rules:

  1. If authorized_by is present and not "", then the contract does a require_auth2(account, authorized_by).
  2. If the account has opted into limitauthchg, then authorized_by must be present and not "".
  3. If the account has opted into limitauthchg, and allow_perms is not empty, then authorized_by must be in the array.
  4. If the account has opted into limitauthchg, and disallow_perms is not empty, then authorized_by must not be in the array.
Parameters
account- the account for which the permission authorization is deleted,
permission- the permission name been deleted.
authorized_by- the permission which is authorizing this change

Definition at line 199 of file native.hpp.

201 {
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 }
std::string name
void check_auth_change(name contract, name account, const binary_extension< name > &authorized_by)
Here is the call graph for this function:

◆ linkauth()

void sysiosystem::native::linkauth ( name account,
name code,
name type,
name requirement,
binary_extension< name > authorized_by )
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 authorization 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.

This contract enforces additional rules:

  1. If authorized_by is present and not "", then the contract does a require_auth2(account, authorized_by).
  2. If the account has opted into limitauthchg, then authorized_by must be present and not "".
  3. If the account has opted into limitauthchg, and allow_perms is not empty, then authorized_by must be in the array.
  4. If the account has opted into limitauthchg, and disallow_perms is not empty, then authorized_by must not be in the array.
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.
authorized_by- the permission which is authorizing this change

Definition at line 235 of file native.hpp.

239 {
240 check_auth_change(get_self(), account, authorized_by);
241 }
Here is the call graph for this function:

◆ newaccount()

void sysiosystem::native::newaccount ( const name & creator,
const name & new_account_name,
ignore< authority > owner,
ignore< authority > active )

These actions map one-on-one with the ones defined in core layer of EOSIO, that's where their implementation actually is done. They are present here only so they can show up in the abi file and thus user can send them to this contract, but they have no specific implementation at this contract level, they will execute the implementation at the core layer and nothing else. New account action is called after a new account is created. This code enforces resource-limits rules for new accounts as well as new account naming conventions.

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

Account names containing '.' symbols must have a suffix equal to the name of the creator. This allows users who buy a premium name (shorter than 12 characters with no dots) to be the only ones who can create accounts with the creator's name as a suffix.

Definition at line 435 of file sysio.system.cpp.

438 {
439
440 if( creator != get_self() ) {
441 uint64_t tmp = new_account_name.value >> 4;
442 bool has_dot = false;
443
444 for( uint32_t i = 0; i < 12; ++i ) {
445 has_dot |= !(tmp & 0x1f);
446 tmp >>= 5;
447 }
448 if( has_dot ) { // or is less than 12 characters
449 auto suffix = new_account_name.suffix();
450 if( suffix == new_account_name ) {
451 name_bid_table bids(get_self(), get_self().value);
452 auto current = bids.find( new_account_name.value );
453 check( current != bids.end(), "no active bid for name" );
454 check( current->high_bidder == creator, "only highest bidder can claim" );
455 check( current->high_bid < 0, "auction for name is not closed yet" );
456 bids.erase( current );
457 } else {
458 check( creator == suffix, "only suffix may create this account" );
459 }
460 }
461 }
462
463 user_resources_table userres( get_self(), new_account_name.value );
464
465 userres.emplace( new_account_name, [&]( auto& res ) {
466 res.owner = new_account_name;
467 res.net_weight = asset( 0, system_contract::get_core_symbol() );
468 res.cpu_weight = asset( 0, system_contract::get_core_symbol() );
469 });
470
471 set_resource_limits( new_account_name, 0, 0, 0 );
472 }
static symbol get_core_symbol(name system_account="sysio"_n)
sysio::multi_index< "namebids"_n, name_bid, indexed_by<"highbid"_n, const_mem_fun< name_bid, uint64_t, &name_bid::by_high_bid > > > name_bid_table
sysio::multi_index< "userres"_n, user_resources > user_resources_table
#define value
Definition pkcs11.h:157
unsigned int uint32_t
Definition stdint.h:126
unsigned __int64 uint64_t
Definition stdint.h:136
Here is the call graph for this function:

◆ onerror()

void sysiosystem::native::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 7 of file native.cpp.

7 {
8 sysio::check( false, "the onerror action cannot be called directly" );
9 }

◆ setabi()

void sysiosystem::native::setabi ( const name & account,
const std::vector< char > & abi,
const binary_extension< std::string > & memo )

Set abi action sets the contract abi for an account.

Parameters
account- the account for which to set the contract abi.
abi- the abi content to be set, in the form of a blob binary.
memo- may be omitted

Definition at line 474 of file sysio.system.cpp.

475 {
476 sysio::multi_index< "abihash"_n, abi_hash > table(get_self(), get_self().value);
477 auto itr = table.find( acnt.value );
478 if( itr == table.end() ) {
479 table.emplace( acnt, [&]( auto& row ) {
480 row.owner = acnt;
481 row.hash = sysio::sha256(const_cast<char*>(abi.data()), abi.size());
482 });
483 } else {
484 table.modify( itr, same_payer, [&]( auto& row ) {
485 row.hash = sysio::sha256(const_cast<char*>(abi.data()), abi.size());
486 });
487 }
488 }

◆ setcode()

void sysiosystem::native::setcode ( const name & account,
uint8_t vmtype,
uint8_t vmversion,
const std::vector< char > & code,
const binary_extension< std::string > & memo )
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..
memo- may be omitted

Definition at line 310 of file native.hpp.

311 {}

◆ unlinkauth()

void sysiosystem::native::unlinkauth ( name account,
name code,
name type,
binary_extension< name > authorized_by )
inline

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

This contract enforces additional rules:

  1. If authorized_by is present and not "", then the contract does a require_auth2(account, authorized_by).
  2. If the account has opted into limitauthchg, then authorized_by must be present and not "".
  3. If the account has opted into limitauthchg, and allow_perms is not empty, then authorized_by must be in the array.
  4. If the account has opted into limitauthchg, and disallow_perms is not empty, then authorized_by must not be in the array.
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.
authorized_by- the permission which is authorizing this change

Definition at line 263 of file native.hpp.

266 {
267 check_auth_change(get_self(), account, authorized_by);
268 }
Here is the call graph for this function:

◆ updateauth()

void sysiosystem::native::updateauth ( name account,
name permission,
name parent,
authority auth,
binary_extension< name > authorized_by )
inline

Update authorization action updates permission for an account.

This contract enforces additional rules:

  1. If authorized_by is present and not "", then the contract does a require_auth2(account, authorized_by).
  2. If the account has opted into limitauthchg, then authorized_by must be present and not "".
  3. If the account has opted into limitauthchg, and allow_perms is not empty, then authorized_by must be in the array.
  4. If the account has opted into limitauthchg, and disallow_perms is not empty, then authorized_by must not be in the array.
Parameters
account- the account for which the permission is updated
permission- the permission name which is updated
parent- the parent of the permission which is updated
auth- the json describing the permission authorization
authorized_by- the permission which is authorizing this change

Definition at line 172 of file native.hpp.

176 {
177 check_auth_change(get_self(), account, authorized_by);
178 }
Here is the call graph for this function:

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