EatTheBlocks Forum

Ethers js Contract Auto Approval

Hello,
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 -> https://github.com/decentraland/marketplace-contracts/blob/master/contracts/marketplace/Marketplace.sol

Thanks in advance.