ETH Price: $3,390.18 (-3.49%)
Gas: 0.06 GWei

Contract

0x5Cb18b6e4e6F3b46Ce646b0f4704D53724C5Df05

Overview

ETH Balance

Linea Mainnet LogoLinea Mainnet LogoLinea Mainnet Logo9,754.830210676362162478 ETH

ETH Value

$33,070,611.16 (@ $3,390.18/ETH)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Request L2Transa...58949262024-06-24 1:24:123 hrs ago1719192252IN
zkLink Nova: zkLink proxy contract
0.00090773 ETH0.000159361.5
Request L2Transa...58915992024-06-23 23:33:185 hrs ago1719185598IN
zkLink Nova: zkLink proxy contract
0.00110773 ETH0.000006370.06
Forward Request ...58904112024-06-23 22:53:425 hrs ago1719183222IN
zkLink Nova: zkLink proxy contract
0.00019454 ETH0.000019860.06984
Forward Request ...58902012024-06-23 22:46:425 hrs ago1719182802IN
zkLink Nova: zkLink proxy contract
0.00020152 ETH0.0000190.06984
Forward Request ...58896012024-06-23 22:26:426 hrs ago1719181602IN
zkLink Nova: zkLink proxy contract
0.00020899 ETH0.0000190.06984
Forward Request ...58892712024-06-23 22:15:426 hrs ago1719180942IN
zkLink Nova: zkLink proxy contract
0.00020598 ETH0.0000190.06984
Forward Request ...58867812024-06-23 20:52:427 hrs ago1719175962IN
zkLink Nova: zkLink proxy contract
0.00018791 ETH0.0000190.06984
Forward Request ...58844112024-06-23 19:33:429 hrs ago1719171222IN
zkLink Nova: zkLink proxy contract
0.00020899 ETH0.0000190.06984
Forward Request ...58843812024-06-23 19:32:429 hrs ago1719171162IN
zkLink Nova: zkLink proxy contract
0.00018902 ETH0.0000190.06984
Forward Request ...58833612024-06-23 18:58:429 hrs ago1719169122IN
zkLink Nova: zkLink proxy contract
0.0002015 ETH0.0000190.06984
Forward Request ...58824912024-06-23 18:29:4210 hrs ago1719167382IN
zkLink Nova: zkLink proxy contract
0.00019232 ETH0.000019860.06984
Forward Request ...58813212024-06-23 17:50:4210 hrs ago1719165042IN
zkLink Nova: zkLink proxy contract
0.00018791 ETH0.0000190.06984
Forward Request ...58811112024-06-23 17:43:4210 hrs ago1719164622IN
zkLink Nova: zkLink proxy contract
0.00018791 ETH0.0000190.06984
Forward Request ...58806312024-06-23 17:27:4211 hrs ago1719163662IN
zkLink Nova: zkLink proxy contract
0.00020899 ETH0.0000190.06984
Forward Request ...58798512024-06-23 17:01:4211 hrs ago1719162102IN
zkLink Nova: zkLink proxy contract
0.00020824 ETH0.000019860.06984
Forward Request ...58796422024-06-23 16:54:4411 hrs ago1719161684IN
zkLink Nova: zkLink proxy contract
0.00020748 ETH0.0000190.06984
Forward Request ...58795512024-06-23 16:51:4211 hrs ago1719161502IN
zkLink Nova: zkLink proxy contract
0.00019563 ETH0.000019860.06984
Request L2Transa...58792772024-06-23 16:42:3411 hrs ago1719160954IN
zkLink Nova: zkLink proxy contract
0.0001671 ETH0.000006580.062
Forward Request ...58787112024-06-23 16:23:4212 hrs ago1719159822IN
zkLink Nova: zkLink proxy contract
0.00020748 ETH0.0000190.06984
Forward Request ...58776012024-06-23 15:46:4212 hrs ago1719157602IN
zkLink Nova: zkLink proxy contract
0.00020748 ETH0.0000190.06984
Forward Request ...58773022024-06-23 15:36:4413 hrs ago1719157004IN
zkLink Nova: zkLink proxy contract
0.00030765 ETH0.000019860.06984
Forward Request ...58772412024-06-23 15:34:4213 hrs ago1719156882IN
zkLink Nova: zkLink proxy contract
0.00020899 ETH0.0000190.06984
Forward Request ...58766712024-06-23 15:15:4213 hrs ago1719155742IN
zkLink Nova: zkLink proxy contract
0.00020899 ETH0.0000190.06984
Forward Request ...58764022024-06-23 15:06:4413 hrs ago1719155204IN
zkLink Nova: zkLink proxy contract
0.00019122 ETH0.000019860.06984
Forward Request ...58761612024-06-23 14:58:4213 hrs ago1719154722IN
zkLink Nova: zkLink proxy contract
0.00018791 ETH0.0000190.06984
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To Value
59006472024-06-24 4:34:543 mins ago1719203694
zkLink Nova: zkLink proxy contract
0 ETH
59006472024-06-24 4:34:543 mins ago1719203694
zkLink Nova: zkLink proxy contract
0 ETH
59004942024-06-24 4:29:488 mins ago1719203388
zkLink Nova: zkLink proxy contract
0 ETH
59004942024-06-24 4:29:488 mins ago1719203388
zkLink Nova: zkLink proxy contract
0 ETH
59004942024-06-24 4:29:488 mins ago1719203388
zkLink Nova: zkLink proxy contract
0 ETH
59004942024-06-24 4:29:488 mins ago1719203388
zkLink Nova: zkLink proxy contract
0 ETH
59004942024-06-24 4:29:488 mins ago1719203388
zkLink Nova: zkLink proxy contract
0 ETH
59004942024-06-24 4:29:488 mins ago1719203388
zkLink Nova: zkLink proxy contract
0 ETH
59004942024-06-24 4:29:488 mins ago1719203388
zkLink Nova: zkLink proxy contract
0 ETH
59004942024-06-24 4:29:488 mins ago1719203388
zkLink Nova: zkLink proxy contract
0 ETH
59004942024-06-24 4:29:488 mins ago1719203388
zkLink Nova: zkLink proxy contract
0 ETH
59004942024-06-24 4:29:488 mins ago1719203388
zkLink Nova: zkLink proxy contract
0 ETH
59004942024-06-24 4:29:488 mins ago1719203388
zkLink Nova: zkLink proxy contract
0 ETH
59004942024-06-24 4:29:488 mins ago1719203388
zkLink Nova: zkLink proxy contract
0 ETH
59004942024-06-24 4:29:488 mins ago1719203388
zkLink Nova: zkLink proxy contract
0 ETH
59004942024-06-24 4:29:488 mins ago1719203388
zkLink Nova: zkLink proxy contract
0 ETH
59004942024-06-24 4:29:488 mins ago1719203388
zkLink Nova: zkLink proxy contract
0 ETH
59004942024-06-24 4:29:488 mins ago1719203388
zkLink Nova: zkLink proxy contract
0 ETH
59004892024-06-24 4:29:388 mins ago1719203378
zkLink Nova: zkLink proxy contract
0 ETH
59004892024-06-24 4:29:388 mins ago1719203378
zkLink Nova: zkLink proxy contract
0 ETH
59004892024-06-24 4:29:388 mins ago1719203378
zkLink Nova: zkLink proxy contract
0 ETH
59004892024-06-24 4:29:388 mins ago1719203378
zkLink Nova: zkLink proxy contract
0 ETH
59004892024-06-24 4:29:388 mins ago1719203378
zkLink Nova: zkLink proxy contract
0 ETH
59004892024-06-24 4:29:388 mins ago1719203378
zkLink Nova: zkLink proxy contract
0 ETH
59004892024-06-24 4:29:388 mins ago1719203378
zkLink Nova: zkLink proxy contract
0 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DiamondProxy

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 9999999 runs

