EOS 智能合约源代码解读 (13)system合约“native类的关键方法”
Posted thefist11
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了EOS 智能合约源代码解读 (13)system合约“native类的关键方法”相关的知识,希望对你有一定的参考价值。
1. native.hpp
class [[eossys::contract("eossys.system")]] native : public eossys::contract {
public:
/**
* 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.
*
* 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.
*/
[[eossys::action]]
void newaccount( const text_name& creator,
const text_name& name,
ignore<authority> owner,
ignore<authority> active);
[[eossys::action]]
void eosupdate( ignore<text_name> account,
ignore<name> permission,
ignore<name> parent,
ignore<authority> auth ) {}
[[eossys::action]]
void eosdelete( ignore<text_name> account,
ignore<name> permission ) {}
1.1 system newaccount
该action在创建新帐户后调用,此代码强制实施新帐户的资源限制规则以及新帐户命名约定。规则包含两个:
- 帐户不能包含’.’ 强制所有帐户的符号长度为12个字符而没有“.” 直到实施未来的帐户拍卖流程。
- 新帐户必须包含最少数量的token(如系统参数中所设置),因此,此方法将为新用户执行内联buyram购买内存,其金额等于当前新帐户的创建费用。
1.2 其他[[eosio::action]]
动作 | 返回值 | 参数 | 解释 |
---|---|---|---|
updateauth | void | ignore account ignore permission ignore parent ignore auth | 更新账户的某项权限内容 |
deleteauth | void | ignore account ignore permission | 删除账户的某项权限内容 |
linkauth | void | ignore account ignore code ignore type ignore requirement | 连接其他账户 |
unlinkauth | void | ignore account ignore code ignore type | 解除某账户的连接 |
canceldelay | void | ignore<permission_level> canceling_auth ignore<capi_checksum256> trx_id | 取消某个延迟交易 |
onerror | void | ignore<uint128_t> sender_id ignorestd::vector sent_trx | 处理错误 |
setabi | void | name account const std::vector& abi | 设置账户的abi内容 |
setcode | void | name account uint8_t vmtype uint8_t vmversion const std::vector& code | 设置账户的code内容 |
以上是关于EOS 智能合约源代码解读 (13)system合约“native类的关键方法”的主要内容,如果未能解决你的问题,请参考以下文章