From 60bd5897821a274936e787a7ffd8754f5e133814 Mon Sep 17 00:00:00 2001 From: Austin Kline Date: Fri, 31 May 2024 22:59:25 -0700 Subject: [PATCH] contract creation event optionally creates a drop as well --- args/create_open_edition_contract.json | 450 +++++++++++++++++- args/encode_data.json | 192 ++++++++ contracts/DropFactory.cdc | 4 +- contracts/DropTypes.cdc | 4 +- contracts/FlowtyDrops.cdc | 7 +- contracts/FlowtyPricers.cdc | 6 +- .../initializers/OpenEditionInitializer.cdc | 38 ++ contracts/nft/OpenEditionNFT.cdc | 7 +- contracts/nft/OpenEditionTemplate.cdc | 6 +- scripts/util/encode_data.cdc | 4 + 10 files changed, 701 insertions(+), 17 deletions(-) create mode 100644 args/encode_data.json create mode 100644 scripts/util/encode_data.cdc diff --git a/args/create_open_edition_contract.json b/args/create_open_edition_contract.json index e148342..c1e89a1 100644 --- a/args/create_open_edition_contract.json +++ b/args/create_open_edition_contract.json @@ -1 +1,449 @@ -[{"type": "String","value": "MyCollection"},{"type": "Dictionary","value": [{"key": {"type": "String","value": "collectionInfo"},"value": {"type": "Struct","value": {"id": "A.f8d6e0586b0a20c7.NFTMetadata.CollectionInfo","fields": [{"name": "collectionDisplay","value": {"type": "Struct","value": {"id": "A.f8d6e0586b0a20c7.MetadataViews.NFTCollectionDisplay","fields": [{"name": "name","value": {"type": "String","value": "The Open Edition Collection"}},{"name": "description","value": {"type": "String","value": "This collection is used as an example to help you develop your next Open Edition Flow NFT"}},{"name": "externalURL","value": {"type": "Struct","value": {"id": "A.f8d6e0586b0a20c7.MetadataViews.ExternalURL","fields": [{"name": "url","value": {"type": "String","value": "https://flowty.io"}}]}}},{"name": "squareImage","value": {"type": "Struct","value": {"id": "A.f8d6e0586b0a20c7.MetadataViews.Media","fields": [{"name": "file","value": {"type": "Struct","value": {"id": "A.f8d6e0586b0a20c7.MetadataViews.IPFSFile","fields": [{"name": "cid","value": {"type": "String","value": "QmWWLhnkPR3ejavNtzeJcdG9fwcBHKwBVEP4pZ9rGbdHEM"}},{"name": "path","value": {"type": "Optional","value": null}}]}}},{"name": "mediaType","value": {"type": "String","value": "image/png"}}]}}},{"name": "bannerImage","value": {"type": "Struct","value": {"id": "A.f8d6e0586b0a20c7.MetadataViews.Media","fields": [{"name": "file","value": {"type": "Struct","value": {"id": "A.f8d6e0586b0a20c7.MetadataViews.IPFSFile","fields": [{"name": "cid","value": {"type": "String","value": "QmYD8e5s59qYFFQXref1YzyqW1WKYUMPxfqVDEis2s23BF"}},{"name": "path","value": {"type": "Optional","value": null}}]}}},{"name": "mediaType","value": {"type": "String","value": "image/png"}}]}}},{"name": "socials","value": {"type": "Dictionary","value": [{"key": {"type": "String","value": "twitter"},"value": {"type": "Struct","value": {"id": "A.f8d6e0586b0a20c7.MetadataViews.ExternalURL","fields": [{"name": "url","value": {"type": "String","value": "https://x.com/flowty_io"}}]}}}]}}]}}}]}}},{"key": {"type": "String","value": "data"},"value": {"type": "Struct","value": {"id": "A.f8d6e0586b0a20c7.NFTMetadata.Metadata","fields": [{"name": "name","value": {"type": "String","value": "Fluid"}},{"name": "description","value": {"type": "String","value": "Fluid is an open edition collection generated by the Flowty contract factory!"}},{"name": "thumbnail","value": {"type": "Struct","value": {"id": "A.f8d6e0586b0a20c7.MetadataViews.IPFSFile","fields": [{"name": "cid","value": {"type": "String","value": "QmWWLhnkPR3ejavNtzeJcdG9fwcBHKwBVEP4pZ9rGbdHEM"}},{"name": "path","value": {"type": "Optional","value": null}}]}}},{"name": "traits","value": {"type": "Optional","value": null}},{"name": "editions","value": {"type": "Optional","value": null}},{"name": "externalURL","value": {"type": "Optional","value": null}},{"name": "data","value": {"type": "Dictionary","value": []}}]}}}]}] \ No newline at end of file +[ + { + "type": "String", + "value": "MyCollection" + }, + { + "type": "Dictionary", + "value": [ + { + "key": { + "type": "String", + "value": "collectionInfo" + }, + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.NFTMetadata.CollectionInfo", + "fields": [ + { + "name": "collectionDisplay", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.MetadataViews.NFTCollectionDisplay", + "fields": [ + { + "name": "name", + "value": { + "type": "String", + "value": "The Open Edition Collection" + } + }, + { + "name": "description", + "value": { + "type": "String", + "value": "This collection is used as an example to help you develop your next Open Edition Flow NFT" + } + }, + { + "name": "externalURL", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.MetadataViews.ExternalURL", + "fields": [ + { + "name": "url", + "value": { + "type": "String", + "value": "https://flowty.io" + } + } + ] + } + } + }, + { + "name": "squareImage", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.MetadataViews.Media", + "fields": [ + { + "name": "file", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.MetadataViews.IPFSFile", + "fields": [ + { + "name": "cid", + "value": { + "type": "String", + "value": "QmWWLhnkPR3ejavNtzeJcdG9fwcBHKwBVEP4pZ9rGbdHEM" + } + }, + { + "name": "path", + "value": { + "type": "Optional", + "value": null + } + } + ] + } + } + }, + { + "name": "mediaType", + "value": { + "type": "String", + "value": "image/png" + } + } + ] + } + } + }, + { + "name": "bannerImage", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.MetadataViews.Media", + "fields": [ + { + "name": "file", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.MetadataViews.IPFSFile", + "fields": [ + { + "name": "cid", + "value": { + "type": "String", + "value": "QmYD8e5s59qYFFQXref1YzyqW1WKYUMPxfqVDEis2s23BF" + } + }, + { + "name": "path", + "value": { + "type": "Optional", + "value": null + } + } + ] + } + } + }, + { + "name": "mediaType", + "value": { + "type": "String", + "value": "image/png" + } + } + ] + } + } + }, + { + "name": "socials", + "value": { + "type": "Dictionary", + "value": [ + { + "key": { + "type": "String", + "value": "twitter" + }, + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.MetadataViews.ExternalURL", + "fields": [ + { + "name": "url", + "value": { + "type": "String", + "value": "https://x.com/flowty_io" + } + } + ] + } + } + } + ] + } + } + ] + } + } + } + ] + } + } + }, + { + "key": { + "type": "String", + "value": "data" + }, + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.NFTMetadata.Metadata", + "fields": [ + { + "name": "name", + "value": { + "type": "String", + "value": "Fluid" + } + }, + { + "name": "description", + "value": { + "type": "String", + "value": "Fluid is an open edition collection generated by the Flowty contract factory!" + } + }, + { + "name": "thumbnail", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.MetadataViews.IPFSFile", + "fields": [ + { + "name": "cid", + "value": { + "type": "String", + "value": "QmWWLhnkPR3ejavNtzeJcdG9fwcBHKwBVEP4pZ9rGbdHEM" + } + }, + { + "name": "path", + "value": { + "type": "Optional", + "value": null + } + } + ] + } + } + }, + { + "name": "traits", + "value": { + "type": "Optional", + "value": null + } + }, + { + "name": "editions", + "value": { + "type": "Optional", + "value": null + } + }, + { + "name": "externalURL", + "value": { + "type": "Optional", + "value": null + } + }, + { + "name": "data", + "value": { + "type": "Dictionary", + "value": [] + } + } + ] + } + } + }, + { + "key": { + "type": "String", + "value": "dropDetails" + }, + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.FlowtyDrops.DropDetails", + "fields": [ + { + "name": "display", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.MetadataViews.Display", + "fields": [ + { + "name": "name", + "value": { + "type": "String", + "value": "My First Drop" + } + }, + { + "name": "description", + "value": { + "type": "String", + "value": "This is a description for my first drop" + } + }, + { + "name": "thumbnail", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.MetadataViews.IPFSFile", + "fields": [ + { + "name": "cid", + "value": { + "type": "String", + "value": "QmWWLhnkPR3ejavNtzeJcdG9fwcBHKwBVEP4pZ9rGbdHEM" + } + }, + { + "name": "path", + "value": { + "type": "Optional", + "value": null + } + } + ] + } + } + } + ] + } + } + }, + { + "name": "medias", + "value": { + "type": "Optional", + "value": null + } + }, + { + "name": "totalMinted", + "value": { + "type": "Int", + "value": "0" + } + }, + { + "name": "minters", + "value": { + "type": "Dictionary", + "value": [] + } + }, + { + "name": "commissionRate", + "value": { + "type": "UFix64", + "value": "0.05" + } + }, + { + "name": "nftType", + "value": { + "type": "String", + "value": "A.f8d6e0586b0a20c7.MyCollection.NFT" + } + } + ] + } + } + }, + { + "key": { + "type": "String", + "value": "phaseDetails" + }, + "value": { + "type": "Array", + "value": [ + { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.FlowtyDrops.PhaseDetails", + "fields": [ + { + "name": "switcher", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.FlowtySwitchers.AlwaysOn", + "fields": [] + } + } + }, + { + "name": "display", + "value": { + "type": "Optional", + "value": null + } + }, + { + "name": "pricer", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.FlowtyPricers.FlatPrice", + "fields": [ + { + "name": "price", + "value": { + "type": "UFix64", + "value": "1.0" + } + }, + { + "name": "paymentTokenType", + "value": { + "type": "String", + "value": "A.0ae53cb6e3f42a79.FlowToken.Vault" + } + } + ] + } + } + }, + { + "name": "addressVerifier", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.FlowtyAddressVerifiers.AllowAll", + "fields": [ + { + "name": "maxPerMint", + "value": { + "type": "Int", + "value": "100" + } + } + ] + } + } + }, + { + "name": "data", + "value": { + "type": "Dictionary", + "value": [] + } + } + ] + } + } + ] + } + } + ] + } +] \ No newline at end of file diff --git a/args/encode_data.json b/args/encode_data.json new file mode 100644 index 0000000..05696c2 --- /dev/null +++ b/args/encode_data.json @@ -0,0 +1,192 @@ +[ + { + "type": "Dictionary", + "value": [ + { + "key": { + "type": "String", + "value": "dropDetails" + }, + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.FlowtyDrops.DropDetails", + "fields": [ + { + "name": "display", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.MetadataViews.Display", + "fields": [ + { + "name": "name", + "value": { + "type": "String", + "value": "My First Drop" + } + }, + { + "name": "description", + "value": { + "type": "String", + "value": "This is a description for my first drop" + } + }, + { + "name": "thumbnail", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.MetadataViews.IPFSFile", + "fields": [ + { + "name": "cid", + "value": { + "type": "String", + "value": "QmWWLhnkPR3ejavNtzeJcdG9fwcBHKwBVEP4pZ9rGbdHEM" + } + }, + { + "name": "path", + "value": { + "type": "Optional", + "value": null + } + } + ] + } + } + } + ] + } + } + }, + { + "name": "medias", + "value": { + "type": "Optional", + "value": null + } + }, + { + "name": "totalMinted", + "value": { + "type": "Int", + "value": "0" + } + }, + { + "name": "minters", + "value": { + "type": "Dictionary", + "value": [] + } + }, + { + "name": "commissionRate", + "value": { + "type": "UFix64", + "value": "0.05" + } + }, + { + "name": "nftType", + "value": { + "type": "String", + "value": "A.f8d6e0586b0a20c7.MyCollection.NFT" + } + } + ] + } + } + }, + { + "key": { + "type": "String", + "value": "phaseDetails" + }, + "value": { + "type": "Array", + "value": [ + { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.FlowtyDrops.PhaseDetails", + "fields": [ + { + "name": "switcher", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.FlowtySwitchers.AlwaysOn", + "fields": [] + } + } + }, + { + "name": "display", + "value": { + "type": "Optional", + "value": null + } + }, + { + "name": "pricer", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.FlowtyPricers.FlatPrice", + "fields": [ + { + "name": "price", + "value": { + "type": "UFix64", + "value": "1.0" + } + }, + { + "name": "paymentTokenType", + "value": { + "type": "String", + "value": "A.0ae53cb6e3f42a79.FlowToken.Vault" + } + } + ] + } + } + }, + { + "name": "addressVerifier", + "value": { + "type": "Struct", + "value": { + "id": "A.f8d6e0586b0a20c7.FlowtyAddressVerifiers.AllowAll", + "fields": [ + { + "name": "maxPerMint", + "value": { + "type": "Int", + "value": "100" + } + } + ] + } + } + }, + { + "name": "data", + "value": { + "type": "Dictionary", + "value": [] + } + } + ] + } + } + ] + } + } + ] + } +] \ No newline at end of file diff --git a/contracts/DropFactory.cdc b/contracts/DropFactory.cdc index d883c68..822d8c3 100644 --- a/contracts/DropFactory.cdc +++ b/contracts/DropFactory.cdc @@ -35,7 +35,7 @@ access(all) contract DropFactory { let nftType = CompositeType(nftTypeIdentifier) ?? panic("invalid nft type identifier") - let dropDetails = FlowtyDrops.DropDetails(display: dropDisplay, medias: nil, commissionRate: 0.05, nftType: nftType) + let dropDetails = FlowtyDrops.DropDetails(display: dropDisplay, medias: nil, commissionRate: 0.05, nftType: nftTypeIdentifier) let drop <- FlowtyDrops.createDrop(details: dropDetails, minterCap: minterCap, phases: <- [<-phase]) return <- drop @@ -67,7 +67,7 @@ access(all) contract DropFactory { let phase <- FlowtyDrops.createPhase(details: phaseDetails) let nftType = CompositeType(nftTypeIdentifier) ?? panic("invalid nft type identifier") - let dropDetails = FlowtyDrops.DropDetails(display: dropDisplay, medias: nil, commissionRate: 0.05, nftType: nftType) + let dropDetails = FlowtyDrops.DropDetails(display: dropDisplay, medias: nil, commissionRate: 0.05, nftType: nftTypeIdentifier) let drop <- FlowtyDrops.createDrop(details: dropDetails, minterCap: minterCap, phases: <- [<-phase]) return <- drop diff --git a/contracts/DropTypes.cdc b/contracts/DropTypes.cdc index 8338627..4682ea7 100644 --- a/contracts/DropTypes.cdc +++ b/contracts/DropTypes.cdc @@ -207,7 +207,7 @@ access(all) contract DropTypes { minterCount: dropDetails.minters.keys.length, mintedByAddress: minter != nil ? dropDetails.minters[minter!] : nil, commissionRate: dropDetails.commissionRate, - nftType: dropDetails.nftType, + nftType: CompositeType(dropDetails.nftType)!, address: minter, phases: phaseSummaries ) @@ -267,7 +267,7 @@ access(all) contract DropTypes { minterCount: dropDetails.minters.keys.length, mintedByAddress: minter != nil ? dropDetails.minters[minter!] : nil, commissionRate: dropDetails.commissionRate, - nftType: dropDetails.nftType, + nftType: CompositeType(dropDetails.nftType)!, address: minter, phases: phaseSummaries )) diff --git a/contracts/FlowtyDrops.cdc b/contracts/FlowtyDrops.cdc index 408e994..54fd823 100644 --- a/contracts/FlowtyDrops.cdc +++ b/contracts/FlowtyDrops.cdc @@ -37,7 +37,7 @@ access(all) contract FlowtyDrops { access(all) event ResourceDestroyed( uuid: UInt64 = self.uuid, minterAddress: Address = self.minterCap.address, - nftType: String = self.details.nftType.identifier, + nftType: String = self.details.nftType, totalMinted: Int = self.details.totalMinted ) @@ -58,6 +58,7 @@ access(all) contract FlowtyDrops { ): @{FungibleToken.Vault} { pre { expectedType.isSubtype(of: Type<@{NonFungibleToken.NFT}>()): "expected type must be an NFT" + expectedType.identifier == self.details.nftType: "expected type does not match drop details type" self.phases.length > phaseIndex: "phase index is too high" receiverCap.check(): "receiver capability is not valid" } @@ -190,7 +191,7 @@ access(all) contract FlowtyDrops { access(all) var totalMinted: Int access(all) var minters: {Address: Int} access(all) let commissionRate: UFix64 - access(all) let nftType: Type + access(all) let nftType: String access(contract) fun addMinted(num: Int, addr: Address) { self.totalMinted = self.totalMinted + num @@ -201,7 +202,7 @@ access(all) contract FlowtyDrops { self.minters[addr] = self.minters[addr]! + num } - init(display: MetadataViews.Display, medias: MetadataViews.Medias?, commissionRate: UFix64, nftType: Type) { + init(display: MetadataViews.Display, medias: MetadataViews.Medias?, commissionRate: UFix64, nftType: String) { self.display = display self.medias = medias self.totalMinted = 0 diff --git a/contracts/FlowtyPricers.cdc b/contracts/FlowtyPricers.cdc index a8b0b7d..25555f0 100644 --- a/contracts/FlowtyPricers.cdc +++ b/contracts/FlowtyPricers.cdc @@ -13,14 +13,14 @@ access(all) contract FlowtyPricers { */ access(all) struct FlatPrice: FlowtyDrops.Pricer { access(all) var price: UFix64 - access(all) let paymentTokenType: Type + access(all) let paymentTokenType: String access(all) view fun getPrice(num: Int, paymentTokenType: Type, minter: Address?): UFix64 { return self.price * UFix64(num) } access(all) view fun getPaymentTypes(): [Type] { - return [self.paymentTokenType] + return [CompositeType(self.paymentTokenType)!] } access(Mutate) fun setPrice(price: UFix64) { @@ -29,7 +29,7 @@ access(all) contract FlowtyPricers { init(price: UFix64, paymentTokenType: Type) { self.price = price - self.paymentTokenType = paymentTokenType + self.paymentTokenType = paymentTokenType.identifier } } diff --git a/contracts/initializers/OpenEditionInitializer.cdc b/contracts/initializers/OpenEditionInitializer.cdc index 43017db..1b1759f 100644 --- a/contracts/initializers/OpenEditionInitializer.cdc +++ b/contracts/initializers/OpenEditionInitializer.cdc @@ -1,5 +1,6 @@ import "ContractInitializer" import "NFTMetadata" +import "FlowtyDrops" access(all) contract OpenEditionInitializer: ContractInitializer { access(all) fun initialize(contractAcct: auth(Storage, Contracts, Keys, Inbox, Capabilities) &Account, params: {String: AnyStruct}): NFTMetadata.InitializedCaps { @@ -21,6 +22,43 @@ access(all) contract OpenEditionInitializer: ContractInitializer { self.account.storage.save(cap, to: StoragePath(identifier: "metadataAuthAccount_".concat(contractName))!) + // do we have information to setup a drop as well? + log(params.keys) + if params.containsKey("dropDetails") && params.containsKey("phaseDetails") && params.containsKey("minterController") { + // extract expected keys + let minterCap = params["minterController"]! as! Capability<&{FlowtyDrops.Minter}> + let dropDetails = params["dropDetails"]! as! FlowtyDrops.DropDetails + let phaseDetails = params["phaseDetails"]! as! [FlowtyDrops.PhaseDetails] + + log(dropDetails) + log(phaseDetails) + + assert(minterCap.check(), message: "invalid minter capability") + + + let phases: @[FlowtyDrops.Phase] <- [] + for p in phaseDetails { + phases.append(<- FlowtyDrops.createPhase(details: p)) + } + + let drop <- FlowtyDrops.createDrop(details: dropDetails, minterCap: minterCap, phases: <- phases) + if acct.storage.borrow<&AnyResource>(from: FlowtyDrops.ContainerStoragePath) == nil { + acct.storage.save(<- FlowtyDrops.createContainer(), to: FlowtyDrops.ContainerStoragePath) + + acct.capabilities.unpublish(FlowtyDrops.ContainerPublicPath) + acct.capabilities.publish( + acct.capabilities.storage.issue<&{FlowtyDrops.ContainerPublic}>(FlowtyDrops.ContainerStoragePath), + at: FlowtyDrops.ContainerPublicPath + ) + } + + let container = acct.storage.borrow(from: FlowtyDrops.ContainerStoragePath) + ?? panic("drops container not found") + container.addDrop(<- drop) + } else { + log("missing keys to setup drop") + } + return NFTMetadata.initialize(acct: acct, collectionInfo: collectionInfo, collectionType: self.getType()) } } \ No newline at end of file diff --git a/contracts/nft/OpenEditionNFT.cdc b/contracts/nft/OpenEditionNFT.cdc index a94e358..e4ec673 100644 --- a/contracts/nft/OpenEditionNFT.cdc +++ b/contracts/nft/OpenEditionNFT.cdc @@ -33,10 +33,11 @@ access(all) contract OpenEditionNFT: BaseCollection { init(params: {String: AnyStruct}, initializeIdentifier: String) { self.totalSupply = 0 - self.MetadataCap = ContractBorrower.borrowInitializer(typeIdentifier: initializeIdentifier).initialize(contractAcct: self.account, params: params).pubCap - let minter <- create NFTMinter() self.account.storage.save(<-minter, to: FlowtyDrops.getMinterStoragePath(type: self.getType())) - self.account.capabilities.storage.issue<&{FlowtyDrops.Minter}>(FlowtyDrops.getMinterStoragePath(type: self.getType())) + params["minterController"] = self.account.capabilities.storage.issue<&{FlowtyDrops.Minter}>(FlowtyDrops.getMinterStoragePath(type: self.getType())) + + self.MetadataCap = ContractBorrower.borrowInitializer(typeIdentifier: initializeIdentifier).initialize(contractAcct: self.account, params: params).pubCap + } } \ No newline at end of file diff --git a/contracts/nft/OpenEditionTemplate.cdc b/contracts/nft/OpenEditionTemplate.cdc index 0fb6f65..3fe129e 100644 --- a/contracts/nft/OpenEditionTemplate.cdc +++ b/contracts/nft/OpenEditionTemplate.cdc @@ -39,11 +39,11 @@ access(all) contract OpenEditionTemplate: ContractFactoryTemplate { .concat("\n") .concat(" init(params: {String: AnyStruct}, initializeIdentifier: String) {\n") .concat(" self.totalSupply = 0\n") - .concat(" self.MetadataCap = ContractBorrower.borrowInitializer(typeIdentifier: initializeIdentifier).initialize(contractAcct: self.account, params: params).pubCap\n") - .concat("\n\n") .concat(" let minter <- create NFTMinter()\n") .concat(" self.account.storage.save(<-minter, to: FlowtyDrops.getMinterStoragePath(type: self.getType()))\n") - .concat(" self.account.capabilities.storage.issue<&{FlowtyDrops.Minter}>(FlowtyDrops.getMinterStoragePath(type: self.getType()))\n") + .concat(" params[\"minterController\"] = self.account.capabilities.storage.issue<&{FlowtyDrops.Minter}>(FlowtyDrops.getMinterStoragePath(type: self.getType()))\n") + .concat("\n\n") + .concat(" self.MetadataCap = ContractBorrower.borrowInitializer(typeIdentifier: initializeIdentifier).initialize(contractAcct: self.account, params: params).pubCap\n") .concat(" }\n") .concat("}\n") diff --git a/scripts/util/encode_data.cdc b/scripts/util/encode_data.cdc new file mode 100644 index 0000000..582075a --- /dev/null +++ b/scripts/util/encode_data.cdc @@ -0,0 +1,4 @@ +access(all) fun main(data: {String: AnyStruct}): Bool { + log(data) + return true +} \ No newline at end of file