# CallGenericReadFunction

{% hint style="info" %}
This function does not trigger a UI modal
{% endhint %}

## Description

This allows you to call any read-only smart contract function that does not require the user signature. It can be invoked even before the user is logged in.

## Details

### Signature

```csharp
Task<dynamic> CallGenericReadFunction(dynamic args)
```

### Arguments

<table><thead><tr><th width="258">Parameter</th><th width="101">Type</th><th>Definition</th></tr></thead><tbody><tr><td><code>args.contractAddress</code></td><td>String</td><td>Contract address of the smart contract to be called</td></tr><tr><td><code>args.functionABI</code></td><td>String</td><td>The path to the JSON object for the <a href="https://ethereum.org/en/developers/docs/smart-contracts/compiling/#web-applications">smart contract ABI</a>. You can store it in the Resources folder and pass in a path such as <code>@"Assets/Resources/Contracts/Contract.json"</code></td></tr><tr><td><code>args.functionName</code></td><td>String</td><td>Name of the function to be called as per the ABI.</td></tr><tr><td><code>args.chain</code></td><td>Metafi.Unity.Chain</td><td>Which chain to broadcast the transaction on. Pick a chain from the <a href="/pages/RsPwmVr7xSQeT0vZHluX">supported chains list</a></td></tr><tr><td><code>args.params</code></td><td>List&#x3C;object></td><td>Array of objects that will be sent as the arguments to the smart contract function. Please ensure that the order of params matches the contract ABI.<br><br>For large numerical inputs, please refer to the <a href="#handling-numerical-values">section below</a>.</td></tr></tbody></table>

### Return Value

`dynamic` object returned from smart contract.

```csharp
{
    data = {
        ...
    },
    error = "",
}
```

### Handling Large Numerical Values

{% hint style="warning" %}
Applicable to EVM Chains only
{% endhint %}

While passing in large numerical values (values above **9007199254740991**) in `args.params`, a conversion to string format needs to be made. You can use the following methods that convert the number to the appropriate format:

```csharp
// For int values
string ConvertNumberToBigNumber(int value, int decimals);

// For double values
string ConvertNumberToBigNumber(double value, int decimals);

// For float values
string ConvertNumberToBigNumber(float value, int decimals);
```

## Example

<pre class="language-csharp" data-line-numbers><code class="lang-csharp">using System;
using Metafi.Unity;

public class GameManager : MonoBehaviour {
    public async void ReadSmartContractData(){
        var res = await MetafiProvider.Instance.CallGenericReadFunction( new {
            contractAddress = "contract-address",
<strong>            functionABIPath = "path-to-abi",
</strong>            functionName = "readMetadata",
            @params = new object ["param1", "param2"],
            chain = Chains.MUMBAI,
        });
    }
}
</code></pre>


---

# 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.usemeta.fi/unity-sdk/sdk-reference/callgenericreadfunction.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.