Other Settings:
default evmVersion
File 1 of 4 : DiamondProxy.sol
pragma solidity 0.8.19;

// SPDX-License-Identifier: MIT



import {Diamond} from "./libraries/Diamond.sol";

/// @title Diamond Proxy Contract (EIP-2535)
/// @author Matter Labs
/// @custom:security-contact [email protected]
contract DiamondProxy {
    constructor(uint256 _chainId, Diamond.DiamondCutData memory _diamondCut) {
        // Check that the contract is deployed on the expected chain.
        // Thus, the contract deployed by the same Create2 factory on the different chain will have different addresses!
        require(_chainId == block.chainid, "pr");
        Diamond.diamondCut(_diamondCut);
    }

    /// @dev 1. Find the facet for the function that is called.
    /// @dev 2. Delegate the execution to the found facet via `delegatecall`.
    fallback() external payable {
        Diamond.DiamondStorage storage diamondStorage = Diamond.getDiamondStorage();
        // Check whether the data contains a "full" selector or it is empty.
        // Required because Diamond proxy finds a facet by function signature,
        // which is not defined for data length in range [1, 3].
        require(msg.data.length >= 4 || msg.data.length == 0, "Ut");
        // Get facet from function selector
        Diamond.SelectorToFacet memory facet = diamondStorage.selectorToFacet[msg.sig];
        address facetAddress = facet.facetAddress;

        require(facetAddress != address(0), "F"); // Proxy has no facet for this selector
        require(!diamondStorage.isFrozen || !facet.isFreezable, "q1"); // Facet is frozen

        assembly {
            // The pointer to the free memory slot
            let ptr := mload(0x40)
            // Copy function signature and arguments from calldata at zero position into memory at pointer position
            calldatacopy(ptr, 0, calldatasize())
            // Delegatecall method of the implementation contract returns 0 on error
            let result := delegatecall(gas(), facetAddress, ptr, calldatasize(), 0, 0)
            // Get the size of the last return data
            let size := returndatasize()
            // Copy the size length of bytes from return data at zero position to pointer position
            returndatacopy(ptr, 0, size)
            // Depending on the result value
            switch result
            case 0 {
                // End execution and revert state changes
                revert(ptr, size)
            }
            default {
                // Return data with length of size at pointers position
                return(ptr, size)
            }
        }
    }
}

