I'm getting this error when I try to run my Brownie Python script:
myAwesomeGasLimit = 200000
def enter_for_free():
account = get_account()
lottery = Lottery[-1]
tx = lottery.claimFreeEntry(
'0xD3311541C02595112db0e43F241e198E86079349',
{"from" : account, "gasLimit" : myAwesomeGasLimit}
)
tx.wait(1)
print("You successfully entered for free")
And here is the function from the solidity smart contract:
function claimFreeEntry(address _erc721_contract) public {
require(IERC721(msg.sender).balanceOf(_erc721_contract) > 0, "You are not eligible to play for free");
players.push(msg.sender);
}
As you can see there is not much going on, nevertheless I haven't been able to solve it for one hour now. Does anyone know what is wrong?
Exact Error: ValueError: Gas estimation failed: 'execution reverted'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually.
IERC721(_erc721_contract).balanceOf(msg.sender)