Token ICO/IDO/ILO launchpad smart contract. It has all functions of Pinksale
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
launchpad-contracts/tasks/incrementCounter.js

29 lines
1.4 KiB

const CHAIN_ID = require("../constants/chainIds.json")
const ENDPOINTS = require("../constants/layerzeroEndpoints.json");
module.exports = async function (taskArgs, hre) {
const remoteChainId = CHAIN_ID[taskArgs.targetNetwork]
const omniCounter = await ethers.getContract("OmniCounter")
// quote fee with default adapterParams
let adapterParams = ethers.utils.solidityPack(["uint16", "uint256"], [1, 200000]) // default adapterParams example
const endpoint = await ethers.getContractAt("ILayerZeroEndpoint", ENDPOINTS[hre.network.name])
let fees = await endpoint.estimateFees(remoteChainId, omniCounter.address, "0x", false, adapterParams)
console.log(`fees[0] (wei): ${fees[0]} / (eth): ${ethers.utils.formatEther(fees[0])}`)
let tx = await (
await omniCounter.incrementCounter(
remoteChainId,
{ value: fees[0] }
)
).wait()
console.log(`✅ Message Sent [${hre.network.name}] incrementCounter on destination OmniCounter @ [${remoteChainId}]`)
console.log(`tx: ${tx.transactionHash}`)
console.log(``)
console.log(`Note: to poll/wait for the message to arrive on the destination use the command:`)
console.log(` (it may take a minute to arrive, be patient!)`)
console.log("")
console.log(` $ npx hardhat --network ${taskArgs.targetNetwork} ocPoll`)
}