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

     1  import FungibleToken from "FungibleToken"
     2  import FlowToken from "FlowToken"
     3  
     4  transaction(amount: UFix64, recipient: Address) {
     5  
     6  	let sentVault: @{FungibleToken.Vault}
     7  
     8  	prepare(signer: auth(BorrowValue) &Account) {
     9  	    let vaultRef = signer.storage.borrow<auth(FungibleToken.Withdraw) &FlowToken.Vault>(from: /storage/flowTokenVault)
    10  		    ?? panic("failed to borrow reference to sender vault")
    11  	    self.sentVault <- vaultRef.withdraw(amount: amount)
    12  	}
    13  
    14  	execute {
    15  	    let receiverRef =  getAccount(recipient)
    16  		    .capabilities.borrow<&FlowToken.Vault>(/public/flowTokenReceiver)
    17  		    ?? panic("failed to borrow reference to recipient vault")
    18  	    receiverRef.deposit(from: <-self.sentVault)
    19  	}
    20  }