How play to earn games give tokens to players?

Hello, I'm building an nft game with my custom erc20 token and Erc721 nfts.
I would like to know how play to earn games are giving their erc20 token to players who win battles with their erc721.

Are they minting this tokens and then giving them to players? If so, how do I connect the erc721 contract with ERC20 token so I can send the tokens Once that nft won a fight?

1 Like

Hi Daniel_Mari!
You can mint it and give it to the player when they win a match (I think of a function in your backend that deals with this).
I need more information though about this process...what do you mean with "give tokens to players who win battles with their erc712"?
I would write two different Smart Contracts to address this problem one for the tokens and one for the ERC721.
When the player wins the match you simply call the function to mint the tokens, this is how they do this tipically

1 Like

Hi Allennick,
Thank you for the answer.

Let's imagine I've the erc721 contract finished. When someone owns this erc721, he have the option to "fight" function, choose an enemy erc721 of the same contract and get a chance to win a price.

I would like to send my custom erc20 as the price. The problem is that I can't mint the erc20 token from the erc721 contract? Or yes?

Do you've experience in this type of project? I would like to hire someone to help and advise me

You can, you just need to give minting functionality to the contract that is going to manage the fights between the 2 ERC721s.

But I'm minting another different token.. I would need to call that mint function externally from the other contract?

Could you send an example, please?

1 Like

I dont have a working example on hand. Conceptually, you should have 3 contracts:

  1. an erc20 token contract w/ mint function
  2. an erc721 NFT contract
  3. a third contract that manages "fights" between 2 NFTs. This contract should have permissions to mint tokens to the winner of the fight.

The world of play-to-earn games has got me really intrigued lately, and I've been digging into how these games offer tokens to players. It's fascinating to see how you can play games for money free, essentially turning your gaming passion into a money-making opportunity. These games are changing the way we look at leisure time! If you're curious about the mechanics behind these play-to-earn games, there's a great resource out there that goes into detail.