Smart Contract
TitRegistry
A.66b60643244a7738.TitRegistry
1access(all) contract TitRegistry {
2 access(all) resource Admin {
3 access(all) fun addUser(titID: UInt64, flowAddress: Address) {
4 let newUser = User(titID: titID, flowAddress: flowAddress)
5 TitRegistry.userList.append(newUser)
6 }
7 }
8
9 access(all) struct User {
10 access(all) let titID: UInt64
11 access(all) let flowAddress: Address
12
13 init(titID: UInt64, flowAddress: Address) {
14 self.titID = titID
15 self.flowAddress = flowAddress
16 }
17 }
18
19 access(all) var userList: [User]
20
21 access(all) let AdminStoragePath: StoragePath
22
23 init() {
24 self.userList = []
25 self.AdminStoragePath = /storage/TitRegistryAdmin
26
27 let admin <- create Admin()
28 self.account.storage.save(<-admin, to: self.AdminStoragePath)
29 }
30
31 access(all) fun getUsers(): [User] {
32 return self.userList
33 }
34
35}