I'm using erc1155 and I have a contract fully working. I can mint, buy and sell NFTs using Wei. I then convert Wei to bnb and the user is requested to buy with bnb.
What I would like to do is to be able to trade NFTs with another erc20 token. How can I do that? I've tried to import the erc20 contract and call some functions to be able to trade in a different token without success.
Also, I've searched for a similar answer and haven't found any. Is there any tutorial you can point me to?
I think if you can buy the NFT with BNB, then it is easy to buy the NFT with an ERC20 token, you just need to make some slight adjustments, set this ERC20 token in your contract, and call function to receive this ERC20 token.
Hey, thanks for the input. Can you shed me some light on how to do that specifically? Import the contract erc20 and call those functions inside my buyItem function, for example?
In your second function buyItem, I am not sure how do you achieve your safeTransferFrom, do you use the library SafeERC20 in the OpenZeppelin repo? If so, maybe you mismatch the parameters.