@@ -24,13 +24,13 @@ import (
24
24
)
25
25
26
26
func TestFromIBCTransferToContract (t * testing.T ) {
27
- t .Skip ("Not fixed, yet" )
28
27
// scenario: a contract can handle the receiving side of a ibc transfer
29
28
var (
30
29
coordinator = ibctesting .NewCoordinator (t , 2 )
31
30
chainA = coordinator .GetChain (ibctesting .GetChainID (0 ))
32
31
chainB = coordinator .GetChain (ibctesting .GetChainID (1 ))
33
32
)
33
+ coordinator .CommitBlock (chainA , chainB )
34
34
myContractAddr := chainB .NewRandomContractInstance ()
35
35
wasmkeeper .MockContracts [myContractAddr .String ()] = & receiverContract {t : t , contractAddr : myContractAddr , chain : chainB }
36
36
@@ -62,12 +62,13 @@ func TestFromIBCTransferToContract(t *testing.T) {
62
62
require .NoError (t , err )
63
63
newBalance := wasmd .NewTestSupport (t , chainA .App ).BankKeeper ().GetBalance (chainA .GetContext (), chainA .SenderAccount .GetAddress (), sdk .DefaultBondDenom )
64
64
assert .Equal (t , originalBalance .Sub (coinToSendToB ), newBalance )
65
- const ibcVoucherTicker = "ibc/BD392476EF223E2AEB996E1F57EAF98E89D4CD44D9FDEB7F9FEDDCC8027703AC"
65
+
66
+ voucherDenom := ibctransfertypes .ParseDenomTrace (ibctransfertypes .GetPrefixedDenom (channelB .PortID , channelB .ID , coinToSendToB .Denom )).IBCDenom ()
66
67
bankKeeperB := wasmd .NewTestSupport (t , chainB .App ).BankKeeper ()
67
- chainBBalance := bankKeeperB .GetBalance (chainB .GetContext (), chainB .SenderAccount .GetAddress (), ibcVoucherTicker )
68
+ chainBBalance := bankKeeperB .GetBalance (chainB .GetContext (), chainB .SenderAccount .GetAddress (), voucherDenom )
68
69
// note: the contract is called during check and deliverTX but the context used in the contract does not rollback
69
70
// so that we got twice the amount
70
- assert .Equal (t , sdk.Coin {Denom : ibcVoucherTicker , Amount : coinToSendToB .Amount .Mul (sdk .NewInt (2 ))}.String (), chainBBalance .String (), bankKeeperB .GetAllBalances (chainB .GetContext (), chainB .SenderAccount .GetAddress ()))
71
+ assert .Equal (t , sdk.Coin {Denom : voucherDenom , Amount : coinToSendToB .Amount .Mul (sdk .NewInt (2 ))}.String (), chainBBalance .String (), bankKeeperB .GetAllBalances (chainB .GetContext (), chainB .SenderAccount .GetAddress ()))
71
72
}
72
73
73
74
func TestContractCanUseIBCTransferMsg (t * testing.T ) {
0 commit comments