From 3971002414b648de7148c1d265b012e32508fe16 Mon Sep 17 00:00:00 2001 From: cryptoAtwill Date: Fri, 29 Nov 2024 17:42:47 +0800 Subject: [PATCH] support event scan --- ...ssMessengeCaller.sol => CrossMessengerCaller.sol} | 2 +- contracts/tasks/cross-network-messenger.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) rename contracts/contracts/examples/{CrossMessengeCaller.sol => CrossMessengerCaller.sol} (98%) diff --git a/contracts/contracts/examples/CrossMessengeCaller.sol b/contracts/contracts/examples/CrossMessengerCaller.sol similarity index 98% rename from contracts/contracts/examples/CrossMessengeCaller.sol rename to contracts/contracts/examples/CrossMessengerCaller.sol index 636248257..8fe109ab3 100644 --- a/contracts/contracts/examples/CrossMessengeCaller.sol +++ b/contracts/contracts/examples/CrossMessengerCaller.sol @@ -16,7 +16,7 @@ interface ISubnetGetter { } /// This is a simple example contract to invoke cross messages between subnets from different levels -contract CrossMessengeCaller is IpcExchange { +contract CrossMessengerCaller is IpcExchange { event CallReceived(IPCAddress from, CallMsg msg); event ResultReceived(IpcEnvelope original, ResultMsg result); diff --git a/contracts/tasks/cross-network-messenger.ts b/contracts/tasks/cross-network-messenger.ts index 87c281290..6cf577215 100644 --- a/contracts/tasks/cross-network-messenger.ts +++ b/contracts/tasks/cross-network-messenger.ts @@ -22,7 +22,7 @@ task('cross-network-messenger-deploy') console.log("queried ipc gateway", gateway); await Deployments.deploy(hre, deployer, { - name: 'CrossMessengeCaller', + name: 'CrossMessengerCaller', args: [args.subnetAddress, gateway], libraries: ['SubnetIDHelper'], }) @@ -45,13 +45,13 @@ task('cross-network-send') const amount = hre.ethers.utils.parseEther(args.value) console.log('sending to address', args.recipient, 'with amount', amount) - const contracts = await Deployments.resolve(hre, 'CrossMessengeCaller') - const contract = contracts.contracts.CrossMessengeCaller + const contracts = await Deployments.resolve(hre, 'CrossMessengerCaller') + const contract = contracts.contracts.CrossMessengerCaller await contract.invokeSendMessage(subnetId, args.recipient, amount, { value: Number(amount) }) }) // step 3. check result -// sample command: pnpm exec hardhat cross-network-scan --network calibrationnet 314159 +// sample command: pnpm exec hardhat cross-network-scan --network calibrationnet task('cross-network-scan') .setDescription('Scan cross network send in the target subnet') .setAction(async (args: TaskArguments, hre: HardhatRuntimeEnvironment) => { @@ -63,8 +63,8 @@ task('cross-network-scan') const amount = hre.ethers.utils.parseEther(args.value) console.log('sending to address', args.recipient, 'with amount', amount) - const contracts = await Deployments.resolve(hre, 'CrossMessengeCaller') - const contract = contracts.contracts.CrossMessengeCaller + const contracts = await Deployments.resolve(hre, 'CrossMessengerCaller') + const contract = contracts.contracts.CrossMessengerCaller const received = contract.filters.CallReceived() const events = await contract.queryFilter(received) for (const event of events) {