@@ -6,9 +6,7 @@ use std::time::SystemTime;
6
6
7
7
use cgp:: extra:: run:: CanRun ;
8
8
use cgp:: prelude:: * ;
9
- use hermes_chain_components:: traits:: queries:: chain_status:: {
10
- CanQueryChainHeight , CanQueryChainStatus ,
11
- } ;
9
+ use hermes_chain_components:: traits:: queries:: chain_status:: CanQueryChainStatus ;
12
10
use hermes_chain_components:: traits:: queries:: client_state:: CanQueryClientStateWithLatestHeight ;
13
11
use hermes_chain_components:: traits:: types:: chain_id:: HasChainId ;
14
12
use hermes_cosmos_chain_components:: types:: channel:: CosmosInitChannelOptions ;
@@ -27,7 +25,6 @@ use hermes_relayer_components::chain::traits::send_message::CanSendSingleMessage
27
25
use hermes_relayer_components:: relay:: impls:: channel:: bootstrap:: CanBootstrapChannel ;
28
26
use hermes_relayer_components:: relay:: impls:: connection:: bootstrap:: CanBootstrapConnection ;
29
27
use hermes_relayer_components:: relay:: traits:: client_creator:: CanCreateClient ;
30
- use hermes_relayer_components:: relay:: traits:: event_relayer:: CanRelayEvent ;
31
28
use hermes_relayer_components:: relay:: traits:: target:: { DestinationTarget , SourceTarget } ;
32
29
use hermes_relayer_components:: transaction:: traits:: poll_tx_response:: CanPollTxResponse ;
33
30
use hermes_runtime_components:: traits:: fs:: read_file:: CanReadFileAsString ;
@@ -459,8 +456,10 @@ fn test_starknet_ics20_contract() -> Result<(), Error> {
459
456
balance_cosmos_a_step_1. quantity + transfer_quantity
460
457
) ;
461
458
462
- // Wait for background relayer to relay packet
463
- runtime. sleep ( Duration :: from_secs ( 5 ) ) . await ;
459
+ // Wait for background relayer to relay packet.
460
+ // We cannot poll the balance here, because the IBC denom will only
461
+ // be relayed after the first token transfer.
462
+ runtime. sleep ( Duration :: from_secs ( 2 ) ) . await ;
464
463
465
464
let ics20_token_address: Felt = {
466
465
let ibc_prefixed_denom = PrefixedDenom {
@@ -599,14 +598,11 @@ fn test_starknet_ics20_contract() -> Result<(), Error> {
599
598
600
599
info ! ( "erc20 token address: {:?}" , erc20_token_address) ;
601
600
602
- let balance_starknet_relayer_step_0 = starknet_chain
601
+ let balance_starknet_step_0 = starknet_chain
603
602
. query_token_balance ( erc20_token_address, address_starknet_b)
604
603
. await ?;
605
604
606
- info ! (
607
- "erc20 balance on starknet: {}" ,
608
- balance_starknet_relayer_step_0
609
- ) ;
605
+ info ! ( "erc20 balance on starknet: {}" , balance_starknet_step_0) ;
610
606
611
607
{
612
608
// approve ics20 contract to spend the tokens for address_starknet_b
@@ -689,19 +685,6 @@ fn test_starknet_ics20_contract() -> Result<(), Error> {
689
685
let tx_hash = execution. send ( ) . await ?. transaction_hash ;
690
686
691
687
starknet_chain. poll_tx_response ( & tx_hash) . await ?;
692
-
693
- // info!("ICS20 send packet response: {:?}", response);
694
-
695
- // let height = starknet_chain.query_chain_height().await?;
696
-
697
- // for event in response.events {
698
- // <StarknetToCosmosRelay as CanRelayEvent<SourceTarget>>::relay_chain_event(
699
- // &starknet_to_cosmos_relay,
700
- // &height,
701
- // &event,
702
- // )
703
- // .await?;
704
- // }
705
688
} ;
706
689
707
690
let cosmos_ibc_denom = derive_ibc_denom (
@@ -730,7 +713,7 @@ fn test_starknet_ics20_contract() -> Result<(), Error> {
730
713
731
714
assert_eq ! (
732
715
balance_starknet_relayer_step_3. quantity,
733
- balance_starknet_relayer_step_0 . quantity - transfer_quantity. into( )
716
+ balance_starknet_step_0 . quantity - transfer_quantity. into( )
734
717
) ;
735
718
736
719
// send the tokens back to starknet
@@ -746,8 +729,6 @@ fn test_starknet_ics20_contract() -> Result<(), Error> {
746
729
)
747
730
. await ?;
748
731
749
- // cosmos_to_starknet_relay.relay_packet(&packet).await?;
750
-
751
732
let balance_cosmos_a_step_4 = cosmos_chain
752
733
. query_balance ( address_cosmos_a, & cosmos_ibc_denom)
753
734
. await ?;
@@ -760,7 +741,7 @@ fn test_starknet_ics20_contract() -> Result<(), Error> {
760
741
assert_eq ! ( balance_cosmos_a_step_4. quantity, 0u64 . into( ) ) ;
761
742
762
743
starknet_chain
763
- . assert_eventual_amount ( erc20_token_address , & balance_starknet_relayer_step_0 )
744
+ . assert_eventual_amount ( address_starknet_b , & balance_starknet_step_0 )
764
745
. await ?;
765
746
766
747
Ok ( ( ) )
0 commit comments