Reputation: 1
Here is my deploy script:
import hre from "hardhat";
import PassNFTModule from "../ignition/modules/PassNFT";
async function deploy() {
const { passNFTContract } = await hre.ignition.deploy(PassNFTModule);
const passNFTContractAddress = await passNFTContract.getAddress();
console.log("Pass NFT contract deployed to:", passNFTContractAddress);
const isPublicMintEnabled = await passNFTContract.isPublicMintEnabled();
console.log("Pass NFT contract isPublicMintEnabled:", isPublicMintEnabled);
}
deploy().catch(console.error);
And here is the PassNFT smart contrct:
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
contract PassNFT is ERC721, Ownable {
uint256 public mintPrice;
uint256 public totalSupply;
uint256 public maxSupply;
uint256 public maxPerWallet;
bool public isPublicMintEnabled;
string internal baseTokenUri;
address payable public withdrawWallet;
mapping(address => uint256) public walletMints;
constructor(string memory _tokenUri) payable ERC721('Pass NFT', 'MP') {
mintPrice = 0.01 ether;
totalSupply = 0;
maxSupply = 10000;
maxPerWallet = 1;
baseTokenUri = _tokenUri;
}
function setIsPublicMintEnabled(bool newPublicMintStatus) external onlyOwner {
isPublicMintEnabled = newPublicMintStatus;
}
...
}
The deploy command:
npx hardhat run scripts/deploy.ts --network localhost
When I deploy it for the first time, it works correctly but if I restart node and try to deploy it again I get the next error:
Error: could not decode result data (value="0x", info={ "method": "isPublicMintEnabled", "signature": "isPublicMintEnabled()" }, code=BAD_DATA, version=6.13.2)
So what am I doing wrong?
Upvotes: 0
Views: 218
Reputation: 1
Maybe is about the future object. Try to wipe it before deploying again. It is a tough topic but with this documentation maybe you can find it out.
https://hardhat.org/ignition/docs/advanced/reconciliation
Upvotes: 0