diff --git a/transactions/flow-token/transfer_flow.cdc b/transactions/flow-token/transfer_flow.cdc new file mode 100644 index 0000000..2c911bb --- /dev/null +++ b/transactions/flow-token/transfer_flow.cdc @@ -0,0 +1,23 @@ +import "FungibleToken" +import "FlowToken" + +transaction(recipient: Address, amount: UFix64) { + + let providerVault: &FlowToken.Vault + let receiver: &{FungibleToken.Receiver} + + prepare(signer: AuthAccount) { + self.providerVault = signer.borrow<&FlowToken.Vault>(from: /storage/flowTokenVault)! + self.receiver = getAccount(recipient).getCapability<&{FungibleToken.Receiver}>(/public/flowTokenReceiver) + .borrow() + ?? panic("Could not borrow receiver reference") + } + + execute { + self.receiver.deposit( + from: <-self.providerVault.withdraw( + amount: amount + ) + ) + } +}