nft-marketplace
nft-marketplace copied to clipboard
it is possible to pay for ERC721 nft with existing ERC20 token
I have created my own ERC20 token already (1 year ago).
Now i try to deploy the ERC721 token for NFT marketplace. After i deploy by the tutorial everything work well. i
But if i want to mint, buy, sell via my own ERC20 token
How i can do ?
change the contract on .sol or something else ?
pls help me or explain
thx :)
Hey, @NakamuraTokio! I believe you would have to implement some token transfers logic inside the ERC721 contract, in a way it removes a given ERC20 token quantity in the msg.sender account when he mints the NFT. He would have to approve it first, of course. If you give me a few days I can try it myself, but feel free to try it too if you've got the idea.
Hey, @NakamuraTokio! I believe you would have to implement some token transfers logic inside the ERC721 contract, in a way it removes a given ERC20 token quantity in the msg.sender account when he mints the NFT. He would have to approve it first, of course. If you give me a few days I can try it myself, but feel free to try it too if you've got the idea.
thank you for your reply. i try to find the solution a week already. T_T
btw, if you can figure out this. will be very grateful
What's up, @NakamuraTokio. I hope you've found a solution already. However, in case you haven't, I've managed it to implement in my project. Feel free to check it out, it's on feat/use-custom-token branch. You can see the diff code on #2: https://github.com/Markkop/nft-marketplace/pull/2/files
We're basically using the ERC20 .approve
method before calling the createMarketItem
and createMarketSale
functions and using .transferFrom
inside them.
Let me know if need help understanding it!