Fixes World
Github
  • 💡What is Fixes?
  • 📓Concepts
    • 🔡Fixes Inscription
    • 💹Fixes Coins
      • Guide 1: How to Launch a new Coin?
    • 🎟️Lottery Game
    • 👻𝔉rc20s
    • 📔Token List
      • 📘Query TokenList
      • 📙Query Reviewers
  • 👨‍💻Developer
    • On-chain Interactions
      • 🔯𝔉rc20
        • Deploy - tx
        • Mint(batch) - tx
        • Transfer - tx
        • Burn - tx
        • List for Sale - tx
        • Take list as buyer - tx
        • List for Purchase - tx
        • Take list as seller - tx
        • Cancel Listing - tx
      • 🔡Fixes Inscription
        • EstimateCost - read
    • Open API Service
      • 🔯𝔉rc20 Basics
        • Query 𝔉rc20 Tokens
        • Fetch 𝔉rc20 Token Info
        • Check 𝔉rc20 registered
        • Get 𝔉rc20 balances
        • Get 𝔉rc20 balance
      • 🛒𝔉rc20 Marketplace
        • Query all 𝔉rc20 Markets
        • Fetch 𝔉rc20 Market detailed info
        • Check 𝔉rc20 Market enabled
        • Query 𝔉rc20 Listings
        • Query Market Trading History
        • Query Address Trading History
      • 🔧Utilities
        • Estimate Fixes inscribing cost
        • Get current $FLOW price
      • 📃Legal Disclaimer
  • 🔗LINKS
    • Official Website
    • Linktree
Powered by GitBook
On this page
Edit on GitHub
  1. Developer
  2. On-chain Interactions
  3. 𝔉rc20

Transfer - tx

Transfer 𝔉rc20 token

Example of Fixes Inscription data string:

op=transfer,tick=fixes,amt=100000.0,to=0xd2abb5dbf5e08666

Transaction parameters:

Key
Required
FType
Description

tick

t.String

Ticker: identity of the 𝔉rc20 token

amt

t.UFix64

Amount to transfer: States the amount of the 𝔉rc20 to transfer.

to

t.Address

The recipient of 𝔉rc20 tokens.

Transaction code example:

import txTransferFRC20 from "@fixes/contracts/transactions/transfer-frc20.cdc?raw";

async function transferFRC20(
  tick: string,
  to: string,
  amt: number
) {
  const txid = await flow.sendTransaction(txTransferFRC20, (arg, t) => [
    arg(tick, t.String),
    arg(amt.toFixed(8), t.UFix64),
    arg(to, t.Address),
  ]);
  return txid;
}

Transaction source code

Related docs

  • EstimateCost - read

PreviousMint(batch) - txNextBurn - tx

Last updated 1 year ago

👨‍💻
🔯
How to send a transaction to Flow blockchain or query data from Flow blockchain?
https://github.com/fixes-world/fixes/blob/main/cadence/transactions/transfer-frc20.cdc
import "FungibleToken"
import "FlowToken"

import "Fixes"
import "FRC20Indexer"
import "FixesInscriptionFactory"

transaction(
    tick: String,
    amt: UFix64,
    to: Address,
) {
    let ins: auth(Fixes.Extractable) &Fixes.Inscription

    prepare(acct: auth(Storage, Capabilities) &Account) {
        /** ------------- Prepare the Inscription Store - Start ---------------- */
        let storePath = Fixes.getFixesStoreStoragePath()
        if acct.storage
            .borrow<auth(Fixes.Manage) &Fixes.InscriptionsStore>(from: storePath) == nil {
            acct.storage.save(<- Fixes.createInscriptionsStore(), to: storePath)
        }

        let store = acct.storage
            .borrow<auth(Fixes.Manage) &Fixes.InscriptionsStore>(from: storePath)
            ?? panic("Could not borrow a reference to the Inscriptions Store!")
        /** ------------- End -------------------------------------------------- */

        // The Inscription's metadata
        let dataStr = FixesInscriptionFactory.buildTransferFRC20(tick: tick, to: to, amt: amt)

        // estimate the required storage
        let estimatedReqValue = FixesInscriptionFactory.estimateFrc20InsribeCost(dataStr)

        // Get a reference to the signer's stored vault
        let vaultRef = acct.storage
            .borrow<auth(FungibleToken.Withdraw) &FlowToken.Vault>(from: /storage/flowTokenVault)
            ?? panic("Could not borrow reference to the owner's Vault!")
        // Withdraw tokens from the signer's stored vault
        let flowToReserve <- vaultRef.withdraw(amount: estimatedReqValue)

        // Create the Inscription first
        let newInsId = FixesInscriptionFactory.createAndStoreFrc20Inscription(
            dataStr,
            <- (flowToReserve as! @FlowToken.Vault),
            store
        )
        // borrow a reference to the new Inscription
        self.ins = store.borrowInscriptionWritableRef(newInsId)
            ?? panic("Could not borrow reference to the new Inscription!")
    }

    execute {
        let indexer = FRC20Indexer.getIndexer()
        indexer.transfer(ins: self.ins)
    }
}