Skip to content

Commit

Permalink
fix ONFT721 example
Browse files Browse the repository at this point in the history
Just fix the ONFT721 example so it is able to be run.

Signed-off-by: Ryan Goulding <[email protected]>
  • Loading branch information
ryandgoulding committed Nov 3, 2023
1 parent 26b283d commit 706e141
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 26 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <address> --token-id 1
npx hardhat --network fuji onftMint --contract ONFT721Mock --to-address <address> --token-id 11
```

5. [Optional] Show the token owner(s)
Expand Down
25 changes: 6 additions & 19 deletions deploy/ONFT721.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,20 @@
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
const { deployer } = await 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,
})
Expand Down
5 changes: 4 additions & 1 deletion tasks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
5 changes: 1 addition & 4 deletions tasks/onftMint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

0 comments on commit 706e141

Please sign in to comment.