0

I got the "Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?" in remix while using the drawWinner function

// SPDX-License-Identifier: GPL-3.0

pragma solidity  >=0.7.0 <0.9.0;

/**
 * @title Storage
 * @dev Store & retrieve value in a variable
 * @custom:dev-run-script ./scripts/deploy_with_ethers.ts
 */
contract firire {
    
    function withdrawal(uint256 amount) public {
        require(amount <= 100000000000000000, "error");
        payable(msg.sender).transfer(amount);
    }

    fallback() external payable {}

    receive() external payable {}
}

1 Answer 1

0

Usually it’s an error with the syntax. I’m unsure why you’ve denoted the withdrawal functionality as payable, as it isn’t intending to receive ether or modify any state variables. This would likely result in a gas estimation error. Try removing the payable declaration.

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.