WalletBalanceProvider

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.

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.

Last updated

Was this helpful?