Cronos EVM Docs
  • Getting Started
    • Getting Started
    • Background
    • Architecture
    • Cronos roadmap
  • FOR USERS
    • 💳Crypto.com Card Top Up
    • 🔥Crypto Wallets
    • 🦊MetaMask Configuration
    • 🦁Brave Wallet
    • 🌉Bridges
      • From the Crypto.com App and Exchange
        • From the Crypto.com App
        • From the Crypto.com Exchange
      • IBC (Cronos POS Chain, other Cosmos chains)
        • Cronos Bridge Web App
      • Independent bridges
      • FAQs for Bridge transfers
      • FAQs for transactions from/to centralized exchanges
    • 🚰Testnet Faucet
    • 💡Tips & FAQs
    • 👮Key Principles for Wallet Security
    • GasTracker
  • FOR DAPP DEVELOPERS
    • 💡Founder FAQs
    • 🏅Hacker's Getting Started Resources
    • 📃Smart Contracts
      • Contract Development on Testnet
      • Contract Deployment and Verification
      • Contract Verification Export: Cronoscan To Cronos Explorer
      • Best Practices
      • Token Contract Addresses
    • 💻dApp Creation
      • Free and commercial RPC endpoints
      • Wallet integrations
      • Web3-wallet
      • JSON-RPC methods
      • Address Conversion
      • Swagger Playground
    • ⚙️Dev Tools & Integrations
      • All dev tools & integrations
      • Account Abstraction
      • Band Protocol
      • Banxa
      • GoldRush
      • Cronos Safe
      • Flair
      • Google Bigquery
      • Moralis
      • Pyth
      • Secret Network
      • SubQuery
      • Witnet
    • Crypto.com AI Agent SDK
  • FOR NODE HOSTS
    • Running nodes
      • Cronos Mainnet
        • Quicksync
        • State-sync
        • Public Node Sync
        • KSYNC
        • The "Huygen" upgrade guide (v0.6.* to v0.7.*)
        • The "v0.7.0-hotfix" upgrade guide (v0.7.* to v0.8.*)
        • The "Galileo" upgrade guide (v0.8.* to v1.0.*)
        • The "Titan" upgrade guide (v1.0.* to v1.1.0)
        • The "v1.2" upgrade guide (v1.1.* to v1.2.0)
        • The "v1.3" upgrade guide (v1.2.* to v1.3.0)
        • The "v1.4" Pallene upgrade guide (v1.3.* to v1.4.1)
        • Patching Unlucky & Duplicate Tx
      • Cronos Testnet
      • Devnet
      • Best Practices
      • Cronosd build with Nix
      • VersionDB
      • MemIAVL
      • Local State Sync
    • Cronosd
  • CRONOS PLAY
    • Introduction
    • Unity Engine
      • Current Version
      • Legacy Version
        • EVM
        • Login Example
        • Custom RPC
        • ERC20
        • ERC721
        • ERC1155
      • Useful Links
    • Unreal Engine
      • Installation and Enabling
      • Working with Blueprint
        • Actors and Blueprint Classes
        • Cronos Configuration
        • Connect Defi Desktop/Onchain Wallet with URI
        • Connect Wallets with QR Code
        • Connect WalletConnect Step by Step
        • WalletConnect 2.0 and Unreal Engine 5: Hello World Example
        • Wallet
        • ERC20
        • ERC721
        • ERC1155
        • Broadcast Transactions
        • Get Tokens or Transactions
      • Working with C++
        • Creating a C++ Project
        • Creating a child DefiWalletCoreActor
        • Querying a contract
        • Customizing Network
      • Demo
    • Cronos Play C++ SDK
    • Crypto.com Pay Integration
    • Cronos Play FAQ
  • Block Explorers
    • Block Explorer and API Keys
    • Cronos Explorer
    • Cronoscan
  • CRONOS CHAIN PROTOCOL
    • Chain ID and Address Format
    • Cronos General FAQ
    • Genesis
    • Modules
      • module_bank
      • module_distribution
      • module_slashing
      • module_feemarket
    • Chain Details
      • List of parameters
      • Technical glossary
      • Protocol Documentation
    • Common IBC Commands
  • Cronos zkEVM
    • Cronos zkEVM
  • Resources
    • Media / brand kit
