contracts/arisen.system/src/com.cpp
/**
    * @brief Updates com_pool balances upon creating a new loan or renewing an existing one
    *
    * @param payment - loan fee paid
    * @param rented_tokens - amount of tokens to be staked to loan receiver
    * @param new_loan - flag indicating whether the loan is new or being renewed
    */
@brief Updates com_pool balances upon creating a new loan or renewing an existing one
@param payment - loan fee paid
@param rented_tokens - amount of tokens to be staked to loan receiver
@param new_loan - flag indicating whether the loan is new or being renewed
@brief Updates com_pool balances upon creating a new loan or renewing an existing one @param payment - loan fee paid @param rented_tokens - amount of tokens to be staked to loan receiver @param new_loan - flag indicating whether the loan is new or being renewed
void system_contract::add_loan_to_com_pool( const asset& payment, int64_t rented_tokens, bool new_loan )
   {
      _compool.modify( _compool.begin(), same_payer, [&]( auto& rt ) {
         rt.total_rent.amount    += payment.amount;
         rt.total_unlent.amount  -= rented_tokens;
         rt.total_lent.amount    += rented_tokens;
         rt.total_unlent.amount  += payment.amount;
         rt.total_lendable.amount = rt.total_unlent.amount + rt.total_lent.amount;
         if ( new_loan ) {
            rt.loan_num++;
         }
      });
   }
void system_contract :: add_loan_to_com_pool ( const asset & payment , int64_t rented_tokens , bool new_loan ) { _compool . modify ( _compool . begin ( ) , same_payer , [ & ] ( auto & rt ) { rt . total_rent . amount += payment . amount ; rt . total_unlent . amount -= rented_tokens ; rt . total_lent . amount += rented_tokens ; rt . total_unlent . amount += payment . amount ; rt . total_lendable . amount = rt . total_unlent . amount + rt . total_lent . amount ; if ( new_loan ) { rt . loan_num ++ ; } } ) ; }
@brief Updates com_pool balances upon creating a new loan or renewing an existing one
 @param payment - loan fee paid
 @param rented_tokens - amount of tokens to be staked to loan receiver
 @param new_loan - flag indicating whether the loan is new or being renewed
@brief Updates com_pool balances upon creating a new loan or renewing an existing one @param payment - loan fee paid @param rented_tokens - amount of tokens to be staked to loan receiver @param new_loan - flag indicating whether the loan is new or being renewed
// add payment to total_rent // move rented_tokens from total_unlent to total_lent // add payment to total_unlent // increment loan_num if a new loan is being created