Skip to content

Commit

Permalink
new feature: allown transfer token to account of self chain in memo s…
Browse files Browse the repository at this point in the history
…tring through bosibc.io contract
  • Loading branch information
justfortest2 committed Jul 1, 2020
1 parent 691391f commit d9fdee3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ibc.token/src/ibc.token.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,18 @@ namespace eosio {
if ( to == _self && memo.find("local") != 0 ) { /// @tag 1: important 'to == _self' logic, avoid inline invoke action 'transfer_notify' or 'withdraw'
auto info = get_memo_info( memo );
eosio_assert( info.receiver != name(), "receiver not provide");

if ( info.peerchain == _gstate.this_chain ){
eosio_assert( _stats.find(sym.raw()) != _stats.end(), "token symbol not found in table stats");
require_recipient( from );
require_recipient( info.receiver );

auto payer = has_auth( info.receiver ) ? info.receiver : from;
sub_balance( from, quantity );
add_balance( info.receiver, quantity, payer );
return;
}

auto pch = _peerchains.get( info.peerchain.value, "peerchain not registered");
eosio_assert( pch.active, "peer chain is not active");

Expand Down

0 comments on commit d9fdee3

Please sign in to comment.