ETH Price: $3,087.02 (-1.21%)

Contract

0x323fDC308f70c5e6635762FAe7f03a0a3972F348

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

1 Internal Transaction found.

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
42133592025-06-26 16:42:50196 days ago1750956170  Contract Creation0 ETH

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TupleHelpers

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 200 runs

Other Settings:
cancun EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/**
 * @notice Helper contract to extract a variety of types from a tuple within the context of a weiroll script
 */
contract TupleHelpers {
    /**
     * @notice Extract a bytes32 encoded static type from a tuple
     * @dev Use with .rawValue() in the weiroll planner
     * @param tuple The bytes encoded tuple
     * @param index The index of the value to be extracted
     */
    function extractElement(bytes memory tuple, uint256 index) public pure returns (bytes32) {
        assembly {
            // let offset := mul(add(index, 1), 32)
            // return(add(tuple, offset), 32)
            return(add(tuple, mul(add(index, 1), 32)), 32)
        }
    }

    /**
     * @notice Extract a bytes encoded dynamic type from a tuple
     * @dev Use with .rawValue() in the weiroll planner
     * @param tuple The bytes encoded tuple
     * @param index The index of the string or bytes to be extracted
     */
    function extractDynamicElement(bytes memory tuple, uint256 index) public pure returns (bytes32) {
        assembly {
            let offset := add(mload(add(tuple, mul(add(index, 1), 32))), 32)
            let length := mload(add(tuple, offset))
            if gt(mod(length, 32), 0) { length := mul(add(div(length, 32), 1), 32) }
            return(add(tuple, add(offset, 32)), length)
        }
    }

    /**
     * @notice Extract a bytes encoded tuple from another tuple
     * @dev Use with .rawValue() in the weiroll planner
     * @param tuple The bytes encoded parent tuple
     * @param index The index of the tuple to be extracted
     * @param isDynamicTypeFormat Boolean to define whether the child tuple is dynamically sized. If the child tuple
     * contains bytes or string variables, set to "true"
     */
    function extractTuple(
        bytes memory tuple,
        uint256 index,
        bool[] memory isDynamicTypeFormat
    )
        public
        pure
        returns (bytes32)
    {
        uint256 offset;
        uint256 length;
        assembly {
            offset := add(mload(add(tuple, mul(add(index, 1), 32))), 32)
        }
        for (uint256 i = 0; i < isDynamicTypeFormat.length; i++) {
            length += 32;
            if (isDynamicTypeFormat[i]) {
                assembly {
                    let paramOffset := add(offset, mload(add(tuple, add(offset, mul(i, 32)))))
                    let paramLength := add(mload(add(tuple, paramOffset)), 32)
                    if gt(mod(paramLength, 32), 0) { paramLength := mul(add(div(paramLength, 32), 1), 32) }
                    length := add(length, paramLength)
                }
            }
        }
        assembly {
            return(add(tuple, add(mload(add(tuple, mul(add(index, 1), 32))), 32)), length)
        }
    }

    /**
     * @notice Extract a bytes encoded static array from a tuple
     * @dev Use with .rawValue() in the weiroll planner
     * @param tuple The bytes encoded array
     * @param index The index of the array to be extracted
     */
    function extractArray(bytes memory tuple, uint256 index) public pure returns (bytes32) {
        assembly {
            // let offset := add(mload(add(tuple, mul(add(index, 1), 32))), 32)
            // let numberOfElements := mload(add(tuple, offset))
            // return(add(tuple, add(offset, 32)), mul(numberOfElements, 32))
            return(
                add(tuple, add(add(mload(add(tuple, mul(add(index, 1), 32))), 32), 32)),
                mul(mload(add(tuple, add(mload(add(tuple, mul(add(index, 1), 32))), 32))), 32)
            )
        }
    }

    /**
     * @notice Extract a bytes encoded dynamic array from a tuple
     * @dev Use with .rawValue() in the weiroll planner
     * @param tuple The bytes encoded tuple
     * @param index The index of the dynamic array to be extracted
     */
    function extractDynamicArray(bytes memory tuple, uint256 index) public pure returns (bytes32) {
        uint256 numberOfElements;
        uint256 offset;
        assembly {
            offset := add(mload(add(tuple, mul(add(index, 1), 32))), 32)
            numberOfElements := mload(add(tuple, offset))
            //numberOfElements := mload(add(tuple, add(mload(add(tuple, mul(add(index, 1), 32))), 32)))
        }

        uint256 length;
        for (uint256 i = 1; i <= numberOfElements; i++) {
            assembly {
                let paramOffset := add(offset, mul(add(i, 1), 32))
                let paramLength := mload(add(tuple, paramOffset))
                if gt(mod(paramLength, 32), 0) { paramLength := mul(add(div(paramLength, 32), 1), 32) }
                length := add(length, paramLength)
                //length := add(length, mload(add(tuple, add(add(mload(add(tuple, mul(add(index, 1), 32))), 32),
                // mul(add(i, 1), 32)))))
            }
        }
        assembly {
            // return(add(tuple, add(offset, 32)), add(length, 32))
            return(add(tuple, add(add(mload(add(tuple, mul(add(index, 1), 32))), 32), 32)), add(length, 32))
        }
    }

    /**
     * @notice Extract a bytes encoded array of tuples from a tuple
     * @dev Use with .rawValue() in the weiroll planner
     * @param tuple The bytes encoded tuple
     * @param index The index of the tuple array to be extracted
     * @param isDynamicTypeFormat Boolean to define whether the tuples in the array are dynamically sized. If the array
     * tuple contains bytes or string variables, set to "true"
     */
    function extractTupleArray(
        bytes memory tuple,
        uint256 index,
        bool[] memory isDynamicTypeFormat
    )
        public
        pure
        returns (bytes32)
    {
        uint256 numberOfElements;
        assembly {
            // let offset := add(mload(add(tuple, mul(add(index, 1), 32))), 32)
            // numberOfElements := mload(add(tuple, offset))
            numberOfElements := mload(add(tuple, add(mload(add(tuple, mul(add(index, 1), 32))), 32)))
        }
        uint256 length = numberOfElements * 32;
        for (uint256 i = 1; i <= numberOfElements; i++) {
            for (uint256 j = 0; j < isDynamicTypeFormat.length; j++) {
                length += 32;
                if (isDynamicTypeFormat[j]) {
                    assembly {
                        // let tupleOffset := add(offset,mload(add(tuple, add(offset, mul(i, 32)))))
                        // let paramOffset := add(tupleOffset, mload(add(tuple, add(tupleOffset, mul(add(j,1), 32)))))
                        // let paramLength := add(mload(add(tuple, paramOffset)),32)
                        // length := add(length, paramLength)
                        length :=
                            add(
                                length,
                                add(
                                    mload(
                                        add(
                                            tuple,
                                            add(
                                                add(
                                                    add(mload(add(tuple, mul(add(index, 1), 32))), 32),
                                                    mload(
                                                        add(
                                                            tuple,
                                                            add(
                                                                add(mload(add(tuple, mul(add(index, 1), 32))), 32),
                                                                mul(i, 32)
                                                            )
                                                        )
                                                    )
                                                ),
                                                mload(
                                                    add(
                                                        tuple,
                                                        add(
                                                            add(
                                                                add(mload(add(tuple, mul(add(index, 1), 32))), 32),
                                                                mload(
                                                                    add(
                                                                        tuple,
                                                                        add(
                                                                            add(
                                                                                mload(add(tuple, mul(add(index, 1), 32))),
                                                                                32
                                                                            ),
                                                                            mul(i, 32)
                                                                        )
                                                                    )
                                                                )
                                                            ),
                                                            mul(add(j, 1), 32)
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    ),
                                    32
                                )
                            )
                    }
                }
            }
        }
        assembly {
            // return(add(tuple, add(offset,32)), length)
            return(add(tuple, add(add(mload(add(tuple, mul(add(index, 1), 32))), 32), 32)), length)
        }
    }
}

Settings
{
  "evmVersion": "cancun",
  "libraries": {},
  "metadata": {
    "appendCBOR": false,
    "bytecodeHash": "none",
    "useLiteralContent": false
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "remappings": [
    "@layerzerolabs/oapp-evm/=lib/devtools/packages/oapp-evm/",
    "@layerzerolabs/lz-evm-protocol-v2/=lib/layerzero-v2/packages/layerzero-v2/evm/protocol/",
    "@layerzerolabs/lz-evm-oapp-v2/=lib/layerzero-v2/packages/layerzero-v2/evm/oapp/",
    "@uniswap/v4-core/=lib/v4-core/",
    "@uniswap/v4-periphery/=lib/v4-periphery/",
    "devtools/=lib/devtools/packages/toolbox-foundry/src/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "enso-weiroll/=lib/enso-weiroll/contracts/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "layerzero-v2/=lib/layerzero-v2/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
    "safe-contracts/=lib/safe-tools/lib/safe-contracts/contracts/",
    "safe-tools/=lib/safe-tools/src/",
    "solady/=lib/solady/src/",
    "solmate/=lib/solady/lib/solmate/src/",
    "@ensdomains/=lib/v4-core/node_modules/@ensdomains/",
    "@openzeppelin/=lib/v4-core/lib/openzeppelin-contracts/",
    "forge-gas-snapshot/=lib/v4-periphery/lib/permit2/lib/forge-gas-snapshot/src/",
    "hardhat/=lib/v4-core/node_modules/hardhat/",
    "permit2/=lib/v4-periphery/lib/permit2/",
    "v4-core/=lib/v4-core/src/",
    "v4-periphery/=lib/v4-periphery/"
  ],
  "viaIR": true
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"bytes","name":"tuple","type":"bytes"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"extractArray","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"tuple","type":"bytes"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"extractDynamicArray","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"tuple","type":"bytes"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"extractDynamicElement","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"tuple","type":"bytes"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"extractElement","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"tuple","type":"bytes"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"bool[]","name":"isDynamicTypeFormat","type":"bool[]"}],"name":"extractTuple","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"tuple","type":"bytes"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"bool[]","name":"isDynamicTypeFormat","type":"bool[]"}],"name":"extractTupleArray","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"}]

608080604052346015576104bf908161001a8239f35b5f80fdfe60806040526004361015610011575f80fd5b5f3560e01c80632fb402541461007457806348f263021461006f5780635305afc01461006a5780639bd3b22714610065578063a208b031146100605763df6d76b51461005b575f80fd5b610423565b610362565b610346565b6102c7565b610288565b3461011057610082366101a5565b600190910160051b820180515f93919291845b8351861015610107576100a790610460565b946100bb6100b58286610473565b51151590565b6100c9575b60010194610095565b946001906020808860051b8601850101518501840101519060208080840193086100f7575b019590506100c0565b90829060051c0160051b906100ee565b60208286510101f35b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b6040519190601f01601f1916820167ffffffffffffffff81118382101761014e57604052565b610114565b81601f820112156101105780359067ffffffffffffffff821161014e57610183601f8301601f1916602001610128565b928284526020838301011161011057815f926020809301838601378301015290565b60606003198201126101105760043567ffffffffffffffff811161011057816101d091600401610153565b916024359160443567ffffffffffffffff811161011057816023820112156101105780600401359167ffffffffffffffff831161014e578260051b916024602061021b818601610128565b80968152019382010191821161011057602401915b81831061023d5750505090565b8235801515810361011057815260209283019201610230565b6040600319820112610110576004359067ffffffffffffffff82116101105761028191600401610153565b9060243590565b3461011057600161029836610256565b9190910160051b81015101602081015190601f82166102b657604001f35b600591821c60010190911b90604001f35b346101105760016102d736610256565b9190910160051b810190815160208183010151905f916001915b8183111561030757856040866020870192510101f35b90919261032e9060206001860160051b84018701015190601f8216610335575b019361049b565b91906102f1565b9060019060051c0160051b90610327565b34610110576020600161035836610256565b9190910160051b01f35b34610110576001610372366101a5565b91920160051b82019160208351820101519261038d846104a9565b926001905b858211156103a4578460408585510101f35b919092935f905b835182101561040a576103bd90610460565b906103cb6100b58286610473565b6103d9575b600101906103ab565b906020600191818551818960051b82018b010151018185870160051b82018b010151018901015101019190506103d0565b95929193610418915061049b565b909493929194610392565b3461011057600161043336610256565b9190910160051b810151016040602082015160051b9101f35b634e487b7160e01b5f52601160045260245ffd5b906020820180921161046e57565b61044c565b80518210156104875760209160051b010190565b634e487b7160e01b5f52603260045260245ffd5b5f19811461046e5760010190565b908160051b918083046020149015171561046e5756

Deployed Bytecode

0x60806040526004361015610011575f80fd5b5f3560e01c80632fb402541461007457806348f263021461006f5780635305afc01461006a5780639bd3b22714610065578063a208b031146100605763df6d76b51461005b575f80fd5b610423565b610362565b610346565b6102c7565b610288565b3461011057610082366101a5565b600190910160051b820180515f93919291845b8351861015610107576100a790610460565b946100bb6100b58286610473565b51151590565b6100c9575b60010194610095565b946001906020808860051b8601850101518501840101519060208080840193086100f7575b019590506100c0565b90829060051c0160051b906100ee565b60208286510101f35b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b6040519190601f01601f1916820167ffffffffffffffff81118382101761014e57604052565b610114565b81601f820112156101105780359067ffffffffffffffff821161014e57610183601f8301601f1916602001610128565b928284526020838301011161011057815f926020809301838601378301015290565b60606003198201126101105760043567ffffffffffffffff811161011057816101d091600401610153565b916024359160443567ffffffffffffffff811161011057816023820112156101105780600401359167ffffffffffffffff831161014e578260051b916024602061021b818601610128565b80968152019382010191821161011057602401915b81831061023d5750505090565b8235801515810361011057815260209283019201610230565b6040600319820112610110576004359067ffffffffffffffff82116101105761028191600401610153565b9060243590565b3461011057600161029836610256565b9190910160051b81015101602081015190601f82166102b657604001f35b600591821c60010190911b90604001f35b346101105760016102d736610256565b9190910160051b810190815160208183010151905f916001915b8183111561030757856040866020870192510101f35b90919261032e9060206001860160051b84018701015190601f8216610335575b019361049b565b91906102f1565b9060019060051c0160051b90610327565b34610110576020600161035836610256565b9190910160051b01f35b34610110576001610372366101a5565b91920160051b82019160208351820101519261038d846104a9565b926001905b858211156103a4578460408585510101f35b919092935f905b835182101561040a576103bd90610460565b906103cb6100b58286610473565b6103d9575b600101906103ab565b906020600191818551818960051b82018b010151018185870160051b82018b010151018901015101019190506103d0565b95929193610418915061049b565b909493929194610392565b3461011057600161043336610256565b9190910160051b810151016040602082015160051b9101f35b634e487b7160e01b5f52601160045260245ffd5b906020820180921161046e57565b61044c565b80518210156104875760209160051b010190565b634e487b7160e01b5f52603260045260245ffd5b5f19811461046e5760010190565b908160051b918083046020149015171561046e5756

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  ]

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.