# 2 - ERC20 Contract Deployment and Cross Contract Call

### [**Overview of Demo Template:**](https://gist.github.com/rajesh-l1x/cc2671a8d6772c521319ee604eacf2fc#overview-of-demo-template) <a href="#user-content-overview-of-demo-template" id="user-content-overview-of-demo-template"></a>

The L1X chain operates using two virtual machines: `l1x-vm` powered by the `ebpf` virtual machine and `l1x-evm` based on the Ethereum Virtual Machine (EVM).

In this walkthrough, we demonstrate how to deploy an ERC20 contract using the `creationCode20.txt` file to `l1x-evm` and interact with the contract functions via `l1x-vm`. This interaction is achieved by making a call to the `l1x_evm_cross_contract` contract functions.

To facilitate interaction with both virtual machines, users can utilize the L1X node client JSON RPC.

The contract code for cross calls, named `l1x_evm_cross_contract`, is located in the `l1x-contracts` directory as shown below:

```
exa -T -L 1 ./l1x-contracts
    ./l1x-contracts
    └── l1x_evm_cross_contract
```

Additionally, the pre-built bytecode blob for the ERC20 contract is stored in the `creationCode20.txt` file within the `l1x-evm-artifacts` directory:

```
exa -T -L 1 ./l1x-evm-artifacts
    ./l1x-evm-artifacts
    └── creationCode20.txt
```

**Note:** The toolchain for creating the bytecode blob for `l1x-evm` is currently in progress and is expected to be released soon as part of the `l1x-toolkit` release.

### [**Step 1: Setting Up Your Environment**](https://gist.github.com/rajesh-l1x/cc2671a8d6772c521319ee604eacf2fc#step-1-setting-up-your-environment) <a href="#user-content-step-1-setting-up-your-environment" id="user-content-step-1-setting-up-your-environment"></a>

*   **1.1. Create an empty folder for this demonstration:**

    ```
     $ mkdir -p $HOME/l1x-demo-home/
    ```
*   **1.2. Change your current directory to the newly created folder:**

    ```
    $ cd $HOME/l1x-home/l1x-demo-home/
    ```

### [**Step 2: Download the Demo Template**](https://gist.github.com/rajesh-l1x/cc2671a8d6772c521319ee604eacf2fc#step-2-download-the-demo-template) <a href="#user-content-step-2-download-the-demo-template" id="user-content-step-2-download-the-demo-template"></a>

* **2.1. Make sure you can access the `l1x-forge` tool from your command line.** If you don't have `l1x-forge` installed, follow the instructions in [Step 2: Checking the L1X Tool](https://app.gitbook.com/o/E37av3Jbz3uuBODbRRSf/s/eTLmER6Ab8VaxeOI6Vla/get-started-with-l1x-sde/setup-l1x-development-environment#step-2-checking-the-l1x-tool) before proceeding.
*   **2.2. Use the `l1x-forge` command to create a new project workspace. We'll name it "l1x\_demo02\_erc20\_cross\_call" and use the template "l1x-erc20-cc-call":**

    ```
    $ l1x-forge new --name l1x_demo02_erc20_cross_call --template l1x-erc20-cc-call
    ```
*   **2.3. After running the command, you'll receive a confirmation message indicating the successful creation of the "l1x\_demo02\_erc20\_cross\_call" contract:**

    ```
    Created contract l1x_demo02_erc20_cross_call
    ```
*   **2.4. Your workspace will now be populated with content from the template.**

    ```
     	$ exa -T -L 1 ./l1x_demo02_erc20_cross_call
     		./l1x_demo02_erc20_cross_call
     		├── Cargo.lock
     		├── Cargo.toml
     		├── devbox.json
     		├── devbox.lock
     		├── devnet-services-dc.yml
     		├── l1x-conf
     		├── l1x-contracts
     		├── l1x-evm-artifacts
     		├── l1x-evm-contracts
     		├── package.json
     		├── process-compose-devnode.yaml
     		├── README.md
     		├── rust-toolchain.toml
     		└── rustfmt.toml
    ```

