why and when is setApprovalForAll called?

Viewed 7416

I'm having a hard time understanding why and when SetApprovalForAll is called on NFT generating contracts.

Take Cool Cats, for example. And for convenience there's a screen shot of relevant transactions, below.

I've noticed that for this contract and others, Set Approval For All is repeatedly called. In my own limited experience with a contract that allows minting, via _safeMint, I'm seeing a SetApprovalForAll transaction in the logs too. It's not called directly in my code.

Why is it being called? Are wallets doing it as part of the minting process?

enter image description here

1 Answers

When you sell NFTs on a Marketplace, you need to authorize this marketplace to transfer sold items from your address to the buyer's address.

This is what SetApprovalForAll is used for: because you trust the marketplace, you "approve" it to sell your NFTs (not all your NFTs, but the NFTs you own in the context of this contract).

The marketplace is what is called the "operator" in the context of this API.

Related