false
false

Contract Address Details

0x607F5DC1890aBd080110a2f9567B46acE0e4E25B

Contract Name
SupraOraclePull
Creator
0xcba34c–bd5014 at 0x294559–5fafee
Balance
0 SYS
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
615773
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
SupraOraclePull




Optimization enabled
true
Compiler version
v0.8.24+commit.e11b9ed9




Optimization runs
200
Verified at
2024-07-09T07:31:16.021564Z

src/SupraOraclePull_V2.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.24;

import "./SupraErrors.sol";
import "./Smr.sol";
import "./BytesLib.sol";
import {ISupraSValueFeed} from "./ISupraSValueFeed.sol";
import {ISupraSValueFeedVerifier} from "./ISupraSValueFeedVerifier.sol";
import {UUPSUpgradeable} from "../lib/openzeppelin-contracts/contracts/proxy/utils/UUPSUpgradeable.sol";
import {MerkleProof} from "../lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol";
import {EnumerableSetRing} from "./EnumerableSetRing.sol";
import "../lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
import {Ownable2StepUpgradeable} from "../lib/openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol";


/// @title Supra Oracle Pull Model Contract
/// @notice This contract verifies DORA committee Price feeds and returns the price data to the caller
/// @notice The contract does not make assumptions about its owner, but its recommended to be a multisig wallet
contract SupraOraclePull is  UUPSUpgradeable, Ownable2StepUpgradeable {
    using EnumerableSetRing for EnumerableSetRing.EnumerableSetRing;
    /// @notice Push Based Supra Svalue Feed Storage contract
    /// @dev This is used to check if a pair is stale

    ISupraSValueFeed internal supraSValueFeedStorage;
    ISupraSValueFeedVerifier internal supraSValueVerifier;
    // Max Future time is 3sec from the current block time.
    uint256 public constant TIME_DELTA_ALLOWANCE = 3000;
    EnumerableSetRing.EnumerableSetRing private merkleSet;

    event SupraSValueFeedUpdated(address supraSValueFeedStorage);
    event SupraSValueVerifierUpdated(address supraSValueVerifier);
    event PriceUpdate(uint256[] pairs, uint256[] prices, uint256[] updateMask);

    /// @notice Price Pair Feed From Oracle Committee
    struct CommitteeFeed {
        uint32 pair;
        uint128 price;
        uint64 timestamp;
        uint16 decimals;
        uint64 round;
    }

    /// @notice Oracle Committee Pair Price Feed with Merkle proof of the pair
    struct CommitteeFeedWithProof {
        CommitteeFeed committee_feed;
        bytes32[] proof;
    }

    /// @notice Multiple Pair Price with Merkle Proof along with Committee details
    struct PriceDetailsWithCommittee {
        uint64 committee_id;
        bytes32 root;
        // DORA committee signature on the merkle root
        uint256[2] sigs;
        CommitteeFeedWithProof[] committee_data;
    }

    /// @notice Proof for verifying and extracting pairs from DORA committee feeds for Multiple Committees
    struct OracleProofV2 {
        PriceDetailsWithCommittee[] data;
    }

    /// @notice Verified price data
    struct PriceData {
        // List of pairs
        uint256[] pairs;
        // List of prices
        // prices[i] is the price of pairs[i]
        uint256[] prices;
        // List of decimals
        // decimals[i] is the decimals of pairs[i]
        uint256[] decimal;
    }

    /// @notice Verified price data
    struct PriceInfo {
        // List of pairs
        uint256[] pairs;
        // List of prices
        // prices[i] is the price of pairs[i]
        uint256[] prices;
        // List of timestamp
        // timestamp[i] is the timestamp of pairs[i]
        uint256[] timestamp;
        // List of decimals
        // decimals[i] is the decimals of pairs[i]
        uint256[] decimal;
        // List of round
        // round[i] is the round of pairs[i]
        uint256[] round;
    }


    /// @notice Helper function for upgradeability
    /// @dev While upgrading using UUPS proxy interface, when we call upgradeTo(address) function
    /// @dev we need to check that only owner can upgrade
    /// @param newImplementation address of the new implementation contract
    function _authorizeUpgrade(address newImplementation) internal virtual override onlyOwner {}

    function initialize(address _supraSValueFeedStorage, address _supraSValueVerifier) public initializer {
        Ownable2StepUpgradeable.__Ownable2Step_init();
        _updateSupraSValueFeedInitLevel(ISupraSValueFeed(_supraSValueFeedStorage));
        _updateSupraSValueVerifierInitLevel(ISupraSValueFeedVerifier(_supraSValueVerifier));
    }

    /// @notice Verify Oracle Pairs
    /// @dev throws error if proof is invalid
    /// @dev Stale price data is marked
    /// @param _bytesProof The oracle proof to extract the pairs from
    function verifyOracleProof(bytes calldata _bytesProof) external returns (PriceData memory) {
        OracleProofV2 memory oracle = abi.decode(_bytesProof, (OracleProofV2));
        uint256 paircnt;
        for (uint256 i; i < oracle.data.length; ++i) {
            paircnt += oracle.data[i].committee_data.length;
            if (merkleSet.contains(oracle.data[i].root)) {
                continue;
            }
            requireRootVerified(oracle.data[i].root, oracle.data[i].sigs, oracle.data[i].committee_id);
            if (!merkleSet.set(oracle.data[i].root)) {
                revert RootIsZero();
            }
        }

        uint256[] memory updateMask = new uint256[](paircnt);

        PriceData memory priceData = PriceData(new uint256[](paircnt), new uint256[](paircnt), new uint256[](paircnt));

        uint256 pair_map = 0;
        uint256 maxFutureTimestamp = block.timestamp * 1000 + TIME_DELTA_ALLOWANCE;

        for (uint256 a = 0; a < oracle.data.length;) {
            for (uint256 b = 0; b < oracle.data[a].committee_data.length;) {
                verifyMerkleProof(oracle.data[a].committee_data[b], oracle.data[a].root);
                priceData.pairs[pair_map] = oracle.data[a].committee_data[b].committee_feed.pair;

                uint256 lastRound =
                    supraSValueFeedStorage.getRound(uint256(oracle.data[a].committee_data[b].committee_feed.pair));
                if (
                    oracle.data[a].committee_data[b].committee_feed.round > lastRound
                        && oracle.data[a].committee_data[b].committee_feed.round <= maxFutureTimestamp
                ) {
                    packData(
                        oracle.data[a].committee_data[b].committee_feed.pair,
                        oracle.data[a].committee_data[b].committee_feed.round,
                        oracle.data[a].committee_data[b].committee_feed.decimals,
                        oracle.data[a].committee_data[b].committee_feed.timestamp,
                        oracle.data[a].committee_data[b].committee_feed.price
                    );
                    priceData.prices[pair_map] = oracle.data[a].committee_data[b].committee_feed.price;
                    priceData.decimal[pair_map] = oracle.data[a].committee_data[b].committee_feed.decimals;
                    updateMask[pair_map] = 1;
                } else if (oracle.data[a].committee_data[b].committee_feed.round > maxFutureTimestamp) {
                    revert IncorrectFutureUpdate(
                        oracle.data[a].committee_data[b].committee_feed.round - block.timestamp * 1000
                    );
                } else if (oracle.data[a].committee_data[b].committee_feed.round < lastRound) {
                    ISupraSValueFeed.priceFeed memory value =
                        supraSValueFeedStorage.getSvalue(uint256(oracle.data[a].committee_data[b].committee_feed.pair));
                    priceData.prices[pair_map] = value.price;
                    priceData.decimal[pair_map] = value.decimals;
                    updateMask[pair_map] = 0;
                } else {
                    priceData.prices[pair_map] = oracle.data[a].committee_data[b].committee_feed.price;
                    priceData.decimal[pair_map] = oracle.data[a].committee_data[b].committee_feed.decimals;
                    updateMask[pair_map] = 0;
                }

                unchecked {
                    ++b;
                    ++pair_map;
                }
            }

            unchecked {
                ++a;
            }
        }

        emit PriceUpdate(priceData.pairs, priceData.prices, updateMask);
        return priceData;
    }

    /// @notice Verify Oracle Pairs
    /// @dev throws error if proof is invalid
    /// @dev Stale price data is marked
    /// @param _bytesProof The oracle proof to extract the pairs from
    function verifyOracleProofV2(bytes calldata _bytesProof) external returns (PriceInfo memory) {
        OracleProofV2 memory oracle = abi.decode(_bytesProof, (OracleProofV2));
        uint256 paircnt = 0;
        for (uint256 i; i < oracle.data.length; ++i) {
            paircnt += oracle.data[i].committee_data.length;
            if (merkleSet.contains(oracle.data[i].root)) {
                continue;
            }
            requireRootVerified(oracle.data[i].root, oracle.data[i].sigs, oracle.data[i].committee_id);
            if (!merkleSet.set(oracle.data[i].root)) {
                revert RootIsZero();
            }
        }

        uint256[] memory updateMask = new uint256[](paircnt);

        PriceInfo memory priceData = PriceInfo(
            new uint256[](paircnt),
            new uint256[](paircnt),
            new uint256[](paircnt),
            new uint256[](paircnt),
            new uint256[](paircnt)
        );

        uint256 pair_map = 0;
        uint256 maxFutureTimestamp = block.timestamp * 1000 + TIME_DELTA_ALLOWANCE;

        for (uint256 a = 0; a < oracle.data.length;) {
            for (uint256 b = 0; b < oracle.data[a].committee_data.length;) {
                verifyMerkleProof(oracle.data[a].committee_data[b], oracle.data[a].root);
                priceData.pairs[pair_map] = oracle.data[a].committee_data[b].committee_feed.pair;

                uint256 lastRound =
                    supraSValueFeedStorage.getRound(uint256(oracle.data[a].committee_data[b].committee_feed.pair));

                if (
                    oracle.data[a].committee_data[b].committee_feed.round > lastRound
                        && oracle.data[a].committee_data[b].committee_feed.round <= maxFutureTimestamp
                ) {
                    packData(
                        oracle.data[a].committee_data[b].committee_feed.pair,
                        oracle.data[a].committee_data[b].committee_feed.round,
                        oracle.data[a].committee_data[b].committee_feed.decimals,
                        oracle.data[a].committee_data[b].committee_feed.timestamp,
                        oracle.data[a].committee_data[b].committee_feed.price
                    );
                    priceData.prices[pair_map] = oracle.data[a].committee_data[b].committee_feed.price;
                    priceData.round[pair_map] = oracle.data[a].committee_data[b].committee_feed.round;
                    priceData.timestamp[pair_map] = oracle.data[a].committee_data[b].committee_feed.timestamp;
                    priceData.decimal[pair_map] = oracle.data[a].committee_data[b].committee_feed.decimals;
                    updateMask[pair_map] = 1;
                } else if (oracle.data[a].committee_data[b].committee_feed.round > maxFutureTimestamp) {
                    revert IncorrectFutureUpdate(
                        oracle.data[a].committee_data[b].committee_feed.round - block.timestamp * 1000
                    );
                } else if (oracle.data[a].committee_data[b].committee_feed.round < lastRound) {
                    ISupraSValueFeed.priceFeed memory value =
                        supraSValueFeedStorage.getSvalue(uint256(oracle.data[a].committee_data[b].committee_feed.pair));
                    priceData.prices[pair_map] = value.price;
                    priceData.round[pair_map] = lastRound;
                    priceData.timestamp[pair_map] = value.time;
                    priceData.decimal[pair_map] = value.decimals;
                    updateMask[pair_map] = 0;
                } else {
                    priceData.prices[pair_map] = oracle.data[a].committee_data[b].committee_feed.price;
                    priceData.round[pair_map] = oracle.data[a].committee_data[b].committee_feed.round;
                    priceData.timestamp[pair_map] = oracle.data[a].committee_data[b].committee_feed.timestamp;
                    priceData.decimal[pair_map] = oracle.data[a].committee_data[b].committee_feed.decimals;
                    updateMask[pair_map] = 0;
                }

                unchecked {
                    ++b;
                    ++pair_map;
                }
            }

            unchecked {
                ++a;
            }
        }

        emit PriceUpdate(priceData.pairs, priceData.prices, updateMask);
        return priceData;
    }

    /// @notice It helps to pack many data points into one single word (32 bytes)
    /// @dev This function will take the required parameters, Will shift the value to its specific position
    /// @dev For concatenating one value with another we are using unary OR operator
    /// @dev Saving the Packed data into the SupraStorage Contract
    /// @param _pair Pair identifier of the token pair
    /// @param _round Round on which DORA nodes collects and post the pair data
    /// @param _decimals Number of decimals that the price of the pair supports
    /// @param _price Price of the pair
    /// @param _time Last updated timestamp of the pair
    function packData(uint256 _pair, uint256 _round, uint256 _decimals, uint256 _time, uint256 _price) internal {
        uint256 r = uint256(_round) << 192;
        r = r | _decimals << 184;
        r = r | _time << 120;
        r = r | _price << 24;
        supraSValueFeedStorage.restrictedSetSupraStorage(_pair, bytes32(r));
    }

    /// @notice helper function to verify the merkle proof with the root
    function verifyMerkleProof(CommitteeFeedWithProof memory oracle, bytes32 root) private pure {
        bytes4 pair_le = BytesLib.betole_4(bytes4(abi.encodePacked(oracle.committee_feed.pair)));
        bytes16 price_le = BytesLib.betole_16(bytes16(abi.encodePacked(oracle.committee_feed.price)));
        bytes8 timestamp_le = BytesLib.betole_8(bytes8(abi.encodePacked(oracle.committee_feed.timestamp)));
        bytes2 decimals_le = BytesLib.betole_2(bytes2(abi.encodePacked(oracle.committee_feed.decimals)));
        bytes8 round_le = BytesLib.betole_8(bytes8(abi.encodePacked(oracle.committee_feed.round)));
        bytes32 leaf_hash = keccak256(abi.encodePacked(pair_le, price_le, timestamp_le, decimals_le, round_le));
        if (MerkleProof.verify(oracle.proof, root, leaf_hash) == false) {
            revert InvalidProof();
        }
    }

    /// @notice Internal Function to check for zero address
    function _ensureNonZeroAddress(address contract_) private pure {
        if (contract_ == address(0)) {
            revert ZeroAddress();
        }
    }

    /// @notice Helper Function to update the supraSValueFeedStorage Contract address during contract initialization
    /// @param supraSValueFeed new supraSValueFeed
    function _updateSupraSValueFeedInitLevel(ISupraSValueFeed supraSValueFeed) private {
        _ensureNonZeroAddress(address(supraSValueFeed));
        supraSValueFeedStorage = supraSValueFeed;

        emit SupraSValueFeedUpdated(address(supraSValueFeed));
    }

    /// @notice Helper Function to update the supraSvalueVerifier Contract address during contract initialization
    /// @param supraSvalueVerifier new supraSvalueVerifier Contract address
    function _updateSupraSValueVerifierInitLevel(ISupraSValueFeedVerifier supraSvalueVerifier) private {
        _ensureNonZeroAddress(address(supraSvalueVerifier));
        supraSValueVerifier = supraSvalueVerifier;

        emit SupraSValueVerifierUpdated(address(supraSvalueVerifier));
    }

    /// @notice Helper Function to update the supraSValueFeedStorage Contract address in future
    /// @param supraSValueFeed new supraSValueFeedStorage Contract address
    function updateSupraSValueFeed(ISupraSValueFeed supraSValueFeed) external onlyOwner {
        _ensureNonZeroAddress(address(supraSValueFeed));
        supraSValueFeedStorage = supraSValueFeed;

        emit SupraSValueFeedUpdated(address(supraSValueFeed));
    }

    /// @notice Helper Function to check for the address of SupraSValueFeedVerifier contract
    function checkSupraSValueVerifier() external view returns (address) {
        return (address(supraSValueVerifier));
    }

    ///@notice Helper function to check for the address of SupraSValueFeed contract
    function checkSupraSValueFeed() external view returns (address) {
        return (address(supraSValueFeedStorage));
    }

    /// @notice Helper Function to update the supraSvalueVerifier Contract address in future
    /// @param supraSvalueVerifier new supraSvalueVerifier Contract address
    function updateSupraSValueVerifier(ISupraSValueFeedVerifier supraSvalueVerifier) external onlyOwner {
        _ensureNonZeroAddress(address(supraSvalueVerifier));
        supraSValueVerifier = supraSvalueVerifier;

        emit SupraSValueVerifierUpdated(address(supraSvalueVerifier));
    }

    /// @notice Verify root
    /// @dev Requires the provided votes to be verified using SupraSValueFeedVerifierContract contract's authority public key and BLS signature.
    /// @param root The root of the merkle tree created using the pair data
    /// @param sigs The BLS signature on the root of the merkle tree.
    /// @dev This function verifies the BLS signature by calling the SupraSValueFeedVerifierContract that uses BLS precompile contract and checks if the root matches the provided signature.
    /// @dev If the signature verification fails or if there is an issue with the BLS precompile contract call, the function reverts with an error.
    function requireRootVerified(bytes32 root, uint256[2] memory sigs, uint256 committee_id) internal view {
        (bool status,) = address(supraSValueVerifier).staticcall(
            abi.encodeCall(ISupraSValueFeedVerifier.requireHashVerified_V2, (root, sigs, committee_id))
        );
        if (!status) {
            revert DataNotVerified();
        }
    }
}
        

