DeploySEALED
#▪&╲╲^╳▫*◇%▫@▪░@╳?~%&□▓◆□@^●^□░~▒■@?╳█■╱░╲%?^&█◆●▫▫!■▫╱░◇*○▒▫*▫■
Transaction ID
Execution Fee
0.00008047 FLOWTransaction Summary
DeployDeployed ContractFactory, ContractFactoryTemplate, OpenEditionTemplate, MetadataViews, OpenEditionInitializer, ContractManager, FungibleToken, FlowToken, FlowtyDrops, NFTMetadata, FlowtyActiveCheckers, FlowtyPricers, FlowtyAddressVerifiers, FungibleTokenRouter, ViewResolver, HybridCustody
Script Arguments
0contractNameString
name
1managerInitialTokenBalanceUFix64
0.01000000
2startUInt64?
1748992834
3endUInt64?
1748993402
4priceUFix64
0.00000000
5paymentTokenTypeString
A.1654653399040a61.FlowToken.Vault
6phaseArgs{String
{}7metadataArgs{String
{
"cid": "QmWqBdyFMRBrULEM5tLAc5tE4sX9tbko3FqW57afQvTa3M",
"description": "description",
"externalURL": "",
"name": "name"
}8collectionInfoArgs{String
{
"bannerImageCid": "QmWz1ticnmu3PNWb68uMPFGffn5pXhpiUin7qfcSaotrGX?pinataGatewayToken=xFpPpu5fb5PZMLV6RF8ueOm08-BkzG5BLYJf1jVw1NL8RUORAi5yj3BwsexCJWIz",
"bannerImageMediaType": "image/png",
"description": "description",
"externalURL": "",
"name": "name",
"squareImageCid": "QmWqBdyFMRBrULEM5tLAc5tE4sX9tbko3FqW57afQvTa3M",
"squareImageMediaType": "image/png"
}9dropDetailArgs{String
{
"description": "",
"name": "",
"nftType": "",
"thumbnailCid": "QmWqBdyFMRBrULEM5tLAc5tE4sX9tbko3FqW57afQvTa3M"
}10collectionRoyaltyUFix64?
0.05000000
Cadence Script
1import ContractFactory from 0xbefbaccb5032a457
2import ContractFactoryTemplate from 0xbefbaccb5032a457
3import OpenEditionTemplate from 0xbefbaccb5032a457
4import MetadataViews from 0x1d7e57aa55817448
5import OpenEditionInitializer from 0xbefbaccb5032a457
6import ContractManager from 0xbefbaccb5032a457
7import FungibleToken from 0xf233dcee88fe0abe
8import FlowToken from 0x1654653399040a61
9import FlowtyDrops from 0xbefbaccb5032a457
10import NFTMetadata from 0xbefbaccb5032a457
11import FlowtyActiveCheckers from 0xbefbaccb5032a457
12import FlowtyPricers from 0xbefbaccb5032a457
13import FlowtyAddressVerifiers from 0xbefbaccb5032a457
14import FungibleTokenRouter from 0x707c0b39a8d689cb
15import ViewResolver from 0x1d7e57aa55817448
16import HybridCustody from 0xd8a7e05a7ac670c0
17
18transaction(contractName: String, managerInitialTokenBalance: UFix64, start: UInt64?, end: UInt64?, price: UFix64, paymentTokenType: String, phaseArgs: {String: String}, metadataArgs: {String: String}, collectionInfoArgs: {String: String}, dropDetailArgs: {String: String}, collectionRoyalty: UFix64?) {
19 prepare(acct: auth(Storage, Capabilities, Inbox) &Account) {
20 if acct.storage.borrow<&AnyResource>(from: ContractManager.StoragePath) == nil {
21 let v = acct.storage.borrow<auth(FungibleToken.Withdraw) &FlowToken.Vault>(from: /storage/flowTokenVault)!
22 let tokens <- v.withdraw(amount: managerInitialTokenBalance) as! @FlowToken.Vault
23
24 let contractManager <- ContractManager.createManager(tokens: <-tokens, defaultRouterAddress: acct.address)
25 let contractAddress = contractManager.getAccount().address
26 acct.storage.save(<- contractManager, to: ContractManager.StoragePath)
27
28 acct.capabilities.unpublish(ContractManager.PublicPath)
29 acct.capabilities.publish(
30 acct.capabilities.storage.issue<&ContractManager.Manager>(ContractManager.StoragePath),
31 at: ContractManager.PublicPath
32 )
33
34 acct.storage.borrow<auth(ContractManager.Manage) &ContractManager.Manager>(from: ContractManager.StoragePath)!.onSave()
35
36 // there is a published hybrid custody capability to redeem
37 if acct.storage.borrow<&HybridCustody.Manager>(from: HybridCustody.ManagerStoragePath) == nil {
38 let m <- HybridCustody.createManager(filter: nil)
39 acct.storage.save(<- m, to: HybridCustody.ManagerStoragePath)
40
41 for c in acct.capabilities.storage.getControllers(forPath: HybridCustody.ManagerStoragePath) {
42 c.delete()
43 }
44
45 acct.capabilities.unpublish(HybridCustody.ManagerPublicPath)
46 acct.capabilities.publish(
47 acct.capabilities.storage.issue<&{HybridCustody.ManagerPublic}>(HybridCustody.ManagerStoragePath),
48 at: HybridCustody.ManagerPublicPath
49 )
50
51 acct.capabilities.storage.issue<auth(HybridCustody.Manage) &{HybridCustody.ManagerPrivate, HybridCustody.ManagerPublic}>(HybridCustody.ManagerStoragePath)
52 }
53
54 let inboxName = HybridCustody.getChildAccountIdentifier(acct.address)
55 let cap = acct.inbox.claim<auth(HybridCustody.Child) &{HybridCustody.AccountPrivate, HybridCustody.AccountPublic, ViewResolver.Resolver}>(inboxName, provider: contractAddress)
56 ?? panic("child account cap not found")
57
58 let hcManager = acct.storage.borrow<auth(HybridCustody.Manage) &HybridCustody.Manager>(from: HybridCustody.ManagerStoragePath)
59 ?? panic("manager no found")
60 hcManager.addAccount(cap: cap)
61
62 hcManager.setChildAccountDisplay(address: cap.address, MetadataViews.Display(
63 name: "Creator Hub",
64 description: "Created by the Flowty Creator Hub",
65 thumbnail: MetadataViews.HTTPFile(url: "https://avatars.flowty.io/6.x/thumbs/png?seed=".concat(cap.address.toString()))
66 ))
67 }
68
69 let manager = acct.storage.borrow<auth(ContractManager.Manage) &ContractManager.Manager>(from: ContractManager.StoragePath)
70 ?? panic("manager was not borrowed successfully")
71
72 let addr = manager.getAccount().address
73 let addrStr = addr.toString()
74 let nftType = "A.".concat(addrStr.slice(from: 2, upTo: addrStr.length)).concat(".").concat(contractName).concat(".NFT")
75 let royalty: MetadataViews.Royalty? = collectionRoyalty != nil ? MetadataViews.Royalty(
76 receiver: getAccount(addr).capabilities.get<&{FungibleToken.Receiver}>(FungibleTokenRouter.PublicPath),
77 cut: collectionRoyalty!,
78 description: ""
79 ) : nil
80
81 let data: {String: AnyStruct} = {}
82 let nftMetadata: NFTMetadata.Metadata = NFTMetadata.Metadata(
83 name: metadataArgs["name"]!,
84 description: metadataArgs["description"]!,
85 thumbnail: MetadataViews.IPFSFile(cid: metadataArgs["cid"]!, path: metadataArgs["path"]),
86 traits: nil,
87 editions: nil,
88 externalURL: metadataArgs["externalURL"] != nil ? MetadataViews.ExternalURL(metadataArgs["externalURL"]!) : nil,
89 royalties: royalty != nil ? MetadataViews.Royalties([royalty!]) : nil,
90 data: data
91 )
92
93 let socials: {String: MetadataViews.ExternalURL} = {}
94 let keys = ["twitter", "x", "discord", "instagram"]
95 for k in keys {
96 if let v = collectionInfoArgs[k] {
97 socials[k] = MetadataViews.ExternalURL(v)
98 }
99 }
100
101 let collectionDisplay = MetadataViews.NFTCollectionDisplay(
102 name: collectionInfoArgs["name"]!,
103 description: collectionInfoArgs["description"]!,
104 externalURL: MetadataViews.ExternalURL(collectionInfoArgs["externalURL"]!),
105 squareImage: MetadataViews.Media(
106 file: MetadataViews.IPFSFile(cid: collectionInfoArgs["squareImageCid"]!, path: collectionInfoArgs["squareImagePath"]),
107 mediaType: collectionInfoArgs["squareImageMediaType"]!
108 ),
109 bannerImage: MetadataViews.Media(
110 file: MetadataViews.IPFSFile(cid: collectionInfoArgs["bannerImageCid"]!, path: collectionInfoArgs["bannerImagePath"]),
111 mediaType: collectionInfoArgs["bannerImageMediaType"]!
112 ),
113 socials: socials
114 )
115
116 let dropDetails = FlowtyDrops.DropDetails(
117 display: MetadataViews.Display(
118 name: dropDetailArgs["name"]!,
119 description: dropDetailArgs["description"]!,
120 thumbnail: MetadataViews.IPFSFile(cid: dropDetailArgs["thumbnailCid"]!, path: dropDetailArgs["thumbnailPath"])
121 ),
122 medias: nil,
123 commissionRate: 0.05,
124 nftType: nftType,
125 paymentTokenTypes: { paymentTokenType: true }
126 )
127
128 let phaseDetails = FlowtyDrops.PhaseDetails(
129 activeChecker: FlowtyActiveCheckers.TimestampChecker(start: start, end: end),
130 display: phaseArgs["displayName"] != nil ? MetadataViews.Display(
131 name: phaseArgs["displayName"]!,
132 description: phaseArgs["displayDescription"]!,
133 thumbnail: MetadataViews.IPFSFile(cid: phaseArgs["displayCid"]!, path: phaseArgs["displayPath"])
134 ) : nil,
135 pricer: FlowtyPricers.FlatPrice(price: price, paymentTokenType: CompositeType(paymentTokenType)!),
136 addressVerifier: FlowtyAddressVerifiers.AllowAll(maxPerMint: 10)
137 )
138
139 // The Open edition initializer requires at least two keys:
140 // - data: NFTMetadata.Metadata
141 // - collectionInfo: NFTMetadata.CollectionInfo
142 //
143 // You can also specify some optional paramters:
144 // - dropDetails: FlowtyDrops.DropDetails
145 // - phaseDetails: [FlowtyDrops.PhaseDetails]
146 // - minterController: This is supplied in the initialization of the contract itself
147 let arr: [FlowtyDrops.PhaseDetails] = [phaseDetails]
148 let params: {String: AnyStruct} = {
149 "data": nftMetadata,
150 "collectionInfo": NFTMetadata.CollectionInfo(collectionDisplay: collectionDisplay),
151 "dropDetails": dropDetails,
152 "phaseDetails": arr
153 }
154
155 ContractFactory.createContract(templateType: Type<OpenEditionTemplate>(), acct: manager.borrowContractAccount(), name: contractName, params: params, initializeIdentifier: Type<OpenEditionInitializer>().identifier)
156 }
157}