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.

6

1 Answer 1

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.

1
  • 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(). Commented Jun 6, 2022 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.