Build a Play2Earn Game Smart Contract

I followed the Tutorial Video part Two: https://www.youtube.com/watch?v=1_qCiL0qajs and when I try to transact, I got the below errors

src : https://github.com/ashbeech/moralis-phaser-demo

I tried adjusting the gas fees, same results…

the createGame method in the code have 4 input, different from the video ( _player, _treasury, _p, _t ) and I got the following error after following the video step by step .. Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? Internal JSON-RPC error.

{ "code": 3, "message": "execution reverted: ERC20: insufficient allowance", "data": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001d45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000" }

This error will be thrown when the erc20 balance is not enough or if you dont have the approval from the erc20 contract to transfer the amount of the tokens.

1 Like