Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

it is possible to pay for ERC721 nft with existing ERC20 token #1

Open
Nakinthorn opened this issue Jan 22, 2022 · 3 comments
Open

Comments

@Nakinthorn
Copy link

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 :)

@Markkop
Copy link
Owner

Markkop commented Jan 22, 2022

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.

@Nakinthorn
Copy link
Author

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

@Markkop
Copy link
Owner

Markkop commented Jan 30, 2022

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants