@@ -388,38 +388,36 @@ impl Block {
388
388
let ( msg, packet_data) = data?;
389
389
let denom = packet_data. token . denom . to_string ( ) ;
390
390
391
- // If the denom is the native token, we can just return the
392
- // receiver
391
+ let ibc_trace = format ! (
392
+ "{}/{}/{}" ,
393
+ msg. packet. port_id_on_b,
394
+ msg. packet. chan_id_on_b,
395
+ packet_data. token. denom
396
+ ) ;
397
+
398
+ let trace = Id :: IbcTrace ( ibc_trace. clone ( ) ) ;
399
+ let address = namada_ibc:: trace:: convert_to_address ( ibc_trace)
400
+ . expect ( "Failed to convert IBC trace to address" ) ;
401
+
402
+ let mut balances = vec ! [ BalanceChange :: new(
403
+ Id :: Account ( String :: from( packet_data. receiver. as_ref( ) ) ) ,
404
+ Token :: Ibc ( IbcToken {
405
+ address: Id :: from( address. clone( ) ) ,
406
+ trace,
407
+ } ) ,
408
+ ) ] ;
409
+
410
+ // If the denom contains the namada native token, try to fetch
411
+ // the balance
393
412
if denom. contains ( & native_token. to_string ( ) ) {
394
- vec ! [ BalanceChange :: new(
413
+ balances . push ( BalanceChange :: new (
395
414
Id :: Account ( String :: from (
396
415
packet_data. receiver . as_ref ( ) ,
397
416
) ) ,
398
417
Token :: Native ( native_token. clone ( ) ) ,
399
- ) ]
400
- } else {
401
- let ibc_trace = format ! (
402
- "{}/{}/{}" ,
403
- msg. packet. port_id_on_b,
404
- msg. packet. chan_id_on_b,
405
- packet_data. token. denom
406
- ) ;
407
-
408
- let trace = Id :: IbcTrace ( ibc_trace. clone ( ) ) ;
409
- let address =
410
- namada_ibc:: trace:: convert_to_address ( ibc_trace)
411
- . expect ( "Failed to convert IBC trace to address" ) ;
412
-
413
- vec ! [ BalanceChange :: new(
414
- Id :: Account ( String :: from(
415
- packet_data. receiver. as_ref( ) ,
416
- ) ) ,
417
- Token :: Ibc ( IbcToken {
418
- address: Id :: from( address. clone( ) ) ,
419
- trace,
420
- } ) ,
421
- ) ]
418
+ ) )
422
419
}
420
+ balances
423
421
}
424
422
TransactionKind :: TransparentTransfer ( data) => {
425
423
let data = data. as_ref ( ) ?;
0 commit comments