Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ONFT721 example #127

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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