From b015bd7bce1de590423d21984ca574b70ddba490 Mon Sep 17 00:00:00 2001 From: Bence Haromi Date: Fri, 5 Jul 2024 11:17:07 +0100 Subject: [PATCH] nonce logs --- core/tests/ts-integration/tests/erc20.test.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/core/tests/ts-integration/tests/erc20.test.ts b/core/tests/ts-integration/tests/erc20.test.ts index a1b9b6b44bb1..a11b1f823ec3 100644 --- a/core/tests/ts-integration/tests/erc20.test.ts +++ b/core/tests/ts-integration/tests/erc20.test.ts @@ -209,24 +209,39 @@ describe('ERC20 contract checks', () => { }); test('Can perform a deposit with precalculated max value', async () => { - console.log('test'); + console.log('nonce0', await alice.getNonce()); + const maxAmountBase = await alice.getBalanceL1(baseTokenDetails.l1Address); + console.log('nonce1', await alice.getNonce()); + const maxAmount = await alice.getBalanceL1(tokenDetails.l1Address); + console.log('nonce2', await alice.getNonce()); + // Approving the needed allowance to ensure that the user has enough funds. await (await alice.approveERC20(baseTokenDetails.l1Address, maxAmountBase)).wait(); + console.log('nonce3', await alice.getNonce()); + await (await alice.approveERC20(tokenDetails.l1Address, maxAmount)).wait(); + console.log('nonce4', await alice.getNonce()); + const depositFee = await alice.getFullRequiredDepositFee({ token: tokenDetails.l1Address }); + console.log('nonce5', await alice.getNonce()); + const l1Fee = depositFee.l1GasLimit * (depositFee.maxFeePerGas! || depositFee.gasPrice!); const l2Fee = depositFee.baseCost; const aliceETHBalance = await alice.getBalanceL1(); + console.log('nonce6', await alice.getNonce()); + if (aliceETHBalance < l1Fee + l2Fee) { throw new Error('Not enough ETH to perform a deposit'); } const l2ERC20BalanceChange = await shouldChangeTokenBalances(tokenDetails.l2Address, [ { wallet: alice, change: maxAmount } ]); + console.log('nonce7', await alice.getNonce()); + const overrides: ethers.Overrides = depositFee.gasPrice ? { gasPrice: depositFee.gasPrice } : { @@ -240,6 +255,8 @@ describe('ERC20 contract checks', () => { l2GasLimit: depositFee.l2GasLimit, overrides }); + console.log('nonce8', await alice.getNonce()); + await expect(depositOp).toBeAccepted([l2ERC20BalanceChange]); });