ETH Price: $2,401.21 (-3.26%)
 
Transaction Hash
Method
Block
From
To
0x60806040176089752023-07-02 21:23:47491 days ago1688333027IN
 Create: PortalsMulticall
0 ETH0.0085681915.70291026

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
211169232024-11-04 21:18:355 hrs ago1730755115
0x89c30E3A...842Fd74f7
1.08682118 ETH
211169232024-11-04 21:18:355 hrs ago1730755115
0x89c30E3A...842Fd74f7
1.08682118 ETH
211127552024-11-04 7:20:5919 hrs ago1730704859
0x89c30E3A...842Fd74f7
0.015 ETH
211127552024-11-04 7:20:5919 hrs ago1730704859
0x89c30E3A...842Fd74f7
0.015 ETH
211044082024-11-03 3:24:5947 hrs ago1730604299
0x89c30E3A...842Fd74f7
0.9785 ETH
211044082024-11-03 3:24:5947 hrs ago1730604299
0x89c30E3A...842Fd74f7
0.9785 ETH
211024802024-11-02 20:56:112 days ago1730580971
0x89c30E3A...842Fd74f7
2.15568475 ETH
211024802024-11-02 20:56:112 days ago1730580971
0x89c30E3A...842Fd74f7
2.15568475 ETH
211002032024-11-02 13:17:472 days ago1730553467
0x89c30E3A...842Fd74f7
6 ETH
211002032024-11-02 13:17:472 days ago1730553467
0x89c30E3A...842Fd74f7
6 ETH
211000492024-11-02 12:46:472 days ago1730551607
0x89c30E3A...842Fd74f7
2.2355 ETH
211000492024-11-02 12:46:472 days ago1730551607
0x89c30E3A...842Fd74f7
2.2355 ETH
210986302024-11-02 8:00:472 days ago1730534447
0x89c30E3A...842Fd74f7
356.72312465 ETH
210986302024-11-02 8:00:472 days ago1730534447
0x89c30E3A...842Fd74f7
356.72312465 ETH
210945242024-11-01 18:15:113 days ago1730484911
0x89c30E3A...842Fd74f7
0.70276359 ETH
210945242024-11-01 18:15:113 days ago1730484911
0x89c30E3A...842Fd74f7
0.70276359 ETH
210909322024-11-01 6:13:593 days ago1730441639
0x89c30E3A...842Fd74f7
0.03744 ETH
210909322024-11-01 6:13:593 days ago1730441639
0x89c30E3A...842Fd74f7
0.03744 ETH
210874612024-10-31 18:37:234 days ago1730399843
0x89c30E3A...842Fd74f7
0.01266122 ETH
210874612024-10-31 18:37:234 days ago1730399843
0x89c30E3A...842Fd74f7
0.01266122 ETH
210845472024-10-31 8:53:474 days ago1730364827
0x89c30E3A...842Fd74f7
0.00074682 ETH
210845472024-10-31 8:53:474 days ago1730364827
0x89c30E3A...842Fd74f7
0.00074682 ETH
210826592024-10-31 2:33:115 days ago1730341991
0x89c30E3A...842Fd74f7
0.028 ETH
210826592024-10-31 2:33:115 days ago1730341991
0x89c30E3A...842Fd74f7
0.028 ETH
210799502024-10-30 17:30:115 days ago1730309411
0x89c30E3A...842Fd74f7
0.49277297 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PortalsMulticall

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion
File 1 of 4 : PortalsMulticall.sol
/// SPDX-License-Identifier: GPL-3.0

/// Copyright (C) 2023 Portals.fi

/// @author Portals.fi
/// @notice This contract bundles multiple methods into a single transaction.
/// @dev Do not grant approvals to this contract unless they are completely
/// consumed or are revoked at the end of the transaction.

pragma solidity 0.8.19;

import { IPortalsMulticall } from
    "../multicall/interface/IPortalsMulticall.sol";
import { ReentrancyGuard } from "solmate/utils/ReentrancyGuard.sol";
import { ERC20 } from "solmate/tokens/ERC20.sol";

