github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/fvm/blueprints/scripts/mintFlowTokenTransactionTemplate.cdc (about)

     1  import FungibleToken from "FungibleToken"
     2  import FlowToken from "FlowToken"
     3  
     4  transaction(amount: UFix64) {
     5  
     6    let tokenAdmin: &FlowToken.Administrator
     7    let tokenReceiver: &FlowToken.Vault
     8  
     9    prepare(signer: auth(BorrowValue) &Account) {
    10  	self.tokenAdmin = signer.storage
    11  	  .borrow<&FlowToken.Administrator>(from: /storage/flowTokenAdmin)
    12  	  ?? panic("Signer is not the token admin")
    13  
    14  	self.tokenReceiver = signer
    15  	  .capabilities.borrow<&FlowToken.Vault>(/public/flowTokenReceiver)
    16  	  ?? panic("Unable to borrow receiver reference for recipient")
    17    }
    18  
    19    execute {
    20  	let minter <- self.tokenAdmin.createNewMinter(allowedAmount: amount)
    21  	let mintedVault <- minter.mintTokens(amount: amount)
    22  
    23  	self.tokenReceiver.deposit(from: <-mintedVault)
    24  
    25  	destroy minter
    26    }
    27  }