Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions contracts/DapperWalletCollections.cdc
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
pub contract DapperWalletCollections {
pub let StoragePath: StoragePath
access(all) contract DapperWalletCollections {
access(all) let StoragePath: StoragePath

pub event TypeChanged(identifier: String, added: Bool)
access(all) entitlement Owner

access(all) event TypeChanged(identifier: String, added: Bool)

access(self) let types: {Type: Bool}

pub resource Admin {
pub fun addType(_ t: Type) {
access(all) resource Admin {
access(Owner) fun addType(_ t: Type) {
DapperWalletCollections.types.insert(key: t, true)
emit TypeChanged(identifier: t.identifier, added: true)
}

pub fun removeType( _ t: Type) {
access(Owner) fun removeType( _ t: Type) {
DapperWalletCollections.types.remove(key: t)
emit TypeChanged(identifier: t.identifier, added: false)
}
}

pub fun containsType(_ t: Type): Bool {
access(all) fun containsType(_ t: Type): Bool {
return self.types.containsKey(t)
}

pub fun getTypes(): [Type] {
access(all) fun getTypes(): [Type] {
return self.types.keys
}

init () {
self.types = {}

self.StoragePath = /storage/dapperWalletCollections
self.account.save(<- create Admin(), to: self.StoragePath)
self.account.storage.save(<- create Admin(), to: self.StoragePath)
}
}
8 changes: 4 additions & 4 deletions flow.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
"key": "7b560c9a75bc0bd9f2921145b6a7e6b341b2adfcafe9870bcd455f61c74d10d1"
},
"testnet": {
"address": "0x6d9ae43184a7ad9f",
"address": "0xe4f4d5fcff8e1524",
"key": {
"type": "google-kms",
"index": 0,
"signatureAlgorithm": "ECDSA_P256",
"hashAlgorithm": "SHA2_256",
"resourceID": "projects/flowty-contracts/locations/global/keyRings/contracts/cryptoKeys/dapper-wallet-collections/cryptoKeyVersions/1"
"resourceID": "projects/flowty-test/locations/global/keyRings/flow/cryptoKeys/dapper-wallet-collections/cryptoKeyVersions/1"
}
},
"mainnet": {
"address": "0x42a54b4f70e7dc81",
"address": "0x662881e32a6728b5",
"key": {
"type": "google-kms",
"index": 0,
"signatureAlgorithm": "ECDSA_P256",
"hashAlgorithm": "SHA2_256",
"resourceID": "projects/flowty-contracts/locations/global/keyRings/contracts/cryptoKeys/dapper-wallet-collections-mainnet/cryptoKeyVersions/1"
"resourceID": "projects/flowty-prod/locations/global/keyRings/flow/cryptoKeys/dapper-wallet-collections/cryptoKeyVersions/1"
}
}
},
Expand Down