0

So I have gotten to the point in my NFT project where I am testing the minting from the website that I setup to mint from. I deployed to Rinkeby, and when I go to mint NFTs on my website, I get the error "Contract Execution reverted." Then when I go to Etherscan it tells me that Value transfer did not complete from a contract execution reverted I will attach my mint function here.

function whitelistMint(
    uint256 amount,
    bytes32[] calldata merkleProof
  ) public payable nonReentrant {
    address sender = _msgSender();
require(wlIsActive, "Whitelist sale is not open");
require(_verify(merkleProof, sender, maxWhitelistMint), "You are not whitelisted");
require(amount <= maxWhitelistMint - _alreadyMinted[sender], "Insufficient mints left");
require(msg.value == mintPrice * amount, "Incorrect payable amount");

_alreadyMinted[sender] += amount;
_internalMint(sender, amount);

}

Could this be an issue with gas estimation? Or is there a problem with my mint function? The weird part is that I can mint directly from Etherscan.

Gray Blanchard
  • 52
  • 1
  • 10

1 Answers1

2

The failed transaction calls the function with id 0xba41b0c6 which refers to the function

mint(uint256 amount, bytes32[] merkleProof)

But there isn't a function mint with that signature in the verified contract. There's a mint(uint256 amount) and whitelistMint(uint256 amount, bytes32[] merkleProof).

The contract doesn't have a fallback function so the call fails because there's nothing to execute.

You have to modify the code to call whitelistMint instead of mint.

Ismael
  • 30,570
  • 21
  • 53
  • 96
  • Ok ,so this is an error in my front-end code. I am using a no code website builder, and it is a pain to use with JavaScript. I was using my contract ABI to call the whitelistMint function, but I guess it was still looking for mint(). – Gray Blanchard Jun 06 '22 at 17:46