FT TransferSEALED
▪□╳◆╳░▪■*?╲^◆░&#╱╲*◇□▓#▫╳◇▪&!█~?▒~█■◇?▒◇*╳□@●▒▓#╱?&◇$█~!○□#●▒╱▪~
Transaction ID
Execution Fee
0.00126 FLOWTransaction Summary
FT TransferCalled NonFungibleToken, ViewResolver, MetadataViews +4 more
Script Arguments
0amountUFix64
2.55000000
1toAddress
Cadence Script
1import NonFungibleToken from 0x1d7e57aa55817448
2import ViewResolver from 0x1d7e57aa55817448
3import MetadataViews from 0x1d7e57aa55817448
4import FungibleToken from 0xf233dcee88fe0abe
5import USDCFlow from 0xf1ab99c82dee3526
6import Burner from 0xf233dcee88fe0abe
7import FungibleTokenMetadataViews from 0xf233dcee88fe0abe
8transaction(amount: UFix64, to: Address) {
9
10 /// FTVaultData metadata view for the token being used
11 let vaultData: FungibleTokenMetadataViews.FTVaultData
12
13 // The Vault resource that holds the tokens that are being transferred
14 let sentVault: @{FungibleToken.Vault}
15
16 prepare(signer: auth(BorrowValue) &Account) {
17
18 self.vaultData = USDCFlow.resolveContractView(resourceType: nil, viewType: Type<FungibleTokenMetadataViews.FTVaultData>()) as! FungibleTokenMetadataViews.FTVaultData?
19 ?? panic("Could not resolve FTVaultData view. The USDCFlow"
20 .concat(" contract needs to implement the USDCVaultData Metadata view in order to execute this transaction."))
21
22 // Get a reference to the signer's stored vault
23 let vaultRef = signer.storage.borrow<auth(FungibleToken.Withdraw) &USDCFlow.Vault>(from: self.vaultData.storagePath)
24 ?? panic("The signer does not store an USDCFlow.Vault object at the path "
25 .concat(self.vaultData.storagePath.toString())
26 .concat(". The signer must initialize their account with this vault first!"))
27
28 // Withdraw tokens from the signer's stored vault
29 self.sentVault <- vaultRef.withdraw(amount: amount)
30 }
31
32 execute {
33
34 // Get the recipient's public account object
35 let recipient = getAccount(to)
36
37 // Get a reference to the recipient's Receiver
38 let receiverRef = recipient.capabilities.borrow<&{FungibleToken.Receiver}>(self.vaultData.receiverPath)
39 ?? panic("Could not borrow a Receiver reference to the FungibleToken Vault in account "
40 .concat(to.toString()).concat(" at path ").concat(self.vaultData.receiverPath.toString())
41 .concat(". Make sure you are sending to an address that has ")
42 .concat("a FungibleToken Vault set up properly at the specified path."))
43
44 // Deposit the withdrawn tokens in the recipient's receiver
45 receiverRef.deposit(from: <-self.sentVault)
46 }
47}