TransactionSEALED

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

Transaction ID

Timestamp

Aug 20, 2024, 02:46:14 AM UTC
1y ago

Block Height

84,920,133

Computation

0

Execution Fee

0.00001492 FLOW

Transaction Summary

Contract Call

Called NonFungibleToken, FungibleToken, OffersV2 +6 more

Script Arguments

0amountUFix64
0.10000000
1royalties{Address
{
  "0x6590f8918060ef13": "0.00200000"
}
2offerParamsString{String
{
  "expiry": "1726713963"
}
3nftIdUInt64
5730211
4collectionAddressAddress
5collectionNameString
AllDay
6publicPathIdentifierString
AllDayNFTCollection
7storagePathIdentifierString
AllDayNFTCollection
8proxyAddressAddress
9expiryUInt64
1726713963

Cadence Script

1import NonFungibleToken from 0x1d7e57aa55817448
2import FungibleToken from 0xf233dcee88fe0abe
3import OffersV2 from 0xb8ea91944fd51c43
4import DapperOffersV2 from 0xb8ea91944fd51c43
5import DapperUtilityCoin from 0xead892083b3e2c6c
6import Resolver from 0xb8ea91944fd51c43
7import FlowtyOffersResolver from 0x322d96c958eb8c46
8import StringUtils from 0x3c1c4b041ad18279
9import NFTStorefrontV2 from 0x3cdbb3d569211ff3
10
11transaction(
12    amount: UFix64,
13    royalties: {Address: UFix64},
14    offerParamsString: {String: String},
15    nftId: UInt64,
16    collectionAddress: Address,
17    collectionName: String,
18    publicPathIdentifier: String,
19    storagePathIdentifier: String,
20    proxyAddress: Address,
21    expiry: UInt64
22) {
23    var nftReceiver: Capability<&{NonFungibleToken.CollectionPublic}>
24    let dapperOffer: &DapperOffersV2.DapperOffer
25    let ducVaultRef: Capability<&DapperUtilityCoin.Vault{FungibleToken.Provider, FungibleToken.Balance}>
26    let resolverCapability: Capability<&{Resolver.ResolverPublic}>
27
28    prepare(signer: AuthAccount, dapper: AuthAccount) {
29        assert(collectionAddress != Address(0x0b2a3299cc857e29), message: "cannot use this transaction for provided collection address")
30        let contractAcct = getAccount(collectionAddress)
31        let contract = contractAcct.contracts.borrow<&NonFungibleToken>(name: collectionName) ?? panic("collection not found")
32
33        let storagePath = StoragePath(identifier: storagePathIdentifier)!
34        let publicPath = PublicPath(identifier: publicPathIdentifier)!
35        if signer.borrow<&{NonFungibleToken.CollectionPublic}>(from: storagePath) == nil {
36            let c <- contract.createEmptyCollection()
37            signer.save(<-c, to: storagePath)
38            signer.link<&{NonFungibleToken.Receiver, NonFungibleToken.CollectionPublic}>(publicPath, target: storagePath)
39        }
40
41        self.nftReceiver = signer.getCapability<&{NonFungibleToken.CollectionPublic}>(publicPath)
42        if !self.nftReceiver.check() {
43            signer.unlink(publicPath)
44            signer.link<&{NonFungibleToken.Receiver, NonFungibleToken.CollectionPublic}>(publicPath, target: storagePath)
45            self.nftReceiver = signer.getCapability<&{NonFungibleToken.CollectionPublic}>(publicPath)
46        }
47
48        // Link the DapperOffer resource
49        if signer.borrow<&DapperOffersV2.DapperOffer>(from: DapperOffersV2.DapperOffersStoragePath) == nil {
50            let dapperOffer <- DapperOffersV2.createDapperOffer()
51            signer.save(<-dapperOffer, to: DapperOffersV2.DapperOffersStoragePath)
52            signer.link<&DapperOffersV2.DapperOffer{DapperOffersV2.DapperOfferPublic}>(DapperOffersV2.DapperOffersPublicPath, target: DapperOffersV2.DapperOffersStoragePath)
53            signer.link<&DapperOffersV2.DapperOffer{DapperOffersV2.DapperOfferManager}>(/private/DapperOffersV2, target: DapperOffersV2.DapperOffersStoragePath)
54        }
55
56        // DapperOfferProxyManager Setup
57        var tokenAdminCollection = signer
58            .getCapability<&DapperOffersV2.DapperOffer{DapperOffersV2.DapperOfferProxyManager}>(/private/DapperOffersV2)
59        if !tokenAdminCollection.check() {
60            signer.unlink(/private/DapperOffersV2)
61            signer.link<&DapperOffersV2.DapperOffer{DapperOffersV2.DapperOfferManager, DapperOffersV2.DapperOfferProxyManager}>(/private/DapperOffersV2, target: DapperOffersV2.DapperOffersStoragePath)
62        }
63
64        if dapper.borrow<&DapperOffersV2.DapperOffer>(from: DapperOffersV2.DapperOffersStoragePath) == nil {
65            let dapperOffer <- DapperOffersV2.createDapperOffer()
66            dapper.save(<-dapperOffer, to: DapperOffersV2.DapperOffersStoragePath)
67            dapper.link<&DapperOffersV2.DapperOffer{DapperOffersV2.DapperOfferPublic}>(DapperOffersV2.DapperOffersPublicPath, target: DapperOffersV2.DapperOffersStoragePath)
68            dapper.link<&DapperOffersV2.DapperOffer{DapperOffersV2.DapperOfferManager, DapperOffersV2.DapperOfferProxyManager}>(/private/DapperOffersV2, target: DapperOffersV2.DapperOffersStoragePath)
69        }
70
71        // Setup Proxy Cancel for Dapper
72        let capabilityReceiver = dapper.getCapability
73            <&DapperOffersV2.DapperOffer{DapperOffersV2.DapperOfferPublic}>(/public/DapperOffersV2).borrow()
74                ?? panic("Could not borrow capability receiver reference")
75        capabilityReceiver.addProxyCapability(account: signer.address, cap: tokenAdminCollection)
76
77        // Get the capability to the offer creators NFT collection
78        self.nftReceiver = signer.getCapability<&{NonFungibleToken.CollectionPublic}>(publicPath)
79        assert(self.nftReceiver.check(), message: "Missing or mis-typed collection receiver")
80
81        self.dapperOffer = signer.borrow<&DapperOffersV2.DapperOffer>(from: DapperOffersV2.DapperOffersStoragePath)
82            ?? panic("Missing or mis-typed DapperOffersV2.DapperOffer")
83        // Get the capability to the DUC vault
84        self.ducVaultRef = dapper.getCapability<&DapperUtilityCoin.Vault{FungibleToken.Provider, FungibleToken.Balance}>(/private/dapperUtilityCoinVault)
85        assert(self.ducVaultRef.check() != nil, message: "Missing or mis-typed DapperUtilityCoin provider")
86        self.resolverCapability = FlowtyOffersResolver.getResolverCap()
87    }
88
89    execute {
90        var royaltysList: [OffersV2.Royalty] = []
91        for k in royalties.keys {
92            royaltysList.append(OffersV2.Royalty(
93                receiver: getAccount(k).getCapability<&{FungibleToken.Receiver}>(/public/dapperUtilityCoinReceiver),
94                amount: royalties[k]!
95            ))
96        }
97
98        let str = collectionAddress.toString()
99        let typeId = StringUtils.join(["A", str.slice(from: 2, upTo: str.length), collectionName, "NFT"], ".")
100
101        offerParamsString.insert(key: "nftId", nftId.toString())
102        offerParamsString.insert(key: "resolver", FlowtyOffersResolver.ResolverType.NFT.rawValue.toString())
103        offerParamsString.insert(key: "_type", "NFT")
104        offerParamsString.insert(key: "typeId", typeId)
105
106        let offerParamsUInt64: {String: UInt64} = { "expiry": expiry }
107
108        self.dapperOffer.createOffer(
109            vaultRefCapability: self.ducVaultRef,
110            nftReceiverCapability: self.nftReceiver,
111            nftType: CompositeType(typeId)!,
112            amount: amount,
113            royalties: royaltysList,
114            offerParamsString: offerParamsString,
115            offerParamsUFix64: {},
116            offerParamsUInt64: offerParamsUInt64,
117            resolverCapability: self.resolverCapability
118        )
119    }
120}