diff --git a/templates/messaging/contracts/{{contractName}}.sol.hbs b/templates/messaging/contracts/{{contractName}}.sol.hbs index eea90648..6bd9ad37 100644 --- a/templates/messaging/contracts/{{contractName}}.sol.hbs +++ b/templates/messaging/contracts/{{contractName}}.sol.hbs @@ -32,7 +32,7 @@ contract {{contractName}} is ZetaInteractor, ZetaReceiver { {{/if}} } - function sendMessage(uint256 destinationChainId{{#unless arguments.feesNative}}, uint256 zetaValueAndGas{{/unless}}{{#if arguments.pairsWithDataLocation}}, {{#each arguments.pairsWithDataLocation}}{{#if @index}}, {{/if}}{{this.[1]}} {{this.[0]}}{{/each}}{{/if}}) external payable { + function sendMessage(uint256 destinationChainId{{#if arguments.pairsWithDataLocation}}, {{#each arguments.pairsWithDataLocation}}{{#if @index}}, {{/if}}{{this.[1]}} {{this.[0]}}{{/each}}{{/if}}{{#unless arguments.feesNative}}, uint256 zetaValueAndGas{{/unless}}) external payable { if (!_isValidChainId(destinationChainId)) revert InvalidDestinationChainId(); diff --git a/templates/messaging/tasks/deploy.ts.hbs b/templates/messaging/tasks/deploy.ts.hbs index ae1d033b..1d125b7d 100644 --- a/templates/messaging/tasks/deploy.ts.hbs +++ b/templates/messaging/tasks/deploy.ts.hbs @@ -41,6 +41,7 @@ const deployContract = async ( const connector = getAddress("connector", networkName as any); const zetaToken = getAddress("zetaToken", networkName as any); + {{#if arguments.feesNative}} const zetaTokenConsumerUniV2 = getAddress( "zetaTokenConsumerUniV2", networkName as any @@ -49,14 +50,11 @@ const deployContract = async ( "zetaTokenConsumerUniV3", networkName as any ); + {{/if}} const { abi, bytecode } = await hre.artifacts.readArtifact(contractName); const factory = new ethers.ContractFactory(abi, bytecode, wallet); - const contract = await factory.deploy( - connector, - zetaToken, - zetaTokenConsumerUniV2 || zetaTokenConsumerUniV3 - ); + const contract = await factory.deploy(connector, zetaToken{{#if arguments.feesNative}}, zetaTokenConsumerUniV2 || zetaTokenConsumerUniV3{{/if}}); await contract.deployed(); if (!json) { diff --git a/templates/messaging/tasks/interact.ts.hbs b/templates/messaging/tasks/interact.ts.hbs index da83e6d2..1f29c082 100644 --- a/templates/messaging/tasks/interact.ts.hbs +++ b/templates/messaging/tasks/interact.ts.hbs @@ -1,7 +1,6 @@ import { task } from "hardhat/config"; import { HardhatRuntimeEnvironment } from "hardhat/types"; import { parseEther } from "@ethersproject/units"; -import { trackCCTX } from "@zetachain/toolkit/helpers"; const contractName = "{{contractName}}"; @@ -20,15 +19,16 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { {{#each arguments.casts}}const param{{this.[0]}} = {{this.[1]}}; {{/each}} + const value = parseEther(args.amount); + const tx = await contract .connect(signer) - .sendMessage(destination, {{#each arguments.casts}} param{{this.[0]}}, {{/each}} { value: parseEther(args.amount) }); + .sendMessage(destination{{#each arguments.casts}}, param{{this.[0]}}{{/each}}{{#if arguments.feesNative}}, { value }{{else}}, value{{/if}}); const receipt = await tx.wait(); console.log(`✅ The transaction has been broadcasted to ${hre.network.name} 📝 Transaction hash: ${receipt.transactionHash} `); - await trackCCTX(tx.hash); }; task("interact", "Sends a message from one chain to another.", main) diff --git a/templates/omnichain/tasks/interact.ts.hbs b/templates/omnichain/tasks/interact.ts.hbs index 1ee7d8e1..a9595fb3 100644 --- a/templates/omnichain/tasks/interact.ts.hbs +++ b/templates/omnichain/tasks/interact.ts.hbs @@ -2,7 +2,7 @@ import { task } from "hardhat/config"; import { HardhatRuntimeEnvironment } from "hardhat/types"; import { parseEther } from "@ethersproject/units"; import { getAddress } from "@zetachain/protocol-contracts"; -import { prepareData, trackCCTX } from "@zetachain/toolkit/helpers"; +import { prepareData } from "@zetachain/toolkit/helpers"; const main = async (args: any, hre: HardhatRuntimeEnvironment) => { const [signer] = await hre.ethers.getSigners(); @@ -22,7 +22,6 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { 🚀 Successfully broadcasted a token transfer transaction on ${hre.network.name} network. 📝 Transaction hash: ${tx.hash} `); - await trackCCTX(tx.hash); }; task("interact", "Interact with the contract", main)