public-awesome / cw-nfts

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

Does Receive Conflict with CW20? #37

Closed frankfka closed 2 years ago

frankfka commented 2 years ago

From the code, it seems like implementing the receiver "interface", we must have an ExecuteMsg::Receive: https://github.com/CosmWasm/cw-nfts/blob/11c62b95d464d7cba5e8f8c43e546f65a5fe398b/packages/cw721/src/receiver.rs#L6

However, CW20 also has this requirement: https://github.com/CosmWasm/cw-plus/tree/main/packages/cw20#receiver

Is it possible to be a receiver for both CW20 and CW721?

ethanfrey commented 2 years ago

They do seem to be the same.

There is a valid proposal for a rename to ReceiveNft for this cw721 variant. I don't know if any one (many) are using this interface in the wild. It would be good to know how API breaking one can be without messing with deployed contracts

frankfka commented 2 years ago

They do seem to be the same.

There is a valid proposal for a rename to ReceiveNft for this cw721 variant. I don't know if any one (many) are using this interface in the wild. It would be good to know how API breaking one can be without messing with deployed contracts

Actually - is this true? Looking at the code, it seems like the message is already named ReceiveNft, not Receive: https://github.com/CosmWasm/cw-nfts/blob/11c62b95d464d7cba5e8f8c43e546f65a5fe398b/packages/cw721/src/receiver.rs#L18

ethanfrey commented 2 years ago

Haha, I wrote this 1 year ago, and I assume you were referencing the code saying they were the same. Guess I thought this item through already and the answer is no.