Skip to content

Commit

Permalink
support event scan
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptoAtwill committed Nov 29, 2024
1 parent 8a730f8 commit 3971002
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
12 changes: 6 additions & 6 deletions contracts/tasks/cross-network-messenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
})
Expand All @@ -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) => {
Expand All @@ -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) {
Expand Down

0 comments on commit 3971002

Please sign in to comment.