MarketplaceSEALED

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

Transaction ID

Timestamp

Feb 26, 2026, 08:29:31 PM UTC
2h ago

Block Height

143,509,788

Computation

0

Proposerseq:0 key:0

Authorizers

1

Transaction Summary

Marketplace

Called DapperUtilityCoin, FungibleToken, NonFungibleToken +5 more

Script Arguments

0collectionIdentifierString
NBATopShot
1saleItemIDUInt64
39300234
2saleItemPriceUFix64
0.17000000
3customIDString?
null
4buyerAddress?
null
5expiryUInt64
2592000

Cadence Script

1import DapperUtilityCoin from 0xead892083b3e2c6c
2import FungibleToken from 0xf233dcee88fe0abe
3import NonFungibleToken from 0x1d7e57aa55817448
4import MetadataViews from 0x1d7e57aa55817448
5import NFTCatalog from 0x49a7cda3a1eecc29
6import NFTStorefrontV2 from 0x3cdbb3d569211ff3
7import TokenForwarding from 0xe544175ee0461c4b
8import FlowtyUtils from 0x3cdbb3d569211ff3
9
10/// If the given nft has a support of the RoyaltyView then royalties will added as the sale cut.
11transaction(collectionIdentifier: String, saleItemID: UInt64, saleItemPrice: UFix64, customID: String?, buyer: Address?, expiry: UInt64) {
12    let paymentReceiver: Capability<&{FungibleToken.Receiver}>
13    let collectionCap: Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>
14    let storefront: auth(NFTStorefrontV2.List, NFTStorefrontV2.Cancel) &NFTStorefrontV2.Storefront
15    let nftType: Type
16
17    prepare(seller: auth(Storage, Capabilities) &Account) {
18        if seller.storage.borrow<&NFTStorefrontV2.Storefront>(from: NFTStorefrontV2.StorefrontStoragePath) == nil {
19            let storefront <- NFTStorefrontV2.createStorefront()
20            seller.storage.save(<-storefront, to: NFTStorefrontV2.StorefrontStoragePath)
21
22            seller.capabilities.unpublish(NFTStorefrontV2.StorefrontPublicPath)
23            seller.capabilities.publish(
24                seller.capabilities.storage.issue<&NFTStorefrontV2.Storefront>(NFTStorefrontV2.StorefrontStoragePath),
25                at: NFTStorefrontV2.StorefrontPublicPath
26            )
27        }
28
29        let catalogEntry = NFTCatalog.getCatalogEntry(collectionIdentifier: collectionIdentifier) ?? panic("Provided collection is not in the NFT Catalog.")
30
31        // Receiver for the sale cut.
32        self.paymentReceiver = seller.capabilities.get<&{FungibleToken.Receiver}>(/public/dapperUtilityCoinReceiver)
33        assert(self.paymentReceiver.borrow() != nil, message: "Missing or mis-typed DapperUtilityCoin receiver")
34
35        let capStoragePath = FlowtyUtils.getCapabilityStoragePath(type: catalogEntry.nftType, suffix: "CollectionProviderForFlowtyNFTStorefront")
36        let cap = seller.storage.copy<Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>>(from: capStoragePath)
37        if cap != nil && cap!.check() {
38            self.collectionCap = cap!
39        } else {
40            // clean this storage slot in case something is there already
41            seller.storage.load<AnyStruct>(from: capStoragePath)
42            self.collectionCap = seller.capabilities.storage.issue<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>(catalogEntry.collectionData.storagePath)
43            seller.storage.save(self.collectionCap, to: capStoragePath)
44        }
45
46        assert(self.collectionCap.check(), message: "collection provider is invalid")
47
48        let collection = self.collectionCap.borrow()
49            ?? panic("Could not borrow a reference to the collection")
50        let nft = collection.borrowNFT(saleItemID)
51            ?? panic("nft could not be borrowed from provider collection")
52        assert(nft.getType() == catalogEntry.nftType, message: "nftType must match type for catalog entry")
53        self.nftType = catalogEntry.nftType
54
55        self.storefront = seller.storage.borrow<auth(NFTStorefrontV2.List, NFTStorefrontV2.Cancel) &NFTStorefrontV2.Storefront>(from: NFTStorefrontV2.StorefrontStoragePath)
56            ?? panic("Missing or mis-typed NFTStorefront Storefront")
57    }
58
59    execute {
60        // check for existing listings of the NFT
61        var existingListingIDs = self.storefront.getExistingListingIDs(
62            nftType: self.nftType,
63            nftID: saleItemID
64        )
65        // remove existing listings
66        for listingID in existingListingIDs {
67            self.storefront.removeListing(listingResourceID: listingID)
68        }
69
70        // Create listing
71        self.storefront.createListing(
72            nftProviderCapability: self.collectionCap,
73            paymentReceiver: self.paymentReceiver,
74            nftType: self.nftType,
75            nftID: saleItemID,
76            salePaymentVaultType: Type<@DapperUtilityCoin.Vault>(),
77            price: saleItemPrice,
78            customID: customID,
79            expiry: UInt64(getCurrentBlock().timestamp) + expiry,
80            buyer: buyer
81        )
82    }
83}