/** * @file * @copyright defined in eos/LICENSE.txt */ #include #include #include #include #include #include #include #include namespace eosiosystem { template class contract { public: static const account_name system_account = N(eosio.system); typedef eosio::generic_currency< eosio::token > currency; struct total_bandwidth { account_name owner; typename currency::token_type total_net_weight; typename currency::token_type total_cpu_weight; }; typedef eosio::table64 total_bandwidth; struct delegated_bandwidth { account_name from; account_name to; typename currency::token_type net_weight; typename currency::token_type cpu_weight; uint32_t start_pending_net_withdraw = 0; typename currency::token_type pending_net_withdraw; uint64_t deferred_net_withdraw_handler = 0; uint32_t start_pending_cpu_withdraw = 0; typename currency::token_type pending_cpu_withdraw; uint64_t deferred_cpu_withdraw_handler = 0; }; ACTION( SystemAccount, finshundel ) { account_name from; account_name to; }; ACTION( SystemAccount, regproducer ) { account_name producer_to_register; EOSLIB_SERIALIZE( regproducer, (producer_to_register) ); }; ACTION( SystemAccount, regproxy ) { account_name proxy_to_register; EOSLIB_SERIALIZE( regproxy, (proxy_to_register) ); }; ACTION( SystemAccount, delnetbw ) { account_name from; account_name receiver; typename currency::token_type stake_quantity; EOSLIB_SERIALIZE( delnetbw, (delegator)(receiver)(stake_quantity) ) }; ACTION( SystemAccount, undelnetbw ) { account_name from; account_name receiver; typename currency::token_type stake_quantity; EOSLIB_SERIALIZE( delnetbw, (delegator)(receiver)(stake_quantity) ) }; ACTION( SystemAccount, nonce ) { eosio::string value; EOSLIB_SERIALIZE( nonce, (value) ); }; static void on( const delnetbw& del ) { require_auth( del.from ); // require_account( receiver ); currency::inline_transfer( del.from, SystemAccount, del.stake_quantity, "stake bandwidth" ); } static void on( const regproducer& reg ) { require_auth( reg.producer_to_register ); } static void on( const regproxy& reg ) { require_auth( reg.proxy_to_register ); } static void on( const nonce& ) { } static void apply( account_name code, action_name act ) { if( !eosio::dispatch( code, act) ) { if ( !eosio::dispatch( code, act ) ) { eosio::print("Unexpected action: ", act, "\n"); eos_assert( false, "received unexpected action"); } } } /// apply }; } /// eosiosystem