MulticallBalances

Description:

Smart contract deployed on Ethereum with Factory features.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "Multichain.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IERC20 {
    function balanceOf(address account) external view returns (uint256);
}

contract MulticallBalances {
    struct BalanceResult {
        address token;
        uint256 balance;
    }

    function getBalances(address wallet, address[] calldata tokens)
        external
        view
        returns (BalanceResult[] memory results)
    {
        uint256 len = tokens.length;
        results = new BalanceResult[](len);

        for (uint256 i = 0; i < len; i++) {
            uint256 bal;
            address token = tokens[i];
            // try/catch protects from non-standard ERC20
            try IERC20(token).balanceOf(wallet) returns (uint256 b) {
                bal = b;
            } catch {
                bal = 0;
            }
            results[i] = BalanceResult({token: token, balance: bal});
        }
    }
}"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": false,
      "runs": 200
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "remappings": []
  }
}}

Tags:
Factory|addr:0x41a9798081d99577096886a1846fb247f79c8190|verified:true|block:23693718|tx:0xd57a144ed796a5eade2dda29b7c90416ea6ac3c70628041585e9f7257e363939|first_check:1761905921

Submitted on: 2025-10-31 11:18:42

Comments

Log in to comment.

No comments yet.