contracts/arisen.system/src/com.cpp
/**
    * @brief Consolidates COM maturity buckets into one
    *
    * @param bitr - iterator pointing to com_balance object
    * @param com_in_sell_order - COM tokens in owner unfilled sell order, if one exists
    */
@brief Consolidates COM maturity buckets into one
@param bitr - iterator pointing to com_balance object
@param com_in_sell_order - COM tokens in owner unfilled sell order, if one exists
@brief Consolidates COM maturity buckets into one @param bitr - iterator pointing to com_balance object @param com_in_sell_order - COM tokens in owner unfilled sell order if one exists
void system_contract::consolidate_com_balance( const com_balance_table::const_iterator& bitr,
                                                  const asset& com_in_sell_order )
   {
      const int64_t com_in_savings = read_com_savings( bitr );
      _combalance.modify( bitr, same_payer, [&]( auto& rb ) {
         int64_t total  = rb.matured_com - com_in_sell_order.amount;
         rb.matured_com = com_in_sell_order.amount;
         while ( !rb.com_maturities.empty() ) {
            total += rb.com_maturities.front().second;
            rb.com_maturities.pop_front();
         }
         if ( total > 0 ) {
            rb.com_maturities.emplace_back( get_com_maturity(), total );
         }
      });
      put_com_savings( bitr, com_in_savings );
   }
void system_contract :: consolidate_com_balance ( const com_balance_table :: const_iterator & bitr , const asset & com_in_sell_order ) { const int64_t com_in_savings = read_com_savings ( bitr ) ; _combalance . modify ( bitr , same_payer , [ & ] ( auto & rb ) { int64_t total = rb . matured_com - com_in_sell_order . amount ; rb . matured_com = com_in_sell_order . amount ; while ( ! rb . com_maturities . empty ( ) ) { total += rb . com_maturities . front ( ) . second ; rb . com_maturities . pop_front ( ) ; } if ( total > 0 ) { rb . com_maturities . emplace_back ( get_com_maturity ( ) , total ) ; } } ) ; put_com_savings ( bitr , com_in_savings ) ; }
@brief Consolidates COM maturity buckets into one
 @param bitr - iterator pointing to com_balance object
 @param com_in_sell_order - COM tokens in owner unfilled sell order, if one exists
@brief Consolidates COM maturity buckets into one @param bitr - iterator pointing to com_balance object @param com_in_sell_order - COM tokens in owner unfilled sell order if one exists