Skip to content

Commit

Permalink
blobal mailboxIface instead of selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Uacias committed Jan 8, 2024
1 parent 109f832 commit 6bc89e8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions system-contracts/test/L2EthToken.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ describe("L2EthToken tests", () => {
let wallets: Array<Wallet>;
let l2EthToken: L2EthToken;
let bootloaderAccount: ethers.Signer;
let selector: string;
let mailboxIface: ethers.utils.Interface;

before(async () => {
await prepareEnvironment();
await deployContractOnAddress(TEST_ETH_TOKEN_SYSTEM_CONTRACT_ADDRESS, "L2EthToken");
l2EthToken = L2EthTokenFactory.connect(TEST_ETH_TOKEN_SYSTEM_CONTRACT_ADDRESS, richWallet);
bootloaderAccount = await ethers.getImpersonatedSigner(TEST_BOOTLOADER_FORMAL_ADDRESS);
selector = new ethers.utils.Interface((await loadArtifact("IMailbox")).abi).getSighash("finalizeEthWithdrawal");
mailboxIface = new ethers.utils.Interface((await loadArtifact("IMailbox")).abi);
});

beforeEach(async () => {
Expand Down Expand Up @@ -170,7 +170,7 @@ describe("L2EthToken tests", () => {
const amountToWithdraw: BigNumber = ethers.utils.parseEther("1.0");
const message: string = ethers.utils.solidityPack(
["bytes4", "address", "uint256"],
[selector, wallets[1].address, amountToWithdraw]
[mailboxIface.getSighash("finalizeEthWithdrawal"), wallets[1].address, amountToWithdraw]
);

await setResult("L1Messenger", "sendToL1", [message], {
Expand Down Expand Up @@ -201,7 +201,13 @@ describe("L2EthToken tests", () => {
const additionalData: string = ethers.utils.defaultAbiCoder.encode(["string"], ["additional data"]);
const message: string = ethers.utils.solidityPack(
["bytes4", "address", "uint256", "address", "bytes"],
[selector, wallets[1].address, amountToWithdraw, richWallet.address, additionalData]
[
mailboxIface.getSighash("finalizeEthWithdrawal"),
wallets[1].address,
amountToWithdraw,
richWallet.address,
additionalData,
]
);

await setResult("L1Messenger", "sendToL1", [message], {
Expand Down

0 comments on commit 6bc89e8

Please sign in to comment.