1

eos/chain/apply_context.cpp 66 line

i had been found the something where account_name newly was created like eosio.token, eosio.rex....

So, i found some hint

controller.cpp // 321 Line
#define SET_APP_HANDLER( receiver, contract, action) \
set_apply_handler( #receiver, #contract, #action, &BOOST_PP_CAT(apply_, BOOST_PP_CAT(contract, BOOST_PP_CAT(_,action) ) ) )

first, the set_apply_handler set the handler. and when i create a account, account data must go throuh the following code

     auto native = control.find_apply_handler( receiver, act->account, act->name );
     if( native ) {
        if( trx_context.enforce_whiteblacklist && control.is_producing_block() ) {
           control.check_contract_list( receiver );
           control.check_action_list( act->account, act->name );
        }
        (*native)( *this );
     }

and the (*native)(*this) code is trigger a function

eosio_contract.cpp // 71 line
void apply_eosio_newaccount(){
    const auto &new_account = db.create<account_object>([&](auto &a) {
        a.name = create.name;
        a.creation_date = context.control.pending_block_time();
});
....
}

but how can use the (*native)(*this) and how operate the code??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.