-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
80 changed files
with
4,197 additions
and
18,353 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,35 @@ | ||
import { task } from "hardhat/config"; | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
import { parseEther } from "@ethersproject/units"; | ||
import { trackCCTX } from "@zetachain/toolkit/helpers"; | ||
|
||
const contractName = "Counter"; | ||
|
||
const main = async (args: any, hre: HardhatRuntimeEnvironment) => { | ||
const [signer] = await hre.ethers.getSigners(); | ||
console.log(`🔑 Using account: ${signer.address}\n`); | ||
|
||
const factory = await hre.ethers.getContractFactory(contractName); | ||
const factory = await hre.ethers.getContractFactory("Counter"); | ||
const contract = factory.attach(args.contract); | ||
|
||
const destination = hre.config.networks[args.destination]?.chainId; | ||
if (destination === undefined) { | ||
throw new Error(`${args.destination} is not a valid destination chain`); | ||
} | ||
|
||
const tx = await contract | ||
.connect(signer) | ||
.sendMessage(destination, { value: parseEther(args.amount) }); | ||
const value = parseEther(args.amount); | ||
|
||
const tx = await contract.connect(signer).sendMessage(destination, { value }); | ||
|
||
const receipt = await tx.wait(); | ||
console.log(`✅ The transaction has been broadcasted to ${hre.network.name} | ||
if (args.json) { | ||
console.log(JSON.stringify(tx, null, 2)); | ||
} else { | ||
console.log(`🔑 Using account: ${signer.address}\n`); | ||
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) | ||
.addFlag("json", "Output JSON") | ||
.addParam("contract", "Contract address") | ||
.addParam("amount", "Token amount to send") | ||
.addParam("destination", "Destination chain"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.