Contract 0x1B18AEeF8a60Ea303B52d7b02E8c5D3E8B39A2e5

 

Contract Overview

Balance:
0 MATIC

MATIC Value:
$0.00

Token:
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x8a840bc460ca37268b0dec204a8f94e2888aafcdbb3dc5f1189fc5eba8b365fe0x60806040161364882021-06-25 14:36:19205 days 20 hrs ago0xb0dd96118594903bacb2746eb228550c10b2b1da IN  Create: Balances0 MATIC0.00028590761.1
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Balances

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 2 : Balances.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract Balances {
	address internal constant MATIC =
		0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

	function getBalances(address[] calldata tokens, address user)
		external
		view
		returns (uint256[] memory)
	{
		uint256[] memory balances = new uint256[](tokens.length);

		for (uint256 i = 0; i < tokens.length; i++) {
			if (tokens[i] == MATIC) balances[i] = user.balance;
			else balances[i] = IERC20(tokens[i]).balanceOf(user);
		}

		return balances;
	}
}

File 2 of 2 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"address","name":"user","type":"address"}],"name":"getBalances","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b506103bd806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063d1c0702814610030575b600080fd5b61004361003e366004610285565b610059565b604051610050919061031c565b60405180910390f35b606060008367ffffffffffffffff81111561008457634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156100ad578160200160208202803683370190505b50905060005b8481101561023f5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8686838181106100f057634e487b7160e01b600052603260045260246000fd5b90506020020160208101906101059190610264565b6001600160a01b0316141561015057836001600160a01b03163182828151811061013f57634e487b7160e01b600052603260045260246000fd5b60200260200101818152505061022d565b85858281811061017057634e487b7160e01b600052603260045260246000fd5b90506020020160208101906101859190610264565b6040516370a0823160e01b81526001600160a01b03868116600483015291909116906370a082319060240160206040518083038186803b1580156101c857600080fd5b505afa1580156101dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102009190610304565b82828151811061022057634e487b7160e01b600052603260045260246000fd5b6020026020010181815250505b8061023781610360565b9150506100b3565b50949350505050565b80356001600160a01b038116811461025f57600080fd5b919050565b600060208284031215610275578081fd5b61027e82610248565b9392505050565b600080600060408486031215610299578182fd5b833567ffffffffffffffff808211156102b0578384fd5b818601915086601f8301126102c3578384fd5b8135818111156102d1578485fd5b8760208260051b85010111156102e5578485fd5b6020928301955093506102fb9186019050610248565b90509250925092565b600060208284031215610315578081fd5b5051919050565b6020808252825182820181905260009190848201906040850190845b8181101561035457835183529284019291840191600101610338565b50909695505050505050565b600060001982141561038057634e487b7160e01b81526011600452602481fd5b506001019056fea2646970667358221220ea5b703124b36cae8e2f7d7a940abcc5db925032a9588322ec7869990f536ea064736f6c63430008040033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.