Smart Contract
BenchmarkRoot
A.fca5fe88ab256a6c.BenchmarkRoot
1access(all) contract BenchmarkRoot {
2 // All the accounts created by this account for benchmarking purposes.
3 access(all) let benchmarkAccounts: [Address]
4
5 access(all) event NewBenchmarkAccount(_ address: Address)
6 access(all) event ExistingBenchmarkAccount(_ address: Address)
7
8 access(all) resource Administrator {
9 access(all) fun add(_ address: Address) {
10 BenchmarkRoot.benchmarkAccounts.append(address)
11 emit NewBenchmarkAccount(address)
12 }
13 access(all) fun getAddress(_ index: Int): Address? {
14 if index < BenchmarkRoot.benchmarkAccounts.length {
15 let address = BenchmarkRoot.benchmarkAccounts[index]
16 emit ExistingBenchmarkAccount(address)
17 return address
18 }
19 return nil
20 }
21 }
22
23
24 init() {
25 self.benchmarkAccounts = []
26
27 let admin <- create Administrator()
28 self.account.storage.save(<-admin, to: /storage/benchmarkRootAdmin)
29 }
30}