Smart Contract
DapperWalletCollections
A.662881e32a6728b5.DapperWalletCollections
1access(all) contract DapperWalletCollections {
2 access(all) let StoragePath: StoragePath
3
4 access(all) entitlement Owner
5
6 access(all) event TypeChanged(identifier: String, added: Bool)
7
8 access(self) let types: {Type: Bool}
9
10 access(all) resource Admin {
11 access(Owner) fun addType(_ t: Type) {
12 DapperWalletCollections.types.insert(key: t, true)
13 emit TypeChanged(identifier: t.identifier, added: true)
14 }
15
16 access(Owner) fun removeType( _ t: Type) {
17 DapperWalletCollections.types.remove(key: t)
18 emit TypeChanged(identifier: t.identifier, added: false)
19 }
20 }
21
22 access(all) fun containsType(_ t: Type): Bool {
23 return self.types.containsKey(t)
24 }
25
26 access(all) fun getTypes(): [Type] {
27 return self.types.keys
28 }
29
30 init () {
31 self.types = {}
32
33 self.StoragePath = /storage/dapperWalletCollections
34 self.account.storage.save(<- create Admin(), to: self.StoragePath)
35 }
36}