TransactionSEALED
░$▓◇$■╱▒??▒$□█▓▓▫@▪$&◇▫◇█●#□#○@█○■~$^░▒╲▒●^█!▪▒%▫▒~▒◇╱%$▪╲!&▒&!▫
Transaction ID
Payer
Proposerseq:0 key:0
Transaction Summary
Contract CallCalled NonFungibleToken, FungibleToken, OffersV2 +5 more
Script Arguments
0amountUFix64
110.00000000
1royalties{Address
{
"0x15e71a9f7fe7d53d": "5.50000000"
}2clubIdUInt64
635
3expiryUInt64
1772401369
Cadence Script
1import NonFungibleToken from 0x1d7e57aa55817448
2import FungibleToken from 0xf233dcee88fe0abe
3import OffersV2 from 0xb8ea91944fd51c43
4import DapperOffersV2 from 0xb8ea91944fd51c43
5import DapperUtilityCoin from 0xead892083b3e2c6c
6import MFLClub from 0x8ebcbfd516b1da27
7import MFLOffersResolver from 0x8ebcbfd516b1da27
8import Resolver from 0xb8ea91944fd51c43
9
10transaction(
11 amount: UFix64,
12 royalties: {Address: UFix64},
13 clubId: UInt64,
14 expiry: UInt64,
15) {
16 var nftReceiver: Capability<&MFLClub.Collection>
17 let dapperOffer: auth(DapperOffersV2.Manager) &DapperOffersV2.DapperOffer
18 let ducVaultRef: Capability<auth(FungibleToken.Withdraw) &DapperUtilityCoin.Vault>
19 let resolverCapability: Capability<&{Resolver.ResolverPublic}>
20 let tokenAdminCollection: Capability<auth(DapperOffersV2.ProxyManager) &DapperOffersV2.DapperOffer>
21 let dappAddress: Address
22
23 prepare(dapp: auth(Storage, Capabilities) &Account, signer: auth(Storage, Capabilities) &Account, dapper: auth(Storage, Capabilities) &Account) {
24 self.dappAddress = dapp.address
25
26 if signer.storage.borrow<&MFLClub.Collection>(from: MFLClub.CollectionStoragePath) == nil {
27 let collection <- MFLClub.createEmptyCollection(nftType: Type<@MFLClub.NFT>())
28 signer.storage.save(<-collection, to: MFLClub.CollectionStoragePath)
29 }
30
31 self.nftReceiver = signer.capabilities.get<&MFLClub.Collection>(MFLClub.CollectionPublicPath)
32 if !self.nftReceiver.check() {
33 signer.capabilities.unpublish(MFLClub.CollectionPublicPath)
34 let collectionCap = signer.capabilities.storage.issue<&MFLClub.Collection>(MFLClub.CollectionStoragePath)
35 signer.capabilities.publish(collectionCap, at: MFLClub.CollectionPublicPath)
36 self.nftReceiver = signer.capabilities.get<&MFLClub.Collection>(MFLClub.CollectionPublicPath)
37 }
38
39 let dapperOfferType = Type<@DapperOffersV2.DapperOffer>()
40
41 // Link the DapperOffer resource
42 if signer.storage.borrow<&DapperOffersV2.DapperOffer>(from: DapperOffersV2.DapperOffersStoragePath) == nil {
43 let dapperOffer <- DapperOffersV2.createDapperOffer()
44 signer.storage.save(<-dapperOffer, to: DapperOffersV2.DapperOffersStoragePath)
45 signer.capabilities.publish(
46 signer.capabilities.storage.issue<&{DapperOffersV2.DapperOfferPublic}>(DapperOffersV2.DapperOffersStoragePath),
47 at: DapperOffersV2.DapperOffersPublicPath
48 )
49
50 let managerStoragePath = /storage/mflDapperOfferManager
51 let cap = signer.storage.copy<Capability<auth(DapperOffersV2.Manager) &{DapperOffersV2.DapperOfferManager}>>(from: managerStoragePath)
52 if cap?.check() != true {
53 let managerCap = signer.capabilities.storage.issue<auth(DapperOffersV2.Manager) &{DapperOffersV2.DapperOfferManager}>(DapperOffersV2.DapperOffersStoragePath)
54 signer.storage.save(managerCap, to: managerStoragePath)
55 }
56 }
57
58 // DapperOfferProxyManager Setup
59 let proxyStoragePath = /storage/mflDapperOfferProxy
60 let copiedProxy = signer.storage.copy<Capability<auth(DapperOffersV2.ProxyManager) &DapperOffersV2.DapperOffer>>(from: proxyStoragePath)
61 if copiedProxy?.check() == true {
62 self.tokenAdminCollection = copiedProxy!
63 } else {
64 self.tokenAdminCollection = signer.capabilities.storage.issue<auth(DapperOffersV2.ProxyManager) &DapperOffersV2.DapperOffer>(DapperOffersV2.DapperOffersStoragePath)
65 signer.storage.load<AnyStruct>(from: proxyStoragePath)
66 signer.storage.save(self.tokenAdminCollection, to: proxyStoragePath)
67 }
68
69 // Setup Proxy Cancel for Dapper
70 let capabilityReceiver = dapper.capabilities.get<&{DapperOffersV2.DapperOfferPublic}>(/public/DapperOffersV2).borrow()
71 ?? panic("Could not borrow capability receiver reference")
72 capabilityReceiver.addProxyCapability(account: signer.address, cap: self.tokenAdminCollection)
73
74 // Setup Proxy Cancel for MFL
75 let mflCapabilityReceiver = dapp.capabilities.get<&{DapperOffersV2.DapperOfferPublic}>(/public/DapperOffersV2).borrow()
76 ?? panic("Could not borrow MFL capability receiver reference")
77 mflCapabilityReceiver.addProxyCapability(account: signer.address, cap: self.tokenAdminCollection)
78
79 // Get the capability to the offer creators NFT collection
80 self.nftReceiver = signer.capabilities.get<&MFLClub.Collection>(MFLClub.CollectionPublicPath)
81 assert(self.nftReceiver.check(), message: "Missing or mis-typed collection receiver")
82
83 self.dapperOffer = signer.storage.borrow<auth(DapperOffersV2.Manager) &DapperOffersV2.DapperOffer>(from: DapperOffersV2.DapperOffersStoragePath)
84 ?? panic("Missing or mis-typed DapperOffersV2.DapperOffer")
85
86
87 // Get the capability to the DUC vault
88 let ducCapStoragePath = /storage/mflDucProvider
89 let copiedDucProvider = dapper.storage.copy<Capability<auth(FungibleToken.Withdraw) &DapperUtilityCoin.Vault>>(from: ducCapStoragePath)
90 if copiedDucProvider?.check() == true {
91 self.ducVaultRef = copiedDucProvider!
92 } else {
93 self.ducVaultRef = dapper.capabilities.storage.issue<auth(FungibleToken.Withdraw) &DapperUtilityCoin.Vault>(/storage/dapperUtilityCoinVault)
94 dapper.storage.save(self.ducVaultRef, to: ducCapStoragePath)
95 }
96
97 assert(self.ducVaultRef.check() != nil, message: "Missing or mis-typed DapperUtilityCoin provider")
98
99 self.resolverCapability = MFLOffersResolver.getResolverCap()
100 }
101
102 pre {
103 self.dappAddress == 0x15e71a9f7fe7d53d : "Requires valid authorizing signature"
104 }
105
106 execute {
107 var royaltysList: [OffersV2.Royalty] = []
108 for k in royalties.keys {
109 royaltysList.append(OffersV2.Royalty(
110 receiver: getAccount(k).capabilities.get<&{FungibleToken.Receiver}>(/public/dapperUtilityCoinReceiver),
111 amount: royalties[k]!
112 ))
113 }
114
115 let typeId = "A.8ebcbfd516b1da27.MFLClub.NFT"
116
117 let offerParamsString: {String: String} = {}
118 offerParamsString.insert(key: "resolver", "0")
119 offerParamsString.insert(key: "nftId", clubId.toString())
120 offerParamsString.insert(key: "_type", "NFT")
121 offerParamsString.insert(key: "typeId", typeId)
122 offerParamsString.insert(key: "marketplace", "MFL")
123
124 let offerParamsUInt64: {String: UInt64} = { "expiry": expiry }
125
126 self.dapperOffer.createOffer(
127 vaultRefCapability: self.ducVaultRef,
128 nftReceiverCapability: self.nftReceiver,
129 nftType: CompositeType(typeId)!,
130 amount: amount,
131 royalties: royaltysList,
132 offerParamsString: offerParamsString,
133 offerParamsUFix64: {},
134 offerParamsUInt64: offerParamsUInt64,
135 resolverCapability: self.resolverCapability
136 )
137 }
138}