# Interacting with the deployed smart contracts

Now that Remix IDE is connected to the Mandala test network, we can interact with the smart contracts deployed on it. As you complete the setting up, you can take a look at the `File explorers` section. It should already include folders named `contracts`, `scripts` and `tests`, as well as `REAMDE.txt`.

{% hint style="info" %}
File explorers section is represented by the <img src="https://399453287-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAr4HPdeSWiuUx1XzEALT%2Fuploads%2F3Vb5i1oDwNkNoSdJGVXX%2FScreenshot%20from%202022-01-29%2000-08-33.png?alt=media&#x26;token=65026263-6ffd-4127-acac-c98fb4c65b03" alt="" data-size="line"> icon.
{% endhint %}

We can use a very simple smart contract that is further explained in the tutorials section and is already deployed on the Mandala TC9 network. The smart contract is called Echo and it has one function that stores a value passed to it in a public variable, which we are able to get using it's getter function. In order to use Remix IDE to interact with it, we need to add it into the `contracts` folder. We do this by option-clicking onto the folder and selecting `New file` option. the file should be named `Echo.sol`. You can now copy-paste the following code into the file:

{% code title="Echo.sol" %}

```solidity
pragma solidity =0.8.9;

contract Echo{
    string public echo;
    uint echoCount;

    event NewEcho(string message, uint count);

    constructor() {
        echo = "Deployed successfully!";
    }

    function scream(string memory message) public returns(string memory){
        echo = message;
        echoCount += 1;
        emit NewEcho(message, echoCount);
        return message;
    }
}
```

{% endcode %}

Once you save the file, the Remix IDE built-in compiler will run and compile the smart contract. If the compilation fails (you can see that by a red error indicator appearing over the Solidity compiler section <img src="https://399453287-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAr4HPdeSWiuUx1XzEALT%2Fuploads%2FoqGd1guURE4dE0P3FUv8%2FScreenshot%20from%202022-01-29%2000-19-48.png?alt=media&#x26;token=0dde9ea8-7e67-4943-b137-9170d59194f9" alt="" data-size="line">), you might have to manually set the compiler version to `0.8.9.`

![](https://399453287-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAr4HPdeSWiuUx1XzEALT%2Fuploads%2F3DQHwV8oikm9XvJlLmWy%2FScreenshot%20from%202022-01-29%2000-21-43.png?alt=media\&token=b3507c46-2eed-415e-93f7-c87f0197db36)

As the smart contract compiles as expected, we need to point to the address to which it is deployed to. There is an instance deployed at `0x87c8Dc09548195A3B1222ab5c3905c01595D5516`, so you can use this one. To use it, navigate to `Deploy & run transactions` tab and paste the address into the `At Address` section.

{% hint style="info" %}
The Deploy & run transactions is represented by <img src="https://399453287-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAr4HPdeSWiuUx1XzEALT%2Fuploads%2F8M6NnKuNbuvt8qowZKCz%2FScreenshot%20from%202022-01-30%2023-04-41.png?alt=media&#x26;token=0d0bb0b8-8f0f-4194-a63f-db2dcc4e2c1e" alt="" data-size="line"> icon.
{% endhint %}

![](https://399453287-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAr4HPdeSWiuUx1XzEALT%2Fuploads%2FzNTCjfhBPl3gnJMijCGm%2FScreenshot%20from%202022-01-30%2023-06-16.png?alt=media\&token=376f59e2-c2cf-4121-80ed-d86601590419)

Once you click on the `At Address` button, you should see `ECHO` in the `Deployed contracts` section.

![](https://399453287-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAr4HPdeSWiuUx1XzEALT%2Fuploads%2FNOcseiARciAbscJWgvvT%2FScreenshot%20from%202022-01-30%2023-08-00.png?alt=media\&token=ad1c31a7-f339-4b9d-96eb-5fc85d811662)

Once you expand the view, you can interact with the smart contract. If you select the `echo` getter, there will be no MetaMask confirmation needed, as no transaction is executed. If you select scream, then you should pass a string to it within the `""` and confirm the transaction in MetaMask as the prompt appears.


---

# 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://evmdocs.acala.network/tooling/remix-ide/interacting-with-the-deployed-smart-contracts.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.
