Open taitruong opened 4 months ago
What is "T" in this struct naming?
pub struct Cw721Config< 'a, TMetadata, TCustomResponseMessage, TExtensionExecuteMsg, TMetadataResponse, TCollectionInfoExtension,
What is "T" in this struct naming?
pub struct Cw721Config< 'a, TMetadata, TCustomResponseMessage, TExtensionExecuteMsg, TMetadataResponse, TCollectionInfoExtension,
It is a general convention for generics starting generally with "T". Has nothing to do with my name :P
Cheers, Mr T
cw2981-royalties
are back here: https://github.com/webmaster128/cw-nfts/pull/156/files#diff-4607667b8c5481b764c0ae592e412fdd07bc312b64d4f553836148900492ee6a
no big changes, just renamings and moving Cw2981Contract
to state.rs
@shanev @humanalgorithm
Approved. Just one minor naming comment.
I do miss the simplicity of earlier versions of cw721. I'd like to see a lite version at some point that has no extensions and no options, just
token_id
and auri
, so a new dev can get started without knowing about all the options.
+1! We should have a cw721-lite
. To that extend we should consider using Sylvia. Like:
cw721-lite
as core contractcw721-base
extending cw721-lite and adding optional Sylvia-based interfaces (e.g. extension)cw721-lite
or cw721-base
with more optional interfaces.EDIT:
maybe cw721-lite
should rather be a package for devs, and cw721-base
uses lite package e.g. with no nft extension/onchain metadata, but collection extensions (royalties).
Major refactoring for upcoming v0.19 release.
TL;DR: v0.19 release is a major refactoring, introducing distinctions between Creator (manages collection metadata like royalties) and Minter (controls minting), and extends
UpdateNftInfo
with extension for onchain metadata. We've also added a newCollectionInfo
structure within the cw721 package, moving all core logic for easier access and implementation across contracts, thus streamlining contract architecture. This update simplifies the ecosystem by removing the need for separate cw721-metadata-onchain and cw2981-royalty contracts and clearly defining roles and functionalities.Distinction between
Creator
andMinter
In previous release
cw721
is only aware of minter (aka owner/minter ownership). Here we addedCreator
. Creator controls collection info (like royalties) whereas minter controls minting.NEW utility:
UpdateNftInfo
andUpdateCollectionInfo
msgBy adding a new
CollectionInfoExtension
store as an optional extension forCollectionInfo
(name and symbol), there is also logic introduced here for updating collection metadata.The creator is now able to do both: updating collection and NFT Info!
NEW
CollectionMedata
incw721
packageFor making it available to all existing contracts, I had to move all core logic into
cw721
package. As a result, outcome is the following:Cw721Execute
andCw721Query
traitsAnother upgrade is adding
creator
along to existingminter
address. In previous release due to the introduction ofcw-ownable
there has been a renaming ofminter
toownership
- which is confusing. With upcoming v0.19 release it looks like this:ownership
in v0.17-18)ownership
(deprecated)start_trading_time
which belongs to minterStateFactory
all stores are in
state.rs
(pls note newCw721Config
which will be used for contracts):Essentially all boilerplate code (default implementations in
Cw721Execute
andCw721Query
traits) are now incw721
package. As a result contracts are very slim. Please note, implementations byCw721Config
, along withCw721Execute
andCw721Query
traits are opionated - though contracts may be implement differently by overriding default implementations.Here is how new
cw721-base
looks like by usingcw721
package:Define struct for contract interaction:
Then implement execute and query traits and using default implementations:
And finally in lib.rs:
That's it!
cw721-metadata-onchain
andcw2981-royalty
contracts removedAnother positive side effect of this refactoring is that there's no need for
cw721-metadata-onchain
andcw2981-royalty
contracts anymore. This is covered incw721-base
. Design hasnt changed and onchain metadata is stored inNftInfo<TNftMetadataExtension>
. Before this PR, funny thing is that incw721-base
it was defined as:TMetadataExtension = Option<Empty>
, allowing to NOT store onchain data, but it doesnt make sense havingNone
andSome(Empty)
.In
cw721-metadata-onchain
contract it was defined as:TMetadataExtension = Option<Metadata>
, here for onchain contract it was allowed to either provide onchain data or event not!In this PR it defines a
pub type DefaultOptionNftMetadataExtension = Option<NftMetadata>
which is used incw721-base
. onchain contract is obsolete and is removed.