OP Sepolia Testnet

Contract

0x254cfb4b4306CA87494d78C9d6Ce06D61dB3d464

Overview

ETH Balance

0 ETH

Sponsored

Transaction Hash
Method
Block
From
To
0x60806040126364412024-05-30 13:23:4251 days ago1717075422IN
 Contract Creation
0 ETH0.093590825650.11000026

Advanced mode:
Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xFE7F2C8a...b139F5559
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
SFFLRegistryRollup

Compiler Version
v0.8.12+commit.f00d7308

Optimization Enabled:
Yes with 100 runs

Other Settings:
london EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 24 : SFFLRegistryRollup.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import {Initializable} from "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";
import {Pausable} from "@eigenlayer/contracts/permissions/Pausable.sol";
import {IPauserRegistry} from "@eigenlayer/contracts/interfaces/IPauserRegistry.sol";

import {BN254} from "eigenlayer-middleware/src/libraries/BN254.sol";

import {SFFLRegistryBase} from "../base/SFFLRegistryBase.sol";
import {StateRootUpdate} from "../base/message/StateRootUpdate.sol";
import {OperatorSetUpdate} from "../base/message/OperatorSetUpdate.sol";
import {RollupOperators} from "../base/utils/RollupOperators.sol";

/**
 * @title SFFL registry for rollups / external networks
 * @notice Contract that centralizes the AVS operator set copy management,
 * which is based on agreements such as the state root updates, as well as
 * state root updates themselves. Differently from the Ethereum AVS contracts,
 * the rollup contract heavily assumes a one-quorum operator set and can only
 * prove agreements based on the current operator set state
 */
contract SFFLRegistryRollup is Initializable, OwnableUpgradeable, Pausable, SFFLRegistryBase {
    using BN254 for BN254.G1Point;
    using RollupOperators for RollupOperators.OperatorSet;
    using OperatorSetUpdate for OperatorSetUpdate.Message;
    using StateRootUpdate for StateRootUpdate.Message;

    /**
     * @notice Index for flag that pauses operator set updates
     */
    uint8 public constant PAUSED_UPDATE_OPERATOR_SET = 0;
    /**
     * @notice Index for flag that pauses state root updates
     */
    uint8 public constant PAUSED_UPDATE_STATE_ROOT = 1;

    /**
     * @dev Operator set used for agreements
     */
    RollupOperators.OperatorSet internal _operatorSet;

    /**
     * @notice Next operator set update message ID
     */
    uint64 public nextOperatorUpdateId;

    /**
     * @notice Aggregator address, used for the initial operator set setup
     */
    address public aggregator;

    modifier onlyAggregator() {
        require(msg.sender == aggregator, "Sender is not aggregator");
        _;
    }

    constructor() {
        _disableInitializers();
    }

    /**
     * @notice Initializes the contract
     * @param quorumThreshold Quorum threshold, based on THRESHOLD_DENOMINATOR
     * @param initialOwner Owner address
     * @param _aggregator Aggregator address
     * @param _pauserRegistry Pauser registry address
     */
    function initialize(
        uint128 quorumThreshold,
        address initialOwner,
        address _aggregator,
        IPauserRegistry _pauserRegistry
    ) public initializer {
        _initializePauser(_pauserRegistry, UNPAUSE_ALL);
        _transferOwnership(initialOwner);
        _operatorSet.setQuorumThreshold(quorumThreshold);

        aggregator = _aggregator;
    }

    /**
     * @notice Sets the initial operator set
     * @param operators Initial operator list
     * @param _nextOperatorUpdateId Starting next operator update message ID
     */
    function setInitialOperatorSet(RollupOperators.Operator[] memory operators, uint64 _nextOperatorUpdateId)
        external
        onlyAggregator
    {
        require(_operatorSet.totalWeight == 0, "Operator set already initialized");

        _operatorSet.update(operators);
        nextOperatorUpdateId = _nextOperatorUpdateId;
    }

    /**
     * @notice Updates the operator set through an operator set update message
     * @param message Operator set update message
     * @param signatureInfo BLS aggregated signature info
     */
    function updateOperatorSet(
        OperatorSetUpdate.Message calldata message,
        RollupOperators.SignatureInfo calldata signatureInfo
    ) external onlyWhenNotPaused(PAUSED_UPDATE_OPERATOR_SET) {
        require(message.id == nextOperatorUpdateId, "Wrong message ID");
        require(_operatorSet.verifyCalldata(message.hashCalldata(), signatureInfo), "Quorum not met");

        nextOperatorUpdateId = message.id + 1;

        _operatorSet.update(message.operators);
    }

    /**
     * @notice Updates a rollup's state root for a block height through a state
     * root update message
     * @param message State root update message
     * @param signatureInfo BLS aggregated signature info
     */
    function updateStateRoot(
        StateRootUpdate.Message calldata message,
        RollupOperators.SignatureInfo calldata signatureInfo
    ) public onlyWhenNotPaused(PAUSED_UPDATE_STATE_ROOT) {
        require(_operatorSet.verifyCalldata(message.hashCalldata(), signatureInfo), "Quorum not met");

        _pushStateRoot(message.rollupId, message.blockHeight, message.stateRoot);
    }

    /**
     * Updates a rollup's state root based on the AVS operators agreement
     * @param message State root update message
     * @param encodedSignatureInfo Encoded BLS aggregated signature info
     */
    function _updateStateRoot(StateRootUpdate.Message calldata message, bytes calldata encodedSignatureInfo)
        internal
        override
    {
        RollupOperators.SignatureInfo calldata signatureInfo;

        assembly {
            signatureInfo := encodedSignatureInfo.offset
        }

        updateStateRoot(message, signatureInfo);
    }

    /**
     * @notice Forces an operator set update. This is meant to be used only
     * by the owner in a testnet scenario in case there is no consensus on a
     * particular operator set update. This can also be used while operator
     * set updating is paused.
     * @param message Operator set update message
     */
    function forceOperatorSetUpdate(OperatorSetUpdate.Message calldata message) external onlyOwner {
        require(message.id == nextOperatorUpdateId, "Wrong message ID");

        nextOperatorUpdateId = message.id + 1;

        _operatorSet.update(message.operators);
    }

    /**
     * @notice Sets the operator set quorum weight threshold
     * @param newQuorumThreshold New quorum threshold, based on
     * THRESHOLD_DENOMINATOR
     */
    function setQuorumThreshold(uint128 newQuorumThreshold) external onlyOwner {
        return _operatorSet.setQuorumThreshold(newQuorumThreshold);
    }

    /**
     * @notice Gets an operator's weight
     * @param pubkeyHash Operator pubkey hash
     * @return Operator weight
     */
    function getOperatorWeight(bytes32 pubkeyHash) external view returns (uint128) {
        return _operatorSet.getOperatorWeight(pubkeyHash);
    }

    /**
     * @notice Gets the operator set aggregate public key
     * @return Operator set aggregate public key
     */
    function getApk() external view returns (BN254.G1Point memory) {
        return _operatorSet.apk;
    }

    /**
     * @notice Gets the operator set total weight
     * @return Operator set total weight
     */
    function getTotalWeight() external view returns (uint128) {
        return _operatorSet.totalWeight;
    }

    /**
     * @notice Gets the operator set weight threshold
     * @return Operator set weight threshold
     */
    function getQuorumThreshold() external view returns (uint128) {
        return _operatorSet.quorumThreshold;
    }

    /**
     * @notice Gets the operator set quorum weight threshold denominator
     * @return Operator set weight threshold denominator
     */
    function THRESHOLD_DENOMINATOR() external pure returns (uint128) {
        return RollupOperators.THRESHOLD_DENOMINATOR;
    }
}

File 2 of 24 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
     * initialization step. This is essential to configure modules that are added through upgrades and that require
     * initialization.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }
}

File 3 of 24 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 4 of 24 : Pausable.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity =0.8.12;

import "../interfaces/IPausable.sol";

/**
 * @title Adds pausability to a contract, with pausing & unpausing controlled by the `pauser` and `unpauser` of a PauserRegistry contract.
 * @author Layr Labs, Inc.
 * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
 * @notice Contracts that inherit from this contract may define their own `pause` and `unpause` (and/or related) functions.
 * These functions should be permissioned as "onlyPauser" which defers to a `PauserRegistry` for determining access control.
 * @dev Pausability is implemented using a uint256, which allows up to 256 different single bit-flags; each bit can potentially pause different functionality.
 * Inspiration for this was taken from the NearBridge design here https://etherscan.io/address/0x3FEFc5A4B1c02f21cBc8D3613643ba0635b9a873#code.
 * For the `pause` and `unpause` functions we've implemented, if you pause, you can only flip (any number of) switches to on/1 (aka "paused"), and if you unpause,
 * you can only flip (any number of) switches to off/0 (aka "paused").
 * If you want a pauseXYZ function that just flips a single bit / "pausing flag", it will:
 * 1) 'bit-wise and' (aka `&`) a flag with the current paused state (as a uint256)
 * 2) update the paused state to this new value
 * @dev We note as well that we have chosen to identify flags by their *bit index* as opposed to their numerical value, so, e.g. defining `DEPOSITS_PAUSED = 3`
 * indicates specifically that if the *third bit* of `_paused` is flipped -- i.e. it is a '1' -- then deposits should be paused
 */
