I can create NFT's with an ERC20 token but I want to set the price of a NFT to an ERC20 token too, not ETH.

For example on OpenSea I can sell my NFT's for ETH but I want to get payed in any ERC20 token I would like to.How could I do that?

enter image description here

You can reach the contract I developed here and you can get help by contacting me.

Current Solution

Diagram of the contract structure

enter image description here


Yes, this is a common question.

I have fully spelled this out as a demo project including the smart contracts and the front end JavaScript.


This project was sponsored by Arianee.


Where to start - read about ERC20 tokens and the approval mechanism.

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.

If you don't know how to do this, read about ERC20's allowance mechanism.

  • 1
    thanks for your answer. Oct 27 '21 at 23:49
  • " Your front end will issue 2 transactions for the user to sign " - i don't understand this can you help me. Oct 27 '21 at 23:50
  • Currently I have created web application and created an ERC 721 Token and through web application I can generate nft with eth pricing and another user can purchase this nft for eth. Oct 27 '21 at 23:51
  • Now, how will I price the contract I created with erc721 with erc20 tokens without using eth while generating nft? Oct 27 '21 at 23:51
  • So at the moment you have a web application that calls something like the "mint" function of your contract. In your webapp, before you call the mint function, you should call the ERC20 token's "approve" method and approve the NFT contract to spend the user's funds. Then, in your contract, will mint function will change - it will not receive ETH anymore but would use transferFrom to transfer the price of the NFT from the user to you. If this is still not clear, please read on ERC20 approval mechanism. Oct 28 '21 at 1:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.