Closed dashDebasis123 closed 1 year ago
Hello! Thanks for making this issue.
Can you:
Make this a discusson on the full repo? https://github.com/Cyfrin/foundry-full-course-f23/discussions
Could you please remember to follow this section to format your questions? https://youtu.be/umepbfKp5rI?t=22464
While building a nftmarketplace , I got an error in running the mint-and-list.js in localhost
code for BasicNftTwo.sol ........................................................
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; contract BasicNftTwo is ERC721 { string public constant TOKEN_URI = "ipfs://QmdryoExpgEQQQgJPoruwGJyZmz6SqV4FRTX1i73CT3iXn"; uint256 private s_tokenCounter; event DogMinted(uint256 indexed tokenId); constructor() ERC721("Dogie", "DOG") { s_tokenCounter = 0; } function mintNft() public { _safeMint(msg.sender, s_tokenCounter); emit DogMinted(s_tokenCounter); s_tokenCounter = s_tokenCounter + 1; } function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); return TOKEN_URI; }
} ..............................................................................................................
code for mint-and-list.js ............................................................................................................... const { ethers, network } = require("hardhat") const { moveBlocks } = require("../utils/move-blocks")
const PRICE = ethers.parseEther("0.1")
async function mintAndList() { const nftMarketplace = await ethers.getContract("NftMarketplace") // const randomNumber = Math.floor(Math.random() * 2) const basicNft = await ethers.getContract("BasicNftTwo")
}
mintAndList() .then(() => process.exit(0)) .catch((error) => { console.error(error) process.exit(1) }) .................................................................................................
getting error TypeError: Cannot read properties of undefined (reading '0')