Smart Contract

TopshotAdminReceiver

A.e1f2a091f7bb5245.TopshotAdminReceiver

Deployed

1w ago
Feb 18, 2026, 06:24:03 AM UTC

Dependents

0 imports
1/*
2
3  AdminReceiver.cdc
4
5  This contract defines a function that takes a TopShot admin
6  object and stores it in the storage of the contract account
7  so it can be used normally
8
9 */
10
11import TopShot from 0x0b2a3299cc857e29
12import TopShotShardedCollection from 0xef4d8b44dd7f7ef6
13
14pub contract TopshotAdminReceiver {
15
16    pub fun storeAdmin(newAdmin: @TopShot.Admin) {
17        self.account.save(<-newAdmin, to: /storage/TopShotAdmin)
18    }
19    
20    init() {
21        if self.account.borrow<&TopShotShardedCollection.ShardedCollection>(from: /storage/ShardedMomentCollection) == nil {
22            let collection <- TopShotShardedCollection.createEmptyCollection(numBuckets: 32)
23            // Put a new Collection in storage
24            self.account.save(<-collection, to: /storage/ShardedMomentCollection)
25
26            self.account.link<&{TopShot.MomentCollectionPublic}>(/public/MomentCollection, target: /storage/ShardedMomentCollection)
27        }
28    }
29}