# WalletBalanceProvider

{% hint style="info" %}
This contract is a **balance aggregator**. It helps frontends or services query multiple token balances at once, making it efficient for dashboards, portfolio trackers, or DeFi apps where users hold many assets.
{% endhint %}

#### Functions

* **balanceOf(address user, address token) → uint256**\
  Returns the balance of a specific `token` held by a given `user`.
  * `user`: The wallet address to check.
  * `token`: The ERC20 token contract address.
  * **Output**: Token balance (`uint256`).

***

* **batchBalanceOf(address\[] users, address\[] tokens) → uint256\[]**\
  Returns balances for multiple users and tokens in one call (bulk query).
  * `users`: Array of wallet addresses.
  * `tokens`: Array of token addresses.
  * **Output**: Array of balances, aligned with the `(user, token)` pairs queried.

***

* **getUserWalletBalances(address provider, address user) → (address\[] tokens, uint256\[] balances)**\
  Fetches all token balances for a given user from a specified provider.
  * `provider`: Likely a registry or liquidity provider that tracks tokens.
  * `user`: The wallet address whose balances are being checked.
  * **Outputs**:
    * `tokens`: Array of token addresses.
    * `balances`: Array of balances corresponding to those tokens.

***

* **receive() payable**\
  The contract can directly accept ETH transfers.

```
[
  {
    "inputs": [
      { "internalType": "address", "name": "user", "type": "address" },
      { "internalType": "address", "name": "token", "type": "address" }
    ],
    "name": "balanceOf",
    "outputs": [
      { "internalType": "uint256", "name": "", "type": "uint256" }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      { "internalType": "address[]", "name": "users", "type": "address[]" },
      { "internalType": "address[]", "name": "tokens", "type": "address[]" }
    ],
    "name": "batchBalanceOf",
    "outputs": [
      { "internalType": "uint256[]", "name": "", "type": "uint256[]" }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      { "internalType": "address", "name": "provider", "type": "address" },
      { "internalType": "address", "name": "user", "type": "address" }
    ],
    "name": "getUserWalletBalances",
    "outputs": [
      { "internalType": "address[]", "name": "", "type": "address[]" },
      { "internalType": "uint256[]", "name": "", "type": "uint256[]" }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  { "stateMutability": "payable", "type": "receive" }
]

```


---

# 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://colend.gitbook.io/home/abi/walletbalanceprovider.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.