contract Pausable is IPausable {
    /// @notice Address of the `PauserRegistry` contract that this contract defers to for determining access control (for pausing).
    IPauserRegistry public pauserRegistry;

    /// @dev whether or not the contract is currently paused
    uint256 private _paused;

    uint256 internal constant UNPAUSE_ALL = 0;
    uint256 internal constant PAUSE_ALL = type(uint256).max;

    /// @notice
    modifier onlyPauser() {
        require(pauserRegistry.isPauser(msg.sender), "msg.sender is not permissioned as pauser");
        _;
    }

    modifier onlyUnpauser() {
        require(msg.sender == pauserRegistry.unpauser(), "msg.sender is not permissioned as unpauser");
        _;
    }

    /// @notice Throws if the contract is paused, i.e. if any of the bits in `_paused` is flipped to 1.
    modifier whenNotPaused() {
        require(_paused == 0, "Pausable: contract is paused");
        _;
    }

    /// @notice Throws if the `indexed`th bit of `_paused` is 1, i.e. if the `index`th pause switch is flipped.
    modifier onlyWhenNotPaused(uint8 index) {
        require(!paused(index), "Pausable: index is paused");
        _;
    }

    /// @notice One-time function for setting the `pauserRegistry` and initializing the value of `_paused`.
    function _initializePauser(IPauserRegistry _pauserRegistry, uint256 initPausedStatus) internal {
        require(
            address(pauserRegistry) == address(0) && address(_pauserRegistry) != address(0),
            "Pausable._initializePauser: _initializePauser() can only be called once"
        );
        _paused = initPausedStatus;
        emit Paused(msg.sender, initPausedStatus);
        _setPauserRegistry(_pauserRegistry);
    }

    /**
     * @notice This function is used to pause an EigenLayer contract's functionality.
     * It is permissioned to the `pauser` address, which is expected to be a low threshold multisig.
     * @param newPausedStatus represents the new value for `_paused` to take, which means it may flip several bits at once.
     * @dev This function can only pause functionality, and thus cannot 'unflip' any bit in `_paused` from 1 to 0.
     */
    function pause(uint256 newPausedStatus) external onlyPauser {
        // verify that the `newPausedStatus` does not *unflip* any bits (i.e. doesn't unpause anything, all 1 bits remain)
        require((_paused & newPausedStatus) == _paused, "Pausable.pause: invalid attempt to unpause functionality");
        _paused = newPausedStatus;
        emit Paused(msg.sender, newPausedStatus);
    }

    /**
     * @notice Alias for `pause(type(uint256).max)`.
     */
    function pauseAll() external onlyPauser {
        _paused = type(uint256).max;
        emit Paused(msg.sender, type(uint256).max);
    }

    /**
     * @notice This function is used to unpause an EigenLayer contract's functionality.
     * It is permissioned to the `unpauser` address, which is expected to be a high threshold multisig or governance contract.
     * @param newPausedStatus represents the new value for `_paused` to take, which means it may flip several bits at once.
     * @dev This function can only unpause functionality, and thus cannot 'flip' any bit in `_paused` from 0 to 1.
     */
    function unpause(uint256 newPausedStatus) external onlyUnpauser {
        // verify that the `newPausedStatus` does not *flip* any bits (i.e. doesn't pause anything, all 0 bits remain)
        require(
            ((~_paused) & (~newPausedStatus)) == (~_paused),
            "Pausable.unpause: invalid attempt to pause functionality"
        );
        _paused = newPausedStatus;
        emit Unpaused(msg.sender, newPausedStatus);
    }

    /// @notice Returns the current paused status as a uint256.
    function paused() public view virtual returns (uint256) {
        return _paused;
    }

    /// @notice Returns 'true' if the `indexed`th bit of `_paused` is 1, and 'false' otherwise
    function paused(uint8 index) public view virtual returns (bool) {
        uint256 mask = 1 << index;
        return ((_paused & mask) == mask);
    }

    /// @notice Allows the unpauser to set a new pauser registry
    function setPauserRegistry(IPauserRegistry newPauserRegistry) external onlyUnpauser {
        _setPauserRegistry(newPauserRegistry);
    }

    /// internal function for setting pauser registry
    function _setPauserRegistry(IPauserRegistry newPauserRegistry) internal {
        require(
            address(newPauserRegistry) != address(0),
            "Pausable._setPauserRegistry: newPauserRegistry cannot be the zero address"
        );
        emit PauserRegistrySet(pauserRegistry, newPauserRegistry);
        pauserRegistry = newPauserRegistry;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[48] private __gap;
}

File 5 of 24 : IPauserRegistry.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

/**
 * @title Interface for the `PauserRegistry` contract.
 * @author Layr Labs, Inc.
 * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
 */
interface IPauserRegistry {
    event PauserStatusChanged(address pauser, bool canPause);

    event UnpauserChanged(address previousUnpauser, address newUnpauser);
    
    /// @notice Mapping of addresses to whether they hold the pauser role.
    function isPauser(address pauser) external view returns (bool);

    /// @notice Unique address that holds the unpauser role. Capable of changing *both* the pauser and unpauser addresses.
    function unpauser() external view returns (address);
}

File 6 of 24 : BN254.sol
// SPDX-License-Identifier: MIT
// several functions are taken or adapted from https://github.com/HarryR/solcrypto/blob/master/contracts/altbn128.sol (MIT license):
// Copyright 2017 Christian Reitwiessner
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.

// The remainder of the code in this library is written by LayrLabs Inc. and is also under an MIT license

pragma solidity =0.8.12;

/**
 * @title Library for operations on the BN254 elliptic curve.
 * @author Layr Labs, Inc.
 * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
 * @notice Contains BN254 parameters, common operations (addition, scalar mul, pairing), and BLS signature functionality.
 */
library BN254 {
    // modulus for the underlying field F_p of the elliptic curve
    uint256 internal constant FP_MODULUS =
        21888242871839275222246405745257275088696311157297823662689037894645226208583;
    // modulus for the underlying field F_r of the elliptic curve
    uint256 internal constant FR_MODULUS =
        21888242871839275222246405745257275088548364400416034343698204186575808495617;

    struct G1Point {
        uint256 X;
        uint256 Y;
    }

    // Encoding of field elements is: X[1] * i + X[0]
    struct G2Point {
        uint256[2] X;
        uint256[2] Y;
    }

    function generatorG1() internal pure returns (G1Point memory) {
        return G1Point(1, 2);
    }

    // generator of group G2
    /// @dev Generator point in F_q2 is of the form: (x0 + ix1, y0 + iy1).
    uint256 internal constant G2x1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;
    uint256 internal constant G2x0 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
    uint256 internal constant G2y1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
    uint256 internal constant G2y0 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;

    /// @notice returns the G2 generator
    /// @dev mind the ordering of the 1s and 0s!
    ///      this is because of the (unknown to us) convention used in the bn254 pairing precompile contract
    ///      "Elements a * i + b of F_p^2 are encoded as two elements of F_p, (a, b)."
    ///      https://github.com/ethereum/EIPs/blob/master/EIPS/eip-197.md#encoding
    function generatorG2() internal pure returns (G2Point memory) {
        return G2Point([G2x1, G2x0], [G2y1, G2y0]);
    }

    // negation of the generator of group G2
    /// @dev Generator point in F_q2 is of the form: (x0 + ix1, y0 + iy1).
    uint256 internal constant nG2x1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;
    uint256 internal constant nG2x0 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
    uint256 internal constant nG2y1 = 17805874995975841540914202342111839520379459829704422454583296818431106115052;
    uint256 internal constant nG2y0 = 13392588948715843804641432497768002650278120570034223513918757245338268106653;

    function negGeneratorG2() internal pure returns (G2Point memory) {
        return G2Point([nG2x1, nG2x0], [nG2y1, nG2y0]);
    }

    bytes32 internal constant powersOfTauMerkleRoot =
        0x22c998e49752bbb1918ba87d6d59dd0e83620a311ba91dd4b2cc84990b31b56f;

    /**
     * @param p Some point in G1.
     * @return The negation of `p`, i.e. p.plus(p.negate()) should be zero.
     */
    function negate(G1Point memory p) internal pure returns (G1Point memory) {
        // The prime q in the base field F_q for G1
        if (p.X == 0 && p.Y == 0) {
            return G1Point(0, 0);
        } else {
            return G1Point(p.X, FP_MODULUS - (p.Y % FP_MODULUS));
        }
    }

    /**
     * @return r the sum of two points of G1
     */
    function plus(G1Point memory p1, G1Point memory p2) internal view returns (G1Point memory r) {
        uint256[4] memory input;
        input[0] = p1.X;
        input[1] = p1.Y;
        input[2] = p2.X;
        input[3] = p2.Y;
        bool success;

        // solium-disable-next-line security/no-inline-assembly
        assembly {
            success := staticcall(sub(gas(), 2000), 6, input, 0x80, r, 0x40)
            // Use "invalid" to make gas estimation work
            switch success
            case 0 {
                invalid()
            }
        }

        require(success, "ec-add-failed");
    }

    /**
     * @notice an optimized ecMul implementation that takes O(log_2(s)) ecAdds
     * @param p the point to multiply
     * @param s the scalar to multiply by
     * @dev this function is only safe to use if the scalar is 9 bits or less
     */ 
    function scalar_mul_tiny(BN254.G1Point memory p, uint16 s) internal view returns (BN254.G1Point memory) {
        require(s < 2**9, "scalar-too-large");

        // if s is 1 return p
        if(s == 1) {
            return p;
        }

        // the accumulated product to return
        BN254.G1Point memory acc = BN254.G1Point(0, 0);
        // the 2^n*p to add to the accumulated product in each iteration
        BN254.G1Point memory p2n = p;
        // value of most significant bit
        uint16 m = 1;
        // index of most significant bit
        uint8 i = 0;

        //loop until we reach the most significant bit
        while(s >= m){
            unchecked {
                // if the  current bit is 1, add the 2^n*p to the accumulated product
                if ((s >> i) & 1 == 1) {
                    acc = plus(acc, p2n);
                }
                // double the 2^n*p for the next iteration
                p2n = plus(p2n, p2n);

                // increment the index and double the value of the most significant bit
                m <<= 1;
                ++i;
            }
        }
        
        // return the accumulated product
        return acc;
    }

    /**
     * @return r the product of a point on G1 and a scalar, i.e.
     *         p == p.scalar_mul(1) and p.plus(p) == p.scalar_mul(2) for all
     *         points p.
     */
    function scalar_mul(G1Point memory p, uint256 s) internal view returns (G1Point memory r) {
        uint256[3] memory input;
        input[0] = p.X;
        input[1] = p.Y;
        input[2] = s;
        bool success;
        // solium-disable-next-line security/no-inline-assembly
        assembly {
            success := staticcall(sub(gas(), 2000), 7, input, 0x60, r, 0x40)
            // Use "invalid" to make gas estimation work
            switch success
            case 0 {
                invalid()
            }
        }
        require(success, "ec-mul-failed");
    }

    /**
     *  @return The result of computing the pairing check
     *         e(p1[0], p2[0]) *  .... * e(p1[n], p2[n]) == 1
     *         For example,
     *         pairing([P1(), P1().negate()], [P2(), P2()]) should return true.
     */
    function pairing(
        G1Point memory a1,
        G2Point memory a2,
        G1Point memory b1,
        G2Point memory b2
    ) internal view returns (bool) {
        G1Point[2] memory p1 = [a1, b1];
        G2Point[2] memory p2 = [a2, b2];

        uint256[12] memory input;

        for (uint256 i = 0; i < 2; i++) {
            uint256 j = i * 6;
            input[j + 0] = p1[i].X;
            input[j + 1] = p1[i].Y;
            input[j + 2] = p2[i].X[0];
            input[j + 3] = p2[i].X[1];
            input[j + 4] = p2[i].Y[0];
            input[j + 5] = p2[i].Y[1];
        }

        uint256[1] memory out;
        bool success;

        // solium-disable-next-line security/no-inline-assembly
        assembly {
            success := staticcall(sub(gas(), 2000), 8, input, mul(12, 0x20), out, 0x20)
            // Use "invalid" to make gas estimation work
            switch success
            case 0 {
                invalid()
            }
        }

        require(success, "pairing-opcode-failed");

        return out[0] != 0;
    }

    /**
     * @notice This function is functionally the same as pairing(), however it specifies a gas limit
     *         the user can set, as a precompile may use the entire gas budget if it reverts.
     */
    function safePairing(
        G1Point memory a1,
        G2Point memory a2,
        G1Point memory b1,
        G2Point memory b2,
        uint256 pairingGas
    ) internal view returns (bool, bool) {
        G1Point[2] memory p1 = [a1, b1];
        G2Point[2] memory p2 = [a2, b2];

        uint256[12] memory input;

        for (uint256 i = 0; i < 2; i++) {
            uint256 j = i * 6;
            input[j + 0] = p1[i].X;
            input[j + 1] = p1[i].Y;
            input[j + 2] = p2[i].X[0];
            input[j + 3] = p2[i].X[1];
            input[j + 4] = p2[i].Y[0];
            input[j + 5] = p2[i].Y[1];
        }

        uint256[1] memory out;
        bool success;

        // solium-disable-next-line security/no-inline-assembly
        assembly {
            success := staticcall(pairingGas, 8, input, mul(12, 0x20), out, 0x20)
        }

        //Out is the output of the pairing precompile, either 0 or 1 based on whether the two pairings are equal.
        //Success is true if the precompile actually goes through (aka all inputs are valid)

        return (success, out[0] != 0);
    }

    /// @return hashedG1 the keccak256 hash of the G1 Point
    /// @dev used for BLS signatures
    function hashG1Point(BN254.G1Point memory pk) internal pure returns (bytes32 hashedG1) {
        assembly {
            mstore(0, mload(pk))
            mstore(0x20, mload(add(0x20, pk)))
            hashedG1 := keccak256(0, 0x40)
        }
    }

    /// @return the keccak256 hash of the G2 Point
    /// @dev used for BLS signatures
    function hashG2Point(
        BN254.G2Point memory pk
    ) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked(pk.X[0], pk.X[1], pk.Y[0], pk.Y[1]));
    }

    /**
     * @notice adapted from https://github.com/HarryR/solcrypto/blob/master/contracts/altbn128.sol
     */
    function hashToG1(bytes32 _x) internal view returns (G1Point memory) {
        uint256 beta = 0;
        uint256 y = 0;

        uint256 x = uint256(_x) % FP_MODULUS;

        while (true) {
            (beta, y) = findYFromX(x);

            // y^2 == beta
            if( beta == mulmod(y, y, FP_MODULUS) ) {
                return G1Point(x, y);
            }

            x = addmod(x, 1, FP_MODULUS);
        }
        return G1Point(0, 0);
    }

    /**
     * Given X, find Y
     *
     *   where y = sqrt(x^3 + b)
     *
     * Returns: (x^3 + b), y
     */
    function findYFromX(uint256 x) internal view returns (uint256, uint256) {
        // beta = (x^3 + b) % p
        uint256 beta = addmod(mulmod(mulmod(x, x, FP_MODULUS), x, FP_MODULUS), 3, FP_MODULUS);

        // y^2 = x^3 + b
        // this acts like: y = sqrt(beta) = beta^((p+1) / 4)
        uint256 y = expMod(beta, 0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f52, FP_MODULUS);

        return (beta, y);
    }

    function expMod(uint256 _base, uint256 _exponent, uint256 _modulus) internal view returns (uint256 retval) {
        bool success;
        uint256[1] memory output;
        uint[6] memory input;
        input[0] = 0x20; // baseLen = new(big.Int).SetBytes(getData(input, 0, 32))
        input[1] = 0x20; // expLen  = new(big.Int).SetBytes(getData(input, 32, 32))
        input[2] = 0x20; // modLen  = new(big.Int).SetBytes(getData(input, 64, 32))
        input[3] = _base;
        input[4] = _exponent;
        input[5] = _modulus;
        assembly {
            success := staticcall(sub(gas(), 2000), 5, input, 0xc0, output, 0x20)
            // Use "invalid" to make gas estimation work
            switch success
            case 0 {
                invalid()
            }
        }
        require(success, "BN254.expMod: call failure");
        return output[0];
    }
}

File 7 of 24 : SFFLRegistryBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import {Lib_AddressResolver} from "@eth-optimism/contracts/libraries/resolver/Lib_AddressResolver.sol";
import {Lib_OVMCodec} from "@eth-optimism/contracts/libraries/codec/Lib_OVMCodec.sol";
import {Lib_SecureMerkleTrie} from "@eth-optimism/contracts/libraries/trie/Lib_SecureMerkleTrie.sol";
import {Lib_RLPReader} from "@eth-optimism/contracts/libraries/rlp/Lib_RLPReader.sol";

import {StateRootUpdate} from "../base/message/StateRootUpdate.sol";

/**
 * @title SFFL registry base implementation
 * @notice Base implementation for all SFFL contracts in any chain, including
 * state root storage utilities and storage verification through the trusted
 * roots.
 * @dev This base implementation expects `_pushStateRoot` to be called by the
 * children contracts. This should ideally be done only through state root
 * update messages, and after verifying its agreement.
 */
