forked from decentology/fast-floward-registry-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegistryService.cdc
45 lines (38 loc) · 1.21 KB
/
RegistryService.cdc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
pub contract RegistryService {
pub var totalSupply: UInt64
// AuthNFT
// The AuthNFT exists so an owner of a DappContract
// can "register" with this RegistryService contract in order
// to use contracts that exist within the Registry.
//
// This will only need to be acquired one time.
// Ex. A new account comes to the Registry, gets this AuthNFT,
// and can now interact and retrieve Tenants from whatever
// Registry contracts they want. They will never have to get another
// AuthNFT.
//
pub resource AuthNFT {
// The unique ID of this AuthNFT
pub let authID: UInt64
init() {
self.authID = RegistryService.totalSupply
RegistryService.totalSupply = RegistryService.totalSupply + (1 as UInt64)
}
}
// register
// register gets called by someone who has never registered with
// RegistryService before.
//
// It returns a AuthNFT.
//
pub fun register(): @AuthNFT {
return <- create AuthNFT()
}
// Named Paths
//
pub let AuthStoragePath: StoragePath
init() {
self.totalSupply = 0
self.AuthStoragePath = /storage/RegistryServiceAuthNFT
}
}