TransactionSEALED
~╳□*!▓%◇╱□*◇◆□▓●!▪╲╲◆!◆╲╳*^&○◆░◆■◆?╲&╲■~█!$□&▫╱^▓▫*◇╳!%&○╱^@■&○◆
Transaction ID
Execution Fee
0.00002274 FLOWTransaction Summary
Contract Call
Called NonFungibleToken, MetadataViews, FlowToken +7 more
Script Arguments
Copy:
0nftIds[UInt64]
[ "63771675845191", "172623327172569" ]
Cadence Script
1// Third Party Imports
2import NonFungibleToken from 0x1d7e57aa55817448
3import MetadataViews from 0x1d7e57aa55817448
4import FlowToken from 0x1654653399040a61
5// Fixes imports
6import Fixes from 0xd2abb5dbf5e08666
7import FRC20Indexer from 0xd2abb5dbf5e08666
8import FRC20FTShared from 0xd2abb5dbf5e08666
9import FRC20AccountsPool from 0xd2abb5dbf5e08666
10import FRC20SemiNFT from 0xd2abb5dbf5e08666
11import FRC20Staking from 0xd2abb5dbf5e08666
12import FRC20StakingManager from 0xd2abb5dbf5e08666
13
14transaction(
15 nftIds: [UInt64],
16) {
17 let semiNFTCol: auth(NonFungibleToken.Withdraw, NonFungibleToken.Update) &FRC20SemiNFT.Collection
18
19 prepare(acct: auth(Storage, Capabilities) &Account) {
20
21 /** ------------- Start -- FRC20 Semi NFT Collection Initialization ------------ */
22 // ensure resource
23 if acct.storage.borrow<&AnyResource>(from: FRC20SemiNFT.CollectionStoragePath) == nil {
24 acct.storage.save(<- FRC20SemiNFT.createEmptyCollection(nftType: Type<@FRC20SemiNFT.NFT>()), to: FRC20SemiNFT.CollectionStoragePath)
25 }
26
27 // link to public capability
28 if acct
29 .capabilities.get<&FRC20SemiNFT.Collection>(FRC20SemiNFT.CollectionPublicPath)
30 .borrow() == nil {
31 acct.capabilities.unpublish(FRC20SemiNFT.CollectionPublicPath)
32 acct.capabilities.publish(
33 acct.capabilities.storage.issue<&FRC20SemiNFT.Collection>(
34 FRC20SemiNFT.CollectionStoragePath
35 ),
36 at: FRC20SemiNFT.CollectionPublicPath
37 )
38 }
39 /** ------------- End ---------------------------------------------------------- */
40
41 /** ------------- Start -- FRC20 Delegator General Initialization ------------- */
42 if acct.storage.borrow<&AnyResource>(from: FRC20Staking.DelegatorStoragePath) == nil {
43 let cap = acct.capabilities.storage
44 .issue<auth(NonFungibleToken.Withdraw, NonFungibleToken.Update) &FRC20SemiNFT.Collection>(FRC20SemiNFT.CollectionStoragePath)
45 acct.storage.save(<- FRC20Staking.createDelegator(cap), to: FRC20Staking.DelegatorStoragePath)
46 }
47
48 if acct
49 .capabilities.get<&FRC20Staking.Delegator>(FRC20Staking.DelegatorPublicPath)
50 .borrow() == nil {
51 acct.capabilities.unpublish(FRC20Staking.DelegatorPublicPath)
52 acct.capabilities.publish(
53 acct.capabilities.storage.issue<&FRC20Staking.Delegator>(
54 FRC20Staking.DelegatorStoragePath
55 ),
56 at: FRC20Staking.DelegatorPublicPath
57 )
58 }
59 /** ------------- End ---------------------------------------------------------- */
60
61 self.semiNFTCol = acct.storage
62 .borrow<auth(NonFungibleToken.Withdraw, NonFungibleToken.Update) &FRC20SemiNFT.Collection>(from: FRC20SemiNFT.CollectionStoragePath)
63 ?? panic("Could not borrow a reference to the owner's collection")
64 }
65
66 pre {
67 nftIds.length > 1: "You must provide more than one NFT ID"
68 }
69
70 execute {
71 let firstId = nftIds.removeFirst()
72 let first = self.semiNFTCol.borrowFRC20SemiNFT(id: firstId)
73 ?? panic("Could not borrow a reference to the NFT with ID :".concat(firstId.toString()))
74 /// merge all the NFTs into the first one
75 for nftId in nftIds {
76 let nft <- self.semiNFTCol.withdraw(withdrawID: nftId) as! @FRC20SemiNFT.NFT
77 first.merge(<- nft)
78
79 log("Merged NFTs with ID: ".concat(nftId.toString()))
80 }
81 }
82}