MarketplaceSEALED
▪▓▫▓%!^$▫█#■●@■○#!▪▓?^▒●▫*▪?◆╲#■╳╱!▫$%!▒◆╲!▓▫▪▓~$◇●▓~#╳^!^?$╱◆~@
Transaction ID
Execution Fee
0.00001524 FLOWTransaction Summary
MarketplaceCalled FungibleToken, NonFungibleToken, DapperUtilityCoin +2 more
Script Arguments
0saleItemIDUInt64
1547897
1saleItemPriceUFix64
4.00000000
2royaltyPercentUFix64
0.05000000
Cadence Script
1import FungibleToken from 0xf233dcee88fe0abe
2import NonFungibleToken from 0x1d7e57aa55817448
3import DapperUtilityCoin from 0xead892083b3e2c6c
4import UFC_NFT from 0x329feb3ab062d289
5import NFTStorefront from 0x4eb8a10cb9f87357
6
7transaction(saleItemID: UInt64, saleItemPrice: UFix64, royaltyPercent: UFix64) {
8 let sellerPaymentReceiver: Capability<&{FungibleToken.Receiver}>
9 let UFC_NFTProvider: Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>
10 let storefront: auth(NFTStorefront.CreateListing) &NFTStorefront.Storefront
11
12 prepare(acct: auth(Storage, Capabilities) &Account) {
13 // If the account doesn't already have a Storefront
14 if acct.storage.borrow<&NFTStorefront.Storefront>(from: NFTStorefront.StorefrontStoragePath) == nil {
15 // Create a new empty Storefront
16 let newstorefront <- NFTStorefront.createStorefront()
17
18 // Save it to the account
19 acct.storage.save(<-newstorefront, to: NFTStorefront.StorefrontStoragePath)
20
21 // Create a public capability for the Storefront
22 acct.capabilities.publish(
23 acct.capabilities.storage.issue<&NFTStorefront.Storefront>(NFTStorefront.StorefrontStoragePath),
24 at: NFTStorefront.StorefrontPublicPath
25 )
26 }
27
28 self.sellerPaymentReceiver = acct.capabilities.get<&{FungibleToken.Receiver}>(/public/dapperUtilityCoinReceiver)
29 assert(self.sellerPaymentReceiver.borrow() != nil, message: "Missing or mis-typed DapperUtilityCoin receiver")
30
31 let ufcNFTCap = acct.storage.copy<
32 Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>
33 >(from: /storage/UFC_NFT_NFT_WithdrawCap_3)
34
35 if ufcNFTCap != nil && ufcNFTCap!.check() {
36 self.UFC_NFTProvider = ufcNFTCap!
37 } else {
38 self.UFC_NFTProvider = acct.capabilities.storage.issue<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>(
39 UFC_NFT.CollectionStoragePath
40 )
41
42 acct.storage.save(self.UFC_NFTProvider, to: /storage/UFC_NFT_NFT_WithdrawCap_3)
43 }
44
45 assert(self.UFC_NFTProvider.borrow() != nil, message: "Missing or mis-typed UFC_NFT.Collection provider")
46
47 self.storefront = acct.storage.borrow<auth(NFTStorefront.CreateListing) &NFTStorefront.Storefront>(
48 from: NFTStorefront.StorefrontStoragePath
49 ) ?? panic("Missing or mis-typed NFTStorefront Storefront")
50
51 }
52
53 execute {
54 let amountSeller = saleItemPrice * (1.0 - royaltyPercent)
55 let amountRoyalty = saleItemPrice - amountSeller
56
57 // Get the royalty recipient's public account object
58 let royaltyRecipient = getAccount(0x746c13e60ec8c434)
59
60 // Get a reference to the royalty recipient's Receiver
61 let royaltyReceiverRef = royaltyRecipient.capabilities.get<&{FungibleToken.Receiver}>(/public/dapperUtilityCoinReceiver)
62 assert(royaltyReceiverRef.borrow() != nil, message: "Missing or mis-typed DapperUtilityCoin royalty receiver")
63
64 let saleCutSeller = NFTStorefront.SaleCut(
65 receiver: self.sellerPaymentReceiver,
66 amount: amountSeller
67 )
68
69 let saleCutRoyalty = NFTStorefront.SaleCut(
70 receiver: royaltyReceiverRef,
71 amount: amountRoyalty
72 )
73
74 self.storefront.createListing(
75 nftProviderCapability: self.UFC_NFTProvider,
76 nftType: Type<@UFC_NFT.NFT>(),
77 nftID: saleItemID,
78 salePaymentVaultType: Type<@DapperUtilityCoin.Vault>(),
79 saleCuts: [saleCutSeller, saleCutRoyalty]
80 )
81 }
82}