contract PortalsMulticall is IPortalsMulticall, ReentrancyGuard {
    /// @dev Executes a series of calls in a single transaction
    /// @param calls The calls to execute
    function aggregate(Call[] calldata calls)
        external
        payable
        override
        nonReentrant
    {
        for (uint256 i = 0; i < calls.length;) {
            IPortalsMulticall.Call memory call = calls[i];
            uint256 value;
            if (call.inputToken == address(0)) {
                value = address(this).balance;
                _setAmount(call.data, call.amountIndex, value);
            } else {
                _setAmount(
                    call.data,
                    call.amountIndex,
                    ERC20(call.inputToken).balanceOf(address(this))
                );
            }

            (bool success, bytes memory returnData) =
                call.target.call{ value: value }(call.data);
            if (!success) {
                // Next 5 lines from https://ethereum.stackexchange.com/a/83577
                if (returnData.length < 68) {
                    revert("PortalsMulticall: failed");
                }
                assembly {
                    returnData := add(returnData, 0x04)
                }
                revert(abi.decode(returnData, (string)));
            }
            unchecked {
                ++i;
            }
        }
    }

    /// @notice Transfers ETH from this contract to the specified address
    /// @param to The address to transfer ETH to
    /// @param amount The quantity of ETH to transfer
    function transferEth(address to, uint256 amount)
        external
        payable
    {
        (bool success,) = to.call{ value: amount }("");
        require(success, "PortalsMulticall: failed to transfer ETH");
    }

    /// @dev Sets the quantity of a token a specified index in the data
    /// @param data The data to set the quantity in
    /// @param amountIndex The index of the quantity of inputToken in the data
    function _setAmount(
        bytes memory data,
        uint256 amountIndex,
        uint256 amount
    ) private pure {
        if (amountIndex == type(uint256).max) return;
        assembly {
            mstore(add(data, add(36, mul(amountIndex, 32))), amount)
        }
    }

    receive() external payable { }
}

File 2 of 4 : IPortalsMulticall.sol
/// SPDX-License-Identifier: GPL-3.0

/// Copyright (C) 2023 Portals.fi

/// @author Portals.fi
/// @notice Interface for the Portals Multicall contract

pragma solidity 0.8.19;

interface IPortalsMulticall {
    /// @dev Describes a call to be executed in the aggregate function of PortalsMulticall.sol
    /// @param inputToken The token to sell
    /// @param target The target contract to call
    /// @param data The data to call the target contract with
    /// @param amountIndex The index of the quantity of inputToken in the data
    struct Call {
        address inputToken;
        address target;
        bytes data;
        uint256 amountIndex;
    }

    /// @dev Executes a series of calls in a single transaction
    /// @param calls An array of Call to execute
    function aggregate(Call[] calldata calls) external payable;
}

File 3 of 4 : ReentrancyGuard.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Gas optimized reentrancy protection for smart contracts.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/ReentrancyGuard.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/security/ReentrancyGuard.sol)
abstract contract ReentrancyGuard {
    uint256 private locked = 1;

    modifier nonReentrant() virtual {
        require(locked == 1, "REENTRANCY");

        locked = 2;

        _;

        locked = 1;
    }
}

