contracts/arisen.system/src/com.cpp
/**
    * @brief Updates com_pool balances upon closing an expired loan
    *
    * @param loan - loan to be closed
    */
@brief Updates com_pool balances upon closing an expired loan
@param loan - loan to be closed
@brief Updates com_pool balances upon closing an expired loan @param loan - loan to be closed
void system_contract::remove_loan_from_com_pool( const com_loan& loan )
   {
      const auto& pool = _compool.begin();
      const int64_t delta_total_rent = exchange_state::get_bancor_output( pool->total_unlent.amount,
                                                                          pool->total_rent.amount,
                                                                          loan.total_staked.amount );
      _compool.modify( pool, same_payer, [&]( auto& rt ) {
         rt.total_rent.amount    -= delta_total_rent;
         rt.total_unlent.amount  += loan.total_staked.amount;
         rt.total_lent.amount    -= loan.total_staked.amount;
         rt.total_lendable.amount = rt.total_unlent.amount + rt.total_lent.amount;
      });
   }
void system_contract :: remove_loan_from_com_pool ( const com_loan & loan ) { const auto & pool = _compool . begin ( ) ; const int64_t delta_total_rent = exchange_state :: get_bancor_output ( pool -> total_unlent . amount , pool -> total_rent . amount , loan . total_staked . amount ) ; _compool . modify ( pool , same_payer , [ & ] ( auto & rt ) { rt . total_rent . amount -= delta_total_rent ; rt . total_unlent . amount += loan . total_staked . amount ; rt . total_lent . amount -= loan . total_staked . amount ; rt . total_lendable . amount = rt . total_unlent . amount + rt . total_lent . amount ; } ) ; }
@brief Updates com_pool balances upon closing an expired loan
 @param loan - loan to be closed
@brief Updates com_pool balances upon closing an expired loan @param loan - loan to be closed
// deduct calculated delta_total_rent from total_rent // move rented tokens from total_lent to total_unlent