Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(erc20-test): only approving baseToken allowance when needed #2379

Merged
merged 19 commits into from
Jul 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removing debug logs
benceharomi committed Jul 5, 2024
commit f2c31c4368d606abcdeaeefea4099114833614a2
8 changes: 0 additions & 8 deletions core/tests/ts-integration/tests/erc20.test.ts
Original file line number Diff line number Diff line change
@@ -215,23 +215,17 @@ describe('ERC20 contract checks', () => {
await (await alice.approveERC20(baseTokenDetails.l1Address, baseTokenMaxAmount)).wait();
}

console.log('LOG1');

// Approving the needed allowance to ensure that the user has enough funds.
const maxAmount = await alice.getBalanceL1(tokenDetails.l1Address);
await (await alice.approveERC20(tokenDetails.l1Address, maxAmount)).wait();

console.log('LOG4');

const depositFee = await alice.getFullRequiredDepositFee({
token: tokenDetails.l1Address
});
console.log('LOG2');

const l1Fee = depositFee.l1GasLimit * (depositFee.maxFeePerGas! || depositFee.gasPrice!);
const l2Fee = depositFee.baseCost;
const aliceETHBalance = await alice.getBalanceL1();
console.log('LOG3');

if (aliceETHBalance < l1Fee + l2Fee) {
throw new Error('Not enough ETH to perform a deposit');
@@ -240,7 +234,6 @@ describe('ERC20 contract checks', () => {
const l2ERC20BalanceChange = await shouldChangeTokenBalances(tokenDetails.l2Address, [
{ wallet: alice, change: maxAmount }
]);
console.log('LOG5');

const overrides: ethers.Overrides = depositFee.gasPrice
? { gasPrice: depositFee.gasPrice }
@@ -255,7 +248,6 @@ describe('ERC20 contract checks', () => {
l2GasLimit: depositFee.l2GasLimit,
overrides
});
console.log('LOG6');
await expect(depositOp).toBeAccepted([l2ERC20BalanceChange]);
});