# 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="../constants/chain">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>