File 2 of 4 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {
    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.2._
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v2.5._
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.2._
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v2.5._
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v2.5._
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v2.5._
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v2.5._
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     *
     * _Available since v3.0._
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.7._
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.7._
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     *
     * _Available since v3.0._
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

File 3 of 4 : UncheckedMath.sol
pragma solidity 0.8.19;

// SPDX-License-Identifier: MIT



/**
 * @author Matter Labs
 * @custom:security-contact [email protected]
 * @notice The library for unchecked math.
 */
library UncheckedMath {
    function uncheckedInc(uint256 _number) internal pure returns (uint256) {
        unchecked {
            return _number + 1;
        }
    }

    function uncheckedAdd(uint256 _lhs, uint256 _rhs) internal pure returns (uint256) {
        unchecked {
            return _lhs + _rhs;
        }
    }
}

File 4 of 4 : Diamond.sol
pragma solidity 0.8.19;

// SPDX-License-Identifier: MIT



import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
import {UncheckedMath} from "../../common/libraries/UncheckedMath.sol";

/// @author Matter Labs
/// @custom:security-contact [email protected]
/// @notice The helper library for managing the EIP-2535 diamond proxy.
library Diamond {
    using UncheckedMath for uint256;
    using SafeCast for uint256;

    /// @dev Magic value that should be returned by diamond cut initialize contracts.
    /// @dev Used to distinguish calls to contracts that were supposed to be used as diamond initializer from other contracts.
    bytes32 internal constant DIAMOND_INIT_SUCCESS_RETURN_VALUE =
        0x33774e659306e47509050e97cb651e731180a42d458212294d30751925c551a2; // keccak256("diamond.zksync.init") - 1

    /// @dev Storage position of `DiamondStorage` structure.
    bytes32 private constant DIAMOND_STORAGE_POSITION =
        0xc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131b; // keccak256("diamond.standard.diamond.storage") - 1;

    event DiamondCut(FacetCut[] facetCuts, address initAddress, bytes initCalldata);

    /// @dev Utility struct that contains associated facet & meta information of selector
    /// @param facetAddress address of the facet which is connected with selector
    /// @param selectorPosition index in `FacetToSelectors.selectors` array, where is selector stored
    /// @param isFreezable denotes whether the selector can be frozen.
    struct SelectorToFacet {
        address facetAddress;
        uint16 selectorPosition;
        bool isFreezable;
    }

    /// @dev Utility struct that contains associated selectors & meta information of facet
    /// @param selectors list of all selectors that belong to the facet
    /// @param facetPosition index in `DiamondStorage.facets` array, where is facet stored
    struct FacetToSelectors {
        bytes4[] selectors;
        uint16 facetPosition;
    }

    /// @notice The structure that holds all diamond proxy associated parameters
    /// @dev According to the EIP-2535 should be stored on a special storage key - `DIAMOND_STORAGE_POSITION`
    /// @param selectorToFacet A mapping from the selector to the facet address and its meta information
    /// @param facetToSelectors A mapping from facet address to its selectors with meta information
    /// @param facets The array of all unique facet addresses that belong to the diamond proxy
    /// @param isFrozen Denotes whether the diamond proxy is frozen and all freezable facets are not accessible
    struct DiamondStorage {
        mapping(bytes4 selector => SelectorToFacet selectorInfo) selectorToFacet;
        mapping(address facetAddress => FacetToSelectors facetInfo) facetToSelectors;
        address[] facets;
        bool isFrozen;
    }

    /// @dev Parameters for diamond changes that touch one of the facets
    /// @param facet The address of facet that's affected by the cut
    /// @param action The action that is made on the facet
    /// @param isFreezable Denotes whether the facet & all their selectors can be frozen
    /// @param selectors An array of unique selectors that belongs to the facet address
    struct FacetCut {
        address facet;
        Action action;
        bool isFreezable;
        bytes4[] selectors;
    }

    /// @dev Structure of the diamond proxy changes
    /// @param facetCuts The set of changes (adding/removing/replacement) of implementation contracts
    /// @param initAddress The address that's delegate called after setting up new facet changes
    /// @param initCalldata Calldata for the delegate call to `initAddress`
    struct DiamondCutData {
        FacetCut[] facetCuts;
        address initAddress;
        bytes initCalldata;
    }

    /// @dev Type of change over diamond: add/replace/remove facets
    enum Action {
        Add,
        Replace,
        Remove
    }

    /// @return diamondStorage The pointer to the storage where all specific diamond proxy parameters stored
    function getDiamondStorage() internal pure returns (DiamondStorage storage diamondStorage) {
        bytes32 position = DIAMOND_STORAGE_POSITION;
        assembly {
            diamondStorage.slot := position
        }
    }

    /// @dev Add/replace/remove any number of selectors and optionally execute a function with delegatecall
    /// @param _diamondCut Diamond's facet changes and the parameters to optional initialization delegatecall
    function diamondCut(DiamondCutData memory _diamondCut) internal {
        FacetCut[] memory facetCuts = _diamondCut.facetCuts;
        address initAddress = _diamondCut.initAddress;
        bytes memory initCalldata = _diamondCut.initCalldata;
        uint256 facetCutsLength = facetCuts.length;
        for (uint256 i = 0; i < facetCutsLength; i = i.uncheckedInc()) {
            Action action = facetCuts[i].action;
            address facet = facetCuts[i].facet;
            bool isFacetFreezable = facetCuts[i].isFreezable;
            bytes4[] memory selectors = facetCuts[i].selectors;

            require(selectors.length > 0, "B"); // no functions for diamond cut

            if (action == Action.Add) {
                _addFunctions(facet, selectors, isFacetFreezable);
            } else if (action == Action.Replace) {
                _replaceFunctions(facet, selectors, isFacetFreezable);
            } else if (action == Action.Remove) {
                _removeFunctions(facet, selectors);
            } else {
                revert("C"); // undefined diamond cut action
            }
        }

        _initializeDiamondCut(initAddress, initCalldata);
        emit DiamondCut(facetCuts, initAddress, initCalldata);
    }

    /// @dev Add new functions to the diamond proxy
    /// NOTE: expect but NOT enforce that `_selectors` is NON-EMPTY array
    function _addFunctions(address _facet, bytes4[] memory _selectors, bool _isFacetFreezable) private {
        DiamondStorage storage ds = getDiamondStorage();

        // Facet with no code cannot be added.
        // This check also verifies that the facet does not have zero address, since it is the
        // address with which 0x00000000 selector is associated.
        require(_facet.code.length > 0, "G");

        // Add facet to the list of facets if the facet address is new one
        _saveFacetIfNew(_facet);

        uint256 selectorsLength = _selectors.length;
        for (uint256 i = 0; i < selectorsLength; i = i.uncheckedInc()) {
            bytes4 selector = _selectors[i];
            SelectorToFacet memory oldFacet = ds.selectorToFacet[selector];
            require(oldFacet.facetAddress == address(0), "J"); // facet for this selector already exists

            _addOneFunction(_facet, selector, _isFacetFreezable);
        }
    }

    /// @dev Change associated facets to already known function selectors
    /// NOTE: expect but NOT enforce that `_selectors` is NON-EMPTY array
    function _replaceFunctions(address _facet, bytes4[] memory _selectors, bool _isFacetFreezable) private {
        DiamondStorage storage ds = getDiamondStorage();

        // Facet with no code cannot be added.
        // This check also verifies that the facet does not have zero address, since it is the
        // address with which 0x00000000 selector is associated.
        require(_facet.code.length > 0, "K");

        uint256 selectorsLength = _selectors.length;
        for (uint256 i = 0; i < selectorsLength; i = i.uncheckedInc()) {
            bytes4 selector = _selectors[i];
            SelectorToFacet memory oldFacet = ds.selectorToFacet[selector];
            require(oldFacet.facetAddress != address(0), "L"); // it is impossible to replace the facet with zero address

            _removeOneFunction(oldFacet.facetAddress, selector);
            // Add facet to the list of facets if the facet address is a new one
            _saveFacetIfNew(_facet);
            _addOneFunction(_facet, selector, _isFacetFreezable);
        }
    }

    /// @dev Remove association with function and facet
    /// NOTE: expect but NOT enforce that `_selectors` is NON-EMPTY array
    function _removeFunctions(address _facet, bytes4[] memory _selectors) private {
        DiamondStorage storage ds = getDiamondStorage();

        require(_facet == address(0), "a1"); // facet address must be zero

        uint256 selectorsLength = _selectors.length;
        for (uint256 i = 0; i < selectorsLength; i = i.uncheckedInc()) {
            bytes4 selector = _selectors[i];
            SelectorToFacet memory oldFacet = ds.selectorToFacet[selector];
            require(oldFacet.facetAddress != address(0), "a2"); // Can't delete a non-existent facet

            _removeOneFunction(oldFacet.facetAddress, selector);
        }
    }

    /// @dev Add address to the list of known facets if it is not on the list yet
    /// NOTE: should be called ONLY before adding a new selector associated with the address
    function _saveFacetIfNew(address _facet) private {
        DiamondStorage storage ds = getDiamondStorage();

        uint256 selectorsLength = ds.facetToSelectors[_facet].selectors.length;
        // If there are no selectors associated with facet then save facet as new one
        if (selectorsLength == 0) {
            ds.facetToSelectors[_facet].facetPosition = ds.facets.length.toUint16();
            ds.facets.push(_facet);
        }
    }

    /// @dev Add one function to the already known facet
    /// NOTE: It is expected but NOT enforced that:
    /// - `_facet` is NON-ZERO address
    /// - `_facet` is already stored address in `DiamondStorage.facets`
    /// - `_selector` is NOT associated by another facet
    function _addOneFunction(address _facet, bytes4 _selector, bool _isSelectorFreezable) private {
        DiamondStorage storage ds = getDiamondStorage();

        uint16 selectorPosition = (ds.facetToSelectors[_facet].selectors.length).toUint16();

        // if selectorPosition is nonzero, it means it is not a new facet
        // so the freezability of the first selector must be matched to _isSelectorFreezable
        // so all the selectors in a facet will have the same freezability
        if (selectorPosition != 0) {
            bytes4 selector0 = ds.facetToSelectors[_facet].selectors[0];
            require(_isSelectorFreezable == ds.selectorToFacet[selector0].isFreezable, "J1");
        }

        ds.selectorToFacet[_selector] = SelectorToFacet({
            facetAddress: _facet,
            selectorPosition: selectorPosition,
            isFreezable: _isSelectorFreezable
        });
        ds.facetToSelectors[_facet].selectors.push(_selector);
    }

    /// @dev Remove one associated function with facet
    /// NOTE: It is expected but NOT enforced that `_facet` is NON-ZERO address
    function _removeOneFunction(address _facet, bytes4 _selector) private {
        DiamondStorage storage ds = getDiamondStorage();

        // Get index of `FacetToSelectors.selectors` of the selector and last element of array
        uint256 selectorPosition = ds.selectorToFacet[_selector].selectorPosition;
        uint256 lastSelectorPosition = ds.facetToSelectors[_facet].selectors.length - 1;

        // If the selector is not at the end of the array then move the last element to the selector position
        if (selectorPosition != lastSelectorPosition) {
            bytes4 lastSelector = ds.facetToSelectors[_facet].selectors[lastSelectorPosition];

            ds.facetToSelectors[_facet].selectors[selectorPosition] = lastSelector;
            ds.selectorToFacet[lastSelector].selectorPosition = selectorPosition.toUint16();
        }

        // Remove last element from the selectors array
        ds.facetToSelectors[_facet].selectors.pop();

        // Finally, clean up the association with facet
        delete ds.selectorToFacet[_selector];

        // If there are no selectors for facet then remove the facet from the list of known facets
        if (lastSelectorPosition == 0) {
            _removeFacet(_facet);
        }
    }

    /// @dev remove facet from the list of known facets
    /// NOTE: It is expected but NOT enforced that there are no selectors associated with `_facet`
    function _removeFacet(address _facet) private {
        DiamondStorage storage ds = getDiamondStorage();

        // Get index of `DiamondStorage.facets` of the facet and last element of array
        uint256 facetPosition = ds.facetToSelectors[_facet].facetPosition;
        uint256 lastFacetPosition = ds.facets.length - 1;

        // If the facet is not at the end of the array then move the last element to the facet position
        if (facetPosition != lastFacetPosition) {
            address lastFacet = ds.facets[lastFacetPosition];

            ds.facets[facetPosition] = lastFacet;
            ds.facetToSelectors[lastFacet].facetPosition = facetPosition.toUint16();
        }

        // Remove last element from the facets array
        ds.facets.pop();
    }

    /// @dev Delegates call to the initialization address with provided calldata
    /// @dev Used as a final step of diamond cut to execute the logic of the initialization for changed facets
    function _initializeDiamondCut(address _init, bytes memory _calldata) private {
        if (_init == address(0)) {
            require(_calldata.length == 0, "H"); // Non-empty calldata for zero address
        } else {
            // Do not check whether `_init` is a contract since later we check that it returns data.
            (bool success, bytes memory data) = _init.delegatecall(_calldata);
            if (!success) {
                // If the returndata is too small, we still want to produce some meaningful error
                if (data.length <= 4) {
                    revert("I"); // delegatecall failed
                }

                assembly {
                    revert(add(data, 0x20), mload(data))
                }
            }

            // Check that called contract returns magic value to make sure that contract logic
            // supposed to be used as diamond cut initializer.
            require(data.length == 32, "lp");
            require(abi.decode(data, (bytes32)) == DIAMOND_INIT_SUCCESS_RETURN_VALUE, "lp1");
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_chainId","type":"uint256"},{"components":[{"components":[{"internalType":"address","name":"facet","type":"address"},{"internalType":"enum Diamond.Action","name":"action","type":"uint8"},{"internalType":"bool","name":"isFreezable","type":"bool"},{"internalType":"bytes4[]","name":"selectors","type":"bytes4[]"}],"internalType":"struct Diamond.FacetCut[]","name":"facetCuts","type":"tuple[]"},{"internalType":"address","name":"initAddress","type":"address"},{"internalType":"bytes","name":"initCalldata","type":"bytes"}],"internalType":"struct Diamond.DiamondCutData","name":"_diamondCut","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"payable","type":"fallback"}]

60806040523480156200001157600080fd5b506040516200167338038062001673833981016040819052620000349162001015565b4682146200006e5760405162461bcd60e51b8152602060048201526002602482015261383960f11b60448201526064015b60405180910390fd5b620000798162000081565b5050620013a7565b805160208201516040830151825160005b8181101562000233576000858281518110620000b257620000b2620011c6565b60200260200101516020015190506000868381518110620000d757620000d7620011c6565b60200260200101516000015190506000878481518110620000fc57620000fc620011c6565b60200260200101516040015190506000888581518110620001215762000121620011c6565b60200260200101516060015190506000815111620001665760405162461bcd60e51b81526020600482015260016024820152602160f91b604482015260640162000065565b60008460028111156200017d576200017d620011dc565b0362000196576200019083828462000284565b62000216565b6001846002811115620001ad57620001ad620011dc565b03620001c05762000190838284620003b9565b6002846002811115620001d757620001d7620011dc565b03620001e957620001908382620004f3565b60405162461bcd60e51b81526020600482015260016024820152604360f81b604482015260640162000065565b505050506200022b816200061e60201b60201c565b905062000092565b5062000240838362000624565b7f87b829356b3403d36217eff1f66ee48eacd0a69015153aba4f0de29fe5340c30848484604051620002759392919062001220565b60405180910390a15050505050565b600080516020620016538339815191526001600160a01b0384163b620002d15760405162461bcd60e51b81526020600482015260016024820152604760f81b604482015260640162000065565b620002dc84620007c2565b825160005b81811015620003b1576000858281518110620003015762000301620011c6565b6020908102919091018101516001600160e01b031981166000908152868352604090819020815160608101835290546001600160a01b038116808352600160a01b820461ffff1695830195909552600160b01b900460ff161515918101919091529092509015620003995760405162461bcd60e51b81526020600482015260016024820152602560f91b604482015260640162000065565b620003a688838862000870565b5050600101620002e1565b505050505050565b600080516020620016538339815191526001600160a01b0384163b620004065760405162461bcd60e51b81526020600482015260016024820152604b60f81b604482015260640162000065565b825160005b81811015620003b15760008582815181106200042b576200042b620011c6565b6020908102919091018101516001600160e01b031981166000908152868352604090819020815160608101835290546001600160a01b038116808352600160a01b820461ffff1695830195909552600160b01b900460ff1615159181019190915290925090620004c25760405162461bcd60e51b81526020600482015260016024820152601360fa1b604482015260640162000065565b8051620004d0908362000a39565b620004db88620007c2565b620004e888838862000870565b50506001016200040b565b600080516020620016538339815191526001600160a01b03831615620005415760405162461bcd60e51b8152602060048201526002602482015261613160f01b604482015260640162000065565b815160005b8181101562000617576000848281518110620005665762000566620011c6565b6020908102919091018101516001600160e01b031981166000908152868352604090819020815160608101835290546001600160a01b038116808352600160a01b820461ffff1695830195909552600160b01b900460ff1615159181019190915290925090620005fe5760405162461bcd60e51b8152602060048201526002602482015261309960f11b604482015260640162000065565b80516200060c908362000a39565b505060010162000546565b5050505050565b60010190565b6001600160a01b0382166200066c57805115620006685760405162461bcd60e51b81526020600482015260016024820152600960fb1b604482015260640162000065565b5050565b600080836001600160a01b03168360405162000689919062001331565b600060405180830381855af49150503d8060008114620006c6576040519150601f19603f3d011682016040523d82523d6000602084013e620006cb565b606091505b509150915081620007155760048151116200070d5760405162461bcd60e51b81526020600482015260016024820152604960f81b604482015260640162000065565b805160208201fd5b80516020146200074d5760405162461bcd60e51b815260206004820152600260248201526106c760f41b604482015260640162000065565b7f33774e659306e47509050e97cb651e731180a42d458212294d30751925c551a260001b818060200190518101906200078791906200134f565b14620007bc5760405162461bcd60e51b81526020600482015260036024820152626c703160e81b604482015260640162000065565b50505050565b6001600160a01b038116600090815260008051602062001633833981519152602052604081205460008051602062001653833981519152918190036200086b576002820154620008129062000c3d565b6001600160a01b038416600081815260018581016020908152604083208201805461ffff191661ffff96909616959095179094556002860180549182018155825292902090910180546001600160a01b03191690911790555b505050565b6001600160a01b0383166000908152600080516020620016338339815191526020526040812054600080516020620016538339815191529190620008b49062000c3d565b905061ffff8116156200096f576001600160a01b0385166000908152600183016020526040812080548290620008ee57620008ee620011c6565b6000918252602080832060088304015460079092166004026101000a90910460e01b6001600160e01b03198116835290859052604090912054909150600160b01b900460ff161515841515146200096d5760405162461bcd60e51b81526020600482015260026024820152614a3160f01b604482015260640162000065565b505b604080516060810182526001600160a01b0396871680825261ffff93841660208084019182529615158385019081526001600160e01b03198916600090815287895285812094518554935192519b166001600160b01b031990931692909217600160a01b91909616029490941760ff60b01b1916600160b01b981515989098029790971790559481526001918201835293842080549182018155845292206008830401805463ffffffff60079094166004026101000a938402191660e09290921c92909202179055565b6001600160e01b0319811660009081526000805160206200165383398151915260208181526040808420546001600160a01b0387168552600080516020620016338339815191529092528320549192600160a01b90910461ffff169162000aa39060019062001369565b905080821462000bab576001600160a01b0385166000908152600184016020526040812080548390811062000adc5762000adc620011c6565b600091825260208083206008830401546001600160a01b038a168452600188019091526040909220805460079092166004026101000a90920460e01b92508291908590811062000b305762000b30620011c6565b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908360e01c021790555062000b718362000c3d60201b60201c565b6001600160e01b03199091166000908152602085905260409020805461ffff92909216600160a01b0261ffff60a01b199092169190911790555b6001600160a01b0385166000908152600184016020526040902080548062000bd75762000bd762001391565b60008281526020808220600860001990940193840401805463ffffffff600460078716026101000a0219169055919092556001600160e01b0319861682528490526040812080546001600160b81b03191690558190036200061757620006178562000ca6565b600061ffff82111562000ca25760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201526536206269747360d01b606482015260840162000065565b5090565b6001600160a01b038116600090815260008051602062001633833981519152602052604081206001908101547fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131d54600080516020620016538339815191529361ffff9092169262000d179162001369565b905080821462000dd657600083600201828154811062000d3b5762000d3b620011c6565b6000918252602090912001546002850180546001600160a01b03909216925082918590811062000d6f5762000d6f620011c6565b600091825260209091200180546001600160a01b0319166001600160a01b039290921691909117905562000da38362000c3d565b6001600160a01b039190911660009081526001858101602052604090912001805461ffff191661ffff9092169190911790555b8260020180548062000dec5762000dec62001391565b600082815260209020810160001990810180546001600160a01b031916905501905550505050565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b038111828210171562000e4f5762000e4f62000e14565b60405290565b604051608081016001600160401b038111828210171562000e4f5762000e4f62000e14565b604051601f8201601f191681016001600160401b038111828210171562000ea55762000ea562000e14565b604052919050565b60006001600160401b0382111562000ec95762000ec962000e14565b5060051b60200190565b80516001600160a01b038116811462000eeb57600080fd5b919050565b600082601f83011262000f0257600080fd5b8151602062000f1b62000f158362000ead565b62000e7a565b82815260059290921b8401810191818101908684111562000f3b57600080fd5b8286015b8481101562000f705780516001600160e01b03198116811462000f625760008081fd5b835291830191830162000f3f565b509695505050505050565b60005b8381101562000f9857818101518382015260200162000f7e565b50506000910152565b600082601f83011262000fb357600080fd5b81516001600160401b0381111562000fcf5762000fcf62000e14565b62000fe4601f8201601f191660200162000e7a565b81815284602083860101111562000ffa57600080fd5b6200100d82602083016020870162000f7b565b949350505050565b600080604083850312156200102957600080fd5b825160208401519092506001600160401b03808211156200104957600080fd5b90840190606082870312156200105e57600080fd5b6200106862000e2a565b8251828111156200107857600080fd5b8301601f810188136200108a57600080fd5b80516200109b62000f158262000ead565b8082825260208201915060208360051b85010192508a831115620010be57600080fd5b602084015b838110156200117857805187811115620010dc57600080fd5b85016080818e03601f19011215620010f357600080fd5b620010fd62000e55565b6200110b6020830162000ed3565b81526040820151600381106200112057600080fd5b6020820152606082015180151581146200113957600080fd5b60408201526080820151898111156200115157600080fd5b620011628f60208386010162000ef0565b60608301525084525060209283019201620010c3565b508452506200118d9150506020840162000ed3565b6020820152604083015182811115620011a557600080fd5b620011b38882860162000fa1565b6040830152508093505050509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b600081518084526200120c81602086016020860162000f7b565b601f01601f19169290920160200192915050565b60006060808301818452808751808352608092508286019150828160051b8701016020808b0160005b84811015620012ff57898403607f19018652815180516001600160a01b031685528381015188860190600381106200129157634e487b7160e01b600052602160045260246000fd5b868601526040828101511515908701529089015189860189905280519182905284019060009060a08701905b80831015620012e95783516001600160e01b0319168252928601926001929092019190860190620012bd565b5097850197955050509082019060010162001249565b50506001600160a01b038a16908801528681036040880152620013238189620011f2565b9a9950505050505050505050565b600082516200134581846020870162000f7b565b9190910192915050565b6000602082840312156200136257600080fd5b5051919050565b818103818111156200138b57634e487b7160e01b600052601160045260246000fd5b92915050565b634e487b7160e01b600052603160045260246000fd5b61027c80620013b76000396000f3fe60806040527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131b600436101580610033575036155b61009e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f557400000000000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b600080357fffffffff0000000000000000000000000000000000000000000000000000000016815260208281526040918290208251606081018452905473ffffffffffffffffffffffffffffffffffffffff811680835274010000000000000000000000000000000000000000820461ffff1693830193909352760100000000000000000000000000000000000000000000900460ff16151592810192909252806101a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f46000000000000000000000000000000000000000000000000000000000000006044820152606401610095565b600383015460ff1615806101bb57508160400151155b610221576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f71310000000000000000000000000000000000000000000000000000000000006044820152606401610095565b60405136600082376000803683855af43d806000843e818015610242578184f35b8184fdfea26469706673582212202993da30391fbf6c9994175628242986951ce631872e84129cec8d097607a34264736f6c63430008130033c8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131cc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131b000000000000000000000000000000000000000000000000000000000000e708000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000600000000000000000000000002648175aa1f56ac55024748eeca80fdcb01a6d3e0000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000073b076425025a3bf059001d5be0e21384c8cf049000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000d0e18b68100000000000000000000000000000000000000000000000000000000e58bb6390000000000000000000000000000000000000000000000000000000064bf8d6600000000000000000000000000000000000000000000000000000000a9f6d9410000000000000000000000000000000000000000000000000000000027ae4c160000000000000000000000000000000000000000000000000000000090646b4a000000000000000000000000000000000000000000000000000000004dd18bf500000000000000000000000000000000000000000000000000000000f235757f000000000000000000000000000000000000000000000000000000001cc5d10300000000000000000000000000000000000000000000000000000000be6f11cf0000000000000000000000000000000000000000000000000000000019b25add000000000000000000000000000000000000000000000000000000004623c91d000000000000000000000000000000000000000000000000000000001733894500000000000000000000000000000000000000000000000000000000000000000000000000000000fe3eb2e5afaa936093c0dd2db8898f4a2643ffe00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000026cdffacc60000000000000000000000000000000000000000000000000000000052ef6b2c00000000000000000000000000000000000000000000000000000000adfca15e000000000000000000000000000000000000000000000000000000007a0ed62700000000000000000000000000000000000000000000000000000000c93739360000000000000000000000000000000000000000000000000000000079823c9a0000000000000000000000000000000000000000000000000000000042bf3cc1000000000000000000000000000000000000000000000000000000004fc07d7500000000000000000000000000000000000000000000000000000000d86970d800000000000000000000000000000000000000000000000000000000fd791f3c00000000000000000000000000000000000000000000000000000000e5355c75000000000000000000000000000000000000000000000000000000009d1b5a81000000000000000000000000000000000000000000000000000000007b30c8da000000000000000000000000000000000000000000000000000000008665b15000000000000000000000000000000000000000000000000000000000631f4bac000000000000000000000000000000000000000000000000000000000ec6b0b70000000000000000000000000000000000000000000000000000000033ce93fe00000000000000000000000000000000000000000000000000000000dd0994050000000000000000000000000000000000000000000000000000000051ccde9f00000000000000000000000000000000000000000000000000000000538cebc300000000000000000000000000000000000000000000000000000000db1f0bf900000000000000000000000000000000000000000000000000000000b8c2f66f00000000000000000000000000000000000000000000000000000000ef3f0bae00000000000000000000000000000000000000000000000000000000fe26699e000000000000000000000000000000000000000000000000000000003960738200000000000000000000000000000000000000000000000000000000af6a2dcd00000000000000000000000000000000000000000000000000000000a1954fc50000000000000000000000000000000000000000000000000000000046657fe90000000000000000000000000000000000000000000000000000000018e3a9410000000000000000000000000000000000000000000000000000000029b98c6700000000000000000000000000000000000000000000000000000000bd7c541200000000000000000000000000000000000000000000000000000000c3bbd2d700000000000000000000000000000000000000000000000000000000e81e0ba100000000000000000000000000000000000000000000000000000000facd743b000000000000000000000000000000000000000000000000000000009cd939e40000000000000000000000000000000000000000000000000000000056142d7a00000000000000000000000000000000000000000000000000000000b22dd78e0000000000000000000000000000000000000000000000000000000074f4d30d000000000000000000000000000000000000000000000000000000000000000000000000000000006052b353022da2c61a999bf081c349260de993af000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000a6c0960f900000000000000000000000000000000000000000000000000000000a01059a600000000000000000000000000000000000000000000000000000000b473318e00000000000000000000000000000000000000000000000000000000042901c700000000000000000000000000000000000000000000000000000000263b7f8e00000000000000000000000000000000000000000000000000000000e4948f4300000000000000000000000000000000000000000000000000000000eb672419000000000000000000000000000000000000000000000000000000001effb4b30000000000000000000000000000000000000000000000000000000018d0d57500000000000000000000000000000000000000000000000000000000b5ca74dc000000000000000000000000000000000000000000000000000000000000000000000000000000005e7077bf147fc1bb8f46039cc40bbd39f2ddfea00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000005701f58c500000000000000000000000000000000000000000000000000000000c3d93e7c000000000000000000000000000000000000000000000000000000006a74f6f5000000000000000000000000000000000000000000000000000000007f61885c0000000000000000000000000000000000000000000000000000000097c09d340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002847da889ed000000000000000000000000902c3806a84f4e855a8746e92d7f1c9a5140045800000000000000000000000034788df312acc671e62c9ab15523f7cdc4d29ba900000000000000000000000034788df312acc671e62c9ab15523f7cdc4d29ba9222883f3ab8722970c145b96ee10f801dadce5c6bd6b807def6ecd48f138346800000000000000000000000000000000000000000000000000000000000000192ea0ea1c5d1733a76f1c4f8757b71ced8aaf851ef1288ce2ca980c0a428fbadb5a3ef282b21e12fe1f4438e5bb158fc5060b160559c5158c6389d62d9fe3d080062362cb3eaf1f631406cbe19bf2a2c5d0d9ea69d069309a6003addae9f387be00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010007ed0e328b940e241f7666a6303b7ffd4e3fd7e8c154d6e7556befe6cd6d0100055b7a8be90522251be8be1a186464d056462973502ac8a0437c85e4d2a900000000000000000000000000000000000000000000000000000000044aa2000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f4240000000000000000000000000000000000000000000000000000000000001d4c00000000000000000000000000000000000000000000000000000000004c4b40000000000000000000000000000000000000000000000000000000000000182b8000000000000000000000000000000000000000000000000000000000ee6b28000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x60806040527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131b600436101580610033575036155b61009e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f557400000000000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b600080357fffffffff0000000000000000000000000000000000000000000000000000000016815260208281526040918290208251606081018452905473ffffffffffffffffffffffffffffffffffffffff811680835274010000000000000000000000000000000000000000820461ffff1693830193909352760100000000000000000000000000000000000000000000900460ff16151592810192909252806101a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f46000000000000000000000000000000000000000000000000000000000000006044820152606401610095565b600383015460ff1615806101bb57508160400151155b610221576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f71310000000000000000000000000000000000000000000000000000000000006044820152606401610095565b60405136600082376000803683855af43d806000843e818015610242578184f35b8184fdfea26469706673582212202993da30391fbf6c9994175628242986951ce631872e84129cec8d097607a34264736f6c63430008130033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000000000000000000000000000000000000000e708000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000600000000000000000000000002648175aa1f56ac55024748eeca80fdcb01a6d3e0000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000073b076425025a3bf059001d5be0e21384c8cf049000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000d0e18b68100000000000000000000000000000000000000000000000000000000e58bb6390000000000000000000000000000000000000000000000000000000064bf8d6600000000000000000000000000000000000000000000000000000000a9f6d9410000000000000000000000000000000000000000000000000000000027ae4c160000000000000000000000000000000000000000000000000000000090646b4a000000000000000000000000000000000000000000000000000000004dd18bf500000000000000000000000000000000000000000000000000000000f235757f000000000000000000000000000000000000000000000000000000001cc5d10300000000000000000000000000000000000000000000000000000000be6f11cf0000000000000000000000000000000000000000000000000000000019b25add000000000000000000000000000000000000000000000000000000004623c91d000000000000000000000000000000000000000000000000000000001733894500000000000000000000000000000000000000000000000000000000000000000000000000000000fe3eb2e5afaa936093c0dd2db8898f4a2643ffe00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000026cdffacc60000000000000000000000000000000000000000000000000000000052ef6b2c00000000000000000000000000000000000000000000000000000000adfca15e000000000000000000000000000000000000000000000000000000007a0ed62700000000000000000000000000000000000000000000000000000000c93739360000000000000000000000000000000000000000000000000000000079823c9a0000000000000000000000000000000000000000000000000000000042bf3cc1000000000000000000000000000000000000000000000000000000004fc07d7500000000000000000000000000000000000000000000000000000000d86970d800000000000000000000000000000000000000000000000000000000fd791f3c00000000000000000000000000000000000000000000000000000000e5355c75000000000000000000000000000000000000000000000000000000009d1b5a81000000000000000000000000000000000000000000000000000000007b30c8da000000000000000000000000000000000000000000000000000000008665b15000000000000000000000000000000000000000000000000000000000631f4bac000000000000000000000000000000000000000000000000000000000ec6b0b70000000000000000000000000000000000000000000000000000000033ce93fe00000000000000000000000000000000000000000000000000000000dd0994050000000000000000000000000000000000000000000000000000000051ccde9f00000000000000000000000000000000000000000000000000000000538cebc300000000000000000000000000000000000000000000000000000000db1f0bf900000000000000000000000000000000000000000000000000000000b8c2f66f00000000000000000000000000000000000000000000000000000000ef3f0bae00000000000000000000000000000000000000000000000000000000fe26699e000000000000000000000000000000000000000000000000000000003960738200000000000000000000000000000000000000000000000000000000af6a2dcd00000000000000000000000000000000000000000000000000000000a1954fc50000000000000000000000000000000000000000000000000000000046657fe90000000000000000000000000000000000000000000000000000000018e3a9410000000000000000000000000000000000000000000000000000000029b98c6700000000000000000000000000000000000000000000000000000000bd7c541200000000000000000000000000000000000000000000000000000000c3bbd2d700000000000000000000000000000000000000000000000000000000e81e0ba100000000000000000000000000000000000000000000000000000000facd743b000000000000000000000000000000000000000000000000000000009cd939e40000000000000000000000000000000000000000000000000000000056142d7a00000000000000000000000000000000000000000000000000000000b22dd78e0000000000000000000000000000000000000000000000000000000074f4d30d000000000000000000000000000000000000000000000000000000000000000000000000000000006052b353022da2c61a999bf081c349260de993af000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000a6c0960f900000000000000000000000000000000000000000000000000000000a01059a600000000000000000000000000000000000000000000000000000000b473318e00000000000000000000000000000000000000000000000000000000042901c700000000000000000000000000000000000000000000000000000000263b7f8e00000000000000000000000000000000000000000000000000000000e4948f4300000000000000000000000000000000000000000000000000000000eb672419000000000000000000000000000000000000000000000000000000001effb4b30000000000000000000000000000000000000000000000000000000018d0d57500000000000000000000000000000000000000000000000000000000b5ca74dc000000000000000000000000000000000000000000000000000000000000000000000000000000005e7077bf147fc1bb8f46039cc40bbd39f2ddfea00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000005701f58c500000000000000000000000000000000000000000000000000000000c3d93e7c000000000000000000000000000000000000000000000000000000006a74f6f5000000000000000000000000000000000000000000000000000000007f61885c0000000000000000000000000000000000000000000000000000000097c09d340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002847da889ed000000000000000000000000902c3806a84f4e855a8746e92d7f1c9a5140045800000000000000000000000034788df312acc671e62c9ab15523f7cdc4d29ba900000000000000000000000034788df312acc671e62c9ab15523f7cdc4d29ba9222883f3ab8722970c145b96ee10f801dadce5c6bd6b807def6ecd48f138346800000000000000000000000000000000000000000000000000000000000000192ea0ea1c5d1733a76f1c4f8757b71ced8aaf851ef1288ce2ca980c0a428fbadb5a3ef282b21e12fe1f4438e5bb158fc5060b160559c5158c6389d62d9fe3d080062362cb3eaf1f631406cbe19bf2a2c5d0d9ea69d069309a6003addae9f387be00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010007ed0e328b940e241f7666a6303b7ffd4e3fd7e8c154d6e7556befe6cd6d0100055b7a8be90522251be8be1a186464d056462973502ac8a0437c85e4d2a900000000000000000000000000000000000000000000000000000000044aa2000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f4240000000000000000000000000000000000000000000000000000000000001d4c00000000000000000000000000000000000000000000000000000000004c4b40000000000000000000000000000000000000000000000000000000000000182b8000000000000000000000000000000000000000000000000000000000ee6b28000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _chainId (uint256): 59144
Arg [1] : _diamondCut (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]

-----Encoded View---------------
118 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000000000000000000000000000e708
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [3] : 0000000000000000000000002648175aa1f56ac55024748eeca80fdcb01a6d3e
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000bc0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [7] : 00000000000000000000000000000000000000000000000000000000000002c0
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000820
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000a00
Arg [10] : 00000000000000000000000073b076425025a3bf059001d5be0e21384c8cf049
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [14] : 000000000000000000000000000000000000000000000000000000000000000d
Arg [15] : 0e18b68100000000000000000000000000000000000000000000000000000000
Arg [16] : e58bb63900000000000000000000000000000000000000000000000000000000
Arg [17] : 64bf8d6600000000000000000000000000000000000000000000000000000000
Arg [18] : a9f6d94100000000000000000000000000000000000000000000000000000000
Arg [19] : 27ae4c1600000000000000000000000000000000000000000000000000000000
Arg [20] : 90646b4a00000000000000000000000000000000000000000000000000000000
Arg [21] : 4dd18bf500000000000000000000000000000000000000000000000000000000
Arg [22] : f235757f00000000000000000000000000000000000000000000000000000000
Arg [23] : 1cc5d10300000000000000000000000000000000000000000000000000000000
Arg [24] : be6f11cf00000000000000000000000000000000000000000000000000000000
Arg [25] : 19b25add00000000000000000000000000000000000000000000000000000000
Arg [26] : 4623c91d00000000000000000000000000000000000000000000000000000000
Arg [27] : 1733894500000000000000000000000000000000000000000000000000000000
Arg [28] : 000000000000000000000000fe3eb2e5afaa936093c0dd2db8898f4a2643ffe0
Arg [29] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [30] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [31] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [32] : 0000000000000000000000000000000000000000000000000000000000000026
Arg [33] : cdffacc600000000000000000000000000000000000000000000000000000000
Arg [34] : 52ef6b2c00000000000000000000000000000000000000000000000000000000
Arg [35] : adfca15e00000000000000000000000000000000000000000000000000000000
Arg [36] : 7a0ed62700000000000000000000000000000000000000000000000000000000
Arg [37] : c937393600000000000000000000000000000000000000000000000000000000
Arg [38] : 79823c9a00000000000000000000000000000000000000000000000000000000
Arg [39] : 42bf3cc100000000000000000000000000000000000000000000000000000000
Arg [40] : 4fc07d7500000000000000000000000000000000000000000000000000000000
Arg [41] : d86970d800000000000000000000000000000000000000000000000000000000
Arg [42] : fd791f3c00000000000000000000000000000000000000000000000000000000
Arg [43] : e5355c7500000000000000000000000000000000000000000000000000000000
Arg [44] : 9d1b5a8100000000000000000000000000000000000000000000000000000000
Arg [45] : 7b30c8da00000000000000000000000000000000000000000000000000000000
Arg [46] : 8665b15000000000000000000000000000000000000000000000000000000000
Arg [47] : 631f4bac00000000000000000000000000000000000000000000000000000000
Arg [48] : 0ec6b0b700000000000000000000000000000000000000000000000000000000
Arg [49] : 33ce93fe00000000000000000000000000000000000000000000000000000000
Arg [50] : dd09940500000000000000000000000000000000000000000000000000000000
Arg [51] : 51ccde9f00000000000000000000000000000000000000000000000000000000
Arg [52] : 538cebc300000000000000000000000000000000000000000000000000000000
Arg [53] : db1f0bf900000000000000000000000000000000000000000000000000000000
Arg [54] : b8c2f66f00000000000000000000000000000000000000000000000000000000
Arg [55] : ef3f0bae00000000000000000000000000000000000000000000000000000000
Arg [56] : fe26699e00000000000000000000000000000000000000000000000000000000
Arg [57] : 3960738200000000000000000000000000000000000000000000000000000000
Arg [58] : af6a2dcd00000000000000000000000000000000000000000000000000000000
Arg [59] : a1954fc500000000000000000000000000000000000000000000000000000000
Arg [60] : 46657fe900000000000000000000000000000000000000000000000000000000
Arg [61] : 18e3a94100000000000000000000000000000000000000000000000000000000
Arg [62] : 29b98c6700000000000000000000000000000000000000000000000000000000
Arg [63] : bd7c541200000000000000000000000000000000000000000000000000000000
Arg [64] : c3bbd2d700000000000000000000000000000000000000000000000000000000
Arg [65] : e81e0ba100000000000000000000000000000000000000000000000000000000
Arg [66] : facd743b00000000000000000000000000000000000000000000000000000000
Arg [67] : 9cd939e400000000000000000000000000000000000000000000000000000000
Arg [68] : 56142d7a00000000000000000000000000000000000000000000000000000000
Arg [69] : b22dd78e00000000000000000000000000000000000000000000000000000000
Arg [70] : 74f4d30d00000000000000000000000000000000000000000000000000000000
Arg [71] : 0000000000000000000000006052b353022da2c61a999bf081c349260de993af
Arg [72] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [73] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [74] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [75] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [76] : 6c0960f900000000000000000000000000000000000000000000000000000000
Arg [77] : a01059a600000000000000000000000000000000000000000000000000000000
Arg [78] : b473318e00000000000000000000000000000000000000000000000000000000
Arg [79] : 042901c700000000000000000000000000000000000000000000000000000000
Arg [80] : 263b7f8e00000000000000000000000000000000000000000000000000000000
Arg [81] : e4948f4300000000000000000000000000000000000000000000000000000000
Arg [82] : eb67241900000000000000000000000000000000000000000000000000000000
Arg [83] : 1effb4b300000000000000000000000000000000000000000000000000000000
Arg [84] : 18d0d57500000000000000000000000000000000000000000000000000000000
Arg [85] : b5ca74dc00000000000000000000000000000000000000000000000000000000
Arg [86] : 0000000000000000000000005e7077bf147fc1bb8f46039cc40bbd39f2ddfea0
Arg [87] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [88] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [89] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [90] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [91] : 701f58c500000000000000000000000000000000000000000000000000000000
Arg [92] : c3d93e7c00000000000000000000000000000000000000000000000000000000
Arg [93] : 6a74f6f500000000000000000000000000000000000000000000000000000000
Arg [94] : 7f61885c00000000000000000000000000000000000000000000000000000000
Arg [95] : 97c09d3400000000000000000000000000000000000000000000000000000000
Arg [96] : 0000000000000000000000000000000000000000000000000000000000000284
Arg [97] : 7da889ed000000000000000000000000902c3806a84f4e855a8746e92d7f1c9a
Arg [98] : 5140045800000000000000000000000034788df312acc671e62c9ab15523f7cd
Arg [99] : c4d29ba900000000000000000000000034788df312acc671e62c9ab15523f7cd
Arg [100] : c4d29ba9222883f3ab8722970c145b96ee10f801dadce5c6bd6b807def6ecd48
Arg [101] : f138346800000000000000000000000000000000000000000000000000000000
Arg [102] : 000000192ea0ea1c5d1733a76f1c4f8757b71ced8aaf851ef1288ce2ca980c0a
Arg [103] : 428fbadb5a3ef282b21e12fe1f4438e5bb158fc5060b160559c5158c6389d62d
Arg [104] : 9fe3d080062362cb3eaf1f631406cbe19bf2a2c5d0d9ea69d069309a6003adda
Arg [105] : e9f387be00000000000000000000000000000000000000000000000000000000
Arg [106] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [107] : 00000000010007ed0e328b940e241f7666a6303b7ffd4e3fd7e8c154d6e7556b
Arg [108] : efe6cd6d0100055b7a8be90522251be8be1a186464d056462973502ac8a0437c
Arg [109] : 85e4d2a900000000000000000000000000000000000000000000000000000000
Arg [110] : 044aa20000000000000000000000000000000000000000000000000000000000
Arg [111] : 0000001200000000000000000000000000000000000000000000000000000000
Arg [112] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [113] : 000f424000000000000000000000000000000000000000000000000000000000
Arg [114] : 0001d4c000000000000000000000000000000000000000000000000000000000
Arg [115] : 04c4b40000000000000000000000000000000000000000000000000000000000
Arg [116] : 000182b800000000000000000000000000000000000000000000000000000000
Arg [117] : 0ee6b28000000000000000000000000000000000000000000000000000000000


Block Transaction Gas Used Reward
view all blocks sequenced

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

OVERVIEW

Build on the world’s first ZK Aggregated Layer 3 and access limitless liquidity with zkLink's Rollup solutions.

Loading...
Loading

Validator Index Block Amount
View All Withdrawals

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

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