public-awesome / cw-nfts

Examples and helpers to build NFT contracts on CosmWasm
Apache License 2.0
188 stars 180 forks source link

ReceiveApproval callback #124

Open Art3miX opened 1 year ago

Art3miX commented 1 year ago

How about adding ReceiveApproval callback?

Logically speaking, receiving an approval to use the NFT has the same meaning as receiving the actual NFT, as far as the contract cares. This will make the flow much easier for marketplaces that use approval system, instead of a 2 msg system, where you first send approval, and then send the actual msg.

This will reduce complexity by a lot, and reduce number of queries needed, right now on each marketplace listing, you need to query for owner and approvals, this callback will make those queries not needed as you can just pass data with the callback.

We can add the callback to existing approval msg, or create a new message (much like transfer and send). Same idea can be applied to revoke.

Benefits:

  1. This will simplify the usage of approvals for contracts, and reduce much of the complexity
  2. Because of 1, this will increase the usage of approvals, which in my opinion are more secure then transferring ownership
  3. Doesn't break or block anything, and is backward compatible.