abstract contract SFFLRegistryBase {
    /**
     * @dev Maps rollupId => blockHeight => stateRoot
     */
    mapping(uint32 => mapping(uint64 => bytes32)) internal _stateRootBuffers;

    /**
     * @notice Emitted when a rollup's state root is updated
     * @param rollupId Pre-defined rollup ID
     * @param blockHeight Rollup block height
     * @param stateRoot Rollup state root at blockHeight
     */
    event StateRootUpdated(uint32 indexed rollupId, uint64 indexed blockHeight, bytes32 stateRoot);

    /**
     * @notice Gets a state root for a rollup in a specific block height
     * @dev Does not fail if it's empty, should be checked for zeroes
     * @param rollupId Pre-defined rollup ID
     * @param blockHeight Rollup block height
     * @return Rollup state root, or 0 if unset
     */
    function getStateRoot(uint32 rollupId, uint64 blockHeight) external view returns (bytes32) {
        return _stateRootBuffers[rollupId][blockHeight];
    }

    struct ProofParams {
        address target;
        bytes32 storageKey;
        bytes stateTrieWitness;
        bytes storageTrieWitness;
    }

    /**
     * @notice Gets a storage key value based on a rollup's state root in a block
     * @param message State root update message
     * @param proofParams Storage proof parameters
     * @param agreement AVS operators agreement info
     * @return Verified storage value
     */
    function updateAndGetStorageValue(
        StateRootUpdate.Message calldata message,
        ProofParams calldata proofParams,
        bytes calldata agreement
    ) external returns (bytes32) {
        require(
            message.nearDaTransactionId != bytes32(0) && message.nearDaCommitment != bytes32(0),
            "Empty NEAR DA commitment"
        );

        bytes32 stateRoot = _stateRootBuffers[message.rollupId][message.blockHeight];

        if (stateRoot == bytes32(0)) {
            require(agreement.length != 0, "Empty agreement");

            _updateStateRoot(message, agreement);
        }

        return getStorageValue(message, proofParams);
    }

    /**
     * @notice Gets a storage key value based on a rollup's state root in a block
     * @param message State root update message
     * @param proofParams Storage proof parameters
     * @return Verified storage value
     */
    function getStorageValue(StateRootUpdate.Message calldata message, ProofParams calldata proofParams)
        public
        view
        returns (bytes32)
    {
        bytes32 stateRoot = _stateRootBuffers[message.rollupId][message.blockHeight];

        require(stateRoot == message.stateRoot, "Mismatching state roots");

        return _getStorageValue(
            proofParams.target,
            proofParams.storageKey,
            stateRoot,
            proofParams.stateTrieWitness,
            proofParams.storageTrieWitness
        );
    }

    /**
     * @notice Gets a storage slot value based on a state root
     * @dev Based on: https://github.com/ensdomains/arb-resolver/blob/a2ee680e4a62bb5a3f22fd9cfc4a1863504144d2/packages/contracts/contracts/l1/ArbitrumResolverStub.sol#L167C1-L194C1
     * @param target Address of the account
     * @param slot Storage slot / key
     * @param stateRoot Network state root
     * @param stateTrieWitness Witness for the state trie
     * @param storageTrieWitness Witness for the storage trie
     * @return Retrieved storage value padded to 32 bytes
     */
    function _getStorageValue(
        address target,
        bytes32 slot,
        bytes32 stateRoot,
        bytes memory stateTrieWitness,
        bytes memory storageTrieWitness
    ) internal pure returns (bytes32) {
        (bool exists, bytes memory encodedResolverAccount) =
            Lib_SecureMerkleTrie.get(abi.encodePacked(target), stateTrieWitness, stateRoot);

        require(exists, "Account does not exist");

        Lib_OVMCodec.EVMAccount memory account = Lib_OVMCodec.decodeEVMAccount(encodedResolverAccount);

        (bool storageExists, bytes memory retrievedValue) =
            Lib_SecureMerkleTrie.get(abi.encodePacked(slot), storageTrieWitness, account.storageRoot);

        require(storageExists, "Storage value does not exist");

        return _toBytes32PadLeft(Lib_RLPReader.readBytes(retrievedValue));
    }

    /**
     * Updates a rollup's state root based on the AVS operators agreement
     * @param message State root update message
     * @param agreement AVS operators agreement info
     */
    function _updateStateRoot(StateRootUpdate.Message calldata message, bytes calldata agreement) internal virtual;

    /**
     * @dev Simple utility to pad a bytes into a bytes32.
     * Based on: https://github.com/ensdomains/arb-resolver/blob/a2ee680e4a62bb5a3f22fd9cfc4a1863504144d2/packages/contracts/contracts/l1/ArbitrumResolverStub.sol#L196C1-L208C1
     * @param _bytes Byte array, should be 32 bytes or smaller
     */
    function _toBytes32PadLeft(bytes memory _bytes) internal pure returns (bytes32) {
        bytes32 ret;
        uint256 len = _bytes.length <= 32 ? _bytes.length : 32;
        assembly {
            ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))
        }
        return ret;
    }

    /**
     * @dev Stores the state root for a rollup in a specific block height
     * @param rollupId Pre-defined rollup ID
     * @param blockHeight Rollup block height
     * @param stateRoot Rollup state root at blockHeight
     */
    function _pushStateRoot(uint32 rollupId, uint64 blockHeight, bytes32 stateRoot) internal {
        _stateRootBuffers[rollupId][blockHeight] = stateRoot;

        emit StateRootUpdated(rollupId, blockHeight, stateRoot);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 8 of 24 : StateRootUpdate.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

/**
 * @title SFFL state root update message library
 * @notice Represents the message passed to update state roots in various
 * chains and related utilities
 * @dev These messages include a rollup ID, which is a pre-defined ID for a
 * rollup, the rollup's block height and its state root, as well as the NEAR
 * DA transaction ID and commitment for the block submission. In case of
 * messages that do not correspond to NEAR DA data, both these fields must be
 * `bytes32(0)`.
 * The hashes of these messages should be signed by the SFFL operators through
 * their BLS private key
 */
library StateRootUpdate {
    struct Message {
        uint32 rollupId;
        uint64 blockHeight;
        uint64 timestamp;
        bytes32 nearDaTransactionId;
        bytes32 nearDaCommitment;
        bytes32 stateRoot;
    }

    bytes32 internal constant STATE_ROOT_UPDATE_HASH_PREFIX = keccak256("SFFL::StateRootUpdateMessage");

    /**
     * @notice Hashes a state root update message
     * @param message Message structured data
     * @return Message hash
     */
    function hashCalldata(Message calldata message) internal pure returns (bytes32) {
        return keccak256(abi.encode(STATE_ROOT_UPDATE_HASH_PREFIX, keccak256(abi.encode(message))));
    }

    /**
     * @notice Hashes a state root update message
     * @param message Message structured data
     * @return Message hash
     */
    function hash(Message memory message) internal pure returns (bytes32) {
        return keccak256(abi.encode(STATE_ROOT_UPDATE_HASH_PREFIX, keccak256(abi.encode(message))));
    }

    /**
     * @notice Gets a state root update index
     * @dev This is linked to the byte size of Message.blockHeight and
     * Message.rollupId. This MUST be updated if any of those types is changed.
     * @param message Message structured data
     * @return Message index
     */
    function indexCalldata(Message calldata message) internal pure returns (bytes32) {
        return bytes32(uint256(message.blockHeight) | (uint256(message.rollupId) << 64));
    }

    /**
     * @notice Gets a state root update index
     * @dev This is linked to the byte size of Message.blockHeight and
     * Message.rollupId. This MUST be updated if any of those types is changed.
     * @param message Message structured data
     * @return Message index
     */
    function index(Message memory message) internal pure returns (bytes32) {
        return bytes32(uint256(message.blockHeight) | (uint256(message.rollupId) << 64));
    }
}

File 9 of 24 : OperatorSetUpdate.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import {RollupOperators} from "../utils/RollupOperators.sol";

/**
 * @title SFFL operator set update message library
 * @notice Represents the message passed to update operator set copies in
 * various chains and related utilities.
 * @dev These messages include a sequential ID and an operator list. The
 * operators should be simply set based on this list, i.e. creating, updating
 * and removing an operator is effectively the same operation.
 */
library OperatorSetUpdate {
    struct Message {
        uint64 id;
        uint64 timestamp;
        RollupOperators.Operator[] operators;
    }

    bytes32 internal constant OPERATOR_SET_UPDATE_HASH_PREFIX = keccak256("SFFL::OperatorSetUpdateMessage");

    /**
     * @notice Hashes an operator set update message
     * @param message Message structured data
     * @return Message hash
     */
    function hashCalldata(Message calldata message) internal pure returns (bytes32) {
        return keccak256(abi.encode(OPERATOR_SET_UPDATE_HASH_PREFIX, keccak256(abi.encode(message))));
    }

    /**
     * @notice Hashes an operator set update message
     * @param message Message structured data
     * @return Message hash
     */
    function hash(Message memory message) internal pure returns (bytes32) {
        return keccak256(abi.encode(OPERATOR_SET_UPDATE_HASH_PREFIX, keccak256(abi.encode(message))));
    }

    /**
     * @notice Gets a state root update index
     * @dev This is linked to the byte size of Message.id. This MUST be updated
     * if the Message.id type is changed.
     * @param message Message structured data
     * @return Message index
     */
    function indexCalldata(Message calldata message) internal pure returns (bytes32) {
        return bytes32(uint256(message.id));
    }

    /**
     * @notice Gets a state root update index
     * @dev This is linked to the byte size of Message.id. This MUST be updated
     * if the Message.id type is changed.
     * @return Message index
     */
    function index(Message memory message) internal pure returns (bytes32) {
        return bytes32(uint256(message.id));
    }
}

File 10 of 24 : RollupOperators.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import {BN254} from "eigenlayer-middleware/src/libraries/BN254.sol";

/**
 * @title Operator set utilities
 * @notice Utilities for SFFL's rollups operator set copy. Each rollup has an
 * operator set which is periodically updated by the AVS, and is used to
 * validate agreements on state root updates
 * @dev The operator set is an alternative representation of the AVS' original
 * operator set, as it assumes a one-quorum one-weight based voting
 */
library RollupOperators {
    using BN254 for BN254.G1Point;

    /**
     * @dev Denominator for quorum weight thresholds
     */
    uint128 internal constant THRESHOLD_DENOMINATOR = 100;
    /**
     * @dev Gas for checking pairing equality on ecpairing call. Based on
     * Eigenlayer's BLSSignatureChecker
     */
    uint256 internal constant PAIRING_EQUALITY_CHECK_GAS = 120000;

    struct Operator {
        BN254.G1Point pubkey;
        uint128 weight;
    }

    struct OperatorSet {
        mapping(bytes32 => uint128) pubkeyHashToWeight;
        BN254.G1Point apk;
        uint128 totalWeight;
        uint128 quorumThreshold;
    }

    struct SignatureInfo {
        BN254.G1Point[] nonSignerPubkeys;
        BN254.G2Point apkG2;
        BN254.G1Point sigma;
    }

    /**
     * @notice Emitted when an operator is updated
     * @param pubkeyHash Hash of the BLS pubkey
     * @param weight Operator weight
     */
    event OperatorUpdated(bytes32 indexed pubkeyHash, uint128 weight);
    /**
     * @notice Emitted when the quorum weight threshold is updated
     * @param newQuorumThreshold New quorum weight threshold, based on
     * THRESHOLD_DENOMINATOR
     */
    event QuorumThresholdUpdated(uint128 indexed newQuorumThreshold);

    /**
     * @notice Sets the weight threshold for agreement validations
     * @param self Operator set
     * @param quorumThreshold New quorum weight threshold, based on
     * THRESHOLD_DENOMINATOR
     */
    function setQuorumThreshold(OperatorSet storage self, uint128 quorumThreshold) internal {
        require(quorumThreshold <= THRESHOLD_DENOMINATOR, "Quorum threshold greater than denominator");

        self.quorumThreshold = quorumThreshold;

        emit QuorumThresholdUpdated(quorumThreshold);
    }

    /**
     * @notice Gets an operator's weight
     * @param self Operator set
     * @param pubkeyHash Operator pubkey hash
     * @return Operator weight
     */
    function getOperatorWeight(OperatorSet storage self, bytes32 pubkeyHash) internal view returns (uint128) {
        return self.pubkeyHashToWeight[pubkeyHash];
    }

    /**
     * @notice Updates the operator set operators, effectively overwriting set
     * operators
     * @param self Operator set
     * @param operators Operators to be overwritten
     */
    function update(OperatorSet storage self, Operator[] memory operators) internal {
        Operator memory operator;

        BN254.G1Point memory newApk = self.apk;
        uint128 newTotalWeight = self.totalWeight;

        for (uint256 i = 0; i < operators.length; i++) {
            operator = operators[i];

            bytes32 pubkeyHash = operator.pubkey.hashG1Point();
            uint128 currentWeight = self.pubkeyHashToWeight[pubkeyHash];

            require(operator.weight != currentWeight, "Operator is up to date");

            newTotalWeight = newTotalWeight - currentWeight + operator.weight;

            self.pubkeyHashToWeight[pubkeyHash] = operator.weight;

            if (currentWeight == 0) {
                newApk = newApk.plus(operator.pubkey);
            } else if (operator.weight == 0) {
                newApk = newApk.plus(operator.pubkey.negate());
            }

            emit OperatorUpdated(pubkeyHash, operator.weight);
        }

        self.totalWeight = newTotalWeight;
        self.apk = newApk;
    }

    /**
     * @notice Verifies an agreement
     * @dev This fails if the agreement is invalid, as opposed to returning
     * `false`
     * @param self Operator set
     * @param msgHash Message hash, which is the signed value
     * @param signatureInfo BLS aggregated signature info
     * @return Whether the agreement passed quorum or not
     */
    function verifyCalldata(OperatorSet storage self, bytes32 msgHash, SignatureInfo calldata signatureInfo)
        internal
        view
        returns (bool)
    {
        BN254.G1Point memory apk = BN254.G1Point(0, 0);
        uint256 weight = self.totalWeight;

        require(weight != 0, "Operator set was not initialized");

        bytes32[] memory nonSignerPubkeyHashes = new bytes32[](signatureInfo.nonSignerPubkeys.length);

        for (uint256 i = 0; i < signatureInfo.nonSignerPubkeys.length; i++) {
            nonSignerPubkeyHashes[i] = signatureInfo.nonSignerPubkeys[i].hashG1Point();

            if (i != 0) {
                require(uint256(nonSignerPubkeyHashes[i]) > uint256(nonSignerPubkeyHashes[i - 1]), "Pubkeys not sorted");
            }

            uint256 operatorWeight = self.pubkeyHashToWeight[nonSignerPubkeyHashes[i]];

            require(operatorWeight != 0, "Operator has zero weight");

            apk = apk.plus(signatureInfo.nonSignerPubkeys[i]);
            weight -= operatorWeight;
        }

        apk = self.apk.plus(apk.negate());

        (bool pairingSuccessful, bool signatureIsValid) =
            trySignatureAndApkVerification(msgHash, apk, signatureInfo.apkG2, signatureInfo.sigma);

        require(pairingSuccessful, "Pairing precompile call failed");
        require(signatureIsValid, "Signature is invalid");

        return weight >= (self.totalWeight * self.quorumThreshold) / THRESHOLD_DENOMINATOR;
    }

    /**
     * @dev Tries verifying a BLS aggregate signature
     * @param apk Expected G1 public key
     * @param apkG2 Provided G2 public key
     * @param sigma G1 point signature
     * @return pairingSuccessful Whether the inner ecpairing call was successful
     * @return signatureIsValid Whether the signature is valid
     */
    function trySignatureAndApkVerification(
        bytes32 msgHash,
        BN254.G1Point memory apk,
        BN254.G2Point memory apkG2,
        BN254.G1Point memory sigma
    ) private view returns (bool pairingSuccessful, bool signatureIsValid) {
        uint256 gamma = uint256(
            keccak256(
                abi.encodePacked(
                    msgHash, apk.X, apk.Y, apkG2.X[0], apkG2.X[1], apkG2.Y[0], apkG2.Y[1], sigma.X, sigma.Y
                )
            )
        ) % BN254.FR_MODULUS;

        (pairingSuccessful, signatureIsValid) = BN254.safePairing(
            sigma.plus(apk.scalar_mul(gamma)),
            BN254.negGeneratorG2(),
            BN254.hashToG1(msgHash).plus(BN254.generatorG1().scalar_mul(gamma)),
            apkG2,
            PAIRING_EQUALITY_CHECK_GAS
        );
    }
}

File 11 of 24 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 12 of 24 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 13 of 24 : IPausable.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

import "../interfaces/IPauserRegistry.sol";

/**
 * @title Adds pausability to a contract, with pausing & unpausing controlled by the `pauser` and `unpauser` of a PauserRegistry contract.
 * @author Layr Labs, Inc.
 * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
 * @notice Contracts that inherit from this contract may define their own `pause` and `unpause` (and/or related) functions.
 * These functions should be permissioned as "onlyPauser" which defers to a `PauserRegistry` for determining access control.
 * @dev Pausability is implemented using a uint256, which allows up to 256 different single bit-flags; each bit can potentially pause different functionality.
 * Inspiration for this was taken from the NearBridge design here https://etherscan.io/address/0x3FEFc5A4B1c02f21cBc8D3613643ba0635b9a873#code.
 * For the `pause` and `unpause` functions we've implemented, if you pause, you can only flip (any number of) switches to on/1 (aka "paused"), and if you unpause,
 * you can only flip (any number of) switches to off/0 (aka "paused").
 * If you want a pauseXYZ function that just flips a single bit / "pausing flag", it will:
 * 1) 'bit-wise and' (aka `&`) a flag with the current paused state (as a uint256)
 * 2) update the paused state to this new value
 * @dev We note as well that we have chosen to identify flags by their *bit index* as opposed to their numerical value, so, e.g. defining `DEPOSITS_PAUSED = 3`
 * indicates specifically that if the *third bit* of `_paused` is flipped -- i.e. it is a '1' -- then deposits should be paused
 */

interface IPausable {
    /// @notice Emitted when the `pauserRegistry` is set to `newPauserRegistry`.
    event PauserRegistrySet(IPauserRegistry pauserRegistry, IPauserRegistry newPauserRegistry);

    /// @notice Emitted when the pause is triggered by `account`, and changed to `newPausedStatus`.
    event Paused(address indexed account, uint256 newPausedStatus);

    /// @notice Emitted when the pause is lifted by `account`, and changed to `newPausedStatus`.
    event Unpaused(address indexed account, uint256 newPausedStatus);
    
    /// @notice Address of the `PauserRegistry` contract that this contract defers to for determining access control (for pausing).
    function pauserRegistry() external view returns (IPauserRegistry);

    /**
     * @notice This function is used to pause an EigenLayer contract's functionality.
     * It is permissioned to the `pauser` address, which is expected to be a low threshold multisig.
     * @param newPausedStatus represents the new value for `_paused` to take, which means it may flip several bits at once.
     * @dev This function can only pause functionality, and thus cannot 'unflip' any bit in `_paused` from 1 to 0.
     */
    function pause(uint256 newPausedStatus) external;

    /**
     * @notice Alias for `pause(type(uint256).max)`.
     */
    function pauseAll() external;

    /**
     * @notice This function is used to unpause an EigenLayer contract's functionality.
     * It is permissioned to the `unpauser` address, which is expected to be a high threshold multisig or governance contract.
     * @param newPausedStatus represents the new value for `_paused` to take, which means it may flip several bits at once.
     * @dev This function can only unpause functionality, and thus cannot 'flip' any bit in `_paused` from 0 to 1.
     */
    function unpause(uint256 newPausedStatus) external;

    /// @notice Returns the current paused status as a uint256.
    function paused() external view returns (uint256);

    /// @notice Returns 'true' if the `indexed`th bit of `_paused` is 1, and 'false' otherwise
    function paused(uint8 index) external view returns (bool);

    /// @notice Allows the unpauser to set a new pauser registry
    function setPauserRegistry(IPauserRegistry newPauserRegistry) external;
}

File 14 of 24 : Lib_AddressResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

/* Library Imports */
import {Lib_AddressManager} from "./Lib_AddressManager.sol";

/**
 * @title Lib_AddressResolver
 */
abstract contract Lib_AddressResolver {
    /**
     *
     * Variables *
     *
     */

    Lib_AddressManager public libAddressManager;

    /**
     *
     * Constructor *
     *
     */

    /**
     * @param _libAddressManager Address of the Lib_AddressManager.
     */
    constructor(address _libAddressManager) {
        libAddressManager = Lib_AddressManager(_libAddressManager);
    }

    /**
     *
     * Public Functions *
     *
     */

    /**
     * Resolves the address associated with a given name.
     * @param _name Name to resolve an address for.
     * @return Address associated with the given name.
     */
    function resolve(string memory _name) public view returns (address) {
        return libAddressManager.getAddress(_name);
    }
}

File 15 of 24 : Lib_OVMCodec.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

/* Library Imports */
import {Lib_RLPReader} from "../rlp/Lib_RLPReader.sol";
import {Lib_RLPWriter} from "../rlp/Lib_RLPWriter.sol";
import {Lib_BytesUtils} from "../utils/Lib_BytesUtils.sol";
import {Lib_Bytes32Utils} from "../utils/Lib_Bytes32Utils.sol";

/**
 * @title Lib_OVMCodec
 */
library Lib_OVMCodec {
    /**
     *
     * Enums *
     *
     */

    enum QueueOrigin {
        SEQUENCER_QUEUE,
        L1TOL2_QUEUE
    }

    /**
     *
     * Structs *
     *
     */

    struct EVMAccount {
        uint256 nonce;
        uint256 balance;
        bytes32 storageRoot;
        bytes32 codeHash;
    }

    struct ChainBatchHeader {
        uint256 batchIndex;
        bytes32 batchRoot;
        uint256 batchSize;
        uint256 prevTotalElements;
        bytes extraData;
    }

    struct ChainInclusionProof {
        uint256 index;
        bytes32[] siblings;
    }

    struct Transaction {
        uint256 timestamp;
        uint256 blockNumber;
        QueueOrigin l1QueueOrigin;
        address l1TxOrigin;
        address entrypoint;
        uint256 gasLimit;
        bytes data;
    }

    struct TransactionChainElement {
        bool isSequenced;
        uint256 queueIndex; // QUEUED TX ONLY
        uint256 timestamp; // SEQUENCER TX ONLY
        uint256 blockNumber; // SEQUENCER TX ONLY
        bytes txData; // SEQUENCER TX ONLY
    }

    struct QueueElement {
        bytes32 transactionHash;
        uint40 timestamp;
        uint40 blockNumber;
    }

    /**
     *
     * Internal Functions *
     *
     */

    /**
     * Encodes a standard OVM transaction.
     * @param _transaction OVM transaction to encode.
     * @return Encoded transaction bytes.
     */
    function encodeTransaction(Transaction memory _transaction) internal pure returns (bytes memory) {
        return abi.encodePacked(
            _transaction.timestamp,
            _transaction.blockNumber,
            _transaction.l1QueueOrigin,
            _transaction.l1TxOrigin,
            _transaction.entrypoint,
            _transaction.gasLimit,
            _transaction.data
        );
    }

    /**
     * Hashes a standard OVM transaction.
     * @param _transaction OVM transaction to encode.
     * @return Hashed transaction
     */
    function hashTransaction(Transaction memory _transaction) internal pure returns (bytes32) {
        return keccak256(encodeTransaction(_transaction));
    }

    /**
     * @notice Decodes an RLP-encoded account state into a useful struct.
     * @param _encoded RLP-encoded account state.
     * @return Account state struct.
     */
    function decodeEVMAccount(bytes memory _encoded) internal pure returns (EVMAccount memory) {
        Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);

        return EVMAccount({
            nonce: Lib_RLPReader.readUint256(accountState[0]),
            balance: Lib_RLPReader.readUint256(accountState[1]),
            storageRoot: Lib_RLPReader.readBytes32(accountState[2]),
            codeHash: Lib_RLPReader.readBytes32(accountState[3])
        });
    }

    /**
     * Calculates a hash for a given batch header.
     * @param _batchHeader Header to hash.
     * @return Hash of the header.
     */
    function hashBatchHeader(Lib_OVMCodec.ChainBatchHeader memory _batchHeader) internal pure returns (bytes32) {
        return keccak256(
            abi.encode(
                _batchHeader.batchRoot, _batchHeader.batchSize, _batchHeader.prevTotalElements, _batchHeader.extraData
            )
        );
    }
}

