Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Jul 3, 2024
1 parent 76f284d commit e62b051
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion scripts/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
10 changes: 6 additions & 4 deletions scripts/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions tasks/localnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit e62b051

Please sign in to comment.