MarketplaceSEALED

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

Transaction ID

Timestamp

Sep 02, 2024, 08:06:35 PM UTC
1y ago

Block Height

85,866,827

Computation

0

Proposerseq:0 key:0

Authorizers

1

Transaction Summary

Marketplace

Called FungibleToken, NonFungibleToken, DapperUtilityCoin +2 more

Script Arguments

0saleItemIDUInt64
4795468
1saleItemPriceUFix64
8.00000000

Cadence Script

1import FungibleToken from 0xf233dcee88fe0abe
2import NonFungibleToken from 0x1d7e57aa55817448
3import DapperUtilityCoin from 0xead892083b3e2c6c
4import AllDay from 0xe4cf4bdc1751c65d
5import NFTStorefront from 0x4eb8a10cb9f87357
6
7transaction(saleItemID: UInt64, saleItemPrice: UFix64) {
8    let ducReceiver: Capability<&{FungibleToken.Receiver}>
9    let royaltyReceiver: Capability<&{FungibleToken.Receiver}>
10    let AllDayNFTProvider: Capability<&AllDay.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>
11    let storefront: &NFTStorefront.Storefront
12
13    prepare(acct: AuthAccount) {
14        // If the account doesn't already have a Storefront
15        if acct.borrow<&NFTStorefront.Storefront>(from: NFTStorefront.StorefrontStoragePath) == nil {
16
17            // Create a new empty .Storefront
18            let storefront <- NFTStorefront.createStorefront() as! @NFTStorefront.Storefront
19            
20            // save it to the account
21            acct.save(<-storefront, to: NFTStorefront.StorefrontStoragePath)
22
23            // create a public capability for the .Storefront
24            acct.link<&NFTStorefront.Storefront{NFTStorefront.StorefrontPublic}>(NFTStorefront.StorefrontPublicPath, target: NFTStorefront.StorefrontStoragePath)
25        }
26
27        self.ducReceiver = acct.getCapability<&{FungibleToken.Receiver}>(/public/dapperUtilityCoinReceiver)
28		assert(self.ducReceiver.borrow() != nil, message: "Missing or mis-typed DUC receiver")
29        
30        self.royaltyReceiver = getAccount(0xe4cf4bdc1751c65d).getCapability<&{FungibleToken.Receiver}>(/public/dapperUtilityCoinReceiver)
31            assert(self.royaltyReceiver.borrow() != nil, message: "Missing or mis-typed fungible token receiver for AllDay account")
32        
33        let AllDayNFTCollectionProviderPrivatePath = /private/AllDayNFTCollectionProviderForNFTStorefront
34
35        if !acct.getCapability<&AllDay.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>(AllDayNFTCollectionProviderPrivatePath)!.check() {
36            acct.link<&AllDay.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>(AllDayNFTCollectionProviderPrivatePath, target: /storage/AllDayNFTCollection)
37        }
38
39        self.AllDayNFTProvider = acct.getCapability<&AllDay.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>(AllDayNFTCollectionProviderPrivatePath)!
40        assert(self.AllDayNFTProvider.borrow() != nil, message: "Missing or mis-typed AllDay.Collection provider")
41
42        self.storefront = acct.borrow<&NFTStorefront.Storefront>(from: NFTStorefront.StorefrontStoragePath)
43            ?? panic("Missing or mis-typed NFTStorefront Storefront")
44    }
45
46    execute {
47        let saleCut = NFTStorefront.SaleCut(
48            receiver: self.ducReceiver,
49            amount: saleItemPrice * 0.95
50        )
51        let royaltyCut = NFTStorefront.SaleCut(
52            receiver: self.royaltyReceiver,
53            amount: saleItemPrice * 0.05
54        )
55        self.storefront.createListing(
56            nftProviderCapability: self.AllDayNFTProvider,
57            nftType: Type<@AllDay.NFT>(),
58            nftID: saleItemID,
59            salePaymentVaultType: Type<@DapperUtilityCoin.Vault>(),
60            saleCuts: [saleCut, royaltyCut]
61        )
62    }
63}