TransactionSEALED

█░▪~╳●#%%?□▫▫◆@█%╲░▒$&╲%▒?!◆*▒▒◇╱○○●░◆@■~◆◇●□█▓$?^░▫$#▓╲●◇●■▪█▪^

Transaction ID

Timestamp

Jul 14, 2025, 12:05:53 PM UTC
7mo ago

Block Height

119,614,611

Computation

0

Execution Fee

0.00002524 FLOW

Transaction Summary

Contract Call

Called NonFungibleToken, DriverzStakingXx, VroomToken +6 more

Script Arguments

Copy:
0nftIds[UInt64]
[
  "294"
]
1nftTypes[String]
[
  "genesis"
]
2nftNames[String]
[
  "Genesis 294"
]
3thumbnails[String]
[
  "ipfs://QmWTUGcHK9kxG3JnBzsMNHRaoVk2YW6q11bnJX5VLxFP1N"
]

Cadence Script

1import NonFungibleToken from 0x1d7e57aa55817448
2import DriverzStakingXx from 0xf887ece39166906e
3import VroomToken from 0xf887ece39166906e
4import CarClub from 0xf887ece39166906e
5import Helmet from 0xf887ece39166906e
6import Wheel from 0xf887ece39166906e
7import Car from 0xf887ece39166906e
8import DriverzNFT from 0xa039bd7d55a96c0c
9import Tires from 0xf887ece39166906e
10
11transaction(nftIds: [UInt64], nftTypes: [String], nftNames: [String], thumbnails: [String]) {
12let nfts: @{Int: {NonFungibleToken.NFT}}
13let address: Address
14let stakingRef: &{DriverzStakingXx.DriverzStakePublic}
15let collectionRefHelmet: auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}
16let collectionRefCarClub: auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}
17let collectionRefGenesis: auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}
18let collectionRefCar: auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}
19let collectionRefWheel: auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}
20let collectionRefTires: auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}
21
22
23
24
25    prepare(signer: auth(Storage, BorrowValue, Capabilities) &Account) {
26        // Ensure the user has a staking resource; if not, create one.
27        if signer.storage.borrow<&DriverzStakingXx.DriverzStake>(from: DriverzStakingXx.StakingStoragePath) == nil {
28            let staking <- DriverzStakingXx.createDriverzStakingXx(owner: signer.address)
29            signer.storage.save(<-staking, to: DriverzStakingXx.StakingStoragePath)
30            signer.capabilities.publish(
31                signer.capabilities.storage.issue<&{DriverzStakingXx.DriverzStakePublic}>(DriverzStakingXx.StakingStoragePath),
32                at: DriverzStakingXx.StakingPublicPath
33            )
34        }
35
36                // Borrow the staking resource.
37        self.stakingRef = signer.storage.borrow<&DriverzStakingXx.DriverzStake>(from: DriverzStakingXx.StakingStoragePath)
38            ?? panic("Staking resource not found!")
39
40
41
42        // Check for HELMET    
43
44        if signer.storage.borrow<&Helmet.Collection>(from: Helmet.CollectionStoragePath) == nil {
45            let collection <- Helmet.createEmptyCollection(nftType: Type<@Helmet.NFT>())
46            signer.storage.save(<-collection, to: Helmet.CollectionStoragePath)
47
48            signer.capabilities.publish(
49                signer.capabilities.storage.issue<&{NonFungibleToken.CollectionPublic}>(Helmet.CollectionStoragePath),
50                at: Helmet.CollectionPublicPath    
51            )
52        }
53        self.collectionRefHelmet = signer.storage.borrow<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}>(from: /storage/HelmetCollection)
54            ?? panic("Could not borrow a reference to the Helmet NFT collection")
55
56
57
58        // Ensure the user has a Car Club NFT collection
59
60        if signer.storage.borrow<&CarClub.Collection>(from: CarClub.CollectionStoragePath) == nil {
61            let collection <- CarClub.createEmptyCollection(nftType: Type<@CarClub.NFT>())
62            signer.storage.save(<-collection, to: CarClub.CollectionStoragePath)
63            signer.capabilities.publish(
64                signer.capabilities.storage.issue<&{NonFungibleToken.CollectionPublic}>(CarClub.CollectionStoragePath),
65                at: CarClub.CollectionPublicPath    
66            )
67        }
68
69        self.collectionRefCarClub = signer.storage.borrow<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}>(from: /storage/CarClubCollection)
70            ?? panic("Could not borrow a reference to the Car Club NFT collection")
71
72
73
74
75
76
77        // Ensure the user has a Genesis NFT collection
78
79        if signer.storage.borrow<&DriverzNFT.Collection>(from: DriverzNFT.CollectionStoragePath) == nil {
80            let collection <- DriverzNFT.createEmptyCollection(nftType: Type<@DriverzNFT.NFT>())
81            signer.storage.save(<-collection, to: DriverzNFT.CollectionStoragePath)
82            signer.capabilities.publish(
83                signer.capabilities.storage.issue<&{NonFungibleToken.CollectionPublic}>(DriverzNFT.CollectionStoragePath),
84                at: DriverzNFT.CollectionPublicPath    
85            )
86        }
87
88        self.collectionRefGenesis = signer.storage.borrow<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}>(from: /storage/DriverzNFTCollection)
89            ?? panic("Could not borrow a reference to the DriverzNFT collection")
90
91
92
93        // Ensure the user has a Car NFT collection
94
95        if signer.storage.borrow<&Car.Collection>(from: Car.CollectionStoragePath) == nil {
96            let collection <- Car.createEmptyCollection(nftType: Type<@Car.NFT>())
97            signer.storage.save(<-collection, to: Car.CollectionStoragePath)
98
99            signer.capabilities.publish(
100                signer.capabilities.storage.issue<&{NonFungibleToken.CollectionPublic}>(Car.CollectionStoragePath),
101                at: Car.CollectionPublicPath    
102            )
103        }
104
105        self.collectionRefCar = signer.storage.borrow<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}>(from: /storage/CarCollection)
106            ?? panic("Could not borrow a reference to the Car NFT collection")
107
108
109
110
111        // Ensure the user has a Wheel NFT collection
112
113        if signer.storage.borrow<&Wheel.Collection>(from: Wheel.CollectionStoragePath) == nil {
114            let collection <- Wheel.createEmptyCollection(nftType: Type<@Wheel.NFT>())
115            signer.storage.save(<-collection, to: Wheel.CollectionStoragePath)
116
117            signer.capabilities.publish(
118                signer.capabilities.storage.issue<&{NonFungibleToken.CollectionPublic}>(Wheel.CollectionStoragePath),
119                at: Wheel.CollectionPublicPath    
120            )
121        }
122
123        self.collectionRefWheel = signer.storage.borrow<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}>(from: /storage/WheelCollection)
124            ?? panic("Could not borrow a reference to the Wheel NFT collection")
125
126
127
128
129        // Ensure the user has a Tires NFT collection
130
131        if signer.storage.borrow<&Tires.Collection>(from: Tires.CollectionStoragePath) == nil {
132            let collection <- Tires.createEmptyCollection(nftType: Type<@Tires.NFT>())
133            signer.storage.save(<-collection, to: Tires.CollectionStoragePath)
134
135            signer.capabilities.publish(
136                signer.capabilities.storage.issue<&{NonFungibleToken.CollectionPublic}>(Tires.CollectionStoragePath),
137                at: Tires.CollectionPublicPath    
138            )
139        }
140
141        self.collectionRefTires = signer.storage.borrow<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}>(from: /storage/TiresCollection)
142            ?? panic("Could not borrow a reference to the Tires NFT collection")
143
144
145        self.address = signer.address
146        self.nfts <- {}
147
148        // Ensure that an assets dictionary exists for this owner.
149        if !DriverzStakingXx.hasAssets(owner: signer.address) {
150            DriverzStakingXx.createAssetsDictionary(owner: signer.address)
151        }
152
153
154
155
156        // Ensure all input arrays are of equal length.
157        if nftIds.length != nftTypes.length || nftIds.length != nftNames.length {
158            panic("Input arrays must be of equal length")
159        }
160
161        for i in [nftTypes.length -1] {
162            // if the type is pages, the we'll use the pages collection ref and if the type is courtiers, then we'll use the courtiers collection ref
163            // Withdraw the NFT from the user's collection.
164            if nftTypes[i] == "genesis" {
165                self.nfts[i] <-! self.collectionRefGenesis.withdraw(withdrawID: nftIds[i])
166            } else if nftTypes[i] == "carclubcommon" {
167                self.nfts[i] <-! self.collectionRefCarClub.withdraw(withdrawID: nftIds[i]) 
168            } else if nftTypes[i] == "carclubrare" {
169                self.nfts[i] <-! self.collectionRefCarClub.withdraw(withdrawID: nftIds[i]) 
170            } else if nftTypes[i] == "carclubsponsor" {
171                self.nfts[i] <-! self.collectionRefCarClub.withdraw(withdrawID: nftIds[i]) 
172            } else if nftTypes[i] == "carclublegendary" {
173                self.nfts[i] <-! self.collectionRefCarClub.withdraw(withdrawID: nftIds[i]) 
174            } else if nftTypes[i] == "tires" {
175                self.nfts[i] <-! self.collectionRefTires.withdraw(withdrawID: nftIds[i]) 
176            } else if nftTypes[i] == "wheels" {
177                self.nfts[i] <-! self.collectionRefWheel.withdraw(withdrawID: nftIds[i]) 
178            } else if nftTypes[i] == "helmets" {
179                self.nfts[i] <-! self.collectionRefHelmet.withdraw(withdrawID: nftIds[i]) 
180            } else if nftTypes[i] == "cars" {
181                self.nfts[i] <-! self.collectionRefCar.withdraw(withdrawID: nftIds[i]) 
182            } else {
183                panic("Unsupported NFT type") 
184            }
185        }
186
187
188
189        
190
191    }
192
193    execute {
194
195        // Loop over each NFT to stake.
196        for i in [nftIds.length - 1] {
197            let id = nftIds[i]
198            let type = nftTypes[i]
199            let name = nftNames[i]
200            let thumbnail = thumbnails[i]
201
202            let nft <- self.nfts.remove(key: i)
203                ?? panic("NFT not found in dictionary")
204
205                // Stake the NFT with its level.
206                self.stakingRef.stakeNFT(
207                    nft: <- nft,
208                    nftID: id,
209                    nftType: type,
210                    nftName: name,
211                    owner: self.address,
212                    thumbnail: thumbnail
213                )
214
215        }
216
217        destroy self.nfts
218    }
219}