@@ -309,8 +309,9 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, evmAppCreator ibctesting.A
309
309
)
310
310
Expect (escrowBalance .Amount ).To (Equal (math .ZeroInt ()), "Escrow balance should be 0 before transfer" )
311
311
312
- // send some tokens to the conoract address
312
+ // send some tokens to the contract address
313
313
fundAmt := math .NewInt (100 )
314
+ fundAmtConverted := fundAmt .Mul (math .NewInt (1e12 ))
314
315
err = evmAppA .GetBankKeeper ().SendCoins (
315
316
s .chainA .GetContext (),
316
317
s .chainA .SenderAccount .GetAddress (),
@@ -319,14 +320,14 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, evmAppCreator ibctesting.A
319
320
)
320
321
Expect (err ).To (BeNil (), "Failed to send tokens to contract address" )
321
322
// check contract balance
322
- contractBalance := evmAppA .GetBankKeeper ().GetBalance (
323
+ contractBalance := evmAppA .GetEVMKeeper ().GetBalance (
323
324
s .chainA .GetContext (),
324
- ics20CallerAddr .Bytes (),
325
- sourceBondDenom ,
325
+ ics20CallerAddr ,
326
326
)
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" )
328
328
329
329
sendAmt := math .NewInt (1 )
330
+ sendAmtConverted := sendAmt .Mul (math .NewInt (1e12 ))
330
331
callArgs := testutiltypes.CallArgs {
331
332
ContractABI : ics20CallerContract .ABI ,
332
333
MethodName : "testIbcTransferWithTransfer" ,
@@ -355,20 +356,19 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, evmAppCreator ibctesting.A
355
356
0 ,
356
357
)
357
358
Expect (err ).To (BeNil (), "Failed to testTransfer" )
358
- expectedContractBalance := fundAmt .Sub (sendAmt )
359
+ expectedContractBalance := fundAmtConverted .Sub (sendAmtConverted )
359
360
if tc .before {
360
361
expectedContractBalance = expectedContractBalance .Sub (math .NewInt (15 ))
361
362
}
362
363
if tc .after {
363
364
expectedContractBalance = expectedContractBalance .Sub (math .NewInt (15 ))
364
365
}
365
366
// balance after transfer should be 0
366
- contractBalance = evmAppA .GetBankKeeper ().GetBalance (
367
+ contractBalance = evmAppA .GetEVMKeeper ().GetBalance (
367
368
s .chainA .GetContext (),
368
- ics20CallerAddr .Bytes (),
369
- sourceBondDenom ,
369
+ ics20CallerAddr ,
370
370
)
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" )
372
372
escrowBalance = evmAppA .GetBankKeeper ().GetBalance (
373
373
s .chainA .GetContext (),
374
374
escrowAddr ,
@@ -399,12 +399,11 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, evmAppCreator ibctesting.A
399
399
sourceChannelID := path .EndpointA .ChannelID
400
400
sourceBondDenom := s .chainABondDenom
401
401
escrowAddr := types .GetEscrowAddress (sourcePortID , sourceChannelID )
402
- escrowBalance := evmAppA .GetBankKeeper ().GetBalance (
402
+ escrowBalance := evmAppA .GetEVMKeeper ().GetBalance (
403
403
s .chainA .GetContext (),
404
- escrowAddr ,
405
- sourceBondDenom ,
404
+ common .BytesToAddress (escrowAddr .Bytes ()),
406
405
)
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" )
408
407
409
408
// send some tokens to the contract address
410
409
fundAmt := math .NewInt (100 )
@@ -415,13 +414,12 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, evmAppCreator ibctesting.A
415
414
sdk .NewCoins (sdk .NewCoin (sourceBondDenom , fundAmt )),
416
415
)
417
416
Expect (err ).To (BeNil (), "Failed to send tokens to contract address" )
418
- contractBalance := evmAppA .GetBankKeeper ().GetBalance (
417
+ contractBalance := evmAppA .GetEVMKeeper ().GetBalance (
419
418
s .chainA .GetContext (),
420
- ics20CallerAddr .Bytes (),
421
- sourceBondDenom ,
419
+ common .BytesToAddress (ics20CallerAddr .Bytes ()),
422
420
)
423
421
// 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" )
425
423
426
424
sendAmt := math .NewInt (1 )
427
425
callArgs := testutiltypes.CallArgs {
@@ -452,24 +450,21 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, evmAppCreator ibctesting.A
452
450
0 ,
453
451
)
454
452
Expect (err ).To (BeNil (), "Failed to testTransfer" )
455
- contractBalanceAfter := evmAppA .GetBankKeeper ().GetBalance (
453
+ contractBalanceAfter := evmAppA .GetEVMKeeper ().GetBalance (
456
454
s .chainA .GetContext (),
457
- ics20CallerAddr .Bytes (),
458
- sourceBondDenom ,
455
+ common .BytesToAddress (ics20CallerAddr .Bytes ()),
459
456
)
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 (
462
459
s .chainA .GetContext (),
463
- escrowAddr ,
464
- sourceBondDenom ,
460
+ common .BytesToAddress (escrowAddr .Bytes ()),
465
461
)
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 (
468
464
s .chainA .GetContext (),
469
- randomAccAddr ,
470
- sourceBondDenom ,
465
+ common .BytesToAddress (randomAccAddr .Bytes ()),
471
466
)
472
- Expect (randomAccBalance .Amount ) .To (Equal (math .NewInt (15 )))
467
+ Expect (randomAccBalance .ToBig ()) .To (Equal (math .NewInt (15 ). BigInt ( )))
473
468
})
474
469
})
475
470
0 commit comments