TransactionSEALED
▫@◆▒╱▓^$■█╲▓◆○$#&$!$╲□▪░!^%█$▒■●*~●*╳^@○□◆╳█▓&○~■■*%■░*░○!◆░▓◆@~
Transaction ID
Execution Fee
0.00114 FLOWPayer
Proposerseq:610125 key:5
Authorizers
2Transaction Summary
UpdatingContract Call
Called FungibleToken, FungibleTokenMetadataViews, NonFungibleToken +2 more
Script Arguments
Copy:
0amountUFix64
1.00000000
1nameString
2artistString
3artistAddressAddress
4descriptionString
5royaltyUFix64
0.00000000
6typeIDString
Cadence Script
1/// transactions/mint_v2.cdc
2
3import FungibleToken from 0xf233dcee88fe0abe
4import FungibleTokenMetadataViews from 0xf233dcee88fe0abe
5import NonFungibleToken from 0x1d7e57aa55817448
6import MetadataViews from 0x1d7e57aa55817448
7
8import JOSHIN from 0x82ed1b9cba5bb1b3
9
10
11
12
13transaction(
14 amount: UFix64,
15 name: String,
16 artist: String,
17 artistAddress: Address,
18 description: String,
19 royalty: UFix64,
20 typeID: String
21) {
22
23 /// Reference to the Token Minter Resource object
24 let tokenAdmin: &JOSHIN.Administrator
25 let tokenReceiver: &{FungibleToken.Receiver}
26
27
28 prepare(
29 tokenMinter: auth(BorrowValue) &Account,
30
31 receiver: auth(BorrowValue, IssueStorageCapabilityController, PublishCapability, SaveValue, UnpublishCapability) &Account
32 ) {
33
34 let vaultData = JOSHIN.resolveContractView(resourceType: nil, viewType: Type<FungibleTokenMetadataViews.FTVaultData>()) as! FungibleTokenMetadataViews.FTVaultData?
35 ?? panic("ViewResolver does not resolve FTVaultData view")
36
37 // enable receiver token
38 if receiver.storage.borrow<&JOSHIN.Vault>(from: vaultData.storagePath) == nil {
39 let vault <- JOSHIN.createEmptyVault(vaultType: Type<@JOSHIN.Vault>())
40
41 // Create a new JOSHIN Vault and put it in storage
42 receiver.storage.save(<-vault, to: vaultData.storagePath)
43
44 // Create a public capability to the Vault that exposes the Vault interfaces
45 let vaultCap = receiver.capabilities.storage.issue<&JOSHIN.Vault>(vaultData.storagePath)
46 receiver.capabilities.publish(vaultCap, at: vaultData.metadataPath)
47
48 // Create a public Capability to the Vault's Receiver functionality
49 let receiverCap = receiver.capabilities.storage.issue<&JOSHIN.Vault>(vaultData.storagePath)
50 receiver.capabilities.publish(receiverCap, at: vaultData.receiverPath)
51 }
52
53 self.tokenAdmin = tokenMinter.storage.borrow<&JOSHIN.Administrator>(from: JOSHIN.AdminStoragePath)
54 ?? panic("Signer is not the token admin")
55
56 self.tokenReceiver = getAccount(receiver.address).capabilities.borrow<&{FungibleToken.Receiver}>(vaultData.receiverPath)
57 ?? panic("Could not borrow receiver reference to the Vault")
58
59
60 }
61
62 execute {
63 if amount > UFix64(0) {
64 // Create mint tokens
65 let tokenMinter <- self.tokenAdmin.createNewMinter()
66
67 let mintedVault <- tokenMinter.mintTokens(amount: amount)
68
69 // Deposit them to the receiever
70 self.tokenReceiver.deposit(from: <-mintedVault)
71
72 destroy tokenMinter
73 }
74
75 }
76}