File 16 of 24 : Lib_SecureMerkleTrie.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

/* Library Imports */
import {Lib_MerkleTrie} from "./Lib_MerkleTrie.sol";

/**
 * @title Lib_SecureMerkleTrie
 */
library Lib_SecureMerkleTrie {
    /**
     *
     * Internal Functions *
     *
     */

    /**
     * @notice Verifies a proof that a given key/value pair is present in the
     * Merkle trie.
     * @param _key Key of the node to search for, as a hex string.
     * @param _value Value of the node to search for, as a hex string.
     * @param _proof Merkle trie inclusion proof for the desired node. Unlike
     * traditional Merkle trees, this proof is executed top-down and consists
     * of a list of RLP-encoded nodes that make a path down to the target node.
     * @param _root Known root of the Merkle trie. Used to verify that the
     * included proof is correctly constructed.
     * @return _verified `true` if the k/v pair exists in the trie, `false` otherwise.
     */
    function verifyInclusionProof(bytes memory _key, bytes memory _value, bytes memory _proof, bytes32 _root)
        internal
        pure
        returns (bool _verified)
    {
        bytes memory key = _getSecureKey(_key);
        return Lib_MerkleTrie.verifyInclusionProof(key, _value, _proof, _root);
    }

    /**
     * @notice Retrieves the value associated with a given key.
     * @param _key Key to search for, as hex bytes.
     * @param _proof Merkle trie inclusion proof for the key.
     * @param _root Known root of the Merkle trie.
     * @return _exists Whether or not the key exists.
     * @return _value Value of the key if it exists.
     */
    function get(bytes memory _key, bytes memory _proof, bytes32 _root)
        internal
        pure
        returns (bool _exists, bytes memory _value)
    {
        bytes memory key = _getSecureKey(_key);
        return Lib_MerkleTrie.get(key, _proof, _root);
    }

    /**
     *
     * Private Functions *
     *
     */

    /**
     * Computes the secure counterpart to a key.
     * @param _key Key to get a secure key from.
     * @return _secureKey Secure version of the key.
     */
    function _getSecureKey(bytes memory _key) private pure returns (bytes memory _secureKey) {
        return abi.encodePacked(keccak256(_key));
    }
}

File 17 of 24 : Lib_RLPReader.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

/**
 * @title Lib_RLPReader
 * @dev Adapted from "RLPReader" by Hamdi Allam ([email protected]).
 */
library Lib_RLPReader {
    /**
     *
     * Constants *
     *
     */

    uint256 internal constant MAX_LIST_LENGTH = 32;

    /**
     *
     * Enums *
     *
     */

    enum RLPItemType {
        DATA_ITEM,
        LIST_ITEM
    }

    /**
     *
     * Structs *
     *
     */

    struct RLPItem {
        uint256 length;
        uint256 ptr;
    }

    /**
     *
     * Internal Functions *
     *
     */

    /**
     * Converts bytes to a reference to memory position and length.
     * @param _in Input bytes to convert.
     * @return Output memory reference.
     */
    function toRLPItem(bytes memory _in) internal pure returns (RLPItem memory) {
        uint256 ptr;
        assembly {
            ptr := add(_in, 32)
        }

        return RLPItem({length: _in.length, ptr: ptr});
    }

    /**
     * Reads an RLP list value into a list of RLP items.
     * @param _in RLP list value.
     * @return Decoded RLP list items.
     */
    function readList(RLPItem memory _in) internal pure returns (RLPItem[] memory) {
        (uint256 listOffset,, RLPItemType itemType) = _decodeLength(_in);

        require(itemType == RLPItemType.LIST_ITEM, "Invalid RLP list value.");

        // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by
        // writing to the length. Since we can't know the number of RLP items without looping over
        // the entire input, we'd have to loop twice to accurately size this array. It's easier to
        // simply set a reasonable maximum list length and decrease the size before we finish.
        RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);

        uint256 itemCount = 0;
        uint256 offset = listOffset;
        while (offset < _in.length) {
            require(itemCount < MAX_LIST_LENGTH, "Provided RLP list exceeds max list length.");

            (uint256 itemOffset, uint256 itemLength,) =
                _decodeLength(RLPItem({length: _in.length - offset, ptr: _in.ptr + offset}));

            out[itemCount] = RLPItem({length: itemLength + itemOffset, ptr: _in.ptr + offset});

            itemCount += 1;
            offset += itemOffset + itemLength;
        }

        // Decrease the array size to match the actual item count.
        assembly {
            mstore(out, itemCount)
        }

        return out;
    }

    /**
     * Reads an RLP list value into a list of RLP items.
     * @param _in RLP list value.
     * @return Decoded RLP list items.
     */
    function readList(bytes memory _in) internal pure returns (RLPItem[] memory) {
        return readList(toRLPItem(_in));
    }

    /**
     * Reads an RLP bytes value into bytes.
     * @param _in RLP bytes value.
     * @return Decoded bytes.
     */
    function readBytes(RLPItem memory _in) internal pure returns (bytes memory) {
        (uint256 itemOffset, uint256 itemLength, RLPItemType itemType) = _decodeLength(_in);

        require(itemType == RLPItemType.DATA_ITEM, "Invalid RLP bytes value.");

        return _copy(_in.ptr, itemOffset, itemLength);
    }

    /**
     * Reads an RLP bytes value into bytes.
     * @param _in RLP bytes value.
     * @return Decoded bytes.
     */
    function readBytes(bytes memory _in) internal pure returns (bytes memory) {
        return readBytes(toRLPItem(_in));
    }

    /**
     * Reads an RLP string value into a string.
     * @param _in RLP string value.
     * @return Decoded string.
     */
    function readString(RLPItem memory _in) internal pure returns (string memory) {
        return string(readBytes(_in));
    }

    /**
     * Reads an RLP string value into a string.
     * @param _in RLP string value.
     * @return Decoded string.
     */
    function readString(bytes memory _in) internal pure returns (string memory) {
        return readString(toRLPItem(_in));
    }

    /**
     * Reads an RLP bytes32 value into a bytes32.
     * @param _in RLP bytes32 value.
     * @return Decoded bytes32.
     */
    function readBytes32(RLPItem memory _in) internal pure returns (bytes32) {
        require(_in.length <= 33, "Invalid RLP bytes32 value.");

        (uint256 itemOffset, uint256 itemLength, RLPItemType itemType) = _decodeLength(_in);

        require(itemType == RLPItemType.DATA_ITEM, "Invalid RLP bytes32 value.");

        uint256 ptr = _in.ptr + itemOffset;
        bytes32 out;
        assembly {
            out := mload(ptr)

            // Shift the bytes over to match the item size.
            if lt(itemLength, 32) { out := div(out, exp(256, sub(32, itemLength))) }
        }

        return out;
    }

    /**
     * Reads an RLP bytes32 value into a bytes32.
     * @param _in RLP bytes32 value.
     * @return Decoded bytes32.
     */
    function readBytes32(bytes memory _in) internal pure returns (bytes32) {
        return readBytes32(toRLPItem(_in));
    }

    /**
     * Reads an RLP uint256 value into a uint256.
     * @param _in RLP uint256 value.
     * @return Decoded uint256.
     */
    function readUint256(RLPItem memory _in) internal pure returns (uint256) {
        return uint256(readBytes32(_in));
    }

    /**
     * Reads an RLP uint256 value into a uint256.
     * @param _in RLP uint256 value.
     * @return Decoded uint256.
     */
    function readUint256(bytes memory _in) internal pure returns (uint256) {
        return readUint256(toRLPItem(_in));
    }

    /**
     * Reads an RLP bool value into a bool.
     * @param _in RLP bool value.
     * @return Decoded bool.
     */
    function readBool(RLPItem memory _in) internal pure returns (bool) {
        require(_in.length == 1, "Invalid RLP boolean value.");

        uint256 ptr = _in.ptr;
        uint256 out;
        assembly {
            out := byte(0, mload(ptr))
        }

        require(out == 0 || out == 1, "Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1");

        return out != 0;
    }

    /**
     * Reads an RLP bool value into a bool.
     * @param _in RLP bool value.
     * @return Decoded bool.
     */
    function readBool(bytes memory _in) internal pure returns (bool) {
        return readBool(toRLPItem(_in));
    }

    /**
     * Reads an RLP address value into a address.
     * @param _in RLP address value.
     * @return Decoded address.
     */
    function readAddress(RLPItem memory _in) internal pure returns (address) {
        if (_in.length == 1) {
            return address(0);
        }

        require(_in.length == 21, "Invalid RLP address value.");

        return address(uint160(readUint256(_in)));
    }

    /**
     * Reads an RLP address value into a address.
     * @param _in RLP address value.
     * @return Decoded address.
     */
    function readAddress(bytes memory _in) internal pure returns (address) {
        return readAddress(toRLPItem(_in));
    }

    /**
     * Reads the raw bytes of an RLP item.
     * @param _in RLP item to read.
     * @return Raw RLP bytes.
     */
    function readRawBytes(RLPItem memory _in) internal pure returns (bytes memory) {
        return _copy(_in);
    }

    /**
     *
     * Private Functions *
     *
     */

    /**
     * Decodes the length of an RLP item.
     * @param _in RLP item to decode.
     * @return Offset of the encoded data.
     * @return Length of the encoded data.
     * @return RLP item type (LIST_ITEM or DATA_ITEM).
     */
    function _decodeLength(RLPItem memory _in) private pure returns (uint256, uint256, RLPItemType) {
        require(_in.length > 0, "RLP item cannot be null.");

        uint256 ptr = _in.ptr;
        uint256 prefix;
        assembly {
            prefix := byte(0, mload(ptr))
        }

        if (prefix <= 0x7f) {
            // Single byte.

            return (0, 1, RLPItemType.DATA_ITEM);
        } else if (prefix <= 0xb7) {
            // Short string.

            // slither-disable-next-line variable-scope
            uint256 strLen = prefix - 0x80;

            require(_in.length > strLen, "Invalid RLP short string.");

            return (1, strLen, RLPItemType.DATA_ITEM);
        } else if (prefix <= 0xbf) {
            // Long string.
            uint256 lenOfStrLen = prefix - 0xb7;

            require(_in.length > lenOfStrLen, "Invalid RLP long string length.");

            uint256 strLen;
            assembly {
                // Pick out the string length.
                strLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfStrLen)))
            }

            require(_in.length > lenOfStrLen + strLen, "Invalid RLP long string.");

            return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);
        } else if (prefix <= 0xf7) {
            // Short list.
            // slither-disable-next-line variable-scope
            uint256 listLen = prefix - 0xc0;

            require(_in.length > listLen, "Invalid RLP short list.");

            return (1, listLen, RLPItemType.LIST_ITEM);
        } else {
            // Long list.
            uint256 lenOfListLen = prefix - 0xf7;

            require(_in.length > lenOfListLen, "Invalid RLP long list length.");

            uint256 listLen;
            assembly {
                // Pick out the list length.
                listLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfListLen)))
            }

            require(_in.length > lenOfListLen + listLen, "Invalid RLP long list.");

            return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);
        }
    }

    /**
     * Copies the bytes from a memory location.
     * @param _src Pointer to the location to read from.
     * @param _offset Offset to start reading from.
     * @param _length Number of bytes to read.
     * @return Copied bytes.
     */
    function _copy(uint256 _src, uint256 _offset, uint256 _length) private pure returns (bytes memory) {
        bytes memory out = new bytes(_length);
        if (out.length == 0) {
            return out;
        }

        uint256 src = _src + _offset;
        uint256 dest;
        assembly {
            dest := add(out, 32)
        }

        // Copy over as many complete words as we can.
        for (uint256 i = 0; i < _length / 32; i++) {
            assembly {
                mstore(dest, mload(src))
            }

            src += 32;
            dest += 32;
        }

        // Pick out the remaining bytes.
        uint256 mask;
        unchecked {
            mask = 256 ** (32 - (_length % 32)) - 1;
        }

        assembly {
            mstore(dest, or(and(mload(src), not(mask)), and(mload(dest), mask)))
        }
        return out;
    }

    /**
     * Copies an RLP item into bytes.
     * @param _in RLP item to copy.
     * @return Copied bytes.
     */
    function _copy(RLPItem memory _in) private pure returns (bytes memory) {
        return _copy(_in.ptr, 0, _in.length);
    }
}