Powered by GitBook
On this page
  • Querying
  • Functions
  • Erc20Balance
  • Erc20Name
  • Erc20Symbol
  • Erc20Decimals
  • Erc20TotalSupply
  • Erc20Transfer
  • Erc20TransferFrom
  • Erc20Approve
  • Erc20Allowance

Was this helpful?

Edit on GitHub
  1. CRONOS PLAY
  2. Unreal Engine
  3. Working with Blueprint

ERC20

PreviousWalletNextERC721

Last updated 6 months ago

Was this helpful?

Querying

  • Let's work with ERC20 tokens with Blueprint!

  • Back to the map, select the drop down menu of Blueprints > Open Level Blueprint and launch the Level Blueprint Editor

  • The following screenshot shows Query the name of ERC20 contract and print it on the screen. In this example, we use a Function - Spawn Actor from Class to create an Actor instance from BP_DefiWalletCore Class. The Transformation defines the location, rotation, and scale that will be used by the new Actor. A reference to the new instance is available in the Return Value which feeds as input Value of Function Erc20Name. Erc20Name also has an input Contract Address, for example, we set it as 0xf0307093f23311FE6776a7742dB619EB3df62969. Finally, print the token name with Function - Print String.

  • Click Compile > Play, USDC is printed in the game.

  • We can create a variable contract and set the default value as 0xf0307093f23311FE6776a7742dB619EB3df62969 for later easy access.

  • Similarly, we can call other ERC20 functions by dragging from the Return Value of the SpawnActor BP Defi Wallet Core and search to add Erc20Balance, Erc20Symbol, Erc20Decimals, and Erc20TotalSupply like below

    PS: In above example, we use Account Address 0xf0307093f23311FE6776a7742dB619EB3df62969 to query its balance.

Functions

All ERC20 functions are members of DefiWalletCoreActor. The Target should be Defi Wallet Core Actor.

Erc20Balance

Get erc-20 balance

  • Contract Address: erc20 contract address

  • Account Address: account address to fetch balance

  • Balance: get balance of account address

  • Success: whether succeed or not

  • Output message: error message, "" if succeed

Erc20Name

Get erc-20 name

  • Contract Address: erc20 contract address

  • Name: get name

  • Success: whether succeed or not

  • Output message: error message, "" if succeed

Erc20Symbol

Get erc-20 symbol

  • Contract Address: erc20 contract address

  • Symbol:: get symbol

  • Success: whether succeed or not

  • Output message: error message, "" if succeed

Erc20Decimals

Get erc-20 decimals

  • Contract Address: erc20 contract address

  • Decimals: get decimals

  • Success: whether succeed or not

  • Output message: error message, "" if succeed

Erc20TotalSupply

Get erc-20 total supply

  • Contract Address: erc20 contract address

  • Total Supply: get total supply

  • Success: whether succeed or not

  • Output message: error message, "" if succeed

Erc20Transfer

erc20 Moves amount tokens from the caller’s account to to_address.

  • Contract Address: erc20 contract

  • Walletindex: wallet index which starts from 0

  • To Address: to address

  • Amount: amount

  • Out: Erc20Transfer callback

Erc20TransferFrom

erc20 Moves amount tokens from from_address to to_address using the allowance mechanism.

  • Contract Address: erc20 contract

  • Walletindex: wallet index which starts from 0

  • From Address: from address to move

  • To Address: to address

  • Amount: amount

  • Out: Erc20TransferFrom callback

Erc20Approve

erc20 Allows approved_address to withdraw from your account multiple times, up to the amount amount.

  • Contract Address: erc20 contract

  • Walletindex: wallet index which starts from 0

  • Approved Address: address to approve

  • Amount: amount

  • Out: Erc20Approve callback

Erc20Allowance

Returns the amount of tokens in existence

  • Contract Address: erc20 contract

  • Erc 20owner: erc20 owner

  • Erc 20spender: erc20 spender

  • Result: allowance

  • Success: whether succeed or not

  • Output message: error message, "" if succeed