I am beginning my journey in web3 so please be understanding 🙂
I am struggling to find an issue in my contract that uses VRF. It is a simple coinflip written in Vyper. I have deployed a consumer and checked it separately. I am able to receive random number.
I have the same calls in my contract that I have used for the test. I use ape and I receive
ContractLogicError. Metamask cannot estimate gas and also suggests that there is an error in the contract. I have deployed it on sepolia.
The contract works correctly with simple mock for the random part so that must be some problem with how I call or use the VRF. I have no idea why though.
Here is the contract:
Contract address on sepolia:
To verify if the consumer works you can call it directly. There is a script in the repo with consumer address:
Local contract execution with mocked random functionality:
The error happens when calling
resolve function. To be able to resolve the game you need to be either the owner of the contract or you need to be in the game. The easiest way to reproduce the error is to
join the game and then call
# HEADS=2; TAILS=4;
join_txn = coinflip.join(HEADS, sender=your_account, value="0.01 ether")
resolve_txn = coinflip.resolve(sender=your_account)
Appreciate all the help I can get. Thanks!