# ERC20

## 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

<figure><img src="/files/yJXhUTiXHSixAPCoqLbp" alt=""><figcaption></figcaption></figure>

* 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**.

  <figure><img src="/files/BuQMUzwkB6NdOMCoTh4t" alt="" width="563"><figcaption></figcaption></figure>
* 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.

<figure><img src="/files/9teLZ7edPW78F37nV7H5" alt=""><figcaption></figcaption></figure>

* 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

  <figure><img src="/files/J0yPvW8z5onhNMj4TTNI" alt="" width="563"><figcaption></figcaption></figure>

  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

<figure><img src="/files/TV2x9FikDEs9xfQGDxbU" alt=""><figcaption></figcaption></figure>

* `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

<figure><img src="/files/Cf86LeEV16Mw4bxRa4iP" alt=""><figcaption></figcaption></figure>

* `Contract Address`: erc20 contract address
* `Name`: get name
* `Success`: whether succeed or not
* `Output message`: error message, "" if succeed

### Erc20Symbol

Get erc-20 symbol

<figure><img src="/files/9jMCxjiVQjx17f5rpRNx" alt=""><figcaption></figcaption></figure>

* `Contract Address`: erc20 contract address
* `Symbol`:: get symbol
* `Success`: whether succeed or not
* `Output message`: error message, "" if succeed

### Erc20Decimals

Get erc-20 decimals

<figure><img src="/files/B7m1QZ7rxC3q7jzm4yrG" alt=""><figcaption></figcaption></figure>

* `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

<figure><img src="/files/LmhxB4pSG2HmTgR3hqla" alt=""><figcaption></figcaption></figure>

* `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`.

<figure><img src="/files/qmkMkPxqM7Yyac9TwtYe" alt=""><figcaption></figcaption></figure>

* `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.

<figure><img src="/files/eEBGAZ6pubmEPeSaJ6b1" alt=""><figcaption></figcaption></figure>

* `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.

<figure><img src="/files/A2xpGMiyGKbLcnI4dQtZ" alt=""><figcaption></figcaption></figure>

* `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

<figure><img src="/files/HbafdQzZh2haFmFb1ti1" alt=""><figcaption></figcaption></figure>

* `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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cronos.org/cronos-play/getting-started_unreal/quick-start/erc20.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
