public-awesome / cw-nfts

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

Add cw1155 and cw1155-metatdat-onchain #78

Open ALPAC-4 opened 2 years ago

ALPAC-4 commented 2 years ago

Cw1155 PR seems stop update. So I made new PR for adding cw1155

Most of the codes are based on cw-plus repository

What is Added?

  1. Can add token_uri and extension (metadata) when the first mint.
  2. Add balance query (all_balances) by token_id
  3. Add NumTokens query
  4. Add Minter query

What is Removed?

  1. Remove batch_mint
giorgionocera commented 1 year ago

Hi! I was rapidly looking at this contract to provide some support. I'm sorry because I don't have much time right now to help with the code; I noticed something I think is wrong. https://github.com/ALPAC-4/cw-nfts/blob/9e35f1ebacf0db34b2d9cad5c078c0d99cde6a24/contracts/cw1155-base/src/execute.rs#L119

Here, the token increment happens only if the token does not already exist. So when you mint a token after the first mint, this quantity is not updated and the state is corrupted. You can try to modify the tests to see the error, for example by minting the token at two different moments in time and then trying to access the balance.

What do you think? I hope this could help.

apolloshab commented 4 months ago

development of cw1155 is being continued here: https://github.com/CosmWasm/cw-nfts/pull/162