### [**Step 3: Starting with Workspace Workflow Script Commands**](https://gist.github.com/rajesh-l1x/cc2671a8d6772c521319ee604eacf2fc#step-3-starting-with-workspace-workflow-script-commands) <a href="#user-content-step-3-starting-with-workspace-workflow-script-commands" id="user-content-step-3-starting-with-workspace-workflow-script-commands"></a>

*   **3.1. Introduction to Devbox Shell and Workflow Commands**

    If you're new to the l1x-sde template workspace, it's a good idea to familiarize yourself with the basics of the devbox shell and workflow commands. This will help you get started more smoothly. You can review the following links for an overview:

    * [Step 4: Understanding Configuration Files and Default Settings](https://app.gitbook.com/o/E37av3Jbz3uuBODbRRSf/s/eTLmER6Ab8VaxeOI6Vla/get-started-with-l1x-sde/setup-l1x-development-environment#step-4-understanding-configuration-files-and-default-settings)
    * [Step 5: Getting Started with the Devbox Shell](https://app.gitbook.com/o/E37av3Jbz3uuBODbRRSf/s/eTLmER6Ab8VaxeOI6Vla/get-started-with-l1x-sde/setup-l1x-development-environment#step-5-getting-started-with-the-devbox-shell)
*   **3.2. Default Commands to Begin With**

    To start using the workspace, there are some default commands you can use:

    * **Activate the Shell:** To access the devbox shell, simply enter the following command in your terminal:

    ```
    $ devbox shell
    ```

    *   **List Default Commands:** To see a list of the built-in default commands available in the devbox shell, you can use the following command:

        ```
        	(devbox)$ devbox run -l | sort
        	* 01_init_setup
        	* 01_teardown_setup
        	* 02_check_chain_state
        	* 02_check_devnet_db_state
        	* 02_prune_devnode
        	* 02_start_devnode
        	* 02_stop_devnode
        	* 10_01_compile_ebpf
        	* 10_compile_ebpf_cmd
        	* 11_clean_logs
        	* 11_clean_objs
        	* 18_cli_ro_call_cmd
        	* 18_cli_ro_get_balanceof_ava
        	* 18_cli_ro_get_balanceof_cc_contract
        	* 18_cli_ro_get_balanceof_super
        	* 18_cli_sub_txn_cc_transfer_to_cc_contract
        	* 18_cli_sub_txn_erc20_transfer_to_cc_contract
        	* 40_cli_deploy_ebpf
        	* 40_cli_deploy_ebpf_cmd
        	* 41_cli_init_ebpf
        	* 41_cli_vm_sub_txn_cmd
        	* 60_forge_install_ebpf_cmd_force_deploy
        	* 61_forge_install_ebpf_cmd_reuse_deploy
        	* 62_forge_install_evm_cmd_force_deploy
        	* 80_00_forge_install_ebpf_all
        	* 80_01_forge_install_ebpf_erc20_cross_call
        	* 81_01_forge_install_evm_erc20
        	* 82_01_forge_install_evm_all
        	Available scripts:
        ```
*   **Initialize the Workspace:** To prepare your workspace for building and testing, run:

    ```
     (devbox)$ devbox run 01_init_setup
    ```

Now you have all the necessary tools and packages to work with the demo template workspace.

### [**Step 4: Building Smart Contracts**](https://gist.github.com/rajesh-l1x/cc2671a8d6772c521319ee604eacf2fc#step-4-building-smart-contracts) <a href="#user-content-step-4-building-smart-contracts" id="user-content-step-4-building-smart-contracts"></a>

Now, let's guide you through the process of building the smart contracts.

* **4.1 Compiling the Contract for `l1x-vm`**

To compile the `l1x_evm_cross_contract` contract, simply use this command:

```
(devbox)$ devbox run 10_01_compile_ebpf
```

Running this command will compile the contract for you and save the compiled files in the `./l1x-artifacts` folder automatically.

After executing the command, you'll discover the following files in the `./l1x-artifacts` folder:

````
```shell
	exa -T -L 1 ./l1x-artifacts
	./l1x-artifacts
	├── l1x_evm_cross_contract.base64
	├── l1x_evm_cross_contract.ll
	├── l1x_evm_cross_contract.o
	├── l1x_evm_cross_contract.versioned.ll
	└── l1x_evm_cross_contract.wasm
```
````

* **4.2 Compiling the Contract for `l1x-evm`**

For this demonstration, we're simplifying the process by using a pre-built EVM bytecode image, eliminating the need for a build process. To access the relevant file, execute this command:

```
 	(devbox)$ exa -T ./l1x-evm-artifacts
 		./l1x-evm-artifacts
 		└── creationCode20.txt
```

That's it! We've successfully completed the steps for building smart contracts.

### [**Step 5: Setting Up Local Development Network Services**](https://gist.github.com/rajesh-l1x/cc2671a8d6772c521319ee604eacf2fc#step-5-setting-up-local-development-network-services) <a href="#user-content-step-5-setting-up-local-development-network-services" id="user-content-step-5-setting-up-local-development-network-services"></a>

In this step, we will walk you through the process of configuring local development l1x-chain network.

*   **5.1 Choose the Chain Type**: To begin, select the `"L1X_CFG_CHAIN_TYPE": "local_devnet"` option. Next, open a new terminal and activate the devbox shell:

    ```
    $ devbox shell
    ```
*   **5.2 Start the Devnode Services**: While in the devbox shell, run the following command:

    ```
    (devbox)$ devbox run 02_start_devnode
    ```
* **5.3 Wait for Services to Initialize**: After executing the previous command, please wait for approximately 160 seconds. During this time, the services will start up and become operational. You will also observe the L1X node beginning to produce blocks.

[![Image](https://camo.githubusercontent.com/041f482cc6c18149d543f8d2e650cc3af3d85a59ca823233bdec2726efaaaa9c/68747470733a2f2f692e696d6775722e636f6d2f796d456d75426e2e706e67)](https://camo.githubusercontent.com/041f482cc6c18149d543f8d2e650cc3af3d85a59ca823233bdec2726efaaaa9c/68747470733a2f2f692e696d6775722e636f6d2f796d456d75426e2e706e67)

*   **5.4 Verify DevNet Service Status**: To ensure that everything is running smoothly, use the following command to check the service status:

    ```
    (devbox)$ devbox run 02_check_chain_state
    ```

    [![Image](https://camo.githubusercontent.com/4f9f2b6601b457f613c464bd69220f01eb68aaee8b17d0665740031e66b378f0/68747470733a2f2f692e696d6775722e636f6d2f675357395739592e706e67)](https://camo.githubusercontent.com/4f9f2b6601b457f613c464bd69220f01eb68aaee8b17d0665740031e66b378f0/68747470733a2f2f692e696d6775722e636f6d2f675357395739592e706e67)

    ```
    (devbox)$ devbox run 02_check_devnet_db_state
    ```

    [![Image](https://camo.githubusercontent.com/91f84f5b2c656bea645882c39a122efd81c975b9640d9b4b6eba096f76fa4af4/68747470733a2f2f692e696d6775722e636f6d2f3463326d4a42642e706e67)](https://camo.githubusercontent.com/91f84f5b2c656bea645882c39a122efd81c975b9640d9b4b6eba096f76fa4af4/68747470733a2f2f692e696d6775722e636f6d2f3463326d4a42642e706e67)



* **5.5 Troubleshooting**: Occasionally, we might encounter a problem where the `l1x-node-client` server and the `cassandra` DB service do not sync properly, as indicated by the state shown in the image below.

![Troubleshooting Image](https://i.imgur.com/JrtA2jh.png)

*   To fix this issue and get your setup back on track, follow these simple steps:

    ```shell
    (devbox)$ devbox run 02_stop_devnode
    (devbox)$ devbox run 02_prune_devnode
    (devbox)$ devbox run 02_start_devnode
    ```

These commands will help reset and restart the necessary components. Your setup should work smoothly after completing these steps.

* **5.5 Troubleshooting**: Occasionally, we might encounter a problem where the `l1x-node-client` server and the `cassandra` DB service do not sync properly, as indicated by the state shown in the image below.

[![Troubleshooting Image](https://camo.githubusercontent.com/c0d21a1ec8647574b31d422fa8957b0477811184ec02d61a467adffb21ca5109/68747470733a2f2f692e696d6775722e636f6d2f4a727441326a682e706e67)](https://camo.githubusercontent.com/c0d21a1ec8647574b31d422fa8957b0477811184ec02d61a467adffb21ca5109/68747470733a2f2f692e696d6775722e636f6d2f4a727441326a682e706e67)

*   To fix this issue and get your setup back on track, follow these simple steps:

    ```
    (devbox)$ devbox run 02_stop_devnode
    (devbox)$ devbox run 02_prune_devnode
    (devbox)$ devbox run 02_start_devnode
    ```

These commands will help reset and restart the necessary components. Your setup should work smoothly after completing these steps.

### [**Step 6: Deploying and Creating an Instance From a Compiled Contract**](https://gist.github.com/rajesh-l1x/cc2671a8d6772c521319ee604eacf2fc#step-6-deploying-and-creating-an-instance-from-a-compiled-contract) <a href="#user-content-step-6-deploying-and-creating-an-instance-from-a-compiled-contract" id="user-content-step-6-deploying-and-creating-an-instance-from-a-compiled-contract"></a>

In this section, we'll walk you through the process of deploying and creating an instance of the `erc20` contract on the `l1x-evm` platform, as well as deploying and creating an instance of the `l1x_evm_cross_contract.o` contract on the `l1x-vm` platform.

We will use the default `super` account, which is defined in the `l1x-conf/l1x_dev_wallets.yaml` configuration file. The `super` account acts as the owner or administrator for the contracts we deploy.

* **6.1: Deploying and Creating an Instance of the `erc20` Contract on `l1x-evm`**

To deploy the compiled `erc20` contract, follow these steps:

1. Run the command:

```
 (devbox)$ devbox run 82_01_forge_install_evm_all
```

[![Deploying the Contract](https://camo.githubusercontent.com/843fbab314084098b5071076c739621ab89db26fc790799b23f4c1dd182d98e3/68747470733a2f2f692e696d6775722e636f6d2f645a6743475a782e706e67)](https://camo.githubusercontent.com/843fbab314084098b5071076c739621ab89db26fc790799b23f4c1dd182d98e3/68747470733a2f2f692e696d6775722e636f6d2f645a6743475a782e706e67)

2. Take note of the `L1XEVM_DEPLOY` address displayed in the output. We'll call it the `erc20_instance_address`, and you'll need it for interacting with the contract.
3. Update the following JSON payload transaction files with this address:

```
 	./l1x-conf/scripts/011-01-uc-init-erc20-cross-call.json
 	./l1x-conf/scripts/013-01-test-evm-erc20-transfer.json
```

* **6.2: Deploying the `l1x_evm_cross_contract.o` Contract on `l1x-vm`**

To deploy the compiled `l1x_evm_cross_contract.o` contract, follow these steps:

1.  Update the JSON payload in the file `l1x-conf/scripts/010-01-uc-deploy-erc20-cross-call.json` with the artifact information.

    [![Update JSON Payload](https://camo.githubusercontent.com/1f30906209ba916eeee99ba2eb5acfd2b5878e784c1f47b83c16f25729a09ad9/68747470733a2f2f692e696d6775722e636f6d2f395874676b67762e706e67)](https://camo.githubusercontent.com/1f30906209ba916eeee99ba2eb5acfd2b5878e784c1f47b83c16f25729a09ad9/68747470733a2f2f692e696d6775722e636f6d2f395874676b67762e706e67)
2.  Execute the following command:

    ```
    (devbox)$ devbox run 40_cli_deploy_ebpf
    ```

    [![Deploying the Contract](https://camo.githubusercontent.com/ff36ef8c609b7b98612b1069c86e8cbd22412a7379e7e6b32c0141b9bf3c54cb/68747470733a2f2f692e696d6775722e636f6d2f6e31345573566b2e706e67)](https://camo.githubusercontent.com/ff36ef8c609b7b98612b1069c86e8cbd22412a7379e7e6b32c0141b9bf3c54cb/68747470733a2f2f692e696d6775722e636f6d2f6e31345573566b2e706e67)
3. Take note of the `"address"` displayed in the output. We'll call it the `erc20_cross_call_deploy_address`, which you'll need for contract instance creation.
4. Update the following JSON payload transaction file with this address:
   * `./l1x-conf/scripts/011-01-uc-init-erc20-cross-call.json`

* **6.3: Creating an Instance from the Deployed `l1x_evm_cross_contract.o` Contract on `l1x-vm`**

To create an instance from the compiled `l1x_evm_cross_contract.o` contract, follow these steps:

1. Update the JSON payload file located at `./l1x-conf/scripts/011-01-uc-init-erc20-cross-call.json`.

[![Update JSON Payload](https://camo.githubusercontent.com/4af488d20e91579de550cd644651f70c676a89c4746680b4623c23057b0c8285/68747470733a2f2f692e696d6775722e636f6d2f4f5334523563332e706e67)](https://camo.githubusercontent.com/4af488d20e91579de550cd644651f70c676a89c4746680b4623c23057b0c8285/68747470733a2f2f692e696d6775722e636f6d2f4f5334523563332e706e67)

2. Execute the following command:

```
(devbox)$ devbox run 41_cli_init_ebpf
```

[![Creating an Instance](https://camo.githubusercontent.com/bdca9b6c6abfca8d8a6d84c4c65a44488d5402ef8635ba8b149e85bf595eabbd/68747470733a2f2f692e696d6775722e636f6d2f5a4941634358302e706e67)](https://camo.githubusercontent.com/bdca9b6c6abfca8d8a6d84c4c65a44488d5402ef8635ba8b149e85bf595eabbd/68747470733a2f2f692e696d6775722e636f6d2f5a4941634358302e706e67)

3. Take note of the `"address"` displayed in the output. We'll call it the `erc20_cross_call_instance_address`, which you'll need for contract instance creation.
4. Update the following JSON payload transaction files with this address:

```
 	./l1x-conf/scripts/012-01-test-vm-cc-erc20-balance-of.json
 	./l1x-conf/scripts/012-02-test-vm-cc-erc20-transfer.json
 	./l1x-conf/scripts/012-03-test-vm-cc-erc20-balance-of-ava.json
 	./l1x-conf/scripts/l1x-conf/scripts/012-04-test-vm-cc-erc20-balance-of-cc_contract.json
```

Now you have successfully deployed and created instances of the contracts on the respective platforms. You can use the provided addresses for further interactions with the contracts.

### [**Section 7: Examples Use-Case**](https://gist.github.com/rajesh-l1x/cc2671a8d6772c521319ee604eacf2fc#section-7-examples-use-case) <a href="#user-content-section-7-examples-use-case" id="user-content-section-7-examples-use-case"></a>

This section provides step-by-step examples to help you understand how the system functions in real-life scenarios.

1. **Use-Case 1: Checking Token Balance**

In this example, we'll show you how to check the balance of an ERC20 token for three accounts: `super`, `erc20_cross_call_instance_address`, and `ava`. We'll achieve this by using a feature known as "cross-contract call," which allows interaction between the `l1x-vm` and `l1x-evm`.

2. **Use-Case 2: Transferring Tokens**

In this scenario, we want to transfer tokens to the address `erc20_cross_call_instance_address` from the `super` account.

3. **Use-Case 3: Confirming Transaction Success**

In this final example, we'll revisit the steps from **Use-Case 1** to confirm the success status of the transaction initiated in **Use-Case 2**.

Understanding these straightforward use-cases will help you grasp how the "cross-contract call" feature works effectively.

#### [**Use-Case 1: Checking Token Balance**](https://gist.github.com/rajesh-l1x/cc2671a8d6772c521319ee604eacf2fc#use-case-1-checking-token-balance) <a href="#user-content-use-case-1-checking-token-balance" id="user-content-use-case-1-checking-token-balance"></a>

Here are the steps:

```
1. Begin by initiating a balance request to a contract located at the address `erc20_cross_call_instance_address` within the `l1x-vm`.

2. This request will be internally directed to another contract located at `erc20_instance_address`, which is deployed on the `l1x-evm`.
```

Now, let's check the balance for each of these accounts:

> Checking Balance for Account `super`

To check the balance for the `super` account, run the following command in your development environment:

```
(devbox)$ devbox run 18_cli_ro_get_balanceof_super
```

You'll get a result similar to the image below, with variations in the context-specific `payload`, `address`, and `return values` highlighted:

[![Balance Check Result for super](https://camo.githubusercontent.com/dcd2105d3c1fec8b1e71256bb31f4b4cc01dffbaf52697503e49a44da083dc60/68747470733a2f2f692e696d6775722e636f6d2f694f58343477642e706e67)](https://camo.githubusercontent.com/dcd2105d3c1fec8b1e71256bb31f4b4cc01dffbaf52697503e49a44da083dc60/68747470733a2f2f692e696d6775722e636f6d2f694f58343477642e706e67)

> Checking Balance for Account `erc20_cross_call_instance_address`

To check the balance for the `erc20_cross_call_instance_address` account, execute the following command:

```
(devbox)$ devbox run 18_cli_ro_get_balanceof_cc_contract
```

You'll get a result similar to the image below, with variations in the context-specific `payload`, `address`, and `return values` highlighted:

[![Balance Check Result for erc20\_cross\_call\_instance\_address](https://camo.githubusercontent.com/3db12feb1102a2683e9bdf7b54bf64d6c400141aaf483b99cab3de773fc3eef2/68747470733a2f2f692e696d6775722e636f6d2f734849686e68572e706e67)](https://camo.githubusercontent.com/3db12feb1102a2683e9bdf7b54bf64d6c400141aaf483b99cab3de773fc3eef2/68747470733a2f2f692e696d6775722e636f6d2f734849686e68572e706e67)

> Checking Balance for Account `ava`

Finally, to check the balance for the `ava` account, use the following command:

```
(devbox)$ devbox run 18_cli_ro_get_balanceof_ava
```

You'll get a result similar to the image below, with variations in the context-specific `payload`, `address`, and `return values` highlighted:

[![Balance Check Result for ava](https://camo.githubusercontent.com/cc37198394944a0eecc98ee5c0463716beed839f4838a7f046bff36bf9d47916/68747470733a2f2f692e696d6775722e636f6d2f5a5547426168592e706e67)](https://camo.githubusercontent.com/cc37198394944a0eecc98ee5c0463716beed839f4838a7f046bff36bf9d47916/68747470733a2f2f692e696d6775722e636f6d2f5a5547426168592e706e67)

#### [**Use-Case 2: Transferring Tokens**](https://gist.github.com/rajesh-l1x/cc2671a8d6772c521319ee604eacf2fc#use-case-2-transferring-tokens) <a href="#user-content-use-case-2-transferring-tokens" id="user-content-use-case-2-transferring-tokens"></a>

In this scenario, we aim to move tokens from the `super` account to the address known as `erc20_cross_call_instance_address`. Here are the steps to carry out this transfer:

> 1. Generate an ABI payload using the online ABI encoder tool, which you can access at [this link](https://abi.hashex.org/). Fill in the required information for the `transfer()` function, and then copy the encoded data to a JSON file located at `l1x-conf/scripts/013-01-test-evm-erc20-transfer.json`.

**Note: When specifying the address, use `erc20_cross_call_instance_address`. In this context, this address is `0x4c8a5411e4dd41024673392050ab8928050e8c8d`, and select a token amount of 1000.**

[![Screenshot](https://camo.githubusercontent.com/55f46489545ce45cf4499314cec2aae0de603d74fb1f54325b0ee9098a7bea6d/68747470733a2f2f692e696d6775722e636f6d2f394845536a6d472e706e67)](https://camo.githubusercontent.com/55f46489545ce45cf4499314cec2aae0de603d74fb1f54325b0ee9098a7bea6d/68747470733a2f2f692e696d6775722e636f6d2f394845536a6d472e706e67)

[![Screenshot](https://camo.githubusercontent.com/6eab2cf46ba6486866c2a0cb3392c1e828d101d36732879f82a22d3688f62c14/68747470733a2f2f692e696d6775722e636f6d2f496c41794847562e706e67)](https://camo.githubusercontent.com/6eab2cf46ba6486866c2a0cb3392c1e828d101d36732879f82a22d3688f62c14/68747470733a2f2f692e696d6775722e636f6d2f496c41794847562e706e67)

> 2. Initiate a direct transaction to the contract found at `erc20_instance_address`, which has been deployed on `l1x-evm`. Execute the following command:

```
(devbox)$ devbox run 18_cli_sub_txn_erc20_transfer_to_cc_contract
```

You will receive a result that resembles the image below. Please note that the specifics of the `payload`, `address`, and `return values` may vary depending on the context.

[![Screenshot](https://camo.githubusercontent.com/6d9ed7e68ff2f2595c44e7735114502ca81b440cb1ca057dcd5b2f57e9523312/68747470733a2f2f692e696d6775722e636f6d2f6539586c41477a2e706e67)](https://camo.githubusercontent.com/6d9ed7e68ff2f2595c44e7735114502ca81b440cb1ca057dcd5b2f57e9523312/68747470733a2f2f692e696d6775722e636f6d2f6539586c41477a2e706e67)

#### [**Use-Case 3: Confirming Transaction Success::**](https://gist.github.com/rajesh-l1x/cc2671a8d6772c521319ee604eacf2fc#use-case-3-confirming-transaction-success) <a href="#user-content-use-case-3-confirming-transaction-success" id="user-content-use-case-3-confirming-transaction-success"></a>

In this final example, we'll revisit the steps from **Use-Case 1** to confirm the success status of the transaction initiated in **Use-Case 2**.

> Checking Balance for Account `erc20_cross_call_instance_address`

To check the balance for the `erc20_cross_call_instance_address` account, execute the following command:

```
(devbox)$ devbox run 18_cli_ro_get_balanceof_cc_contract
```

You'll get a result similar to the image below, with variations in the context-specific `payload`, `address`, and `return values` highlighted:

[![Balance Check Result for erc20\_cross\_call\_instance\_address](https://camo.githubusercontent.com/5e7c2c0938e8eb15b8f7083de98359fcdb585440040074287093458db7650976/68747470733a2f2f692e696d6775722e636f6d2f4f7153505843492e706e67)](https://camo.githubusercontent.com/5e7c2c0938e8eb15b8f7083de98359fcdb585440040074287093458db7650976/68747470733a2f2f692e696d6775722e636f6d2f4f7153505843492e706e67)

###

###

###

###

###
