I am trying to build an nft marketplace where users buy nft using my own erc20 tokens. I want to eliminate the need for the user to set approval for the marketplace smart contract before they want to buy an nft. Is there any alternate such as setApprovalForAll() function for the erc721 contract?

2 Answers 2


You can use ERC20Permit extension, so users will approve with signature and transfer tokens in one tx. So in your nft contract buy func will be kind of "swap" of nft for received erc20.


For some ERC20 you can achieve something similar by calling

token.methods.approve(marketPlace, MAX_UINT256)

OpenZeppelin contracts implement that feature.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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