contracts/arisen.system/src/com.cpp
/**
    * @brief Updates voter COM vote stake to the current value of COM tokens held
    *
    * @param voter - account name of voter
    */
@brief Updates voter COM vote stake to the current value of COM tokens held
@param voter - account name of voter
@brief Updates voter COM vote stake to the current value of COM tokens held @param voter - account name of voter
void system_contract::update_com_stake( const name& voter )
   {
      int64_t delta_stake = 0;
      auto bitr = _combalance.find( voter.value );
      if ( bitr != _combalance.end() && com_available() ) {
         asset init_vote_stake = bitr->vote_stake;
         asset current_vote_stake( 0, core_symbol() );
         current_vote_stake.amount = ( uint128_t(bitr->com_balance.amount) * _compool.begin()->total_lendable.amount )
                                     / _compool.begin()->total_com.amount;
         _combalance.modify( bitr, same_payer, [&]( auto& rb ) {
            rb.vote_stake.amount = current_vote_stake.amount;
         });
         delta_stake = current_vote_stake.amount - init_vote_stake.amount;
      }
      if ( delta_stake != 0 ) {
         auto vitr = _voters.find( voter.value );
         if ( vitr != _voters.end() ) {
            _voters.modify( vitr, same_payer, [&]( auto& vinfo ) {
               vinfo.staked += delta_stake;
            });
         }
      }
   }
void system_contract :: update_com_stake ( const name & voter ) { int64_t delta_stake = 0 ; auto bitr = _combalance . find ( voter . value ) ; if ( bitr != _combalance . end ( ) && com_available ( ) ) { asset init_vote_stake = bitr -> vote_stake ; asset current_vote_stake ( 0 , core_symbol ( ) ) ; current_vote_stake . amount = ( uint128_t ( bitr -> com_balance . amount ) * _compool . begin ( ) -> total_lendable . amount ) / _compool . begin ( ) -> total_com . amount ; _combalance . modify ( bitr , same_payer , [ & ] ( auto & rb ) { rb . vote_stake . amount = current_vote_stake . amount ; } ) ; delta_stake = current_vote_stake . amount - init_vote_stake . amount ; } if ( delta_stake != 0 ) { auto vitr = _voters . find ( voter . value ) ; if ( vitr != _voters . end ( ) ) { _voters . modify ( vitr , same_payer , [ & ] ( auto & vinfo ) { vinfo . staked += delta_stake ; } ) ; } } }
@brief Updates voter COM vote stake to the current value of COM tokens held
 @param voter - account name of voter
@brief Updates voter COM vote stake to the current value of COM tokens held @param voter - account name of voter