This is my mint function, “not enough eth sent” error shows up on minting even though there is enough eth in the wallet.
mint price is: 0.05 ether
and there is much more in the rinkeby test net in my wallet.
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "erc721a/contracts/ERC721A.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract STETTE is ERC721A, Ownable, ReentrancyGuard {
uint256 public mintPrice;
uint256 public maxSupply;
uint256 public maxPerWallet;
//uint256 public totalSup;
bool public isPublicMintEnabled;
string internal baseTokenURI;
mapping(address => uint256) public walletMints;
constructor() payable ERC721A("STETTE", "ST") {
mintPrice = 50000000000000000; //0.05 ETH
maxSupply = 1000;
maxPerWallet = 3;
//totalSup = 0;
}
function setIsPublicMintEnabled(bool _isPublicMintEnabled)
external
onlyOwner
{
isPublicMintEnabled = _isPublicMintEnabled;
}
function setBaseTokenURI(string calldata _baseTokenURI) external onlyOwner {
baseTokenURI = _baseTokenURI;
}
function tokenURI(uint256 tokenId_)
public
view
override
returns (string memory)
{
require(_exists(tokenId_), "Token does not exist!");
return
string(
abi.encodePacked(
baseTokenURI,
Strings.toString(tokenId_),
".json"
)
);
}
function withdraw() external onlyOwner nonReentrant {
(bool success, ) = msg.sender.call{value: address(this).balance}("");
require(success, "Transfer failed.");
}
function mint(uint256 quantity_) external payable {
require(isPublicMintEnabled, "mint is not active");
require(totalSupply() + quantity_ < maxSupply, "exceeded max sup");
require(
_numberMinted(msg.sender) + quantity_ <= maxPerWallet,
"can not mint this many"
);
_safeMint(msg.sender, quantity_);
}
}