File 18 of 24 : Lib_AddressManager.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

/* External Imports */
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

/**
 * @title Lib_AddressManager
 */
contract Lib_AddressManager is Ownable {
    /**
     *
     * Events *
     *
     */

    event AddressSet(string indexed _name, address _newAddress, address _oldAddress);

    /**
     *
     * Variables *
     *
     */

    mapping(bytes32 => address) private addresses;

    /**
     *
     * Public Functions *
     *
     */

    /**
     * Changes the address associated with a particular name.
     * @param _name String name to associate an address with.
     * @param _address Address to associate with the name.
     */
    function setAddress(string memory _name, address _address) external onlyOwner {
        bytes32 nameHash = _getNameHash(_name);
        address oldAddress = addresses[nameHash];
        addresses[nameHash] = _address;

        emit AddressSet(_name, _address, oldAddress);
    }

    /**
     * Retrieves the address associated with a given name.
     * @param _name Name to retrieve an address for.
     * @return Address associated with the given name.
     */
    function getAddress(string memory _name) external view returns (address) {
        return addresses[_getNameHash(_name)];
    }

    /**
     *
     * Internal Functions *
     *
     */

    /**
     * Computes the hash of a name.
     * @param _name Name to compute a hash for.
     * @return Hash of the given name.
     */
    function _getNameHash(string memory _name) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked(_name));
    }
}

File 19 of 24 : Lib_RLPWriter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

/**
 * @title Lib_RLPWriter
 * @author Bakaoh (with modifications)
 */
library Lib_RLPWriter {
    /**
     *
     * Internal Functions *
     *
     */

    /**
     * RLP encodes a byte string.
     * @param _in The byte string to encode.
     * @return The RLP encoded string in bytes.
     */
    function writeBytes(bytes memory _in) internal pure returns (bytes memory) {
        bytes memory encoded;

        if (_in.length == 1 && uint8(_in[0]) < 128) {
            encoded = _in;
        } else {
            encoded = abi.encodePacked(_writeLength(_in.length, 128), _in);
        }

        return encoded;
    }

    /**
     * RLP encodes a list of RLP encoded byte byte strings.
     * @param _in The list of RLP encoded byte strings.
     * @return The RLP encoded list of items in bytes.
     */
    function writeList(bytes[] memory _in) internal pure returns (bytes memory) {
        bytes memory list = _flatten(_in);
        return abi.encodePacked(_writeLength(list.length, 192), list);
    }

    /**
     * RLP encodes a string.
     * @param _in The string to encode.
     * @return The RLP encoded string in bytes.
     */
    function writeString(string memory _in) internal pure returns (bytes memory) {
        return writeBytes(bytes(_in));
    }

    /**
     * RLP encodes an address.
     * @param _in The address to encode.
     * @return The RLP encoded address in bytes.
     */
    function writeAddress(address _in) internal pure returns (bytes memory) {
        return writeBytes(abi.encodePacked(_in));
    }

    /**
     * RLP encodes a uint.
     * @param _in The uint256 to encode.
     * @return The RLP encoded uint256 in bytes.
     */
    function writeUint(uint256 _in) internal pure returns (bytes memory) {
        return writeBytes(_toBinary(_in));
    }

    /**
     * RLP encodes a bool.
     * @param _in The bool to encode.
     * @return The RLP encoded bool in bytes.
     */
    function writeBool(bool _in) internal pure returns (bytes memory) {
        bytes memory encoded = new bytes(1);
        encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));
        return encoded;
    }

    /**
     *
     * Private Functions *
     *
     */

    /**
     * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.
     * @param _len The length of the string or the payload.
     * @param _offset 128 if item is string, 192 if item is list.
     * @return RLP encoded bytes.
     */
    function _writeLength(uint256 _len, uint256 _offset) private pure returns (bytes memory) {
        bytes memory encoded;

        if (_len < 56) {
            encoded = new bytes(1);
            encoded[0] = bytes1(uint8(_len) + uint8(_offset));
        } else {
            uint256 lenLen;
            uint256 i = 1;
            while (_len / i != 0) {
                lenLen++;
                i *= 256;
            }

            encoded = new bytes(lenLen + 1);
            encoded[0] = bytes1(uint8(lenLen) + uint8(_offset) + 55);
            for (i = 1; i <= lenLen; i++) {
                encoded[i] = bytes1(uint8((_len / (256 ** (lenLen - i))) % 256));
            }
        }

        return encoded;
    }

    /**
     * Encode integer in big endian binary form with no leading zeroes.
     * @notice TODO: This should be optimized with assembly to save gas costs.
     * @param _x The integer to encode.
     * @return RLP encoded bytes.
     */
    function _toBinary(uint256 _x) private pure returns (bytes memory) {
        bytes memory b = abi.encodePacked(_x);

        uint256 i = 0;
        for (; i < 32; i++) {
            if (b[i] != 0) {
                break;
            }
        }

        bytes memory res = new bytes(32 - i);
        for (uint256 j = 0; j < res.length; j++) {
            res[j] = b[i++];
        }

        return res;
    }

    /**
     * Copies a piece of memory to another location.
     * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.
     * @param _dest Destination location.
     * @param _src Source location.
     * @param _len Length of memory to copy.
     */
    function _memcpy(uint256 _dest, uint256 _src, uint256 _len) private pure {
        uint256 dest = _dest;
        uint256 src = _src;
        uint256 len = _len;

        for (; len >= 32; len -= 32) {
            assembly {
                mstore(dest, mload(src))
            }
            dest += 32;
            src += 32;
        }

        uint256 mask;
        unchecked {
            mask = 256 ** (32 - len) - 1;
        }
        assembly {
            let srcpart := and(mload(src), not(mask))
            let destpart := and(mload(dest), mask)
            mstore(dest, or(destpart, srcpart))
        }
    }

    /**
     * Flattens a list of byte strings into one byte string.
     * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.
     * @param _list List of byte strings to flatten.
     * @return The flattened byte string.
     */
    function _flatten(bytes[] memory _list) private pure returns (bytes memory) {
        if (_list.length == 0) {
            return new bytes(0);
        }

        uint256 len;
        uint256 i = 0;
        for (; i < _list.length; i++) {
            len += _list[i].length;
        }

        bytes memory flattened = new bytes(len);
        uint256 flattenedPtr;
        assembly {
            flattenedPtr := add(flattened, 0x20)
        }

        for (i = 0; i < _list.length; i++) {
            bytes memory item = _list[i];

            uint256 listPtr;
            assembly {
                listPtr := add(item, 0x20)
            }

            _memcpy(flattenedPtr, listPtr, item.length);
            flattenedPtr += _list[i].length;
        }

        return flattened;
    }
}

File 20 of 24 : Lib_BytesUtils.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

/**
 * @title Lib_BytesUtils
 */
library Lib_BytesUtils {
    /**
     *
     * Internal Functions *
     *
     */

    function slice(bytes memory _bytes, uint256 _start, uint256 _length) internal pure returns (bytes memory) {
        require(_length + 31 >= _length, "slice_overflow");
        require(_start + _length >= _start, "slice_overflow");
        require(_bytes.length >= _start + _length, "slice_outOfBounds");

        bytes memory tempBytes;

        assembly {
            switch iszero(_length)
            case 0 {
                // Get a location of some free memory and store it in tempBytes as
                // Solidity does for memory variables.
                tempBytes := mload(0x40)

                // The first word of the slice result is potentially a partial
                // word read from the original array. To read it, we calculate
                // the length of that partial word and start copying that many
                // bytes into the array. The first word we copy will start with
                // data we don't care about, but the last `lengthmod` bytes will
                // land at the beginning of the contents of the new array. When
                // we're done copying, we overwrite the full first word with
                // the actual length of the slice.
                let lengthmod := and(_length, 31)

                // The multiplication in the next line is necessary
                // because when slicing multiples of 32 bytes (lengthmod == 0)
                // the following copy loop was copying the origin's length
                // and then ending prematurely not copying everything it should.
                let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))
                let end := add(mc, _length)

                for {
                    // The multiplication in the next line has the same exact purpose
                    // as the one above.
                    let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)
                } lt(mc, end) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } { mstore(mc, mload(cc)) }

                mstore(tempBytes, _length)

                //update free-memory pointer
                //allocating the array padded to 32 bytes like the compiler does now
                mstore(0x40, and(add(mc, 31), not(31)))
            }
            //if we want a zero-length slice let's just return a zero-length array
            default {
                tempBytes := mload(0x40)

                //zero out the 32 bytes slice we are about to return
                //we need to do it because Solidity does not garbage collect
                mstore(tempBytes, 0)

                mstore(0x40, add(tempBytes, 0x20))
            }
        }

        return tempBytes;
    }

    function slice(bytes memory _bytes, uint256 _start) internal pure returns (bytes memory) {
        if (_start >= _bytes.length) {
            return bytes("");
        }

        return slice(_bytes, _start, _bytes.length - _start);
    }

    function toBytes32(bytes memory _bytes) internal pure returns (bytes32) {
        if (_bytes.length < 32) {
            bytes32 ret;
            assembly {
                ret := mload(add(_bytes, 32))
            }
            return ret;
        }

        return abi.decode(_bytes, (bytes32)); // will truncate if input length > 32 bytes
    }

    function toUint256(bytes memory _bytes) internal pure returns (uint256) {
        return uint256(toBytes32(_bytes));
    }

    function toNibbles(bytes memory _bytes) internal pure returns (bytes memory) {
        bytes memory nibbles = new bytes(_bytes.length * 2);

        for (uint256 i = 0; i < _bytes.length; i++) {
            nibbles[i * 2] = _bytes[i] >> 4;
            nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);
        }

        return nibbles;
    }

    function fromNibbles(bytes memory _bytes) internal pure returns (bytes memory) {
        bytes memory ret = new bytes(_bytes.length / 2);

        for (uint256 i = 0; i < ret.length; i++) {
            ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);
        }

        return ret;
    }

    function equal(bytes memory _bytes, bytes memory _other) internal pure returns (bool) {
        return keccak256(_bytes) == keccak256(_other);
    }
}

File 21 of 24 : Lib_Bytes32Utils.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

/**
 * @title Lib_Byte32Utils
 */
library Lib_Bytes32Utils {
    /**
     *
     * Internal Functions *
     *
     */

    /**
     * Converts a bytes32 value to a boolean. Anything non-zero will be converted to "true."
     * @param _in Input bytes32 value.
     * @return Bytes32 as a boolean.
     */
    function toBool(bytes32 _in) internal pure returns (bool) {
        return _in != 0;
    }

    /**
     * Converts a boolean to a bytes32 value.
     * @param _in Input boolean value.
     * @return Boolean as a bytes32.
     */
    function fromBool(bool _in) internal pure returns (bytes32) {
        return bytes32(uint256(_in ? 1 : 0));
    }

    /**
     * Converts a bytes32 value to an address. Takes the *last* 20 bytes.
     * @param _in Input bytes32 value.
     * @return Bytes32 as an address.
     */
    function toAddress(bytes32 _in) internal pure returns (address) {
        return address(uint160(uint256(_in)));
    }

    /**
     * Converts an address to a bytes32.
     * @param _in Input address value.
     * @return Address as a bytes32.
     */
    function fromAddress(address _in) internal pure returns (bytes32) {
        return bytes32(uint256(uint160(_in)));
    }
}

File 22 of 24 : Lib_MerkleTrie.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

/* Library Imports */
import {Lib_BytesUtils} from "../utils/Lib_BytesUtils.sol";
import {Lib_RLPReader} from "../rlp/Lib_RLPReader.sol";
import {Lib_RLPWriter} from "../rlp/Lib_RLPWriter.sol";

/**
 * @title Lib_MerkleTrie
 */
