Smart Contract

Revealable

A.7752ea736384322f.Revealable

Deployed

3h ago
Feb 28, 2026, 08:14:46 PM UTC

Dependents

0 imports
1// Description
2
3import MetadataViews from 0x1d7e57aa55817448
4import TheFabricantMetadataViews from 0x7752ea736384322f
5import CoCreatable from 0x7752ea736384322f
6
7access(all) contract interface Revealable {
8
9    // When an NFT is minted, its metadata is stored here
10    access(contract) var nftMetadata: {UInt64: {RevealableMetadata}}
11
12    access(all) fun getNftMetadatas(): {UInt64: {RevealableMetadata}}
13
14    // Mutable-Template based NFT Metadata.
15    // Each time a revealable NFT is minted, a RevealableMetadata is created
16    // and saved into the nftMetadata dictionary. This represents the
17    // bare minimum a RevealableMetadata should implement
18    access(all) struct interface RevealableMetadata {
19
20        //NOTE: totalSupply value of attached NFT, therefore edition number. 
21        // nfts are currently stored under their id in the collection, so
22        // this should be used as the key for the nftMetadata dictionary as well
23        // for consistency.
24        access(all) let id: UInt64 
25
26        // NOTE: nftUuid is the uuid of the associated nft.
27        access(all) let nftUuid: UInt64 // uuid of NFT
28        
29        // NOTE: Name of NFT. Will most likely be the last node in the collection value.
30        // eg XXories Original.
31        // Will be combined with the edition number on the application
32        // Doesn't include the edition number.
33        access(all) var name: String
34
35        access(all) var description: String //Display
36        // NOTE: Thumbnail, which is needed for the Display view, should be set using one of the
37        // media properties
38        //access(all) let thumbnail: String //Display
39
40        access(all) let collection: String // Name of collection eg The Fabricant > Season 3 > Wholeland > XXories Originals
41
42        // Stores the metadata associated with this particular creation
43        // but is not part of a characteristic eg mainImage, video etc
44        access(all) var metadata: {String: AnyStruct}
45
46        //These are the characteristics that the 
47        access(all) var characteristics: {String: {CoCreatable.Characteristic}}
48
49        // The numerical score of the rarity
50        access(all) var rarity: UFix64?
51        // Legendary, Epic, Rare, Uncommon, Common or any other string value
52        access(all) var rarityDescription: String?
53
54        // NOTE: Media is not implemented in the struct because MetadataViews.Medias
55        // is not mutable, so can't be updated. In addition, each 
56        // NFT collection might have a different number of image/video properties.
57        // Instead, the NFT should implement a function that rolls up the props
58        // into a MetadataViews.Medias struct
59        //access(all) let media: MetadataViews.Medias //Media
60
61        //URL to the collection page on the website
62        access(all) let externalURL: MetadataViews.ExternalURL //ExternalURL
63        
64        access(all) let coCreatable: Bool
65        access(all) let coCreator: Address
66
67        // Nil if can't be revealed, otherwise set to true when revealed
68        access(all) var isRevealed: Bool?
69
70        // id and editionNumber might not be the same in the nft...
71        access(all) let editionNumber: UInt64 //Edition
72        access(all) let maxEditionNumber: UInt64?
73
74        access(all) let royalties: MetadataViews.Royalties //Royalty
75        access(all) let royaltiesTFMarketplace: TheFabricantMetadataViews.Royalties
76
77        access(contract) var revealableTraits: {String: Bool}
78
79        access(all) fun getRevealableTraits(): {String: Bool}
80
81        // Called by the Admin to reveal the traits for this NFT.
82        // Should contain a switch function that knows how to modify
83        // the properties of this struct. Should check that the trait
84        // being revealed is allowed to be modified.
85        access(contract) fun revealTraits(traits: [{RevealableTrait}])
86
87        access(contract) fun updateMetadata(key: String, value: AnyStruct)
88
89        // Called by the nft owner to modify if a trait can be 
90        // revealed or not - used to revoke admin access
91        access(all) fun updateIsTraitRevealable(key: String, value: Bool)
92
93        access(all) fun checkRevealableTrait(traitName: String): Bool?
94
95    }
96
97    access(all) struct interface RevealableTrait {
98        access(all) let name: String
99        access(all) let value: AnyStruct
100    }
101}
102