From 50ae268617c382a046e8e60a4bef077dd0abf2b2 Mon Sep 17 00:00:00 2001 From: Ryan Goulding Date: Thu, 2 Nov 2023 16:24:16 -0700 Subject: [PATCH] fix ONFT721 example Just fix the ONFT721 example so it is able to be run. Signed-off-by: Ryan Goulding --- README.md | 4 ++-- deploy/ONFT721.js | 25 ++++++------------------- tasks/index.js | 5 ++++- tasks/onftMint.js | 5 +---- 4 files changed, 13 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 7ae9a8ed..e0f23528 100644 --- a/README.md +++ b/README.md @@ -106,8 +106,8 @@ npx hardhat --network fuji setMinDstGas --target-network bsc-testnet --contract 4. Mint an NFT on each chain! ```shell -npx hardhat --network bsc-testnet onftMint --contract ONFT721Mock -npx hardhat --network fuji onftMint --contract ONFT721Mock +npx hardhat --network bsc-testnet onftMint --contract ONFT721Mock --to-address
--token-id 1 +npx hardhat --network fuji onftMint --contract ONFT721Mock --to-address
--token-id 11 ``` 5. [Optional] Show the token owner(s) diff --git a/deploy/ONFT721.js b/deploy/ONFT721.js index d572e9f5..ec20f51b 100644 --- a/deploy/ONFT721.js +++ b/deploy/ONFT721.js @@ -1,19 +1,4 @@ const LZ_ENDPOINTS = require("../constants/layerzeroEndpoints.json") -const ONFT_ARGS = { - "bsc-testnet": { - "startMintId": 1, - "endMintId": 10 - }, - "fuji": { - "startMintId": 11, - "endMintId": 20 - }, - "goerli": { - "startMintId": 21, - "endMintId": 30 - } -} - module.exports = async function ({ deployments, getNamedAccounts }) { const { deploy } = deployments @@ -21,13 +6,15 @@ module.exports = async function ({ deployments, getNamedAccounts }) { console.log(`>>> your address: ${deployer}`) const lzEndpointAddress = LZ_ENDPOINTS[hre.network.name] - const onftArgs = ONFT_ARGS[hre.network.name] - console.log({ onftArgs }) console.log(`[${hre.network.name}] Endpoint Address: ${lzEndpointAddress}`) - await deploy("ONFT721", { + const name = "ONFT721Mock" + const symbol = "SYM" + const minGasToStore = 100000 + + await deploy("ONFT721Mock", { from: deployer, - args: [lzEndpointAddress, onftArgs.startMintId, onftArgs.endMintId], + args: [name, symbol, minGasToStore, lzEndpointAddress], log: true, waitConfirmations: 1, }) diff --git a/tasks/index.js b/tasks/index.js index 61b53fbd..70363b31 100644 --- a/tasks/index.js +++ b/tasks/index.js @@ -117,7 +117,10 @@ task("oftv2Send", "send tokens to another chain", require("./oftv2Send")) .addOptionalParam("contract", "If both contracts are the same name") // -task("onftMint", "mint() mint ONFT", require("./onftMint")).addParam("contract", "Name of contract") +task("onftMint", "mint() mint ONFT", require("./onftMint")) + .addParam("toAddress", "address to mint the ONFT to") + .addParam("tokenId", "the tokenId of the ONFT") + .addParam("contract", "Name of contract") // task("ownerOf", "ownerOf(tokenId) to get the owner of a token", require("./ownerOf")) diff --git a/tasks/onftMint.js b/tasks/onftMint.js index 4cf62674..bf91af5b 100644 --- a/tasks/onftMint.js +++ b/tasks/onftMint.js @@ -2,7 +2,7 @@ module.exports = async function (taskArgs, hre) { let contract = await ethers.getContract(taskArgs.contract) try { - let tx = await (await contract.mint()).wait() + let tx = await (await contract.mint(taskArgs.toAddress, taskArgs.tokenId)).wait() console.log(`✅ [${hre.network.name}] mint()`) console.log(` tx: ${tx.transactionHash}`) let onftTokenId = await ethers.provider.getTransactionReceipt(tx.transactionHash) @@ -15,6 +15,3 @@ module.exports = async function (taskArgs, hre) { } } } - -// npx hardhat --network bsc-testnet onftMint --contract ExampleUniversalONFT721 -// npx hardhat --network fuji onftMint --contract ExampleUniversalONFT721