@@ -309,8 +309,9 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, evmAppCreator ibctesting.A
309309 )
310310 Expect (escrowBalance .Amount ).To (Equal (math .ZeroInt ()), "Escrow balance should be 0 before transfer" )
311311
312- // send some tokens to the conoract address
312+ // send some tokens to the contract address
313313 fundAmt := math .NewInt (100 )
314+ fundAmtConverted := fundAmt .Mul (math .NewInt (1e12 ))
314315 err = evmAppA .GetBankKeeper ().SendCoins (
315316 s .chainA .GetContext (),
316317 s .chainA .SenderAccount .GetAddress (),
@@ -319,14 +320,14 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, evmAppCreator ibctesting.A
319320 )
320321 Expect (err ).To (BeNil (), "Failed to send tokens to contract address" )
321322 // check contract balance
322- contractBalance := evmAppA .GetBankKeeper ().GetBalance (
323+ contractBalance := evmAppA .GetEVMKeeper ().GetBalance (
323324 s .chainA .GetContext (),
324- ics20CallerAddr .Bytes (),
325- sourceBondDenom ,
325+ ics20CallerAddr ,
326326 )
327- Expect (contractBalance .Amount ) .To (Equal (fundAmt ), "Contract balance should be equal to the fund amount" )
327+ Expect (contractBalance .ToBig ()) .To (Equal (fundAmt . Mul ( math . NewInt ( 1e12 )). BigInt () ), "Contract balance should be equal to the fund amount" )
328328
329329 sendAmt := math .NewInt (1 )
330+ sendAmtConverted := sendAmt .Mul (math .NewInt (1e12 ))
330331 callArgs := testutiltypes.CallArgs {
331332 ContractABI : ics20CallerContract .ABI ,
332333 MethodName : "testIbcTransferWithTransfer" ,
@@ -355,20 +356,19 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, evmAppCreator ibctesting.A
355356 0 ,
356357 )
357358 Expect (err ).To (BeNil (), "Failed to testTransfer" )
358- expectedContractBalance := fundAmt .Sub (sendAmt )
359+ expectedContractBalance := fundAmtConverted .Sub (sendAmtConverted )
359360 if tc .before {
360361 expectedContractBalance = expectedContractBalance .Sub (math .NewInt (15 ))
361362 }
362363 if tc .after {
363364 expectedContractBalance = expectedContractBalance .Sub (math .NewInt (15 ))
364365 }
365366 // balance after transfer should be 0
366- contractBalance = evmAppA .GetBankKeeper ().GetBalance (
367+ contractBalance = evmAppA .GetEVMKeeper ().GetBalance (
367368 s .chainA .GetContext (),
368- ics20CallerAddr .Bytes (),
369- sourceBondDenom ,
369+ ics20CallerAddr ,
370370 )
371- Expect (contractBalance .Amount ) .To (Equal (expectedContractBalance ), "Contract balance should be equal to the expected amount after transfer" )
371+ Expect (contractBalance .ToBig ()) .To (Equal (expectedContractBalance . BigInt () ), "Contract balance should be equal to the expected amount after transfer" )
372372 escrowBalance = evmAppA .GetBankKeeper ().GetBalance (
373373 s .chainA .GetContext (),
374374 escrowAddr ,
@@ -399,12 +399,11 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, evmAppCreator ibctesting.A
399399 sourceChannelID := path .EndpointA .ChannelID
400400 sourceBondDenom := s .chainABondDenom
401401 escrowAddr := types .GetEscrowAddress (sourcePortID , sourceChannelID )
402- escrowBalance := evmAppA .GetBankKeeper ().GetBalance (
402+ escrowBalance := evmAppA .GetEVMKeeper ().GetBalance (
403403 s .chainA .GetContext (),
404- escrowAddr ,
405- sourceBondDenom ,
404+ common .BytesToAddress (escrowAddr .Bytes ()),
406405 )
407- Expect (escrowBalance .Amount ). To (Equal (math .ZeroInt ()), "Escrow balance should be 0 before transfer" )
406+ Expect (escrowBalance .ToBig (). Uint64 ()). To (Equal (math .ZeroInt (). Uint64 ()), "Escrow balance should be 0 before transfer" )
408407
409408 // send some tokens to the contract address
410409 fundAmt := math .NewInt (100 )
@@ -415,13 +414,12 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, evmAppCreator ibctesting.A
415414 sdk .NewCoins (sdk .NewCoin (sourceBondDenom , fundAmt )),
416415 )
417416 Expect (err ).To (BeNil (), "Failed to send tokens to contract address" )
418- contractBalance := evmAppA .GetBankKeeper ().GetBalance (
417+ contractBalance := evmAppA .GetEVMKeeper ().GetBalance (
419418 s .chainA .GetContext (),
420- ics20CallerAddr .Bytes (),
421- sourceBondDenom ,
419+ common .BytesToAddress (ics20CallerAddr .Bytes ()),
422420 )
423421 // check contract balance
424- Expect (contractBalance .Amount ) .To (Equal (fundAmt ), "Contract balance should be equal to the fund amount" )
422+ Expect (contractBalance .ToBig ()) .To (Equal (fundAmt . Mul ( math . NewInt ( 1e12 )). BigInt () ), "Contract balance should be equal to the fund amount" )
425423
426424 sendAmt := math .NewInt (1 )
427425 callArgs := testutiltypes.CallArgs {
@@ -452,24 +450,21 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, evmAppCreator ibctesting.A
452450 0 ,
453451 )
454452 Expect (err ).To (BeNil (), "Failed to testTransfer" )
455- contractBalanceAfter := evmAppA .GetBankKeeper ().GetBalance (
453+ contractBalanceAfter := evmAppA .GetEVMKeeper ().GetBalance (
456454 s .chainA .GetContext (),
457- ics20CallerAddr .Bytes (),
458- sourceBondDenom ,
455+ common .BytesToAddress (ics20CallerAddr .Bytes ()),
459456 )
460- Expect (contractBalanceAfter .Amount ) .To (Equal (contractBalance .Amount .Sub (math .NewInt (15 ))) )
461- escrowBalance = evmAppA .GetBankKeeper ().GetBalance (
457+ Expect (contractBalanceAfter .ToBig ()) .To (Equal (math . NewIntFromBigInt ( contractBalance .ToBig ()) .Sub (math .NewInt (15 )). BigInt ()), "Contract balance should be equal to the expected amount after transfer" )
458+ escrowBalance = evmAppA .GetEVMKeeper ().GetBalance (
462459 s .chainA .GetContext (),
463- escrowAddr ,
464- sourceBondDenom ,
460+ common .BytesToAddress (escrowAddr .Bytes ()),
465461 )
466- Expect (escrowBalance .Amount ). To (Equal (math .ZeroInt ()))
467- randomAccBalance := evmAppA .GetBankKeeper ().GetBalance (
462+ Expect (escrowBalance .ToBig (). Uint64 ()). To (Equal (math .ZeroInt (). BigInt (). Uint64 ()))
463+ randomAccBalance := evmAppA .GetEVMKeeper ().GetBalance (
468464 s .chainA .GetContext (),
469- randomAccAddr ,
470- sourceBondDenom ,
465+ common .BytesToAddress (randomAccAddr .Bytes ()),
471466 )
472- Expect (randomAccBalance .Amount ) .To (Equal (math .NewInt (15 )))
467+ Expect (randomAccBalance .ToBig ()) .To (Equal (math .NewInt (15 ). BigInt ( )))
473468 })
474469 })
475470
0 commit comments