EatTheBlocks Forum

Ethers js Contract Auto Approval

I am developing a dapp using ethersjs, which connects to my marketplace contract. I have three contracts: an erc20 token, a marketplace and an NFT contract. Basically the idea is user lists his NFT on marketplace which then purchased with approved erc20 token. Listing an NFT on the marketplace requires some amount of fee in that erc20 token. So listing procedure as follows:

  • User calls NFT.approve(marketplace.address)
  • User calls erc20token.approve(marketplace.address)
  • User calls marketplace.createOrder(nft.address, id)
    which makes this three separate approvals on metamask for a listing operation.
    I am just curious about combining these three approvals on one approval to improve user interaction. Is that possible ?
    If it helps I am using Decentraland’s Marketplace contract ->

Thanks in advance.

1 Like

If you use Polygon Platform, You can combine the 3 Approvals into one & Save on Gas Fee too.:grinning: