From e62b051563bca53775dd126c1be38ccd3c34afaf Mon Sep 17 00:00:00 2001 From: skosito Date: Wed, 3 Jul 2024 21:45:41 +0200 Subject: [PATCH] cleanup --- scripts/readme.md | 2 +- scripts/worker.ts | 10 ++++++---- tasks/localnet.ts | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/readme.md b/scripts/readme.md index 7e04e34f..ecc0a0ef 100644 --- a/scripts/readme.md +++ b/scripts/readme.md @@ -7,4 +7,4 @@ yarn localnet ``` This will run hardhat local node and worker script, which will deploy all contracts, and listen and react to events, facilitating communication between contracts. -Tasks to interact with localnet are located in `tasks/localnet`. To make use of default contract addresses on localnet, start localnode and localnet from scratch, so contracts are deployed on same addresses. Otherwise, provide custom addresses as tasks parameters. +Tasks to interact with localnet are located in `tasks/localnet`. To make use of default contract addresses on localnet, start localnet from scratch, so contracts are deployed on same addresses. Otherwise, provide custom addresses as tasks parameters. diff --git a/scripts/worker.ts b/scripts/worker.ts index 9b9553dd..7571523a 100644 --- a/scripts/worker.ts +++ b/scripts/worker.ts @@ -16,7 +16,7 @@ export const startWorker = async () => { let gatewayEVM: Contract; let token: Contract; let custody: Contract; - let ownerEVM: any, destination: any, tssAddress: any; + let ownerEVM: any, tssAddress: any; // ZEVM let senderZEVM: Contract; @@ -27,7 +27,8 @@ export const startWorker = async () => { let ownerZEVM: SignerWithAddress; let addrs: SignerWithAddress[]; - [ownerEVM, ownerZEVM, destination, tssAddress, ...addrs] = await ethers.getSigners(); + [ownerEVM, ownerZEVM, tssAddress, ...addrs] = await ethers.getSigners(); + // Prepare EVM const TestERC20 = await ethers.getContractFactory("TestERC20"); const ReceiverEVM = await ethers.getContractFactory("ReceiverEVM"); @@ -60,6 +61,7 @@ export const startWorker = async () => { console.log("EVM: 500TTK transfered to custody from:", ownerEVM.address); // Prepare ZEVM + // Impersonate the fungible module account await hre.network.provider.request({ method: "hardhat_impersonateAccount", @@ -137,7 +139,7 @@ export const startWorker = async () => { console.log("Worker: Withdrawal event on GatewayZEVM."); const receiver = args[1]; const message = args[5]; - if (args[5] != "0x") { + if (message != "0x") { console.log("Worker: Calling ReceiverEVM through GatewayEVM..."); const executeTx = await gatewayEVM.execute(receiver, message, { value: 0 }); await executeTx.wait(); @@ -171,7 +173,7 @@ export const startWorker = async () => { const receiver = args[1]; const asset = args[3]; const payload = args[4]; - if (args[4] != "0x") { + if (payload != "0x") { console.log("Worker: Calling TestZContract through GatewayZEVM..."); const executeTx = await gatewayZEVM .connect(fungibleModuleSigner) diff --git a/tasks/localnet.ts b/tasks/localnet.ts index 0acc9591..2c24783b 100644 --- a/tasks/localnet.ts +++ b/tasks/localnet.ts @@ -2,9 +2,9 @@ import { task } from "hardhat/config"; declare const hre: any; -// Contains tasks to make it easier to interact with prototype contracts localnet -// To make use of default contract addresses on localnet, start localnode and localnet from scratch, so contracts are deployed on same addresses -// Otherwise, provide custom addresses as parameters +// Contains tasks to make it easier to interact with prototype contracts localnet. +// To make use of default contract addresses on localnet, start localnet from scratch, so contracts are deployed on same addresses. +// Otherwise, provide custom addresses as parameters. task("zevm-call", "calls evm contract from zevm account") .addOptionalParam("gatewayZEVM", "contract address of gateway on ZEVM", "0x5133BBdfCCa3Eb4F739D599ee4eC45cBCD0E16c5")