File 4 of 4 : ERC20.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event Transfer(address indexed from, address indexed to, uint256 amount);

    event Approval(address indexed owner, address indexed spender, uint256 amount);

    /*//////////////////////////////////////////////////////////////
                            METADATA STORAGE
    //////////////////////////////////////////////////////////////*/

    string public name;

    string public symbol;

    uint8 public immutable decimals;

    /*//////////////////////////////////////////////////////////////
                              ERC20 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    mapping(address => mapping(address => uint256)) public allowance;

    /*//////////////////////////////////////////////////////////////
                            EIP-2612 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 internal immutable INITIAL_CHAIN_ID;

    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;

    mapping(address => uint256) public nonces;

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(
        string memory _name,
        string memory _symbol,
        uint8 _decimals
    ) {
        name = _name;
        symbol = _symbol;
        decimals = _decimals;

        INITIAL_CHAIN_ID = block.chainid;
        INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
    }

    /*//////////////////////////////////////////////////////////////
                               ERC20 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 amount) public virtual returns (bool) {
        allowance[msg.sender][spender] = amount;

        emit Approval(msg.sender, spender, amount);

        return true;
    }

    function transfer(address to, uint256 amount) public virtual returns (bool) {
        balanceOf[msg.sender] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(msg.sender, to, amount);

        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual returns (bool) {
        uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.

        if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;

        balanceOf[from] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(from, to, amount);

        return true;
    }

    /*//////////////////////////////////////////////////////////////
                             EIP-2612 LOGIC
    //////////////////////////////////////////////////////////////*/

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");

        // Unchecked because the only math done is incrementing
        // the owner's nonce which cannot realistically overflow.
        unchecked {
            address recoveredAddress = ecrecover(
                keccak256(
                    abi.encodePacked(
                        "\x19\x01",
                        DOMAIN_SEPARATOR(),
                        keccak256(
                            abi.encode(
                                keccak256(
                                    "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
                                ),
                                owner,
                                spender,
                                value,
                                nonces[owner]++,
                                deadline
                            )
                        )
                    )
                ),
                v,
                r,
                s
            );

            require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");

            allowance[recoveredAddress][spender] = value;
        }

        emit Approval(owner, spender, value);
    }

    function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
        return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
    }

    function computeDomainSeparator() internal view virtual returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                    keccak256(bytes(name)),
                    keccak256("1"),
                    block.chainid,
                    address(this)
                )
            );
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address to, uint256 amount) internal virtual {
        totalSupply += amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(address(0), to, amount);
    }

    function _burn(address from, uint256 amount) internal virtual {
        balanceOf[from] -= amount;

        // Cannot underflow because a user's balance
        // will never be larger than the total supply.
        unchecked {
            totalSupply -= amount;
        }

        emit Transfer(from, address(0), amount);
    }
}

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "solidity-stringutils/=lib/surl/lib/solidity-stringutils/",
    "solmate/=lib/solmate/src/",
    "surl/=lib/surl/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 10000
  },
  "metadata": {
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountIndex","type":"uint256"}],"internalType":"struct IPortalsMulticall.Call[]","name":"calls","type":"tuple[]"}],"name":"aggregate","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferEth","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6080604052600160005534801561001557600080fd5b5061088f806100256000396000f3fe60806040526004361061002d5760003560e01c8063614eb6e514610039578063e9bb84c21461004e57600080fd5b3661003457005b600080fd5b61004c610047366004610470565b610061565b005b61004c61005c36600461050e565b61033f565b6000546001146100d2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f5245454e5452414e43590000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b600260009081555b818110156103355760008383838181106100f6576100f6610538565b90506020028101906101089190610567565b61011190610692565b805190915060009073ffffffffffffffffffffffffffffffffffffffff1661014e574790506101498260400151836060015183610434565b6101f0565b6040828101516060840151845192517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526101f09373ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa1580156101c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101eb9190610742565b610434565b600080836020015173ffffffffffffffffffffffffffffffffffffffff16838560400151604051610221919061077f565b60006040518083038185875af1925050503d806000811461025e576040519150601f19603f3d011682016040523d82523d6000602084013e610263565b606091505b509150915081610326576044815110156102d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f506f7274616c734d756c746963616c6c3a206661696c6564000000000000000060448201526064016100c9565b600481019050808060200190518101906102f39190610791565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100c99190610808565b846001019450505050506100da565b5050600160005550565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114610399576040519150601f19603f3d011682016040523d82523d6000602084013e61039e565b606091505b505090508061042f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f506f7274616c734d756c746963616c6c3a206661696c656420746f207472616e60448201527f736665722045544800000000000000000000000000000000000000000000000060648201526084016100c9565b505050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361046057505050565b8060208302602401840152505050565b6000806020838503121561048357600080fd5b823567ffffffffffffffff8082111561049b57600080fd5b818501915085601f8301126104af57600080fd5b8135818111156104be57600080fd5b8660208260051b85010111156104d357600080fd5b60209290920196919550909350505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461050957600080fd5b919050565b6000806040838503121561052157600080fd5b61052a836104e5565b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8183360301811261059b57600080fd5b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516080810167ffffffffffffffff811182821017156105f7576105f76105a5565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610644576106446105a5565b604052919050565b600067ffffffffffffffff821115610666576106666105a5565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b6000608082360312156106a457600080fd5b6106ac6105d4565b6106b5836104e5565b815260206106c48185016104e5565b81830152604084013567ffffffffffffffff8111156106e257600080fd5b840136601f8201126106f357600080fd5b80356107066107018261064c565b6105fd565b818152368483850101111561071a57600080fd5b8184840185830137600091810190930152506040820152606092830135928101929092525090565b60006020828403121561075457600080fd5b5051919050565b60005b8381101561077657818101518382015260200161075e565b50506000910152565b6000825161059b81846020870161075b565b6000602082840312156107a357600080fd5b815167ffffffffffffffff8111156107ba57600080fd5b8201601f810184136107cb57600080fd5b80516107d96107018261064c565b8181528560208385010111156107ee57600080fd5b6107ff82602083016020860161075b565b95945050505050565b602081526000825180602084015261082781604085016020870161075b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220a48899637cb63e6bd10a3216c5d9cdb4b6147c96683fcc6ee2a70abcae5fe98664736f6c63430008130033

Deployed Bytecode

0x60806040526004361061002d5760003560e01c8063614eb6e514610039578063e9bb84c21461004e57600080fd5b3661003457005b600080fd5b61004c610047366004610470565b610061565b005b61004c61005c36600461050e565b61033f565b6000546001146100d2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f5245454e5452414e43590000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b600260009081555b818110156103355760008383838181106100f6576100f6610538565b90506020028101906101089190610567565b61011190610692565b805190915060009073ffffffffffffffffffffffffffffffffffffffff1661014e574790506101498260400151836060015183610434565b6101f0565b6040828101516060840151845192517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526101f09373ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa1580156101c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101eb9190610742565b610434565b600080836020015173ffffffffffffffffffffffffffffffffffffffff16838560400151604051610221919061077f565b60006040518083038185875af1925050503d806000811461025e576040519150601f19603f3d011682016040523d82523d6000602084013e610263565b606091505b509150915081610326576044815110156102d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f506f7274616c734d756c746963616c6c3a206661696c6564000000000000000060448201526064016100c9565b600481019050808060200190518101906102f39190610791565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100c99190610808565b846001019450505050506100da565b5050600160005550565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114610399576040519150601f19603f3d011682016040523d82523d6000602084013e61039e565b606091505b505090508061042f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f506f7274616c734d756c746963616c6c3a206661696c656420746f207472616e60448201527f736665722045544800000000000000000000000000000000000000000000000060648201526084016100c9565b505050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361046057505050565b8060208302602401840152505050565b6000806020838503121561048357600080fd5b823567ffffffffffffffff8082111561049b57600080fd5b818501915085601f8301126104af57600080fd5b8135818111156104be57600080fd5b8660208260051b85010111156104d357600080fd5b60209290920196919550909350505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461050957600080fd5b919050565b6000806040838503121561052157600080fd5b61052a836104e5565b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8183360301811261059b57600080fd5b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516080810167ffffffffffffffff811182821017156105f7576105f76105a5565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610644576106446105a5565b604052919050565b600067ffffffffffffffff821115610666576106666105a5565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b6000608082360312156106a457600080fd5b6106ac6105d4565b6106b5836104e5565b815260206106c48185016104e5565b81830152604084013567ffffffffffffffff8111156106e257600080fd5b840136601f8201126106f357600080fd5b80356107066107018261064c565b6105fd565b818152368483850101111561071a57600080fd5b8184840185830137600091810190930152506040820152606092830135928101929092525090565b60006020828403121561075457600080fd5b5051919050565b60005b8381101561077657818101518382015260200161075e565b50506000910152565b6000825161059b81846020870161075b565b6000602082840312156107a357600080fd5b815167ffffffffffffffff8111156107ba57600080fd5b8201601f810184136107cb57600080fd5b80516107d96107018261064c565b8181528560208385010111156107ee57600080fd5b6107ff82602083016020860161075b565b95945050505050565b602081526000825180602084015261082781604085016020870161075b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220a48899637cb63e6bd10a3216c5d9cdb4b6147c96683fcc6ee2a70abcae5fe98664736f6c63430008130033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.