TransactionSEALED

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

Transaction ID

Timestamp

Sep 04, 2024, 09:40:58 PM UTC
1y ago

Block Height

85,992,519

Computation

0

Execution Fee

0.00000274 FLOW

Proposerseq:886 key:4591

Authorizers

1

Transaction Summary

Contract Call

Called TrmAssetV2_2, TrmRentV2_2, TrmMarketV2_2 +1 more

Script Arguments

Cadence Script

1import TrmAssetV2_2 from 0x61fc4b873e58733b
2        import TrmRentV2_2 from 0x61fc4b873e58733b
3        import TrmMarketV2_2 from 0x61fc4b873e58733b
4        import NonFungibleToken from 0x1d7e57aa55817448
5
6        transaction {
7
8            prepare(userAccount: auth(IssueStorageCapabilityController, PublishCapability, BorrowValue, SaveValue) &Account) {
9                
10                // First, check to see if an asset collection already exists
11                if userAccount.storage.borrow<&TrmAssetV2_2.Collection>(from: TrmAssetV2_2.collectionStoragePath) == nil {
12
13                    // create a new Asset Collection
14                    let collection <- TrmAssetV2_2.createEmptyCollection(nftType: Type<@TrmAssetV2_2.NFT>()) 
15
16                    // emit Asset Collection initialization event
17                    TrmAssetV2_2.emitCreateEmptyAssetCollectionEvent(userAccountAddress: userAccount.address)
18
19                    // Put the new Collection in storage
20                    userAccount.storage.save(<-collection, to: TrmAssetV2_2.collectionStoragePath)
21
22                    // create a public capability for the collection
23                    let assetStorageCapability = userAccount.capabilities.storage.issue<&TrmAssetV2_2.Collection>(TrmAssetV2_2.collectionStoragePath)
24                    userAccount.capabilities.publish(assetStorageCapability, at: TrmAssetV2_2.collectionPublicPath)
25
26                    log("Asset Collection Initialized")
27                }
28
29                // First, check to see if a rent collection already exists
30                if userAccount.storage.borrow<&TrmRentV2_2.Collection>(from: TrmRentV2_2.collectionStoragePath) == nil {
31
32                    // create a new Rent Collection
33                    let collection <- TrmRentV2_2.createEmptyCollection(nftType: Type<@TrmRentV2_2.NFT>()) 
34
35                    // emit Rent Collection initialization event
36                    TrmRentV2_2.emitCreateEmptyRentCollectionEvent(userAccountAddress: userAccount.address)
37
38                    // Put the new Collection in storage
39                    userAccount.storage.save(<-collection, to: TrmRentV2_2.collectionStoragePath)
40
41                    // create a public capability for the collection
42                    let assetRentStorageCapability = userAccount.capabilities.storage.issue<&TrmAssetV2_2.Collection>(TrmRentV2_2.collectionStoragePath)
43                    userAccount.capabilities.publish(assetRentStorageCapability, at: TrmAssetV2_2.collectionPublicPath)
44
45                    log("Rent Collection Initialized")
46                }
47
48                // First, check to see if a sale collection already exists
49                if userAccount.storage.borrow<&TrmMarketV2_2.SaleCollection>(from: TrmMarketV2_2.marketStoragePath) == nil {
50
51                    // create capability for asset collection
52                    var ownerCollection = userAccount.capabilities.get<&TrmAssetV2_2.Collection>(TrmAssetV2_2.collectionPublicPath)
53
54                    if(!ownerCollection.check()) {
55                        let assetStorageCapability = userAccount.capabilities.storage.issue<&TrmAssetV2_2.Collection>(TrmAssetV2_2.collectionStoragePath)
56                        userAccount.capabilities.publish(assetStorageCapability, at: TrmAssetV2_2.collectionPublicPath)
57                    }
58
59                    // create a new Sale Collection
60                    let collection <- TrmMarketV2_2.createSaleCollection(ownerCollection: ownerCollection)
61
62                    // emit Sale Collection initialization event
63                    TrmMarketV2_2.emitCreateSaleCollectionEvent(userAccountAddress: userAccount.address)
64                    
65                    userAccount.storage.save(<-collection, to: TrmMarketV2_2.marketStoragePath)
66
67                    let marketStorageCapability = userAccount.capabilities.storage.issue<&TrmMarketV2_2.SaleCollection>(TrmMarketV2_2.marketStoragePath)
68                    userAccount.capabilities.publish(marketStorageCapability, at: TrmMarketV2_2.marketPublicPath)
69                    
70                    log("Sale Collection Initialized")
71                }
72
73                log("Account Initialized")
74            }
75        }