Phaser-moralis-demo error

I cloned the phaser-moralis-demo from github and set up my .env file with correct REACT_APP_MORALIS_APPLICATION_ID and REACT_APP_MORALIS_SERVER_URL,
but when I press ā€œStartā€ on Main Menu,
Metamask popā€™s up and asks me to ā€œSign Inā€,
after pressing the button, nothing happens, the game DOESNā€™T load for some reason
and only the starting screen is displayed.
Iā€™m probably doing something wrong, help?
Thanks in advance!

Hereā€™s the error that pops up in Chrome:

Error Error: network does not support ENS (operation=ā€œgetResolverā€, network=ā€œmaticmumā€, code=UNSUPPORTED_OPERATION, version=providers/5.6.0)
at Logger.makeError (index.ts:261:1)
at Logger.throwError (index.ts:273:1)
at Web3Provider. (base-provider.ts:1963:1)
at Generator.next ()
at fulfilled (base-provider.ts:1:1)

You need to insert the necessary contract addresses for REACT_APP_TOKEN_CONTRACT and
REACT_APP_P2E_CONTRACT in your .env file.

You will need to follow the tutorials linked here to get this working.

Have you installed redux?

npm i redux

npm i redux-thunk

npm i redux-logger

Hi, not able to figure out why when i login to play the game it doesnt deduct or transfer any tokens whether i win or lose. For the contract on remix, everything is working perfectly, but when i play the game live its not registering results or making any transfers. Any help would be appreciated.

Do you get any errors? Have you compared your code with the repo? In the game/app, double check all the parameters - ABI, address, correct chain set in the wallet and/or code, etc.

Yes, but i do think the issue im having could be in relation to setting up the cloud file on the server. Could this be the problem? If remix is working but when i run it live its not working.

Make sure your cloud code has the correct options - chain, contract address, private key for your wallet, correct speedy node URL for the chain. You can try those [commands at the bottom of the cloud file] or running each cloud function manually (https://github.com/ashbeech/moralis-phaser-demo/blob/main/src/components/Cloud/CloudFile.js) to test the functions.

If you canā€™t get it working you can share a complete repo.

I never entered the private key. Will enter it and try it. Before i do so, i was a bit confused with the ABI as well. What i have done was:

Copy pasted the Cloudfile.js into the server cloud functions

As for the ABI, i see two files Gametoken.json and P2Egame.json should i copy paste the P2Egame.json into the cloud server?

because the abi i have entered now is the one i took from remix, but it seems too short in comparison to what the .json file has

As for the ABI, i see two files Gametoken.json and P2Egame.json should i copy paste both of them into the cloud for the server?

If both of the contracts are being used in the cloud code then yes their ABIs need to be in there. The tutorial should cover what you need to do.

Could this be the reason for the contract not working in game

ParserError: Source ā€œ@openzeppelin/contracts/utils/Context.solā€ not found: File import callback not supported
ā€“> myc:4:1:
|
4 | import ā€œ@openzeppelin/contracts/utils/Context.solā€
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source ā€œ@openzeppelin/contracts/access/Ownable.solā€ not found: File import callback not supported
ā€“> myc:5:1:
|
5 | import ā€œ@openzeppelin/contracts/access/Ownable.solā€
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source ā€œ@openzeppelin/contracts/token/ERC20/ERC20.solā€ not found: File import callback not supported

Hi, i was able to find a few issues and fix them, had never installed openzepellin that took of a few errors from the code, now it seems flawless but P2E function still doesnt work. When i test the contract on remix i get this error:

Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
execution reverted: ERC20: insufficient allowance { ā€œoriginalErrorā€: { ā€œcodeā€: 3, ā€œdataā€: ā€œ0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001d45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000ā€, ā€œmessageā€: ā€œexecution reverted: ERC20: insufficient allowanceā€ } }

The error happens when i enter player as one wallet and treasury as admin wallet. When I enter both wallets as admins the transaction goes through.

What could the issue be here?create game

Tried a few more different options. No other wallet can be a player, only admins wallet. Treasury can be any wallet, including admins wallet. These two seem to be mixed up as it should be the other way around. Could you help please in switching this up in the contract?

The ERC20: insufficient allowance means the calling wallet address (player) doesnā€™t have enough allowance. From the admin wallet, you can call the approve function on the contract to give more allowance to the player address.

I tried with the test addresses included in the contract, still the same thing, plus each of my wallets now hold nearly an equal amount of tokens but its still the same thing. I have been looking at the contract, the difference between the old contract (the one in the video) and the new one on github is this that on youtube contract says player starts the game, while on githubs contract says admin starts the game.

// admin starts game

// staked tokens get moved to the escrow (this contract)

function createGame(

    address _player,

    address _treasury,

    uint256 _p,

    uint256 _t

Also, on the github contract there is this line of code, does it suggest that the coded approval isnt working?

    // approve contract to spend amount tokens
    // NOTE: this approval method doesn't work and player must approve token contract directly
    //require(token.approve(address(this), _balance), "P2EGame: approval has failed");
    // must include amount >1 token (1000000000000000000)

I increased allowances, still nothing, only allows admin wallet to be the player while any wallet can be treasury.

Please maybe you could take a look at the contract, i can paste it here, its just weird that it allows for any wallet to be placed as a treasury and only admins wallet to be placed as a player. Shouldnt it be the other way around?