Skip to content

Commit

Permalink
add FlowToken transfer txn
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed Oct 4, 2023
1 parent dd7b295 commit e4fcf22
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions transactions/flow-token/transfer_flow.cdc
Original file line number Diff line number Diff line change
@@ -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
)
)
}
}

0 comments on commit e4fcf22

Please sign in to comment.