0

I have a payable function that works fine when calling without any eth, but if I try to call it with eth it gives me a gas estimation fail.

I have another function that is payable and works fine when sending eth, so I know I can send eth fine normally, so what gives?

Code:

function mintRandom(uint256 amount) public payable {
    require(totalSupply() < MAX_NFT_SUPPLY, "All sold");
    require(amount >= 1 && amount <= 10, "Must mint at least one NFT, and no more than 10");
    require(totalSupply() + amount < MAX_NFT_SUPPLY, "You are attempting to mint more NFT's than available");
    require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK - contract will be funded soon");
    
    //require(msg.value >= 10000000000000000, "Must send 0.01 ETH");

    bytes32 requestId = requestRandomness(keyHash, fee, 0);
    owners[requestId] = msg.sender;
    amountToMint[requestId] = amount;
}

function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
    randomResult = randomness;
    
    address owner = owners[requestId];
    uint256 originalIndex = randomResult % MAX_NFT_SUPPLY;
    uint256 i = originalIndex;
    
    uint256 amount = amountToMint[requestId];

 }
1
  • The only use of msg.value is commented out so it is unlikely to cause problems.
    – Ismael
    Jun 22 at 2:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.