Smart Contract

IPackNFT

A.b6f2481eba4df97b.IPackNFT

Deployed

1w ago
Feb 19, 2026, 10:36:10 AM UTC

Dependents

2 imports
1import Crypto
2import NonFungibleToken from 0x1d7e57aa55817448
3
4/// Contract interface for PackNFT contracts.
5///
6access(all) contract interface IPackNFT{
7
8    /// Entitlement to perform operations on the PackNFT
9    ///
10    access(all) entitlement Operate
11
12    /// StoragePath for Collection Resource
13    ///
14    access(all) let CollectionStoragePath: StoragePath
15
16    /// PublicPath expected for deposit
17    ///
18    access(all) let CollectionPublicPath: PublicPath
19
20    /// PublicPath for receiving PackNFT
21    ///
22    access(all) let CollectionIPackNFTPublicPath: PublicPath
23
24    /// StoragePath for the PackNFT Operator Resource (issuer owns this)
25    ///
26    access(all) let OperatorStoragePath: StoragePath
27
28    /// Request for Reveal
29    ///
30    access(all) event RevealRequest(id: UInt64, openRequest: Bool)
31
32    /// Request for Open
33    ///
34    /// This is emitted when owner of a PackNFT request for the entitled NFT to be
35    /// deposited to its account
36    access(all) event OpenRequest(id: UInt64)
37
38    /// Burned
39    ///
40    /// Emitted when a PackNFT has been burned
41    access(all) event Burned(id: UInt64 )
42
43    /// Opened
44    ///
45    /// Emitted when a packNFT has been opened
46    access(all) event Opened(id: UInt64)
47
48    // TODO: Clean up after enum handling/removal is clarified.
49    // Enums cannot be declared anymore in interfaces in Cadence 1.0
50    // access(all) enum Status: UInt8 {
51    //     access(all) case Sealed
52    //     access(all) case Revealed
53    //     access(all) case Opened
54    // }
55
56    /// Struct interface for Collectible
57    ///
58    access(all) struct interface Collectible {
59        access(all) let address: Address
60        access(all) let contractName: String
61        access(all) let id: UInt64
62        access(all) fun hashString(): String
63        view init(address: Address, contractName: String, id: UInt64)
64    }
65
66    /// Resource interface for PackNFT
67    ///
68    access(all) resource interface IPack {
69        access(all) let issuer: Address
70        // access(all) var status: Status
71
72        access(all) fun verify(nftString: String): Bool
73
74        access(contract) fun reveal(id: UInt64, nfts: [{IPackNFT.Collectible}], salt: String)
75        access(contract) fun open(id: UInt64, nfts: [{IPackNFT.Collectible}])
76        view init(commitHash: String, issuer: Address)
77    }
78
79    /// Resource interface for IOperator
80    ///
81    access(all) resource interface IOperator {
82        access(Operate) fun mint(distId: UInt64, commitHash: String, issuer: Address): @{IPackNFT.NFT}
83        access(Operate) fun reveal(id: UInt64, nfts: [{Collectible}], salt: String)
84        access(Operate) fun open(id: UInt64, nfts: [{IPackNFT.Collectible}])
85    }
86
87    // Included for backwards compatibility
88    access(all) resource interface PackNFTOperator: IOperator {}
89
90    /// Resource interface for IPackNFTToken
91    ///
92    access(all) resource interface IPackNFTToken {
93        access(all) let id: UInt64
94        access(all) let issuer: Address
95    }
96
97    /// Resource interface for NFT
98    ///
99    access(all) resource interface NFT: NonFungibleToken.NFT, IPackNFTToken, IPackNFTOwnerOperator {
100        access(all) let id: UInt64
101        access(all) let issuer: Address
102    }
103
104    /// Resource interface for PackNFT Collection
105    ///
106    access(all) resource interface IPackNFTCollectionPublic: NonFungibleToken.Collection {
107        access(NonFungibleToken.Update) fun emitRevealRequestEvent(id: UInt64, openRequest: Bool)
108        access(NonFungibleToken.Update) fun emitOpenRequestEvent(id: UInt64)
109    }
110
111    // Included for backwards compatibility
112    access(all) resource interface IPackNFTOwnerOperator{}
113
114    /// Reveal a Sealed Pack NFT
115    ///
116    access(all) fun publicReveal(id: UInt64, nfts: [{IPackNFT.Collectible}], salt: String)
117}