lib/openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {
    function __Ownable2Step_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable2Step_init_unchained() internal onlyInitializing {
    }
    address private _pendingOwner;

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

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

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
        _transferOwnership(sender);
    }

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

lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

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

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

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

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

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

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

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

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

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}
          

lib/openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}
          

lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol

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

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

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

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

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

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

lib/openzeppelin-contracts/contracts/interfaces/IERC1967.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
 *
 * _Available since v4.8.3._
 */
interface IERC1967 {
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Emitted when the beacon is changed.
     */
    event BeaconUpgraded(address indexed beacon);
}
          

lib/openzeppelin-contracts/contracts/interfaces/draft-IERC1822.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
 * proxy whose upgrades are fully controlled by the current implementation.
 */
interface IERC1822Proxiable {
    /**
     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
     * address.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy.
     */
    function proxiableUUID() external view returns (bytes32);
}
          

lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Upgrade.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)

pragma solidity ^0.8.2;

import "../beacon/IBeacon.sol";
import "../../interfaces/IERC1967.sol";
import "../../interfaces/draft-IERC1822.sol";
import "../../utils/Address.sol";
import "../../utils/StorageSlot.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 */
abstract contract ERC1967Upgrade is IERC1967 {
    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Returns the current implementation address.
     */
    function _getImplementation() internal view returns (address) {
        return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
        StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Perform implementation upgrade
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Perform implementation upgrade with additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {
        _upgradeTo(newImplementation);
        if (data.length > 0 || forceCall) {
            Address.functionDelegateCall(newImplementation, data);
        }
    }

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {
        // Upgrades from old implementations will perform a rollback test. This test requires the new
        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
        // this special case will break upgrade paths from old UUPS implementation to new ones.
        if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {
            _setImplementation(newImplementation);
        } else {
            try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
                require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
            } catch {
                revert("ERC1967Upgrade: new implementation is not UUPS");
            }
            _upgradeToAndCall(newImplementation, data, forceCall);
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     */
    function _getAdmin() internal view returns (address) {
        return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        require(newAdmin != address(0), "ERC1967: new admin is the zero address");
        StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     */
    function _changeAdmin(address newAdmin) internal {
        emit AdminChanged(_getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
     */
    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Returns the current beacon.
     */
    function _getBeacon() internal view returns (address) {
        return StorageSlot.getAddressSlot(_BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract");
        require(
            Address.isContract(IBeacon(newBeacon).implementation()),
            "ERC1967: beacon implementation is not a contract"
        );
        StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;
    }

    /**
     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
     *
     * Emits a {BeaconUpgraded} event.
     */
    function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);
        if (data.length > 0 || forceCall) {
            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
        }
    }
}
          

lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.0;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeacon {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {BeaconProxy} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}
          

lib/openzeppelin-contracts/contracts/proxy/utils/UUPSUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.0;

import "../../interfaces/draft-IERC1822.sol";
import "../ERC1967/ERC1967Upgrade.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 *
 * _Available since v4.1._
 */
abstract contract UUPSUpgradeable is IERC1822Proxiable, ERC1967Upgrade {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
    address private immutable __self = address(this);

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        require(address(this) != __self, "Function must be called through delegatecall");
        require(_getImplementation() == __self, "Function must be called through active proxy");
        _;
    }

    /**
     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall");
        _;
    }

    /**
     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
     */
    function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
        return _IMPLEMENTATION_SLOT;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     *
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function upgradeTo(address newImplementation) public virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     *
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, data, true);
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeTo} and {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal override onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) internal virtual;
}
          

lib/openzeppelin-contracts/contracts/utils/Address.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}
          

lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
 * _Available since v4.9 for `string`, `bytes`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}
          

lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.2) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The tree and the proofs can be generated using our
 * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
 * You will find a quickstart guide in the readme.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 * OpenZeppelin's JavaScript library generates merkle trees that are safe
 * against this attack out of the box.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Calldata version of {verify}
     *
     * _Available since v4.7._
     */
    function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        return processProofCalldata(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Calldata version of {processProof}
     *
     * _Available since v4.7._
     */
    function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function multiProofVerify(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProof(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Calldata version of {multiProofVerify}
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function multiProofVerifyCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProofCalldata(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
     * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
     * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
     * respectively.
     *
     * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
     * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
     * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
     *
     * _Available since v4.7._
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 proofLen = proof.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i]
                ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
                : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            require(proofPos == proofLen, "MerkleProof: invalid multiproof");
            unchecked {
                return hashes[totalHashes - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Calldata version of {processMultiProof}.
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function processMultiProofCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 proofLen = proof.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i]
                ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
                : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            require(proofPos == proofLen, "MerkleProof: invalid multiproof");
            unchecked {
                return hashes[totalHashes - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
        return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}
          

src/BytesLib.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.24;

library BytesLib {
    /// @notice Helper function to convert Big Endian 16 bytes Data To Little Endian or vice versa
    function betole_16(bytes16 a) internal pure returns (bytes16) {
        bytes16 b;
        for (uint256 i; i < 16; i++) {
            bytes1 c = bytes1(a << (i * 8) & bytes1(0xff));
            b = b >> 8 | c;
        }
        return b;
    }

    /// @notice Helper function to convert Big Endian 8 bytes Data To Little Endian or vice versa
    function betole_8(bytes8 a) internal pure returns (bytes8) {
        bytes8 b;
        for (uint256 i; i < 8; i++) {
            bytes1 c = bytes1(a << (i * 8) & bytes1(0xff));
            b = b >> 8 | c;
        }
        return b;
    }

    /// @notice Helper function to convert Big Endian 4 bytes Data To Little Endian or vice versa
    function betole_4(bytes4 a) internal pure returns (bytes4) {
        bytes4 b;
        for (uint256 i; i < 4; i++) {
            bytes1 c = bytes1(a << (i * 8) & bytes1(0xff));
            b = b >> 8 | c;
        }
        return b;
    }

    /// @notice Helper function to convert Big Endian 2 bytes Data To Little Endian or vice versa
    function betole_2(bytes2 a) internal pure returns (bytes2) {
        bytes2 b;
        for (uint256 i; i < 2; i++) {
            bytes1 c = bytes1(a << (i * 8) & bytes1(0xff));
            b = b >> 8 | c;
        }
        return b;
    }
}
          

src/EnumerableSetRing.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.24;

library  EnumerableSetRing {

    struct EnumerableSetRing {
        bytes32[] list;
        uint256 position;
        mapping(bytes32 key => uint256 position) map;
    }

    uint256 public constant MAX_BUFFER_SIZE = 1000;

    /**
     * @dev Adds a key-value pair to a Set, or updates the value for an existing
     * key. O(1).
     *
     * For Vector The operation old_value -> 0 then 0 -> new_value will be more gas consuming than old_value -> new_value.
     * Returns true if the key was added to the Set, that is if it was not
     * already present.
     */
    function set(EnumerableSetRing storage set, bytes32 value) internal returns (bool) {
        if(!contains(set,value)) {
            uint256 position = set.position;
            if (set.list.length == MAX_BUFFER_SIZE) {
                bytes32 old_value = set.list[position];
                delete set.map[old_value];
                set.list[position] = value;
            } else {
                set.list.push(value);
            }
            set.map[value] = position;
            set.position = ++set.position % MAX_BUFFER_SIZE;
            return true;
        }
        else {
            return false;
        }
    }

    /**
     * @dev Returns true if the key is in the set. O(1).
     */
    function contains(EnumerableSetRing storage set, bytes32 key) internal view returns (bool) {
        if(set.list.length == 0) {
            return false;
        }
        uint256 position = set.map[key];
        return (set.list[position] == key);
    }

    /**
     * @dev Return the an array containing all the keys
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(EnumerableSetRing storage set) internal view returns (bytes32[] memory) {
        return set.list;
    }

    function capacity(EnumerableSetRing storage set) internal view returns (uint256) {
        return values(set).length;
    }
}
          

src/ISupraSValueFeed.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

interface ISupraSValueFeed {
    struct priceFeed {
        uint256 round;
        uint256 decimals;
        uint256 time;
        uint256 price;
    }

    struct derivedData {
        int256 roundDifference;
        int256 timeDifference;
        uint256 derivedPrice;
        uint256 decimals;
    }

    function restrictedSetSupraStorage(uint256 _index, bytes32 _bytes) external;

    function restrictedSetTimestamp(uint256 _tradingPair, uint256 timestamp) external;

    function getTimestamp(uint256 _tradingPair) external view returns (uint256);

    function getRound(uint256 _tradingPair) external view returns (uint256);

    function getSvalue(uint64 _pairIndex) external view returns (bytes32, bool);

    function getSvalues(uint64[] memory _pairIndexes) external view returns (bytes32[] memory, bool[] memory);

    function getDerivedSvalue(uint256 _derivedPairId) external view returns (derivedData memory);

    function getSvalue(uint256 _pairIndex) external view returns (priceFeed memory);

    function getSvalues(uint256[] memory _pairIndexes) external view returns (priceFeed[] memory);
}
          

src/ISupraSValueFeedVerifier.sol

pragma solidity ^0.8.19;

interface ISupraSValueFeedVerifier {
    function isPairAlreadyAddedForHCC(uint256[] calldata _pairIndexes) external view returns (bool);

    function isPairAlreadyAddedForHCC(uint256 _pairId) external view returns (bool);

    function requireHashVerified_V2(bytes32 message, uint256[2] memory signature, uint256 committee_id) external view;

    function requireHashVerified_V1(bytes memory message, uint256[2] memory signature) external view;
}
          

src/Smr.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.24;

/// @title Supra SMR Block Utilities
/// @notice This library contains the data structures and functions for hashing SMR blocks.
library Smr {
    /// @notice A vote is a block with a round number.
    /// @dev The library assumes the round number is passed in little endian format
    struct Vote {
        MinBlock smrBlock;
        // SPEC: smrBlock.round.to_le_bytes()
        bytes8 roundLE;
    }

    /// @notice A partial SMR block containing the bare-minimum for hashing
    struct MinBlock {
        uint64 round;
        uint128 timestamp;
        bytes32 author;
        bytes32 qcHash;
        bytes32[] batchHashes;
    }

    /// @notice An SMR Transaction
    struct MinTxn {
        bytes32[] clusterHashes;
        bytes32 sender;
        bytes10 protocol;
        bytes1 tx_sub_type;
        // SPEC: Index of the transaction in its batch
        uint256 txnIdx;
    }

    /// @notice A partial SMR batch containing the bare-minimum for hashing
    /// @dev The library assumes that txnHashes is a list of keccak256 hashes of abi encoded SMR transaction
    struct MinBatch {
        bytes10 protocol;
        // SPEC: List of keccak256(Txn.clusterHashes, Txn.sender, Txn.protocol, Txn.tx_sub_type)
        bytes32[] txnHashes;
        // SPEC: Index of the batch in its block
        uint256 batchIdx;
    }

    /// @notice An SMR Signed Coherent Cluster
    struct SignedCoherentCluster {
        CoherentCluster cc;
        bytes qc;
        uint256 round;
        Origin origin;
    }

    /// @notice An SMR Coherent Cluster containing the price data
    struct CoherentCluster {
        bytes32 dataHash;
        uint256[] pair;
        uint256[] prices;
        uint256[] timestamp;
        uint256[] decimals;
    }

    /// @notice An SMR Txn Sender
    struct Origin {
        bytes32 _publicKeyIdentity;
        uint256 _pubMemberIndex;
        uint256 _committeeIndex;
    }

    /// @notice Hash an SMR Transaction
    /// @param txn The SMR transaction to hash
    /// @return Hash of the SMR Transaction
    function hashTxn(MinTxn memory txn) internal pure returns (bytes32) {
        bytes memory clustersConcat = abi.encodePacked(txn.clusterHashes);
        return keccak256(abi.encodePacked(clustersConcat, txn.sender, txn.protocol, txn.tx_sub_type));
    }

    /// @notice Hash an SMR Batch
    /// @param batch The SMR batch to hash
    /// @return Hash of the SMR Batch
    function hashBatch(MinBatch memory batch) internal pure returns (bytes32) {
        bytes32 txnsHash = keccak256(abi.encodePacked(batch.txnHashes));
        return keccak256(abi.encodePacked(batch.protocol, txnsHash));
    }

    /// @notice Hash an SMR Vote
    /// @param vote The SMR vote to hash
    /// @return Hash of the SMR Vote
    function hashVote(Vote memory vote) internal pure returns (bytes32) {
        bytes32 batchesHash = keccak256(abi.encodePacked(vote.smrBlock.batchHashes));
        bytes32 blockHash = keccak256(
            abi.encodePacked(
                vote.smrBlock.round, vote.smrBlock.timestamp, vote.smrBlock.author, vote.smrBlock.qcHash, batchesHash
            )
        );
        return keccak256(abi.encodePacked(blockHash, vote.roundLE));
    }
}
          

src/SupraErrors.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.24;

error ZeroAddress();
error InvalidBatch();
error InvalidTransaction();
error DuplicateCluster();
error ClusterNotVerified();
error BLSInvalidPubllicKeyorSignaturePoints();
error BLSIncorrectInputMessaage();
error DataNotVerified();
error ArrayLengthMismatch();
error InvalidProof();
error DataProofMismatch();
error IncorrectFutureUpdate(uint256 FutureLengthInMsecs);
error RootIsZero();
error SentinalAlreadySet();
          

Compiler Settings

{"viaIR":true,"remappings":["ds-test/=lib/forge-std/lib/ds-test/src/","erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/","forge-std/=lib/forge-std/src/","openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/","openzeppelin-contracts/=lib/openzeppelin-contracts/","openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/"],"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"optimizer":{"runs":200,"enabled":true},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"libraries":{},"evmVersion":"paris"}
              

Contract ABI

[{"type":"error","name":"DataNotVerified","inputs":[]},{"type":"error","name":"IncorrectFutureUpdate","inputs":[{"type":"uint256","name":"FutureLengthInMsecs","internalType":"uint256"}]},{"type":"error","name":"InvalidProof","inputs":[]},{"type":"error","name":"RootIsZero","inputs":[]},{"type":"error","name":"ZeroAddress","inputs":[]},{"type":"event","name":"AdminChanged","inputs":[{"type":"address","name":"previousAdmin","internalType":"address","indexed":false},{"type":"address","name":"newAdmin","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"BeaconUpgraded","inputs":[{"type":"address","name":"beacon","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferStarted","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"PriceUpdate","inputs":[{"type":"uint256[]","name":"pairs","internalType":"uint256[]","indexed":false},{"type":"uint256[]","name":"prices","internalType":"uint256[]","indexed":false},{"type":"uint256[]","name":"updateMask","internalType":"uint256[]","indexed":false}],"anonymous":false},{"type":"event","name":"SupraSValueFeedUpdated","inputs":[{"type":"address","name":"supraSValueFeedStorage","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"SupraSValueVerifierUpdated","inputs":[{"type":"address","name":"supraSValueVerifier","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"TIME_DELTA_ALLOWANCE","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"acceptOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"checkSupraSValueFeed","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"checkSupraSValueVerifier","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_supraSValueFeedStorage","internalType":"address"},{"type":"address","name":"_supraSValueVerifier","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"pendingOwner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"proxiableUUID","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateSupraSValueFeed","inputs":[{"type":"address","name":"supraSValueFeed","internalType":"contract ISupraSValueFeed"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateSupraSValueVerifier","inputs":[{"type":"address","name":"supraSvalueVerifier","internalType":"contract ISupraSValueFeedVerifier"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"upgradeTo","inputs":[{"type":"address","name":"newImplementation","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"upgradeToAndCall","inputs":[{"type":"address","name":"newImplementation","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"tuple","name":"","internalType":"struct SupraOraclePull.PriceData","components":[{"type":"uint256[]","name":"pairs","internalType":"uint256[]"},{"type":"uint256[]","name":"prices","internalType":"uint256[]"},{"type":"uint256[]","name":"decimal","internalType":"uint256[]"}]}],"name":"verifyOracleProof","inputs":[{"type":"bytes","name":"_bytesProof","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"tuple","name":"","internalType":"struct SupraOraclePull.PriceInfo","components":[{"type":"uint256[]","name":"pairs","internalType":"uint256[]"},{"type":"uint256[]","name":"prices","internalType":"uint256[]"},{"type":"uint256[]","name":"timestamp","internalType":"uint256[]"},{"type":"uint256[]","name":"decimal","internalType":"uint256[]"},{"type":"uint256[]","name":"round","internalType":"uint256[]"}]}],"name":"verifyOracleProofV2","inputs":[{"type":"bytes","name":"_bytesProof","internalType":"bytes"}]}]
              

Contract Creation Code

0x60a0806040523461003157306080526128b2908161003782396080518181816109b401528181610ae101526115f50152f35b600080fdfe61010080604052600436101561001457600080fd5b60003560e01c9081632e89c1e3146117b9575080633659cfe6146115d15780633dcd979314610ea2578063485cc95514610d3f5780634a755aec14610d225780634f1ef28614610a6557806352d1902d146109a15780635580d8c21461097857806357bbe2f814610943578063715018a6146108dc5780637851383e146108a757806379ba5097146108205780638da5cb5b146107f7578063b3a076f41461016b578063e30c3978146101425763f2fde38b146100d057600080fd5b3461013d57602036600319011261013d576100e96117dd565b6100f16125ce565b606580546001600160a01b0319166001600160a01b039283169081179091556033549091167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700600080a3005b600080fd5b3461013d57600036600319011261013d576065546040516001600160a01b039091168152602090f35b3461013d5761019e61017c366117f3565b60606040805161018b8161188b565b8281528260208201520152810190611a05565b600090815b81518051841015610266579060606101be856101c894611d4e565b5101515190611d78565b916101e160206101d9838551611d4e565b510151611f49565b61025e5761022460206101f5838551611d4e565b5101516040610205848651611d4e565b5101516001600160401b0361021b858751611d4e565b51511691611ffc565b61023c6020610234838551611d4e565b51015161209a565b1561024c576001905b01916101a3565b6040516333dc095d60e11b8152600490fd5b600190610245565b5061027081611d85565b61027982611d85565b9161028c61028682611d85565b91611d85565b906040519361029a8561188b565b8452602084015260408301526000916103e893428542020485144215171561059757428502610bb881011061059757600060e0959495525b80515160e05110156107645760005b60606102f060e0518451611d4e565b510151518110156107555761033261031982606061031160e0518751611d4e565b510151611d4e565b51602061032960e0518651611d4e565b51015190612186565b63ffffffff61034a82606061031160e0518751611d4e565b51515116610359878551611d4e565b5260018060a01b036097541663ffffffff61037d83606061031160e0518851611d4e565b51515160405163023c4c9f60e61b815291166004820152602081602481855afa90811561068a57600091610723575b50806001600160401b0360806103cb86606061031160e0518b51611d4e565b515101511611806106f2575b1561050857505063ffffffff6103f682606061031160e0518751611d4e565b5151511660c0526001600160401b03608061041a83606061031160e0518851611d4e565b515101511660a05261ffff608052608051606061043f838261031160e0518851611d4e565b515101511661049a6001600160401b03604061046485606061031160e0518a51611d4e565b5151015116916001600160801b039283602061048987606061031160e0518c51611d4e565b51510151169160a05160c0516124fc565b60206104af83606061031160e0518851611d4e565b51510151166104c2876020860151611d4e565b5260805160606104da838261031160e0518851611d4e565b51510151166104ed876040860151611d4e565b5260016104fa8786611d4e565b525b600195860195016102e1565b836001600160401b036080610534866060610311610bb89a9e9b999c9a8e4202019660e0519051611d4e565b515101511611156105ad57866001600160401b03608061055e8960606103118e60e0519051611d4e565b51510151169042814202048114421517156105975760249161058291420290611df3565b6040519063628c210b60e11b82526004820152fd5b634e487b7160e01b600052601160045260246000fd5b6001600160401b0360806105d088606061031160e09d999b989a9d518a51611d4e565b5151015116101561069657608063ffffffff6105f584606061031160e0518951611d4e565b515151166024604051809481936344dca75160e11b835260048301525afa801561068a5760209160009161065b575b5060608101516106378984880151611d4e565b520151610648876040860151611d4e565b5260006106558786611d4e565b526104fc565b61067d915060803d608011610683575b61067581836118dc565b810190611db7565b88610624565b503d61066b565b6040513d6000823e3d90fd5b506001600160801b0360206106b483606061031160e0518851611d4e565b51510151166106c7876020860151611d4e565b5261ffff60606106df838261031160e0518851611d4e565b5151015116610648876040860151611d4e565b50610bb8874202016001600160401b03608061071786606061031160e0518b51611d4e565b515101511611156103d7565b90506020813d60201161074d575b8161073e602093836118dc565b8101031261013d5751886103ac565b3d9150610731565b5060e0805160010190526102d2565b507ff77b9be227a199cb89ec5a0163ecdfe805c3f5c706b314c1962cd3e1ea5068246107f39282516107a160208501519260405193849384611e34565b0390a1604051918291602083526107c4815160606020860152608085019061183c565b60406107e1602084015192601f199384888303018489015261183c565b9201519084830301606085015261183c565b0390f35b3461013d57600036600319011261013d576033546040516001600160a01b039091168152602090f35b3461013d57600036600319011261013d57606554336001600160a01b03909116036108505761084e33612648565b005b60405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608490fd5b3461013d57602036600319011261013d576004356001600160a01b038116810361013d5761084e906108d76125ce565b611ec0565b3461013d57600036600319011261013d576108f56125ce565b606580546001600160a01b03199081169091556033805491821690556000906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461013d57602036600319011261013d576004356001600160a01b038116810361013d5761084e906109736125ce565b611e6e565b3461013d57600036600319011261013d576098546040516001600160a01b039091168152602090f35b3461013d57600036600319011261013d577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031630036109fa57602060405160008051602061285d8339815191528152f35b60405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608490fd5b604036600319011261013d57610a796117dd565b602435906001600160401b03821161013d573660238301121561013d578160040135610aa4816118fd565b92610ab260405194856118dc565b81845260209182850191366024838301011161013d578160009260248693018537860101526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811690610b0f30831415611918565b610b2c60008051602061285d833981519152928284541614611979565b610b346125ce565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610b6c575050505061084e915061269e565b84939416906040516352d1902d60e01b81528581600481865afa60009181610cf3575b50610bf05760405162461bcd60e51b815260048101879052602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b03610c9c57610bfe8361269e565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a2835115801590610c94575b610c3457005b6000809161084e957f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c60405196610c6a8861188b565b60278852870152660819985a5b195960ca1b60408701525190845af4610c8e611fcc565b91612788565b506001610c2e565b60405162461bcd60e51b815260048101859052602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608490fd5b9091508681813d8311610d1b575b610d0b81836118dc565b8101031261013d57519088610b8f565b503d610d01565b3461013d57600036600319011261013d576020604051610bb88152f35b3461013d57604036600319011261013d57610d586117dd565b6001600160a01b03906024358281169081900361013d5760005460ff8160081c161593848095610e95575b8015610e7e575b15610e225760ff198216600117600055610dd2936109739286610e10575b50610dc360ff60005460081c16610dbe8161256e565b61256e565b610dcc33612648565b16611ec0565b610dd857005b61ff0019600054166000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a1005b61ffff19166101011760005586610da8565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b158015610d8a5750600160ff831614610d8a565b50600160ff831610610d83565b3461013d57610ee1610eb3366117f3565b60606080604051610ec381611870565b82815282602082015282604082015282808201520152810190611a05565b600090815b81518051841015610f4e579060606101be85610f0194611d4e565b91610f1260206101d9838551611d4e565b610f4657610f2660206101f5838551611d4e565b610f366020610234838551611d4e565b1561024c576001905b0191610ee6565b600190610f3f565b50610f5881611d85565b610f6182611d85565b91610f6b81611d85565b90610f7581611d85565b610f87610f8183611d85565b92611d85565b9260405195610f9587611870565b865260208601526040850152606084015260808301526000916103e893428542020485144215171561059757428502610bb8810110610597576000949394905b8051518210156115145760005b6060610fef848451611d4e565b510151518110156115085761101c61100e826060610311878751611d4e565b516020610329868651611d4e565b63ffffffff611032826060610311878751611d4e565b51515116611041888651611d4e565b5260018060a01b036097541663ffffffff611063836060610311888851611d4e565b51515160405163023c4c9f60e61b815291166004820152602081602481855afa90811561068a576000916114d6575b50806001600160401b0360806110af8660606103118b8b51611d4e565b515101511611806114a7575b156112a457505080838351906110d091611d4e565b5160600151906110df91611d4e565b51515163ffffffff1681848451906110f691611d4e565b51606001519061110591611d4e565b5151608001516001600160401b031690828585519061112391611d4e565b51606001519061113291611d4e565b51516060015161ffff1691838686519061114b91611d4e565b51606001519061115a91611d4e565b5151604001516001600160401b03166001600160801b039384868989519061118191611d4e565b51606001519061119091611d4e565b51516020015116926111a1946124fc565b81848451906111af91611d4e565b5160600151906111be91611d4e565b51516020015116876020860151906111d591611d4e565b5280838351906111e491611d4e565b5160600151906111f391611d4e565b5151608001516001600160401b03168760808601519061121291611d4e565b52808383519061122191611d4e565b51606001519061123091611d4e565b5151604001516001600160401b03168760408601519061124f91611d4e565b52808383519061125e91611d4e565b51606001519061126d91611d4e565b51516060015161ffff168760608601519061128791611d4e565b526112928786611d4e565b60019052600180915b01960195610fe2565b610bb888999597949693984202016001600160401b0360806112cd8b60606103118d8d51611d4e565b515101511611156112f457886001600160401b03608061055e8b60606103118d8d51611d4e565b9091949295939796816001600160401b0360806113188460606103118b8b51611d4e565b515101511610156113eb57608063ffffffff61133b8360606103118a8a51611d4e565b515151166024604051809681936344dca75160e11b835260048301525afa92831561068a5760019384936020926000926113ca575b5060608201516113838d858c0151611d4e565b526113928c60808b0151611d4e565b5260408101516113a68c60408b0151611d4e565b5201516113b78a6060890151611d4e565b5260006113c48a89611d4e565b5261129b565b6113e491925060803d6080116106835761067581836118dc565b908c611370565b600192508291506001600160801b03602061140d8360606103118a8a51611d4e565b51510151166114208a6020890151611d4e565b526001600160401b03608061143c8360606103118a8a51611d4e565b515101511661144f8a6080890151611d4e565b526001600160401b03604061146b8360606103118a8a51611d4e565b515101511661147e8a6040890151611d4e565b5261ffff606061149483826103118a8a51611d4e565b51510151166113b78a6060890151611d4e565b50610bb8884202016001600160401b0360806114ca8660606103118b8b51611d4e565b515101511611156110bb565b90506020813d602011611500575b816114f1602093836118dc565b8101031261013d575189611092565b3d91506114e4565b50600190910190610fd5565b6107f3837ff77b9be227a199cb89ec5a0163ecdfe805c3f5c706b314c1962cd3e1ea50682486825161155160208501519260405193849384611e34565b0390a160405191829160208352611574815160a0602086015260c085019061183c565b60806115bf6115ac611598602086015194601f1995868a83030160408b015261183c565b6040860151858983030160608a015261183c565b606085015184888303018489015261183c565b920151908483030160a085015261183c565b3461013d5760208060031936011261013d576115eb6117dd565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116929061162430851415611918565b61164160008051602061285d833981519152948286541614611979565b6116496125ce565b60405193828501918583106001600160401b038411176117a357826040526000865260ff7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd914354166000146116a5575050505061084e915061269e565b84939416906040516352d1902d60e01b81528581600481865afa60009181611774575b506117295760405162461bcd60e51b815260048101879052602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b03610c9c576117378361269e565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a283511580159061176c57610c3457005b506000610c2e565b9091508681813d831161179c575b61178c81836118dc565b8101031261013d575190886116c8565b503d611782565b634e487b7160e01b600052604160045260246000fd5b3461013d57600036600319011261013d576097546001600160a01b03168152602090f35b600435906001600160a01b038216820361013d57565b90602060031983011261013d576004356001600160401b039283821161013d578060238301121561013d57816004013593841161013d576024848301011161013d576024019190565b90815180825260208080930193019160005b82811061185c575050505090565b83518552938101939281019260010161184e565b60a081019081106001600160401b038211176117a357604052565b606081019081106001600160401b038211176117a357604052565b608081019081106001600160401b038211176117a357604052565b604081019081106001600160401b038211176117a357604052565b90601f801991011681019081106001600160401b038211176117a357604052565b6001600160401b0381116117a357601f01601f191660200190565b1561191f57565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b6064820152608490fd5b1561198057565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b6064820152608490fd5b6001600160401b0381116117a35760051b60200190565b35906001600160401b038216820361013d57565b60208183031261013d578035906001600160401b03821161013d570160208183031261013d5760405191602083018381106001600160401b038211176117a35760405281356001600160401b03811161013d5781601f82850101121561013d578083013590611a73826119da565b93611a8160405195866118dc565b82855260208501918460208560051b83850101011161013d57602081830101925b60208560051b83850101018410611abe57505050505050815290565b83356001600160401b03811161013d578383010160a0818803601f19011261013d5760405190611aed826118a6565b611af9602082016119f1565b82526040810135602083015287607f8201121561013d57604051611b1c816118c1565b8060a08301918a831161013d5760608401905b838210611d3e575050604084015235906001600160401b03821161013d5788603f83830101121561013d5760208282010135611b6a816119da565b92611b7860405194856118dc565b81845260208401908b60408460051b83870101011161013d57604081850101915b60408460051b83870101018310611bc25750505050506060820152815260209384019301611aa2565b6001600160401b0383351161013d578482018335018d03603f190160c0811261013d5760a060405191611bf4836118c1565b1261013d57604051611c0581611870565b6040853585890101013563ffffffff8116810361013d578152606085358589010101356001600160801b038116810361013d5760208201526080611c4f818735878b0101016119f1565b604083015260a08635868a0101013561ffff8116810361013d576060830152611c7f60c08735878b0101016119f1565b90820152815260e084358488010101356001600160401b03811161013d578e605f828735878b01010101121561013d578684018535018101604001358f611cc5826119da565b92611cd360405194856118dc565b828452602084019160608460051b838d8b8d359101010101011161013d576060818935898d01010101915b60608460051b838d8b8d359101010101018310611d2e575050505091816020938480940152815201920191611b99565b8235815260209283019201611cfe565b8135815260209182019101611b2f565b8051821015611d625760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b9190820180921161059757565b90611d8f826119da565b611d9c60405191826118dc565b8281528092611dad601f19916119da565b0190602036910137565b9081608091031261013d57606060405191611dd1836118a6565b8051835260208101516020840152604081015160408401520151606082015290565b9190820391821161059757565b90815180825260208080930193019160005b828110611e20575050505090565b835185529381019392810192600101611e12565b91611e5d90611e4f611e6b9593606086526060860190611e00565b908482036020860152611e00565b916040818403910152611e00565b90565b7fda52bd66d138416c3a3ddc3bd0931b7fd43e8566ae54be77d52e767f336f29dd906020906001600160a01b0316611ea581612626565b609880546001600160a01b03191682179055604051908152a1565b7f063406dd506522b1ab1821a883e917769e0877ddf955ba27f5f63acc58069c45906020906001600160a01b0316611ef781612626565b609780546001600160a01b03191682179055604051908152a1565b609954811015611d625760996000527f72a152ddfb8e864297c917af52ea6c1c68aead0fee1a62673fcc7e0c94979d000190600090565b60995415611f735780600052609b602052611f68604060002054611f12565b90549060031b1c1490565b50600090565b6099548015611fc55781600052609b60205260406000205490811015611d625760996000527f72a152ddfb8e864297c917af52ea6c1c68aead0fee1a62673fcc7e0c94979d0001541490565b5050600090565b3d15611ff7573d90611fdd826118fd565b91611feb60405193846118dc565b82523d6000602084013e565b606090565b909160018060a01b0360985416906040519360208086019463140c180760e11b86526024870152604486016000905b60028210612085575050505060848401526084835260c08301918383106001600160401b038411176117a357600093849360405251915afa61206b611fcc565b501561207357565b604051632077b28160e11b8152600490fd5b8280600192865181520194019101909261202b565b6120a381611f79565b611f7357609a546099546103e8929083810361212657506120c382611f12565b90549060031b1c600052609b60205260006040812055806120fd6120e684611f12565b819391549060031b91821b91600019901b19161790565b90555b600052609b602052604060002055609a5460001981146105975760010106609a55600190565b680100000000000000008110156117a35761214b6120e6826001859401609955611f12565b9055612100565b90602082519201516001600160401b0360c01b90818116936008811061217757505050565b60080360031b82901b16169150565b9081515192604051602081019463ffffffff60e01b9060e01b168552600481526121af816118c1565b5193516001600160e01b031981169490600482106124dc575b50506000936000905b6004821061249a575050602083510151936040519460208601906001600160801b03199060801b1681526010956010815261220b816118c1565b5190516001600160801b0319811691906010821061247a575b5050946000956000915b80831061242a5750505061227461226f604086510151604051906001600160401b0360c01b9060c01b1660208201526008815261226a816118c1565b612152565b61272e565b9460608551015195604051602081019761ffff60f01b9060f01b1688526002815261229e816118c1565b5196516001600160f01b0319811697906002821061240a575b50506000805b600281106123cb57508697506122fe61226f60806020979899510151604051906001600160401b0360c01b9060c01b16888201526008815261226a816118c1565b6040516001600160e01b03199095168686019081526001600160801b031990941660248601526001600160c01b031992831660348601526001600160f01b031991909116603c85015216603e830152602682529061235b8161188b565b51902093015192906000915b84518310156123ae5761237a8386611d4e565b519060008282101561239d5750600052602052600160406000205b920191612367565b604091600193825260205220612395565b91509250036123b957565b6040516309bde33960e01b8152600490fd5b908160031b90828204600814831517156105975760081c60ff60f01b166001600160f01b03198a1690911b6001600160f81b03191617906001016122bd565b6001600160f01b031960029290920360031b82901b1616965038806122b7565b9091968760031b90600889830481148a151715610597571c6effffffffffffffffffffffffffffff60801b166001600160801b0319841690911b6001600160f81b0319161796600101919061222e565b6001600160801b031960109290920360031b82901b161690503880612224565b90948560031b906008878304811488151715610597571c62ffffff60e01b166001600160e01b0319831690911b6001600160f81b0319161794600101906121d1565b6001600160e01b031960049290920360031b82901b1616935038806121c8565b60975491946001600160a01b03909216939192843b1561013d5760009460449386926040519889978896635f6ce8c360e11b8852600488015260181b9260781b9160b81b9060c01b17171760248401525af1801561068a5761255b5750565b6001600160401b0381116117a357604052565b1561257557565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b6033546001600160a01b031633036125e257565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6001600160a01b03161561263657565b60405163d92e233d60e01b8152600490fd5b6bffffffffffffffffffffffff60a01b90816065541660655560335460018060a01b038092168093821617603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b803b156126d35760008051602061285d83398151915280546001600160a01b0319166001600160a01b03909216919091179055565b60405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b906000805b60089081831015612782578260031b9183830481148415171561059757600193909301921c66ffffffffffffff60c01b166001600160c01b0319851690911b6001600160f81b03191617612733565b93505050565b919290156127ea575081511561279c575090565b3b156127a55790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156127fd5750805190602001fd5b6040519062461bcd60e51b82528160208060048301528251908160248401526000935b828510612843575050604492506000838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935061282056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca2646970667358221220361e34d159a39933af4f9f5532432cec8db6945d856879e762d2548264c9b2b164736f6c63430008180033

Deployed ByteCode

0x61010080604052600436101561001457600080fd5b60003560e01c9081632e89c1e3146117b9575080633659cfe6146115d15780633dcd979314610ea2578063485cc95514610d3f5780634a755aec14610d225780634f1ef28614610a6557806352d1902d146109a15780635580d8c21461097857806357bbe2f814610943578063715018a6146108dc5780637851383e146108a757806379ba5097146108205780638da5cb5b146107f7578063b3a076f41461016b578063e30c3978146101425763f2fde38b146100d057600080fd5b3461013d57602036600319011261013d576100e96117dd565b6100f16125ce565b606580546001600160a01b0319166001600160a01b039283169081179091556033549091167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700600080a3005b600080fd5b3461013d57600036600319011261013d576065546040516001600160a01b039091168152602090f35b3461013d5761019e61017c366117f3565b60606040805161018b8161188b565b8281528260208201520152810190611a05565b600090815b81518051841015610266579060606101be856101c894611d4e565b5101515190611d78565b916101e160206101d9838551611d4e565b510151611f49565b61025e5761022460206101f5838551611d4e565b5101516040610205848651611d4e565b5101516001600160401b0361021b858751611d4e565b51511691611ffc565b61023c6020610234838551611d4e565b51015161209a565b1561024c576001905b01916101a3565b6040516333dc095d60e11b8152600490fd5b600190610245565b5061027081611d85565b61027982611d85565b9161028c61028682611d85565b91611d85565b906040519361029a8561188b565b8452602084015260408301526000916103e893428542020485144215171561059757428502610bb881011061059757600060e0959495525b80515160e05110156107645760005b60606102f060e0518451611d4e565b510151518110156107555761033261031982606061031160e0518751611d4e565b510151611d4e565b51602061032960e0518651611d4e565b51015190612186565b63ffffffff61034a82606061031160e0518751611d4e565b51515116610359878551611d4e565b5260018060a01b036097541663ffffffff61037d83606061031160e0518851611d4e565b51515160405163023c4c9f60e61b815291166004820152602081602481855afa90811561068a57600091610723575b50806001600160401b0360806103cb86606061031160e0518b51611d4e565b515101511611806106f2575b1561050857505063ffffffff6103f682606061031160e0518751611d4e565b5151511660c0526001600160401b03608061041a83606061031160e0518851611d4e565b515101511660a05261ffff608052608051606061043f838261031160e0518851611d4e565b515101511661049a6001600160401b03604061046485606061031160e0518a51611d4e565b5151015116916001600160801b039283602061048987606061031160e0518c51611d4e565b51510151169160a05160c0516124fc565b60206104af83606061031160e0518851611d4e565b51510151166104c2876020860151611d4e565b5260805160606104da838261031160e0518851611d4e565b51510151166104ed876040860151611d4e565b5260016104fa8786611d4e565b525b600195860195016102e1565b836001600160401b036080610534866060610311610bb89a9e9b999c9a8e4202019660e0519051611d4e565b515101511611156105ad57866001600160401b03608061055e8960606103118e60e0519051611d4e565b51510151169042814202048114421517156105975760249161058291420290611df3565b6040519063628c210b60e11b82526004820152fd5b634e487b7160e01b600052601160045260246000fd5b6001600160401b0360806105d088606061031160e09d999b989a9d518a51611d4e565b5151015116101561069657608063ffffffff6105f584606061031160e0518951611d4e565b515151166024604051809481936344dca75160e11b835260048301525afa801561068a5760209160009161065b575b5060608101516106378984880151611d4e565b520151610648876040860151611d4e565b5260006106558786611d4e565b526104fc565b61067d915060803d608011610683575b61067581836118dc565b810190611db7565b88610624565b503d61066b565b6040513d6000823e3d90fd5b506001600160801b0360206106b483606061031160e0518851611d4e565b51510151166106c7876020860151611d4e565b5261ffff60606106df838261031160e0518851611d4e565b5151015116610648876040860151611d4e565b50610bb8874202016001600160401b03608061071786606061031160e0518b51611d4e565b515101511611156103d7565b90506020813d60201161074d575b8161073e602093836118dc565b8101031261013d5751886103ac565b3d9150610731565b5060e0805160010190526102d2565b507ff77b9be227a199cb89ec5a0163ecdfe805c3f5c706b314c1962cd3e1ea5068246107f39282516107a160208501519260405193849384611e34565b0390a1604051918291602083526107c4815160606020860152608085019061183c565b60406107e1602084015192601f199384888303018489015261183c565b9201519084830301606085015261183c565b0390f35b3461013d57600036600319011261013d576033546040516001600160a01b039091168152602090f35b3461013d57600036600319011261013d57606554336001600160a01b03909116036108505761084e33612648565b005b60405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608490fd5b3461013d57602036600319011261013d576004356001600160a01b038116810361013d5761084e906108d76125ce565b611ec0565b3461013d57600036600319011261013d576108f56125ce565b606580546001600160a01b03199081169091556033805491821690556000906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461013d57602036600319011261013d576004356001600160a01b038116810361013d5761084e906109736125ce565b611e6e565b3461013d57600036600319011261013d576098546040516001600160a01b039091168152602090f35b3461013d57600036600319011261013d577f000000000000000000000000607f5dc1890abd080110a2f9567b46ace0e4e25b6001600160a01b031630036109fa57602060405160008051602061285d8339815191528152f35b60405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608490fd5b604036600319011261013d57610a796117dd565b602435906001600160401b03821161013d573660238301121561013d578160040135610aa4816118fd565b92610ab260405194856118dc565b81845260209182850191366024838301011161013d578160009260248693018537860101526001600160a01b037f000000000000000000000000607f5dc1890abd080110a2f9567b46ace0e4e25b811690610b0f30831415611918565b610b2c60008051602061285d833981519152928284541614611979565b610b346125ce565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610b6c575050505061084e915061269e565b84939416906040516352d1902d60e01b81528581600481865afa60009181610cf3575b50610bf05760405162461bcd60e51b815260048101879052602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b03610c9c57610bfe8361269e565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a2835115801590610c94575b610c3457005b6000809161084e957f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c60405196610c6a8861188b565b60278852870152660819985a5b195960ca1b60408701525190845af4610c8e611fcc565b91612788565b506001610c2e565b60405162461bcd60e51b815260048101859052602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608490fd5b9091508681813d8311610d1b575b610d0b81836118dc565b8101031261013d57519088610b8f565b503d610d01565b3461013d57600036600319011261013d576020604051610bb88152f35b3461013d57604036600319011261013d57610d586117dd565b6001600160a01b03906024358281169081900361013d5760005460ff8160081c161593848095610e95575b8015610e7e575b15610e225760ff198216600117600055610dd2936109739286610e10575b50610dc360ff60005460081c16610dbe8161256e565b61256e565b610dcc33612648565b16611ec0565b610dd857005b61ff0019600054166000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a1005b61ffff19166101011760005586610da8565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b158015610d8a5750600160ff831614610d8a565b50600160ff831610610d83565b3461013d57610ee1610eb3366117f3565b60606080604051610ec381611870565b82815282602082015282604082015282808201520152810190611a05565b600090815b81518051841015610f4e579060606101be85610f0194611d4e565b91610f1260206101d9838551611d4e565b610f4657610f2660206101f5838551611d4e565b610f366020610234838551611d4e565b1561024c576001905b0191610ee6565b600190610f3f565b50610f5881611d85565b610f6182611d85565b91610f6b81611d85565b90610f7581611d85565b610f87610f8183611d85565b92611d85565b9260405195610f9587611870565b865260208601526040850152606084015260808301526000916103e893428542020485144215171561059757428502610bb8810110610597576000949394905b8051518210156115145760005b6060610fef848451611d4e565b510151518110156115085761101c61100e826060610311878751611d4e565b516020610329868651611d4e565b63ffffffff611032826060610311878751611d4e565b51515116611041888651611d4e565b5260018060a01b036097541663ffffffff611063836060610311888851611d4e565b51515160405163023c4c9f60e61b815291166004820152602081602481855afa90811561068a576000916114d6575b50806001600160401b0360806110af8660606103118b8b51611d4e565b515101511611806114a7575b156112a457505080838351906110d091611d4e565b5160600151906110df91611d4e565b51515163ffffffff1681848451906110f691611d4e565b51606001519061110591611d4e565b5151608001516001600160401b031690828585519061112391611d4e565b51606001519061113291611d4e565b51516060015161ffff1691838686519061114b91611d4e565b51606001519061115a91611d4e565b5151604001516001600160401b03166001600160801b039384868989519061118191611d4e565b51606001519061119091611d4e565b51516020015116926111a1946124fc565b81848451906111af91611d4e565b5160600151906111be91611d4e565b51516020015116876020860151906111d591611d4e565b5280838351906111e491611d4e565b5160600151906111f391611d4e565b5151608001516001600160401b03168760808601519061121291611d4e565b52808383519061122191611d4e565b51606001519061123091611d4e565b5151604001516001600160401b03168760408601519061124f91611d4e565b52808383519061125e91611d4e565b51606001519061126d91611d4e565b51516060015161ffff168760608601519061128791611d4e565b526112928786611d4e565b60019052600180915b01960195610fe2565b610bb888999597949693984202016001600160401b0360806112cd8b60606103118d8d51611d4e565b515101511611156112f457886001600160401b03608061055e8b60606103118d8d51611d4e565b9091949295939796816001600160401b0360806113188460606103118b8b51611d4e565b515101511610156113eb57608063ffffffff61133b8360606103118a8a51611d4e565b515151166024604051809681936344dca75160e11b835260048301525afa92831561068a5760019384936020926000926113ca575b5060608201516113838d858c0151611d4e565b526113928c60808b0151611d4e565b5260408101516113a68c60408b0151611d4e565b5201516113b78a6060890151611d4e565b5260006113c48a89611d4e565b5261129b565b6113e491925060803d6080116106835761067581836118dc565b908c611370565b600192508291506001600160801b03602061140d8360606103118a8a51611d4e565b51510151166114208a6020890151611d4e565b526001600160401b03608061143c8360606103118a8a51611d4e565b515101511661144f8a6080890151611d4e565b526001600160401b03604061146b8360606103118a8a51611d4e565b515101511661147e8a6040890151611d4e565b5261ffff606061149483826103118a8a51611d4e565b51510151166113b78a6060890151611d4e565b50610bb8884202016001600160401b0360806114ca8660606103118b8b51611d4e565b515101511611156110bb565b90506020813d602011611500575b816114f1602093836118dc565b8101031261013d575189611092565b3d91506114e4565b50600190910190610fd5565b6107f3837ff77b9be227a199cb89ec5a0163ecdfe805c3f5c706b314c1962cd3e1ea50682486825161155160208501519260405193849384611e34565b0390a160405191829160208352611574815160a0602086015260c085019061183c565b60806115bf6115ac611598602086015194601f1995868a83030160408b015261183c565b6040860151858983030160608a015261183c565b606085015184888303018489015261183c565b920151908483030160a085015261183c565b3461013d5760208060031936011261013d576115eb6117dd565b6001600160a01b037f000000000000000000000000607f5dc1890abd080110a2f9567b46ace0e4e25b8116929061162430851415611918565b61164160008051602061285d833981519152948286541614611979565b6116496125ce565b60405193828501918583106001600160401b038411176117a357826040526000865260ff7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd914354166000146116a5575050505061084e915061269e565b84939416906040516352d1902d60e01b81528581600481865afa60009181611774575b506117295760405162461bcd60e51b815260048101879052602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b03610c9c576117378361269e565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a283511580159061176c57610c3457005b506000610c2e565b9091508681813d831161179c575b61178c81836118dc565b8101031261013d575190886116c8565b503d611782565b634e487b7160e01b600052604160045260246000fd5b3461013d57600036600319011261013d576097546001600160a01b03168152602090f35b600435906001600160a01b038216820361013d57565b90602060031983011261013d576004356001600160401b039283821161013d578060238301121561013d57816004013593841161013d576024848301011161013d576024019190565b90815180825260208080930193019160005b82811061185c575050505090565b83518552938101939281019260010161184e565b60a081019081106001600160401b038211176117a357604052565b606081019081106001600160401b038211176117a357604052565b608081019081106001600160401b038211176117a357604052565b604081019081106001600160401b038211176117a357604052565b90601f801991011681019081106001600160401b038211176117a357604052565b6001600160401b0381116117a357601f01601f191660200190565b1561191f57565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b6064820152608490fd5b1561198057565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b6064820152608490fd5b6001600160401b0381116117a35760051b60200190565b35906001600160401b038216820361013d57565b60208183031261013d578035906001600160401b03821161013d570160208183031261013d5760405191602083018381106001600160401b038211176117a35760405281356001600160401b03811161013d5781601f82850101121561013d578083013590611a73826119da565b93611a8160405195866118dc565b82855260208501918460208560051b83850101011161013d57602081830101925b60208560051b83850101018410611abe57505050505050815290565b83356001600160401b03811161013d578383010160a0818803601f19011261013d5760405190611aed826118a6565b611af9602082016119f1565b82526040810135602083015287607f8201121561013d57604051611b1c816118c1565b8060a08301918a831161013d5760608401905b838210611d3e575050604084015235906001600160401b03821161013d5788603f83830101121561013d5760208282010135611b6a816119da565b92611b7860405194856118dc565b81845260208401908b60408460051b83870101011161013d57604081850101915b60408460051b83870101018310611bc25750505050506060820152815260209384019301611aa2565b6001600160401b0383351161013d578482018335018d03603f190160c0811261013d5760a060405191611bf4836118c1565b1261013d57604051611c0581611870565b6040853585890101013563ffffffff8116810361013d578152606085358589010101356001600160801b038116810361013d5760208201526080611c4f818735878b0101016119f1565b604083015260a08635868a0101013561ffff8116810361013d576060830152611c7f60c08735878b0101016119f1565b90820152815260e084358488010101356001600160401b03811161013d578e605f828735878b01010101121561013d578684018535018101604001358f611cc5826119da565b92611cd360405194856118dc565b828452602084019160608460051b838d8b8d359101010101011161013d576060818935898d01010101915b60608460051b838d8b8d359101010101018310611d2e575050505091816020938480940152815201920191611b99565b8235815260209283019201611cfe565b8135815260209182019101611b2f565b8051821015611d625760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b9190820180921161059757565b90611d8f826119da565b611d9c60405191826118dc565b8281528092611dad601f19916119da565b0190602036910137565b9081608091031261013d57606060405191611dd1836118a6565b8051835260208101516020840152604081015160408401520151606082015290565b9190820391821161059757565b90815180825260208080930193019160005b828110611e20575050505090565b835185529381019392810192600101611e12565b91611e5d90611e4f611e6b9593606086526060860190611e00565b908482036020860152611e00565b916040818403910152611e00565b90565b7fda52bd66d138416c3a3ddc3bd0931b7fd43e8566ae54be77d52e767f336f29dd906020906001600160a01b0316611ea581612626565b609880546001600160a01b03191682179055604051908152a1565b7f063406dd506522b1ab1821a883e917769e0877ddf955ba27f5f63acc58069c45906020906001600160a01b0316611ef781612626565b609780546001600160a01b03191682179055604051908152a1565b609954811015611d625760996000527f72a152ddfb8e864297c917af52ea6c1c68aead0fee1a62673fcc7e0c94979d000190600090565b60995415611f735780600052609b602052611f68604060002054611f12565b90549060031b1c1490565b50600090565b6099548015611fc55781600052609b60205260406000205490811015611d625760996000527f72a152ddfb8e864297c917af52ea6c1c68aead0fee1a62673fcc7e0c94979d0001541490565b5050600090565b3d15611ff7573d90611fdd826118fd565b91611feb60405193846118dc565b82523d6000602084013e565b606090565b909160018060a01b0360985416906040519360208086019463140c180760e11b86526024870152604486016000905b60028210612085575050505060848401526084835260c08301918383106001600160401b038411176117a357600093849360405251915afa61206b611fcc565b501561207357565b604051632077b28160e11b8152600490fd5b8280600192865181520194019101909261202b565b6120a381611f79565b611f7357609a546099546103e8929083810361212657506120c382611f12565b90549060031b1c600052609b60205260006040812055806120fd6120e684611f12565b819391549060031b91821b91600019901b19161790565b90555b600052609b602052604060002055609a5460001981146105975760010106609a55600190565b680100000000000000008110156117a35761214b6120e6826001859401609955611f12565b9055612100565b90602082519201516001600160401b0360c01b90818116936008811061217757505050565b60080360031b82901b16169150565b9081515192604051602081019463ffffffff60e01b9060e01b168552600481526121af816118c1565b5193516001600160e01b031981169490600482106124dc575b50506000936000905b6004821061249a575050602083510151936040519460208601906001600160801b03199060801b1681526010956010815261220b816118c1565b5190516001600160801b0319811691906010821061247a575b5050946000956000915b80831061242a5750505061227461226f604086510151604051906001600160401b0360c01b9060c01b1660208201526008815261226a816118c1565b612152565b61272e565b9460608551015195604051602081019761ffff60f01b9060f01b1688526002815261229e816118c1565b5196516001600160f01b0319811697906002821061240a575b50506000805b600281106123cb57508697506122fe61226f60806020979899510151604051906001600160401b0360c01b9060c01b16888201526008815261226a816118c1565b6040516001600160e01b03199095168686019081526001600160801b031990941660248601526001600160c01b031992831660348601526001600160f01b031991909116603c85015216603e830152602682529061235b8161188b565b51902093015192906000915b84518310156123ae5761237a8386611d4e565b519060008282101561239d5750600052602052600160406000205b920191612367565b604091600193825260205220612395565b91509250036123b957565b6040516309bde33960e01b8152600490fd5b908160031b90828204600814831517156105975760081c60ff60f01b166001600160f01b03198a1690911b6001600160f81b03191617906001016122bd565b6001600160f01b031960029290920360031b82901b1616965038806122b7565b9091968760031b90600889830481148a151715610597571c6effffffffffffffffffffffffffffff60801b166001600160801b0319841690911b6001600160f81b0319161796600101919061222e565b6001600160801b031960109290920360031b82901b161690503880612224565b90948560031b906008878304811488151715610597571c62ffffff60e01b166001600160e01b0319831690911b6001600160f81b0319161794600101906121d1565b6001600160e01b031960049290920360031b82901b1616935038806121c8565b60975491946001600160a01b03909216939192843b1561013d5760009460449386926040519889978896635f6ce8c360e11b8852600488015260181b9260781b9160b81b9060c01b17171760248401525af1801561068a5761255b5750565b6001600160401b0381116117a357604052565b1561257557565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b6033546001600160a01b031633036125e257565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6001600160a01b03161561263657565b60405163d92e233d60e01b8152600490fd5b6bffffffffffffffffffffffff60a01b90816065541660655560335460018060a01b038092168093821617603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b803b156126d35760008051602061285d83398151915280546001600160a01b0319166001600160a01b03909216919091179055565b60405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b906000805b60089081831015612782578260031b9183830481148415171561059757600193909301921c66ffffffffffffff60c01b166001600160c01b0319851690911b6001600160f81b03191617612733565b93505050565b919290156127ea575081511561279c575090565b3b156127a55790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156127fd5750805190602001fd5b6040519062461bcd60e51b82528160208060048301528251908160248401526000935b828510612843575050604492506000838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935061282056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca2646970667358221220361e34d159a39933af4f9f5532432cec8db6945d856879e762d2548264c9b2b164736f6c63430008180033