library Lib_MerkleTrie {
    /**
     *
     * Data Structures *
     *
     */

    enum NodeType {
        BranchNode,
        ExtensionNode,
        LeafNode
    }

    struct TrieNode {
        bytes encoded;
        Lib_RLPReader.RLPItem[] decoded;
    }

    /**
     *
     * Contract Constants *
     *
     */

    // TREE_RADIX determines the number of elements per branch node.
    uint256 constant TREE_RADIX = 16;
    // Branch nodes have TREE_RADIX elements plus an additional `value` slot.
    uint256 constant BRANCH_NODE_LENGTH = TREE_RADIX + 1;
    // Leaf nodes and extension nodes always have two elements, a `path` and a `value`.
    uint256 constant LEAF_OR_EXTENSION_NODE_LENGTH = 2;

    // Prefixes are prepended to the `path` within a leaf or extension node and
    // allow us to differentiate between the two node types. `ODD` or `EVEN` is
    // determined by the number of nibbles within the unprefixed `path`. If the
    // number of nibbles if even, we need to insert an extra padding nibble so
    // the resulting prefixed `path` has an even number of nibbles.
    uint8 constant PREFIX_EXTENSION_EVEN = 0;
    uint8 constant PREFIX_EXTENSION_ODD = 1;
    uint8 constant PREFIX_LEAF_EVEN = 2;
    uint8 constant PREFIX_LEAF_ODD = 3;

    // Just a utility constant. RLP represents `NULL` as 0x80.
    bytes1 constant RLP_NULL = bytes1(0x80);

    /**
     *
     * Internal Functions *
     *
     */

    /**
     * @notice Verifies a proof that a given key/value pair is present in the
     * Merkle trie.
     * @param _key Key of the node to search for, as a hex string.
     * @param _value Value of the node to search for, as a hex string.
     * @param _proof Merkle trie inclusion proof for the desired node. Unlike
     * traditional Merkle trees, this proof is executed top-down and consists
     * of a list of RLP-encoded nodes that make a path down to the target node.
     * @param _root Known root of the Merkle trie. Used to verify that the
     * included proof is correctly constructed.
     * @return _verified `true` if the k/v pair exists in the trie, `false` otherwise.
     */
    function verifyInclusionProof(bytes memory _key, bytes memory _value, bytes memory _proof, bytes32 _root)
        internal
        pure
        returns (bool _verified)
    {
        (bool exists, bytes memory value) = get(_key, _proof, _root);

        return (exists && Lib_BytesUtils.equal(_value, value));
    }

    /**
     * @notice Retrieves the value associated with a given key.
     * @param _key Key to search for, as hex bytes.
     * @param _proof Merkle trie inclusion proof for the key.
     * @param _root Known root of the Merkle trie.
     * @return _exists Whether or not the key exists.
     * @return _value Value of the key if it exists.
     */
    function get(bytes memory _key, bytes memory _proof, bytes32 _root)
        internal
        pure
        returns (bool _exists, bytes memory _value)
    {
        TrieNode[] memory proof = _parseProof(_proof);
        (uint256 pathLength, bytes memory keyRemainder, bool isFinalNode) = _walkNodePath(proof, _key, _root);

        bool exists = keyRemainder.length == 0;

        require(exists || isFinalNode, "Provided proof is invalid.");

        bytes memory value = exists ? _getNodeValue(proof[pathLength - 1]) : bytes("");

        return (exists, value);
    }

    /**
     *
     * Private Functions *
     *
     */

    /**
     * @notice Walks through a proof using a provided key.
     * @param _proof Inclusion proof to walk through.
     * @param _key Key to use for the walk.
     * @param _root Known root of the trie.
     * @return _pathLength Length of the final path
     * @return _keyRemainder Portion of the key remaining after the walk.
     * @return _isFinalNode Whether or not we've hit a dead end.
     */
    function _walkNodePath(TrieNode[] memory _proof, bytes memory _key, bytes32 _root)
        private
        pure
        returns (uint256 _pathLength, bytes memory _keyRemainder, bool _isFinalNode)
    {
        uint256 pathLength = 0;
        bytes memory key = Lib_BytesUtils.toNibbles(_key);

        bytes32 currentNodeID = _root;
        uint256 currentKeyIndex = 0;
        uint256 currentKeyIncrement = 0;
        TrieNode memory currentNode;

        // Proof is top-down, so we start at the first element (root).
        for (uint256 i = 0; i < _proof.length; i++) {
            currentNode = _proof[i];
            currentKeyIndex += currentKeyIncrement;

            // Keep track of the proof elements we actually need.
            // It's expensive to resize arrays, so this simply reduces gas costs.
            pathLength += 1;

            if (currentKeyIndex == 0) {
                // First proof element is always the root node.
                require(keccak256(currentNode.encoded) == currentNodeID, "Invalid root hash");
            } else if (currentNode.encoded.length >= 32) {
                // Nodes 32 bytes or larger are hashed inside branch nodes.
                require(keccak256(currentNode.encoded) == currentNodeID, "Invalid large internal hash");
            } else {
                // Nodes smaller than 31 bytes aren't hashed.
                require(Lib_BytesUtils.toBytes32(currentNode.encoded) == currentNodeID, "Invalid internal node hash");
            }

            if (currentNode.decoded.length == BRANCH_NODE_LENGTH) {
                if (currentKeyIndex == key.length) {
                    // We've hit the end of the key
                    // meaning the value should be within this branch node.
                    break;
                } else {
                    // We're not at the end of the key yet.
                    // Figure out what the next node ID should be and continue.
                    uint8 branchKey = uint8(key[currentKeyIndex]);
                    Lib_RLPReader.RLPItem memory nextNode = currentNode.decoded[branchKey];
                    currentNodeID = _getNodeID(nextNode);
                    currentKeyIncrement = 1;
                    continue;
                }
            } else if (currentNode.decoded.length == LEAF_OR_EXTENSION_NODE_LENGTH) {
                bytes memory path = _getNodePath(currentNode);
                uint8 prefix = uint8(path[0]);
                uint8 offset = 2 - (prefix % 2);
                bytes memory pathRemainder = Lib_BytesUtils.slice(path, offset);
                bytes memory keyRemainder = Lib_BytesUtils.slice(key, currentKeyIndex);
                uint256 sharedNibbleLength = _getSharedNibbleLength(pathRemainder, keyRemainder);

                if (prefix == PREFIX_LEAF_EVEN || prefix == PREFIX_LEAF_ODD) {
                    if (pathRemainder.length == sharedNibbleLength && keyRemainder.length == sharedNibbleLength) {
                        // The key within this leaf matches our key exactly.
                        // Increment the key index to reflect that we have no remainder.
                        currentKeyIndex += sharedNibbleLength;
                    }

                    // We've hit a leaf node, so our next node should be NULL.
                    currentNodeID = bytes32(RLP_NULL);
                    break;
                } else if (prefix == PREFIX_EXTENSION_EVEN || prefix == PREFIX_EXTENSION_ODD) {
                    if (sharedNibbleLength != pathRemainder.length) {
                        // Our extension node is not identical to the remainder.
                        // We've hit the end of this path
                        // updates will need to modify this extension.
                        currentNodeID = bytes32(RLP_NULL);
                        break;
                    } else {
                        // Our extension shares some nibbles.
                        // Carry on to the next node.
                        currentNodeID = _getNodeID(currentNode.decoded[1]);
                        currentKeyIncrement = sharedNibbleLength;
                        continue;
                    }
                } else {
                    revert("Received a node with an unknown prefix");
                }
            } else {
                revert("Received an unparseable node.");
            }
        }

        // If our node ID is NULL, then we're at a dead end.
        bool isFinalNode = currentNodeID == bytes32(RLP_NULL);
        return (pathLength, Lib_BytesUtils.slice(key, currentKeyIndex), isFinalNode);
    }

    /**
     * @notice Parses an RLP-encoded proof into something more useful.
     * @param _proof RLP-encoded proof to parse.
     * @return _parsed Proof parsed into easily accessible structs.
     */
    function _parseProof(bytes memory _proof) private pure returns (TrieNode[] memory _parsed) {
        Lib_RLPReader.RLPItem[] memory nodes = Lib_RLPReader.readList(_proof);
        TrieNode[] memory proof = new TrieNode[](nodes.length);

        for (uint256 i = 0; i < nodes.length; i++) {
            bytes memory encoded = Lib_RLPReader.readBytes(nodes[i]);
            proof[i] = TrieNode({encoded: encoded, decoded: Lib_RLPReader.readList(encoded)});
        }

        return proof;
    }

    /**
     * @notice Picks out the ID for a node. Node ID is referred to as the
     * "hash" within the specification, but nodes < 32 bytes are not actually
     * hashed.
     * @param _node Node to pull an ID for.
     * @return _nodeID ID for the node, depending on the size of its contents.
     */
    function _getNodeID(Lib_RLPReader.RLPItem memory _node) private pure returns (bytes32 _nodeID) {
        bytes memory nodeID;

        if (_node.length < 32) {
            // Nodes smaller than 32 bytes are RLP encoded.
            nodeID = Lib_RLPReader.readRawBytes(_node);
        } else {
            // Nodes 32 bytes or larger are hashed.
            nodeID = Lib_RLPReader.readBytes(_node);
        }

        return Lib_BytesUtils.toBytes32(nodeID);
    }

    /**
     * @notice Gets the path for a leaf or extension node.
     * @param _node Node to get a path for.
     * @return _path Node path, converted to an array of nibbles.
     */
    function _getNodePath(TrieNode memory _node) private pure returns (bytes memory _path) {
        return Lib_BytesUtils.toNibbles(Lib_RLPReader.readBytes(_node.decoded[0]));
    }

    /**
     * @notice Gets the path for a node.
     * @param _node Node to get a value for.
     * @return _value Node value, as hex bytes.
     */
    function _getNodeValue(TrieNode memory _node) private pure returns (bytes memory _value) {
        return Lib_RLPReader.readBytes(_node.decoded[_node.decoded.length - 1]);
    }

    /**
     * @notice Utility; determines the number of nibbles shared between two
     * nibble arrays.
     * @param _a First nibble array.
     * @param _b Second nibble array.
     * @return _shared Number of shared nibbles.
     */
    function _getSharedNibbleLength(bytes memory _a, bytes memory _b) private pure returns (uint256 _shared) {
        uint256 i = 0;
        while (_a.length > i && _b.length > i && _a[i] == _b[i]) {
            i++;
        }
        return i;
    }
}

