message: accounts table in generic_currency swtiched to multi_index
diff: #pragma once
  +#include <eosiolib/multi_index.hpp>
  #include <eosiolib/table.hpp>
  #include <eosiolib/token.hpp>
  #include <eosiolib/asset.hpp>
  @@ -61,6 +62,8 @@ namespace eosio {
  uint64_t symbol = token_type::symbol;
  token_type balance;
  + auto primary_key() const { return symbol; }
  +
  EOSLIB_SERIALIZE( account, (symbol)(balance) )
  };
  @@ -68,6 +71,8 @@ namespace eosio {
  uint64_t symbol = token_type::symbol;
  token_type supply;
  + auto primary_key() const { return symbol; }
  +
  EOSLIB_SERIALIZE( currency_stats, (symbol)(supply) )
  };
  @@ -75,25 +80,41 @@ namespace eosio {
  * Each user stores their balance in the singleton table under the
  * scope of their account name.
  */
  - typedef table64<code, accounts_table_name, code, account> accounts;
  + typedef eosio::multi_index<accounts_table_name, account> accounts;
  + //typedef eosio::multi_index<stats_table_name, > stats;
  typedef table64<code, stats_table_name, code, currency_stats> stats;
  static token_type get_balance( account_name owner ) {
  - return accounts::get_or_create( token_type::symbol, owner ).balance;
  + accounts t( code, owner );
  + auto ptr = t.find( symbol );
  + return ptr ? ptr->balance : token_type( asset(0, symbol) );
  + //return accounts::get_or_create( token_type::symbol, owner ).balance;
  }
  - static void set_balance( account_name owner, token_type balance ) {
  - accounts::set( account{token_type::symbol,balance}, owner );
  + static void set_balance( account_name owner, token_type balance, account_name bill_to_if_create ) {
  + //accounts::set( account{token_type::symbol,balance}, owner );
  + accounts t( code, owner );
  + auto f = [&](account& acc) {
  + acc.symbol = symbol;
  + acc.balance = balance;
  + };
  + auto ptr = t.find( symbol );
  + if (ptr) {
  + t.update( *ptr, 0, f);
  + } else {
  + t.emplace( owner, f);
  + }
  }
  static void on( const issue& act ) {
  require_auth( code );
  + //stats t( code);
  auto s = stats::get_or_create(token_type::symbol);
  s.supply += act.quantity;
  stats::set(s);
  - set_balance( code, get_balance( code ) + act.quantity );
  + set_balance( code, get_balance( code ) + act.quantity, code );
  inline_transfer( code, act.to, act.quantity );
  }
  @@ -103,8 +124,8 @@ namespace eosio {
  require_auth( act.from );
  require_recipient(act.to,act.from);
  - set_balance( act.from, get_balance( act.from ) - act.quantity );
  - set_balance( act.to, get_balance( act.to ) + act.quantity );
  + set_balance( act.from, get_balance( act.from ) - act.quantity, act.from );
  + set_balance( act.to, get_balance( act.to ) + act.quantity, act.from );
  }
  static void inline_transfer( account_name from, account_name to, token_type quantity,
  