forked from LayerZero-Labs/endpoint-v1-solidity-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbatchSendProxyONFT1155.js
27 lines (23 loc) · 1.74 KB
/
batchSendProxyONFT1155.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const CHAIN_IDS = require("../constants/chainIds.json")
const ENDPOINTS = require("../constants/layerzeroEndpoints.json")
module.exports = async function (taskArgs, hre) {
const signers = await ethers.getSigners()
const owner = signers[0]
const proxyONFT1155 = await ethers.getContract("ProxyONFT1155")
const dstChainId = CHAIN_IDS[taskArgs.targetNetwork]
const tokenIds = taskArgs.tokenIds.split(",")
const quantities = taskArgs.quantities.split(",")
console.log(tokenIds)
console.log(quantities)
const payload =
"0x000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000014f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001"
const endpoint = await ethers.getContractAt("ILayerZeroEndpoint", ENDPOINTS[hre.network.name])
let fees = await endpoint.estimateFees(dstChainId, proxyONFT1155.address, payload, false, "0x")
console.log(`fees[0] (wei): ${fees[0]}`)
let tx = await (
await proxyONFT1155.sendBatch(dstChainId, owner.address, tokenIds, quantities, owner.address, ethers.constants.AddressZero, "0x", {
value: fees[0],
})
).wait()
console.log(`send tx: ${tx.transactionHash}`)
}