File 23 of 24 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 24 of 24 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "@eigenlayer/=lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/",
    "eigenlayer-middleware/=lib/eigenlayer-middleware/",
    "@eth-optimism/=node_modules/@eth-optimism/",
    "@openzeppelin/=lib/eigenlayer-middleware/lib/eigenlayer-contracts/lib/openzeppelin-contracts/",
    "@openzeppelin-upgrades/=lib/eigenlayer-middleware/lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable/",
    "eigenlayer-contracts/=lib/eigenlayer-middleware/lib/eigenlayer-contracts/",
    "openzeppelin-contracts-upgradeable/=lib/eigenlayer-middleware/lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/eigenlayer-middleware/lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 100
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "viaIR": false,
  "libraries": {}
}

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"newPausedStatus","type":"uint256"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IPauserRegistry","name":"pauserRegistry","type":"address"},{"indexed":false,"internalType":"contract IPauserRegistry","name":"newPauserRegistry","type":"address"}],"name":"PauserRegistrySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"rollupId","type":"uint32"},{"indexed":true,"internalType":"uint64","name":"blockHeight","type":"uint64"},{"indexed":false,"internalType":"bytes32","name":"stateRoot","type":"bytes32"}],"name":"StateRootUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"newPausedStatus","type":"uint256"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"PAUSED_UPDATE_OPERATOR_SET","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSED_UPDATE_STATE_ROOT","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"THRESHOLD_DENOMINATOR","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"aggregator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"uint64","name":"timestamp","type":"uint64"},{"components":[{"components":[{"internalType":"uint256","name":"X","type":"uint256"},{"internalType":"uint256","name":"Y","type":"uint256"}],"internalType":"struct BN254.G1Point","name":"pubkey","type":"tuple"},{"internalType":"uint128","name":"weight","type":"uint128"}],"internalType":"struct RollupOperators.Operator[]","name":"operators","type":"tuple[]"}],"internalType":"struct OperatorSetUpdate.Message","name":"message","type":"tuple"}],"name":"forceOperatorSetUpdate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getApk","outputs":[{"components":[{"internalType":"uint256","name":"X","type":"uint256"},{"internalType":"uint256","name":"Y","type":"uint256"}],"internalType":"struct BN254.G1Point","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"pubkeyHash","type":"bytes32"}],"name":"getOperatorWeight","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getQuorumThreshold","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"rollupId","type":"uint32"},{"internalType":"uint64","name":"blockHeight","type":"uint64"}],"name":"getStateRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"rollupId","type":"uint32"},{"internalType":"uint64","name":"blockHeight","type":"uint64"},{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"bytes32","name":"nearDaTransactionId","type":"bytes32"},{"internalType":"bytes32","name":"nearDaCommitment","type":"bytes32"},{"internalType":"bytes32","name":"stateRoot","type":"bytes32"}],"internalType":"struct StateRootUpdate.Message","name":"message","type":"tuple"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes32","name":"storageKey","type":"bytes32"},{"internalType":"bytes","name":"stateTrieWitness","type":"bytes"},{"internalType":"bytes","name":"storageTrieWitness","type":"bytes"}],"internalType":"struct SFFLRegistryBase.ProofParams","name":"proofParams","type":"tuple"}],"name":"getStorageValue","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalWeight","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint128","name":"quorumThreshold","type":"uint128"},{"internalType":"address","name":"initialOwner","type":"address"},{"internalType":"address","name":"_aggregator","type":"address"},{"internalType":"contract IPauserRegistry","name":"_pauserRegistry","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nextOperatorUpdateId","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPausedStatus","type":"uint256"}],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pauseAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"index","type":"uint8"}],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauserRegistry","outputs":[{"internalType":"contract IPauserRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint256","name":"X","type":"uint256"},{"internalType":"uint256","name":"Y","type":"uint256"}],"internalType":"struct BN254.G1Point","name":"pubkey","type":"tuple"},{"internalType":"uint128","name":"weight","type":"uint128"}],"internalType":"struct RollupOperators.Operator[]","name":"operators","type":"tuple[]"},{"internalType":"uint64","name":"_nextOperatorUpdateId","type":"uint64"}],"name":"setInitialOperatorSet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPauserRegistry","name":"newPauserRegistry","type":"address"}],"name":"setPauserRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"newQuorumThreshold","type":"uint128"}],"name":"setQuorumThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPausedStatus","type":"uint256"}],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"rollupId","type":"uint32"},{"internalType":"uint64","name":"blockHeight","type":"uint64"},{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"bytes32","name":"nearDaTransactionId","type":"bytes32"},{"internalType":"bytes32","name":"nearDaCommitment","type":"bytes32"},{"internalType":"bytes32","name":"stateRoot","type":"bytes32"}],"internalType":"struct StateRootUpdate.Message","name":"message","type":"tuple"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes32","name":"storageKey","type":"bytes32"},{"internalType":"bytes","name":"stateTrieWitness","type":"bytes"},{"internalType":"bytes","name":"storageTrieWitness","type":"bytes"}],"internalType":"struct SFFLRegistryBase.ProofParams","name":"proofParams","type":"tuple"},{"internalType":"bytes","name":"agreement","type":"bytes"}],"name":"updateAndGetStorageValue","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"uint64","name":"timestamp","type":"uint64"},{"components":[{"components":[{"internalType":"uint256","name":"X","type":"uint256"},{"internalType":"uint256","name":"Y","type":"uint256"}],"internalType":"struct BN254.G1Point","name":"pubkey","type":"tuple"},{"internalType":"uint128","name":"weight","type":"uint128"}],"internalType":"struct RollupOperators.Operator[]","name":"operators","type":"tuple[]"}],"internalType":"struct OperatorSetUpdate.Message","name":"message","type":"tuple"},{"components":[{"components":[{"internalType":"uint256","name":"X","type":"uint256"},{"internalType":"uint256","name":"Y","type":"uint256"}],"internalType":"struct BN254.G1Point[]","name":"nonSignerPubkeys","type":"tuple[]"},{"components":[{"internalType":"uint256[2]","name":"X","type":"uint256[2]"},{"internalType":"uint256[2]","name":"Y","type":"uint256[2]"}],"internalType":"struct BN254.G2Point","name":"apkG2","type":"tuple"},{"components":[{"internalType":"uint256","name":"X","type":"uint256"},{"internalType":"uint256","name":"Y","type":"uint256"}],"internalType":"struct BN254.G1Point","name":"sigma","type":"tuple"}],"internalType":"struct RollupOperators.SignatureInfo","name":"signatureInfo","type":"tuple"}],"name":"updateOperatorSet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"rollupId","type":"uint32"},{"internalType":"uint64","name":"blockHeight","type":"uint64"},{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"bytes32","name":"nearDaTransactionId","type":"bytes32"},{"internalType":"bytes32","name":"nearDaCommitment","type":"bytes32"},{"internalType":"bytes32","name":"stateRoot","type":"bytes32"}],"internalType":"struct StateRootUpdate.Message","name":"message","type":"tuple"},{"components":[{"components":[{"internalType":"uint256","name":"X","type":"uint256"},{"internalType":"uint256","name":"Y","type":"uint256"}],"internalType":"struct BN254.G1Point[]","name":"nonSignerPubkeys","type":"tuple[]"},{"components":[{"internalType":"uint256[2]","name":"X","type":"uint256[2]"},{"internalType":"uint256[2]","name":"Y","type":"uint256[2]"}],"internalType":"struct BN254.G2Point","name":"apkG2","type":"tuple"},{"components":[{"internalType":"uint256","name":"X","type":"uint256"},{"internalType":"uint256","name":"Y","type":"uint256"}],"internalType":"struct BN254.G1Point","name":"sigma","type":"tuple"}],"internalType":"struct RollupOperators.SignatureInfo","name":"signatureInfo","type":"tuple"}],"name":"updateStateRoot","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101845760003560e01c8063715018a6116100d9578063d5d4bb5a11610087578063d5d4bb5a1461036c578063dd64766e1461037f578063e0f5d9f014610392578063ef024458146103bd578063f2fde38b146103c4578063f4db0571146103d7578063fabc1cbc146103df57600080fd5b8063715018a6146102f457806382616b7b146102fc578063886f11951461030f5780638da5cb5b1461032257806390540c3714610333578063b128aeee14610346578063b3a9e53b1461035957600080fd5b80632db52ea5116101365780632db52ea5146102425780632f65284e146102555780634afa71b914610276578063595c6a671461028e5780635ac86ab7146102965780635c975abb146102c95780636f5b9918146102d157600080fd5b80630510c1911461018957806306aba0e1146101a857806310d67a2f146101cd578063136439dd146101e25780631df9e1d2146101f55780631fb4d41114610208578063245a7bfc1461021b575b600080fd5b610191600181565b60405160ff90911681526020015b60405180910390f35b60cd546001600160801b03165b6040516001600160801b03909116815260200161019f565b6101e06101db366004613746565b6103f2565b005b6101e06101f0366004613763565b6104ae565b6101e0610203366004613794565b6105db565b6101e06102163660046137ec565b6106cc565b60ce5461023590600160401b90046001600160a01b031681565b60405161019f919061383a565b6101e0610250366004613865565b610755565b610268610263366004613892565b610768565b60405190815260200161019f565b60cd54600160801b90046001600160801b03166101b5565b6101e0610887565b6102b96102a4366004613935565b606654600160ff9092169190911b9081161490565b604051901515815260200161019f565b606654610268565b6102d9610941565b6040805182518152602092830151928101929092520161019f565b6101e0610964565b6101e061030a366004613958565b610978565b606554610235906001600160a01b031681565b6033546001600160a01b0316610235565b6101e06103413660046139b1565b610a9d565b6101e0610354366004613aff565b610bed565b610268610367366004613bd3565b610cd1565b61026861037a366004613c06565b610d02565b6101b561038d366004613763565b610e5b565b60ce546103a5906001600160401b031681565b6040516001600160401b03909116815260200161019f565b60646101b5565b6101e06103d2366004613746565b610e78565b610191600081565b6101e06103ed366004613763565b610eee565b606560009054906101000a90046001600160a01b03166001600160a01b031663eab66d7a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610445573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104699190613c4a565b6001600160a01b0316336001600160a01b0316146104a25760405162461bcd60e51b815260040161049990613c67565b60405180910390fd5b6104ab81611045565b50565b60655460405163237dfb4760e11b81526001600160a01b03909116906346fbf68e906104de90339060040161383a565b602060405180830381865afa1580156104fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051f9190613cb1565b61053b5760405162461bcd60e51b815260040161049990613cd3565b606654818116146105af5760405162461bcd60e51b815260206004820152603860248201527f5061757361626c652e70617573653a20696e76616c696420617474656d707420604482015277746f20756e70617573652066756e6374696f6e616c69747960401b6064820152608401610499565b6066819055604051818152339060008051602061434d833981519152906020015b60405180910390a250565b6105e361113c565b60ce546001600160401b03166105fc6020830183613d1b565b6001600160401b0316146106225760405162461bcd60e51b815260040161049990613d36565b61062f6020820182613d1b565b61063a906001613d76565b60ce805467ffffffffffffffff19166001600160401b03929092169190911790556104ab61066b6040830183613da1565b808060200260200160405190810160405280939291908181526020016000905b828210156106b7576106a860608302860136819003810190613df0565b8152602001906001019061068b565b505050505060ca61119690919063ffffffff16565b606654600190600290811614156106f55760405162461bcd60e51b815260040161049990613e0c565b61070a6107018461139f565b60ca9084611420565b6107265760405162461bcd60e51b815260040161049990613e3f565b6107506107366020850185613e67565b6107466040860160208701613d1b565b8560a0013561180a565b505050565b61075d61113c565b6104ab60ca82611870565b60006060850135158015906107805750608085013515155b6107c75760405162461bcd60e51b8152602060048201526018602482015277115b5c1d1e48139150548811104818dbdb5b5a5d1b595b9d60421b6044820152606401610499565b60006097816107d96020890189613e67565b63ffffffff1663ffffffff16815260200190815260200160002060008760200160208101906108089190613d1b565b6001600160401b0316815260208101919091526040016000205490508061087357826108685760405162461bcd60e51b815260206004820152600f60248201526e115b5c1d1e481859dc99595b595b9d608a1b6044820152606401610499565b610873868585611929565b61087d8686610d02565b9695505050505050565b60655460405163237dfb4760e11b81526001600160a01b03909116906346fbf68e906108b790339060040161383a565b602060405180830381865afa1580156108d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f89190613cb1565b6109145760405162461bcd60e51b815260040161049990613cd3565b6000196066819055604051908152339060008051602061434d8339815191529060200160405180910390a2565b61094961361d565b506040805180820190915260cb54815260cc54602082015290565b61096c61113c565b610976600061193a565b565b606654600090600190811614156109a15760405162461bcd60e51b815260040161049990613e0c565b60ce546001600160401b03166109ba6020850185613d1b565b6001600160401b0316146109e05760405162461bcd60e51b815260040161049990613d36565b6109ec6107018461198c565b610a085760405162461bcd60e51b815260040161049990613e3f565b610a156020840184613d1b565b610a20906001613d76565b60ce805467ffffffffffffffff19166001600160401b0392909216919091179055610750610a516040850185613da1565b808060200260200160405190810160405280939291908181526020016000905b828210156106b757610a8e60608302860136819003810190613df0565b81526020019060010190610a71565b600054610100900460ff1615808015610abd5750600054600160ff909116105b80610ad75750303b158015610ad7575060005460ff166001145b610b3a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610499565b6000805460ff191660011790558015610b5d576000805461ff0019166101001790555b610b688260006119c0565b610b718461193a565b610b7c60ca86611870565b60ce8054600160401b600160e01b031916600160401b6001600160a01b038616021790558015610be6576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b60ce54600160401b90046001600160a01b03163314610c495760405162461bcd60e51b815260206004820152601860248201527729b2b73232b91034b9903737ba1030b3b3b932b3b0ba37b960411b6044820152606401610499565b60cd546001600160801b031615610ca25760405162461bcd60e51b815260206004820181905260248201527f4f70657261746f722073657420616c726561647920696e697469616c697a65646044820152606401610499565b610cad60ca83611196565b60ce805467ffffffffffffffff19166001600160401b039290921691909117905550565b63ffffffff821660009081526097602090815260408083206001600160401b03851684529091529020545b92915050565b600080609781610d156020870187613e67565b63ffffffff1663ffffffff1681526020019081526020016000206000856020016020810190610d449190613d1b565b6001600160401b03166001600160401b031681526020019081526020016000205490508360a001358114610db45760405162461bcd60e51b81526020600482015260176024820152764d69736d61746368696e6720737461746520726f6f747360481b6044820152606401610499565b610e53610dc46020850185613746565b602085013583610dd76040880188613e82565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610e19925050506060890189613e82565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a9892505050565b949350505050565b600081815260ca60205260408120546001600160801b0316610cfc565b610e8061113c565b6001600160a01b038116610ee55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610499565b6104ab8161193a565b606560009054906101000a90046001600160a01b03166001600160a01b031663eab66d7a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f659190613c4a565b6001600160a01b0316336001600160a01b031614610f955760405162461bcd60e51b815260040161049990613c67565b60665419811960665419161461100e5760405162461bcd60e51b815260206004820152603860248201527f5061757361626c652e756e70617573653a20696e76616c696420617474656d706044820152777420746f2070617573652066756e6374696f6e616c69747960401b6064820152608401610499565b606681905560405181815233907f3582d1828e26bf56bd801502bc021ac0bc8afb57c826e4986b45593c8fad389c906020016105d0565b6001600160a01b0381166110d35760405162461bcd60e51b815260206004820152604960248201527f5061757361626c652e5f73657450617573657252656769737472793a206e657760448201527f50617573657252656769737472792063616e6e6f7420626520746865207a65726064820152686f206164647265737360b81b608482015260a401610499565b606554604080516001600160a01b03928316815291831660208301527f6e9fcd539896fca60e8b0f01dd580233e48a6b0f7df013b89ba7f565869acdb6910160405180910390a1606580546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b031633146109765760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610499565b61119e613637565b60408051808201909152600184015481526002840154602082015260038401546001600160801b031660005b8451811015611364578481815181106111e5576111e5613ec8565b6020026020010151935060006112108560000151805160009081526020918201519091526040902090565b60008181526020898152604090912054908701519192506001600160801b03908116911681141561127c5760405162461bcd60e51b81526020600482015260166024820152754f70657261746f7220697320757020746f206461746560501b6044820152606401610499565b602086015161128b8286613ede565b6112959190613f06565b6020878101516000858152918b9052604090912080546001600160801b0319166001600160801b0392831617905590945081166112e05785516112d9908690611bd3565b945061130c565b60208601516001600160801b031661130c576113096113028760000151611c6a565b8690611bd3565b94505b6020808701516040516001600160801b03909116815283917f7714c619c02393ccf44c3de606bec5c80ae7a6077504b74887fb39f335e98adc910160405180910390a25050808061135c90613f28565b9150506111ca565b506003850180546001600160801b0319166001600160801b039290921691909117905580516001850155602001516002909301929092555050565b60007f482a38e491413194a63664d1808926c0e075bf3aeee17b4a07878c670a8936c5826040516020016113d39190613f43565b60405160208183030381529060405280519060200120604051602001611403929190918252602082015260400190565b604051602081830303815290604052805190602001209050919050565b6040805180820190915260008082526020820181905260038501549091906001600160801b0316806114945760405162461bcd60e51b815260206004820181905260248201527f4f70657261746f722073657420776173206e6f7420696e697469616c697a65646044820152606401610499565b60006114a08580613fad565b90506001600160401b038111156114b9576114b9613a0b565b6040519080825280602002602001820160405280156114e2578160200160208202803683370190505b50905060005b6114f28680613fad565b90508110156116cb576115456115088780613fad565b8381811061151857611518613ec8565b90506040020180360381019061152e9190613ff6565b805160009081526020918201519091526040902090565b82828151811061155757611557613ec8565b602090810291909101015280156115ee5781611574600183614012565b8151811061158457611584613ec8565b602002602001015160001c8282815181106115a1576115a1613ec8565b602002602001015160001c116115ee5760405162461bcd60e51b8152602060048201526012602482015271141d589ad95e5cc81b9bdd081cdbdc9d195960721b6044820152606401610499565b600088600001600084848151811061160857611608613ec8565b6020908102919091018101518252810191909152604001600020546001600160801b03169050806116765760405162461bcd60e51b815260206004820152601860248201527713dc195c985d1bdc881a185cc81e995c9bc81dd95a59da1d60421b6044820152606401610499565b6116a96116838880613fad565b8481811061169357611693613ec8565b9050604002018036038101906113029190613ff6565b94506116b58185614012565b93505080806116c390613f28565b9150506114e8565b506116f96116d884611c6a565b6040805180820190915260018a0154815260028a0154602082015290611bd3565b925060008061172c8886611715368b90038b0160208c01614098565b611727368c90038c0160a08d01613ff6565b611cf9565b915091508161177d5760405162461bcd60e51b815260206004820152601e60248201527f50616972696e6720707265636f6d70696c652063616c6c206661696c656400006044820152606401610499565b806117c15760405162461bcd60e51b815260206004820152601460248201527314da59db985d1d5c99481a5cc81a5b9d985b1a5960621b6044820152606401610499565b60038901546064906117e5906001600160801b03600160801b8204811691166140d7565b6117ef919061411c565b6001600160801b0316841015955050505050505b9392505050565b63ffffffff831660008181526097602090815260408083206001600160401b03871680855290835292819020859055518481529192917fca7171570f4ca232f925661b810636124eaf784a25b7c14e6b34c95b814dfdd8910160405180910390a3505050565b60646001600160801b03821611156118dc5760405162461bcd60e51b815260206004820152602960248201527f51756f72756d207468726573686f6c642067726561746572207468616e2064656044820152683737b6b4b730ba37b960b91b6064820152608401610499565b6003820180546001600160801b03808416600160801b810291909216179091556040517f2b71b2179969a005ac6fd9c196134b364ff40069a17dd72faa96c4a00e73e9f490600090a25050565b8161193484826106cc565b50505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60007f6c53db212565b8956d5fc704eb18d9f2372ce861f785ef64103f74e6c2154b3f826040516020016113d39190614142565b6065546001600160a01b03161580156119e157506001600160a01b03821615155b611a635760405162461bcd60e51b815260206004820152604760248201527f5061757361626c652e5f696e697469616c697a655061757365723a205f696e6960448201527f7469616c697a6550617573657228292063616e206f6e6c792062652063616c6c6064820152666564206f6e636560c81b608482015260a401610499565b6066819055604051818152339060008051602061434d8339815191529060200160405180910390a2611a9482611045565b5050565b6040516bffffffffffffffffffffffff19606087901b16602082015260009081908190611ad8906034016040516020818303038152906040528688611e58565b9150915081611b225760405162461bcd60e51b81526020600482015260166024820152751058d8dbdd5b9d08191bd95cc81b9bdd08195e1a5cdd60521b6044820152606401610499565b6000611b2d82611e81565b9050600080611b628a604051602001611b4891815260200190565b604051602081830303815290604052888560400151611e58565b9150915081611bb35760405162461bcd60e51b815260206004820152601c60248201527f53746f726167652076616c756520646f6573206e6f74206578697374000000006044820152606401610499565b611bc4611bbf82611f45565b611f58565b9b9a5050505050505050505050565b611bdb61361d565b611be3613657565b835181526020808501518183015283516040808401919091529084015160608301526000908360808460066107d05a03fa9050808015611c2257611c24565bfe5b5080611c625760405162461bcd60e51b815260206004820152600d60248201526c1958cb5859190b59985a5b1959609a1b6044820152606401610499565b505092915050565b611c7261361d565b8151158015611c8357506020820151155b15611ca1575050604080518082019091526000808252602082015290565b60405180604001604052808360000151815260200160008051602061436d8339815191528460200151611cd4919061421a565b611cec9060008051602061436d833981519152614012565b905292915050565b919050565b60008060007f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000187876000015188602001518860000151600060028110611d4157611d41613ec8565b60200201518951600160200201518a60200151600060028110611d6657611d66613ec8565b60200201518b60200151600160028110611d8257611d82613ec8565b602090810291909101518c518d830151604051611ddf9a99989796959401988952602089019790975260408801959095526060870193909352608086019190915260a085015260c084015260e08301526101008201526101200190565b6040516020818303038152906040528051906020012060001c611e02919061421a565b9050611e4a611e146113028884611f87565b611e1c612003565b611e40611e3185611e2b6120c3565b90611f87565b611e3a8c6120e4565b90611bd3565b886201d4c0612168565b909890975095505050505050565b600060606000611e678661238c565b9050611e748186866123be565b9250925050935093915050565b604080516080810182526000808252602082018190529181018290526060810182905290611eae83612499565b90506040518060800160405280611ede83600081518110611ed157611ed1613ec8565b60200260200101516124ac565b8152602001611ef983600181518110611ed157611ed1613ec8565b8152602001611f2183600281518110611f1457611f14613ec8565b60200260200101516124b3565b8152602001611f3c83600381518110611f1457611f14613ec8565b90529392505050565b6060610cfc611f5383612555565b612582565b6000806000602084511115611f6e576020611f71565b83515b60209485015194036008029390931c9392505050565b611f8f61361d565b611f97613675565b835181526020808501519082015260408082018490526000908360608460076107d05a03fa9050808015611c22575080611c625760405162461bcd60e51b815260206004820152600d60248201526c1958cb5b5d5b0b59985a5b1959609a1b6044820152606401610499565b61200b613693565b50604080516080810182527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c28183019081527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6060830152815281518083019092527f275dc4a288d1afb3cbb1ac09187524c7db36395df7be3b99e673b13a075a65ec82527f1d9befcd05a5323e6da4d435f3b617cdb3af83285c2df711ef39c01571827f9d60208381019190915281019190915290565b6120cb61361d565b5060408051808201909152600181526002602082015290565b6120ec61361d565b6000808061210860008051602061436d8339815191528661421a565b90505b6121148161260d565b909350915060008051602061436d83398151915282830983141561214e576040805180820190915290815260208101919091529392505050565b60008051602061436d83398151915260018208905061210b565b60408051808201825286815260208082018690528251808401909352868352820184905260009182919061219a6136b8565b60005b600281101561235f5760006121b382600661422e565b90508482600281106121c7576121c7613ec8565b602002015151836121d983600061424d565b600c81106121e9576121e9613ec8565b602002015284826002811061220057612200613ec8565b60200201516020015183826001612217919061424d565b600c811061222757612227613ec8565b602002015283826002811061223e5761223e613ec8565b602002015151518361225183600261424d565b600c811061226157612261613ec8565b602002015283826002811061227857612278613ec8565b602002015151600160200201518361229183600361424d565b600c81106122a1576122a1613ec8565b60200201528382600281106122b8576122b8613ec8565b6020020151602001516000600281106122d3576122d3613ec8565b6020020151836122e483600461424d565b600c81106122f4576122f4613ec8565b602002015283826002811061230b5761230b613ec8565b60200201516020015160016002811061232657612326613ec8565b60200201518361233783600561424d565b600c811061234757612347613ec8565b6020020152508061235781613f28565b91505061219d565b506123686136d7565b60006020826101808560088cfa9151919c9115159b50909950505050505050505050565b606081805190602001206040516020016123a891815260200190565b6040516020818303038152906040529050919050565b6000606060006123cd8561268f565b905060008060006123df848a89612789565b815192955090935091501580806123f35750815b61243f5760405162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e0000000000006044820152606401610499565b60008161245b5760405180602001604052806000815250612487565b6124878661246a600188614012565b8151811061247a5761247a613ec8565b6020026020010151612bad565b919b919a509098505050505050505050565b6060610cfc6124a783612555565b612bd7565b6000610cfc825b60006021826000015111156124da5760405162461bcd60e51b815260040161049990614265565b60008060006124e885612dbd565b9194509250905060008160018111156125035761250361429c565b146125205760405162461bcd60e51b815260040161049990614265565b6000838660200151612532919061424d565b8051909150602084101561087d5760208490036101000a90049695505050505050565b60408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b6060600080600061259285612dbd565b9194509250905060008160018111156125ad576125ad61429c565b146125f55760405162461bcd60e51b815260206004820152601860248201527724b73b30b634b21029262810313cba32b9903b30b63ab29760411b6044820152606401610499565b612604856020015184846130f3565b95945050505050565b6000808060008051602061436d833981519152600360008051602061436d8339815191528660008051602061436d833981519152888909090890506000612683827f0c19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f5260008051602061436d8339815191526131d1565b91959194509092505050565b6060600061269c83612499565b9050600081516001600160401b038111156126b9576126b9613a0b565b6040519080825280602002602001820160405280156126fe57816020015b60408051808201909152606080825260208201528152602001906001900390816126d75790505b50905060005b825181101561278157600061273184838151811061272457612724613ec8565b6020026020010151612582565b9050604051806040016040528082815260200161274d83612499565b81525083838151811061276257612762613ec8565b602002602001018190525050808061277990613f28565b915050612704565b509392505050565b6000606081808061279987613279565b905060008690506000806127c0604051806040016040528060608152602001606081525090565b60005b8c51811015612b85578c81815181106127de576127de613ec8565b6020026020010151915082846127f4919061424d565b935061280160018861424d565b965083612859578151805160209091012085146128545760405162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b6044820152606401610499565b612916565b8151516020116128bb578151805160209091012085146128545760405162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c206861736800000000006044820152606401610499565b846128c983600001516133b3565b146129165760405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f646520686173680000000000006044820152606401610499565b6129226010600161424d565b826020015151141561299b57855184141561293c57612b85565b600086858151811061295057612950613ec8565b602001015160f81c60f81b60f81c9050600083602001518260ff168151811061297b5761297b613ec8565b6020026020010151905061298e816133db565b9650600194505050612b73565b60028260200151511415612b2b5760006129b483613411565b90506000816000815181106129cb576129cb613ec8565b016020015160f81c905060006129e26002836142b2565b6129ed9060026142d4565b905060006129fe848360ff16613435565b90506000612a0c8b8a613435565b90506000612a1a838361346b565b905060ff851660021480612a31575060ff85166003145b15612a6b57808351148015612a465750808251145b15612a5857612a55818b61424d565b99505b50600160ff1b9950612b85945050505050565b60ff85161580612a7e575060ff85166001145b15612ad45782518114612a9e5750600160ff1b9950612b85945050505050565b612ac58860200151600181518110612ab857612ab8613ec8565b60200260200101516133db565b9a509750612b73945050505050565b60405162461bcd60e51b815260206004820152602660248201527f52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e206044820152650e0e4caccd2f60d31b6064820152608401610499565b60405162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e0000006044820152606401610499565b80612b7d81613f28565b9150506127c3565b50600160ff1b841486612b988786613435565b909e909d50909b509950505050505050505050565b60208101518051606091610cfc91612bc790600190614012565b8151811061272457612724613ec8565b6060600080612be584612dbd565b91935090915060019050816001811115612c0157612c0161429c565b14612c485760405162461bcd60e51b815260206004820152601760248201527624b73b30b634b210292628103634b9ba103b30b63ab29760491b6044820152606401610499565b6040805160208082526104208201909252600091816020015b6040805180820190915260008082526020820152815260200190600190039081612c615790505090506000835b8651811015612db25760208210612cfa5760405162461bcd60e51b815260206004820152602a60248201527f50726f766964656420524c50206c6973742065786365656473206d6178206c6960448201526939ba103632b733ba341760b11b6064820152608401610499565b600080612d376040518060400160405280858c60000151612d1b9190614012565b8152602001858c60200151612d30919061424d565b9052612dbd565b509150915060405180604001604052808383612d53919061424d565b8152602001848b60200151612d68919061424d565b815250858581518110612d7d57612d7d613ec8565b6020908102919091010152612d9360018561424d565b9350612d9f818361424d565b612da9908461424d565b92505050612c8e565b508152949350505050565b600080600080846000015111612e105760405162461bcd60e51b81526020600482015260186024820152772926281034ba32b69031b0b73737ba10313290373ab6361760411b6044820152606401610499565b6020840151805160001a607f8111612e355760006001600094509450945050506130ec565b60b78111612ead576000612e4a608083614012565b905080876000015111612e9b5760405162461bcd60e51b815260206004820152601960248201527824b73b30b634b2102926281039b437b93a1039ba3934b7339760391b6044820152606401610499565b600195509350600092506130ec915050565b60bf8111612f97576000612ec260b783614012565b905080876000015111612f175760405162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e006044820152606401610499565b600183015160208290036101000a9004612f31818361424d565b885111612f7b5760405162461bcd60e51b815260206004820152601860248201527724b73b30b634b210292628103637b7339039ba3934b7339760411b6044820152606401610499565b612f8682600161424d565b96509450600093506130ec92505050565b60f7811161300c576000612fac60c083614012565b905080876000015111612ffb5760405162461bcd60e51b815260206004820152601760248201527624b73b30b634b2102926281039b437b93a103634b9ba1760491b6044820152606401610499565b6001955093508492506130ec915050565b600061301960f783614012565b90508087600001511161306e5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e0000006044820152606401610499565b600183015160208290036101000a9004613088818361424d565b8851116130d05760405162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b6044820152606401610499565b6130db82600161424d565b96509450600193506130ec92505050565b9193909250565b60606000826001600160401b0381111561310f5761310f613a0b565b6040519080825280601f01601f191660200182016040528015613139576020820181803683370190505b50905080516000141561314d579050611803565b6000613159858761424d565b90506020820160005b61316d6020876142f7565b8110156131a4578251825261318360208461424d565b925061319060208361424d565b91508061319c81613f28565b915050613162565b5060006001602087066020036101000a039050808251168119845116178252839450505050509392505050565b6000806131dc6136d7565b6131e46136f5565b602080825281810181905260408201819052606082018890526080820187905260a082018690528260c08360056107d05a03fa9250828015611c2257508261326e5760405162461bcd60e51b815260206004820152601a60248201527f424e3235342e6578704d6f643a2063616c6c206661696c7572650000000000006044820152606401610499565b505195945050505050565b606060008251600261328b919061422e565b6001600160401b038111156132a2576132a2613a0b565b6040519080825280601f01601f1916602001820160405280156132cc576020820181803683370190505b50905060005b83518110156133ac5760048482815181106132ef576132ef613ec8565b01602001516001600160f81b031916901c8261330c83600261422e565b8151811061331c5761331c613ec8565b60200101906001600160f81b031916908160001a905350601084828151811061334757613347613ec8565b0160200151613359919060f81c6142b2565b60f81b8261336883600261422e565b61337390600161424d565b8151811061338357613383613ec8565b60200101906001600160f81b031916908160001a905350806133a481613f28565b9150506132d2565b5092915050565b60006020825110156133c757506020015190565b81806020019051810190610cfc919061430b565b600060606020836000015110156133fc576133f5836134e7565b9050613408565b61340583612582565b90505b611803816133b3565b6060610cfc613430836020015160008151811061272457612724613ec8565b613279565b6060825182106134545750604080516020810190915260008152610cfc565b61180383838486516134669190614012565b6134f2565b6000805b80845111801561347f5750808351115b80156134d0575082818151811061349857613498613ec8565b602001015160f81c60f81b6001600160f81b0319168482815181106134bf576134bf613ec8565b01602001516001600160f81b031916145b1561180357806134df81613f28565b91505061346f565b6060610cfc82613607565b60608161350081601f61424d565b101561351e5760405162461bcd60e51b815260040161049990614324565b82613529838261424d565b10156135475760405162461bcd60e51b815260040161049990614324565b613551828461424d565b845110156135955760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610499565b6060821580156135b457604051915060008252602082016040526135fe565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156135ed5780518352602092830192016135d5565b5050858452601f01601f1916604052505b50949350505050565b6060610cfc8260200151600084600001516130f3565b604051806040016040528060008152602001600081525090565b604051806040016040528061364a61361d565b8152600060209091015290565b60405180608001604052806004906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60405180604001604052806136a6613713565b81526020016136b3613713565b905290565b604051806101800160405280600c906020820280368337509192915050565b60405180602001604052806001906020820280368337509192915050565b6040518060c001604052806006906020820280368337509192915050565b60405180604001604052806002906020820280368337509192915050565b6001600160a01b03811681146104ab57600080fd5b60006020828403121561375857600080fd5b813561180381613731565b60006020828403121561377557600080fd5b5035919050565b60006060828403121561378e57600080fd5b50919050565b6000602082840312156137a657600080fd5b81356001600160401b038111156137bc57600080fd5b610e538482850161377c565b600060c0828403121561378e57600080fd5b600060e0828403121561378e57600080fd5b60008060e083850312156137ff57600080fd5b61380984846137c8565b915060c08301356001600160401b0381111561382457600080fd5b613830858286016137da565b9150509250929050565b6001600160a01b0391909116815260200190565b80356001600160801b0381168114611cf457600080fd5b60006020828403121561387757600080fd5b6118038261384e565b60006080828403121561378e57600080fd5b60008060008061010085870312156138a957600080fd5b6138b386866137c8565b935060c08501356001600160401b03808211156138cf57600080fd5b6138db88838901613880565b945060e08701359150808211156138f157600080fd5b818701915087601f83011261390557600080fd5b81358181111561391457600080fd5b88602082850101111561392657600080fd5b95989497505060200194505050565b60006020828403121561394757600080fd5b813560ff8116811461180357600080fd5b6000806040838503121561396b57600080fd5b82356001600160401b038082111561398257600080fd5b61398e8683870161377c565b935060208501359150808211156139a457600080fd5b50613830858286016137da565b600080600080608085870312156139c757600080fd5b6139d08561384e565b935060208501356139e081613731565b925060408501356139f081613731565b91506060850135613a0081613731565b939692955090935050565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715613a4357613a43613a0b565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613a7157613a71613a0b565b604052919050565b600060408284031215613a8b57600080fd5b613a93613a21565b9050813581526020820135602082015292915050565b600060608284031215613abb57600080fd5b613ac3613a21565b9050613acf8383613a79565b8152613add6040830161384e565b602082015292915050565b80356001600160401b0381168114611cf457600080fd5b60008060408385031215613b1257600080fd5b82356001600160401b0380821115613b2957600080fd5b818501915085601f830112613b3d57600080fd5b8135602082821115613b5157613b51613a0b565b613b5f818360051b01613a49565b82815281810193506060928302850182019289841115613b7e57600080fd5b948201945b83861015613ba457613b958a87613aa9565b85529485019493820193613b83565b509550613bb2878201613ae8565b9450505050509250929050565b803563ffffffff81168114611cf457600080fd5b60008060408385031215613be657600080fd5b613bef83613bbf565b9150613bfd60208401613ae8565b90509250929050565b60008060e08385031215613c1957600080fd5b613c2384846137c8565b915060c08301356001600160401b03811115613c3e57600080fd5b61383085828601613880565b600060208284031215613c5c57600080fd5b815161180381613731565b6020808252602a908201527f6d73672e73656e646572206973206e6f74207065726d697373696f6e6564206160408201526939903ab73830bab9b2b960b11b606082015260800190565b600060208284031215613cc357600080fd5b8151801515811461180357600080fd5b60208082526028908201527f6d73672e73656e646572206973206e6f74207065726d697373696f6e6564206160408201526739903830bab9b2b960c11b606082015260800190565b600060208284031215613d2d57600080fd5b61180382613ae8565b60208082526010908201526f15dc9bdb99c81b595cdcd859d948125160821b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60006001600160401b03808316818516808303821115613d9857613d98613d60565b01949350505050565b6000808335601e19843603018112613db857600080fd5b8301803591506001600160401b03821115613dd257600080fd5b6020019150606081023603821315613de957600080fd5b9250929050565b600060608284031215613e0257600080fd5b6118038383613aa9565b60208082526019908201527814185d5cd8589b194e881a5b99195e081a5cc81c185d5cd959603a1b604082015260600190565b6020808252600e908201526d145d5bdc9d5b481b9bdd081b595d60921b604082015260600190565b600060208284031215613e7957600080fd5b61180382613bbf565b6000808335601e19843603018112613e9957600080fd5b8301803591506001600160401b03821115613eb357600080fd5b602001915036819003821315613de957600080fd5b634e487b7160e01b600052603260045260246000fd5b60006001600160801b0383811690831681811015613efe57613efe613d60565b039392505050565b60006001600160801b03828116848216808303821115613d9857613d98613d60565b6000600019821415613f3c57613f3c613d60565b5060010190565b60c0810163ffffffff613f5584613bbf565b168252613f6460208401613ae8565b6001600160401b03808216602085015280613f8160408701613ae8565b1660408501525050606083013560608301526080830135608083015260a083013560a083015292915050565b6000808335601e19843603018112613fc457600080fd5b8301803591506001600160401b03821115613fde57600080fd5b6020019150600681901b3603821315613de957600080fd5b60006040828403121561400857600080fd5b6118038383613a79565b60008282101561402457614024613d60565b500390565b600082601f83011261403a57600080fd5b604051604081018181106001600160401b038211171561405c5761405c613a0b565b806040525080604084018581111561407357600080fd5b845b8181101561408d578035835260209283019201614075565b509195945050505050565b6000608082840312156140aa57600080fd5b6140b2613a21565b6140bc8484614029565b81526140cb8460408501614029565b60208201529392505050565b60006001600160801b03828116848216811515828404821116156140fd576140fd613d60565b02949350505050565b634e487b7160e01b600052601260045260246000fd5b60006001600160801b038381168061413657614136614106565b92169190910492915050565b60006020808352608083016001600160401b038061415f87613ae8565b168386015261416f838701613ae8565b604082821681880152808801359150601e1988360301821261419057600080fd5b908701908135838111156141a357600080fd5b6060935083810236038913156141b857600080fd5b87840184905293849052908401926000919060a088015b8184101561420d578535815286860135878201526001600160801b036141f684880161384e565b1681840152948401946001939093019284016141cf565b9998505050505050505050565b60008261422957614229614106565b500690565b600081600019048311821515161561424857614248613d60565b500290565b6000821982111561426057614260613d60565b500190565b6020808252601a908201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604082015260600190565b634e487b7160e01b600052602160045260246000fd5b600060ff8316806142c5576142c5614106565b8060ff84160691505092915050565b600060ff821660ff8416808210156142ee576142ee613d60565b90039392505050565b60008261430657614306614106565b500490565b60006020828403121561431d57600080fd5b5051919050565b6020808252600e908201526d736c6963655f6f766572666c6f7760901b60408201526060019056feab40a374bc51de372200a8bc981af8c9ecdc08dfdaef0bb6e09f88f3c616ef3d30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47a264697066735822122088bae87d6bae274768571c4de75678f928a7db4743daddc1635592c48525276d64736f6c634300080c0033

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
[ 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.