github.com/koko1123/flow-go-1@v0.29.6/fvm/blueprints/scripts/mintFlowTokenTransactionTemplate.cdc (about)

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