js Date 传参给合约 eosio::time_point

合约

void xxx_contract::updatetime(eosio::time_point timestamp){
    require_auth( _self.value );
    system_tables system_table(_self, _self.value);
    auto itr = system_table.begin();
    if(itr == system_table.end()){
        system_table.emplace( _self, [&]( auto& s ) {
            s.id = system_table.available_primary_key();
            s.zero_time = timestamp;
        });
    }else{
        system_table.modify( itr, _self, [&]( auto& s ) {
            s.zero_time = timestamp;
        });
    }
}

Js

push action 参数为 new Date().getTime() * 1000

版权属于:Surou

本文链接:https://www.bcskill.com/index.php/archives/524.html

相关技术文章仅限于相关区块链底层技术研究,禁止用于非法用途,后果自负!本站严格遵守一切相关法律政策!

评论