Smart Contract

Admin

A.5eb12ad3d5a99945.Admin

Deployed

1d ago
Feb 27, 2026, 12:31:07 PM UTC

Dependents

0 imports
1import NFTStorefront from 0x5eb12ad3d5a99945
2
3pub contract Admin {
4
5    pub let AdminStoragePath: StoragePath
6    pub let AdminPublicPath: PublicPath
7
8    pub event InitAdmin()
9    pub event AddedCapability(owner: Address)
10
11    pub resource interface AdminStorefrontManagerPublic {
12        pub fun addCapability(_ cap: Capability<&NFTStorefront.Storefront>, owner: Address)
13    }
14
15    pub resource AdminStorefront {
16        access(all) let account: Address
17        access(all) let storefrontCapability: Capability<&NFTStorefront.Storefront>
18
19        init(account: Address, storefrontCapability: Capability<&NFTStorefront.Storefront>) {
20            self.account = account
21            self.storefrontCapability = storefrontCapability
22        }
23    }
24
25    pub resource AdminStorefrontManager: AdminStorefrontManagerPublic {
26        access(self) var storefronts: @{Address: AdminStorefront}
27
28        init() {
29            self.storefronts <- {}
30
31            emit InitAdmin()
32        }
33
34        destroy() {
35            destroy self.storefronts
36        }
37
38        pub fun addCapability(_ cap: Capability<&NFTStorefront.Storefront>, owner: Address) {
39            let storefront <- create AdminStorefront(account: owner, storefrontCapability: cap)
40            let oldStorefront <- self.storefronts[owner] <- storefront
41            destroy oldStorefront
42        }
43
44        pub fun getCapability(owner: Address): &AdminStorefront? {
45            return &self.storefronts[owner] as! &AdminStorefront?
46        }
47    }
48
49    pub fun createStorefrontManager(): @AdminStorefrontManager {
50        return <-create AdminStorefrontManager()
51    }
52
53    init() {
54        self.AdminStoragePath = /storage/keepradmin
55        self.AdminPublicPath = /public/keepradmin
56    }
57
58}