I'm building a game and I want when the player clicks to buy a erc721 token to pay with my costum erc20 token. Can anyone explain how to do it?
1 Answer
Your front end will issue 2 transactions for the user to sign - one to approve the ERC20 payment, and one to your "mint" function which will transfer the payment to you and send the tokens to the user.
You can look at this repo : https://github.com/decentraland/marketplace-contracts/blob/master/contracts/marketplace/Marketplace.sol
Source: Is this possible to pay for ERC721 token with ERC20 token not ETH?