Sonic Blaze Testnet

Contract

0x7c81250EC71B2C5e65e1535c42Ffc2b75608Ef28

Overview

S Balance

Sonic Blaze LogoSonic Blaze LogoSonic Blaze Logo0 S

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

> 10 Internal Transactions found.

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
174760942025-02-02 22:43:466 days ago1738536226
0x7c81250E...75608Ef28
0 S
174760942025-02-02 22:43:466 days ago1738536226
0x7c81250E...75608Ef28
0 S
174760942025-02-02 22:43:466 days ago1738536226
0x7c81250E...75608Ef28
0 S
174760942025-02-02 22:43:466 days ago1738536226
0x7c81250E...75608Ef28
0 S
174760942025-02-02 22:43:466 days ago1738536226
0x7c81250E...75608Ef28
0 S
174760942025-02-02 22:43:466 days ago1738536226
0x7c81250E...75608Ef28
0 S
174760942025-02-02 22:43:466 days ago1738536226
0x7c81250E...75608Ef28
0 S
174760942025-02-02 22:43:466 days ago1738536226
0x7c81250E...75608Ef28
0 S
174760942025-02-02 22:43:466 days ago1738536226
0x7c81250E...75608Ef28
0 S
174760942025-02-02 22:43:466 days ago1738536226
0x7c81250E...75608Ef28
0 S
174760942025-02-02 22:43:466 days ago1738536226
0x7c81250E...75608Ef28
4 wei
174754592025-02-02 22:40:026 days ago1738536002
0x7c81250E...75608Ef28
0 S
174754592025-02-02 22:40:026 days ago1738536002
0x7c81250E...75608Ef28
0 S
174754592025-02-02 22:40:026 days ago1738536002
0x7c81250E...75608Ef28
0 S
174754592025-02-02 22:40:026 days ago1738536002
0x7c81250E...75608Ef28
0 S
174754592025-02-02 22:40:026 days ago1738536002
0x7c81250E...75608Ef28
0 S
174754592025-02-02 22:40:026 days ago1738536002
0x7c81250E...75608Ef28
0 S
174754592025-02-02 22:40:026 days ago1738536002
0x7c81250E...75608Ef28
0 S
174754592025-02-02 22:40:026 days ago1738536002
0x7c81250E...75608Ef28
0 S
174754592025-02-02 22:40:026 days ago1738536002
0x7c81250E...75608Ef28
0 S
174754592025-02-02 22:40:026 days ago1738536002
0x7c81250E...75608Ef28
0 S
174754592025-02-02 22:40:026 days ago1738536002
0x7c81250E...75608Ef28
4 wei
174685142025-02-02 21:59:396 days ago1738533579
0x7c81250E...75608Ef28
0 S
174685142025-02-02 21:59:396 days ago1738533579
0x7c81250E...75608Ef28
0 S
174685142025-02-02 21:59:396 days ago1738533579
0x7c81250E...75608Ef28
0 S
View All Internal Transactions
Loading...
Loading

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

Contract Name:
LPManager

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 200 runs

Other Settings:
cancun EvmVersion, BSL 1.1 license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 54 : LPManager.sol
// SPDX-License-Identifier: BUSL-1.1
// (c) Long Gamma Labs, 2024.
pragma solidity ^0.8.28;


import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";


import { FixedPointMathLib } from "@solmate/src/utils/FixedPointMathLib.sol";


// Import Pyth Interfaces
import { IPyth } from "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
import { PythStructs } from "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";


import { ErrorReporter } from "./ErrorReporter.sol";
import { ILPManager } from  "./interfaces/ILPManager.sol";
import { IOnchainLOB } from "./interfaces/IOnchainLOB.sol";
import { IWGAS } from "./interfaces/IWGAS.sol";
import { LPToken } from "./LPToken.sol";
import { ProxyLOB } from "./ProxyLOB.sol";
import { ProxyPyth } from "./ProxyPyth.sol";
import { PythPriceHelper } from "./utils/PythPriceHelper.sol";
import { TokenValueCalculator } from "./utils/TokenValueCalculator.sol";


contract LPManager is ILPManager, ProxyLOB, Ownable2StepUpgradeable, UUPSUpgradeable {
    using SafeCast for uint256; 
    using SafeERC20 for IERC20;
    using Math for uint256;
    using FixedPointMathLib for uint256;

    struct TokenInfo {
        address tokenAddress;
        bool isActive;
        uint16 targetWeight;
        uint16 lowerBoundWeight;
        uint16 upperBoundWeight;
        uint8 decimals;
        uint24 oracleConfRel;
        bytes32 oraclePriceId;
    }

    struct LobInfo {
        address lobAddress;
        uint8 tokenIdX;
        uint8 tokenIdY;
        bool isActive;
        uint16 maxOrderDistanceBps;
    }

    mapping (address => uint256) public lastAddedAt;

    TokenInfo[] public tokens;
    uint24 public totalWeight;

    LobInfo[] public lobs;
    address public primaryMarketMaker;
    mapping (address => bool) public marketMakers;
    address public pauser;

    LPToken public liquidityToken;
    uint96 public hwmLPPrice;

    bool dynamicFeesEnabled;
    uint16 adminMintLPFeeBps;
    uint16 adminBurnLPFeeBps;
    uint16 feeBasisBps;
    uint16 taxBasisBps;
    uint24 cooldownDuration;
    uint16 maxOracleAge;
    uint128 minLiquidityValueUsd;
    uint128 maxLiquidityValueUsd;
    bool marketMakerLPShareEnabled;
    uint16 marketMakerLPShareBps;
    bool nativeTokenEnabled;
    uint8 nativeTokenTokenId;
    address adminFeeRecipient;
    uint24 priceValidityPeriod;
    uint64 baseMultiplier;
    uint64 maxAllowedPriceDeviation;
    uint16 perfFeeBps;
    uint16 adminPerfFeeBps;
    bool slashingAvailableStatus;

    uint16 constant MAX_FEE_BPS = 1e3;  // 10%
    uint16 constant MAX_PERFORMANCE_FEE_BPS = 3e3;  // 30%
    uint16 constant MAX_MARKET_MAKER_LP_TOKENS_SHARE_BPS = 1e4; // 100%
    uint24 constant ORACLE_REL_CONF_DIVISOR = 1e7;
    uint16 constant MAX_ORACLE_AGE = 3600; // 1 hour
    uint256 constant WAD = 1e18;

    ProxyPyth immutable proxyPyth;

    event TokenChanged(
        uint8 tokenId,
        address tokenAddress,
        bool isActive,
        uint16 targetWeight,
        uint16 lowerBoundWeight,
        uint16 upperBoundWeight,
        uint8 decimals,
        uint24 oracleConfRel,
        bytes32 oraclePriceId
    );

    event LobChanged(
        uint8 lobId,
        address lobAddress,
        bool isActive,
        uint8 tokenIdX,
        uint8 tokenIdY,
        uint16 maxOrderDistanceBps
    );

    event MarketMakerChanged(
        address marketMaker,
        bool isActive
    );

    event PrimaryMarketMakerChanged(
        address oldMarketMaker,
        address newMarketMaker
    );

    event PauserChanged(
        address newPauser,
        address oldPauser
    );

    event ConfigSet(
        bool dynamicFeesEnabled,
        uint16 adminMintLPFeeBps,
        uint16 adminBurnLPFeeBps,
        uint16 feeBasisBps,
        uint16 taxBasisPoints,
        uint24 cooldownDuration,
        uint16 maxOracleAge,
        uint128 minLiquidityValueUsd,
        uint128 maxLiquidityValueUsd,
        bool marketMakerLPShareEnabled,
        uint16 marketMakerLPShareBps,
        bool nativeTokenEnabled,
        uint8 nativeTokenTokenId,
        address adminFeeRecipient,
        uint24 priceValidityPeriod,
        uint64 baseMultiplier,
        uint64 maxAllowedPriceDeviation,
        uint16 perfFeeBps,
        uint16 adminPerfFeeBps
    );

    event MakersSharesSlashed(
        address marketMaker,
        uint256 amount,
        uint256 totalSupply
    );

    event SlashingAvailableStatusChanged(
        bool status
    );

    event LiquidityAdded(
        address indexed account,
        address indexed token,
        uint256 tokenAmount,
        uint256 tokenUSDValue,
        uint256 totalUSDValue,
        uint256 protocolFee,
        uint256 mintedLP,
        uint256 accountLpShares,
        uint256 totalSupply
    );

    event LiquidityRemoved(
        address indexed account,
        address indexed token,
        uint256 tokenAmount,
        uint256 lpUSDValue,
        uint256 totalUSDValue,
        uint256 protocolFee,
        uint256 burnedLP,
        uint256 accountLpShares,
        uint256 totalSupply
    );

    event PerformanceFeesDistributed(
        uint256 currentPrice,
        uint256 previousHWM,
        uint256 adminFeeAmount,
        uint256 marketMakerFeeAmount,
        uint256 totalSupply
    );

    event Sync(
        address indexed token,
        uint256 tokenBalance,
        uint256 tokenReserved
    );

    modifier ensure(uint256 expires) {
        if (block.timestamp > expires) {
            revert ErrorReporter.Expired();
        }
        _;
    }

    constructor(address _pythAddress, address _proxyPythAddress) {
        _disableInitializers();

        pyth = IPyth(_pythAddress);
        proxyPyth = ProxyPyth(_proxyPythAddress);
    }

    receive() external payable {
        IWGAS wgas = IWGAS(_getGASTokenAddress());
        wgas.deposit{value: msg.value}();
    }

    function initialize(
        address _owner,
        address _liquidityToken,
        address _adminFeeRecipient
    ) external initializer {
        __UUPSUpgradeable_init();
        __Ownable_init(_owner);
        __Ownable2Step_init();
        __ReentrancyGuard_init();
        __Pausable_init();

        liquidityToken = LPToken(_liquidityToken);

        require(_adminFeeRecipient != address(0), ErrorReporter.ZeroAddress());
        adminFeeRecipient = _adminFeeRecipient;
    }

    /// @notice Sets the configuration for the liquidity manager.
    /// @param _dynamicFeesEnabled Enable or disable dynamic fees adjustment based on token weight imbalances.
    /// @param _adminMintLPFeeBps Admin fee for minting LP tokens (100 = 1%, maximum 1000 = 10%).
    /// @param _adminBurnLPFeeBps Admin fee for burning LP tokens (100 = 1%, maximum 1000 = 10%).
    /// @param _feeBasisBps Base protocol fee (100 = 1%, maximum 1000 = 10%).
    /// @param _taxBasisBps Additional tax fee for imbalanced operations (100 = 1%, maximum 1000 = 10%).
    /// @param _cooldownDuration Lockup period after adding liquidity in seconds
    ///                         during which removeLiquidity and LP token transfers are blocked
    ///                         (maximum 16 777 215 seconds ≈ 194 days)
    /// @param _maxOracleAge Maximum allowable age of oracle price data in seconds.
    /// @param _minLiquidityValueUsd Minimum liquidity value in USD (scaled by 1e18).
    /// @param _maxLiquidityValueUsd Maximum liquidity value in USD (scaled by 1e18).
    /// @param _marketMakerLPShareEnabled Enable or disable minimum market maker share in LP tokens.
    /// @param _marketMakerLPShareBps Minimum market maker share in LP tokens (100 = 1%, maximum 10000 = 100%).
    /// @param _nativeTokenEnabled Flag to enable or disable the use of the native GAS token for transactions.
    /// @param _nativeTokenTokenId The index of the token in the tokens array that is used as the native GAS token, if enabled.
    /// @param _adminFeeRecipient The address that will receive the admin fees.
    /// @param _priceValidityPeriod The period in seconds for which the LP token price is considered valid.
    /// @param _baseMultiplier Base multiplier for calculating the allowed LP token price deviation (scaled by 1e18).
    /// @param _maxAllowedPriceDeviation The maximum allowed deviation of the LP token price from the previous valid price.
    /// @param _perfFeeBps Performance fee in basis points charged when LP token price reaches new high-water mark (100 = 1%, maximum 3000 = 30%).
    /// @param _adminPerfFeeBps Admin's share of the performance fee in basis points (100 = 1%, maximum 10000 = 100%).
    function setConfig(
        bool _dynamicFeesEnabled,
        uint16 _adminMintLPFeeBps,
        uint16 _adminBurnLPFeeBps,
        uint16 _feeBasisBps,
        uint16 _taxBasisBps,
        uint24 _cooldownDuration,
        uint16 _maxOracleAge,
        uint128 _minLiquidityValueUsd,
        uint128 _maxLiquidityValueUsd,
        bool _marketMakerLPShareEnabled,
        uint16 _marketMakerLPShareBps,
        bool _nativeTokenEnabled,
        uint8 _nativeTokenTokenId,
        address _adminFeeRecipient,
        uint24 _priceValidityPeriod,
        uint64 _baseMultiplier,
        uint64 _maxAllowedPriceDeviation,
        uint16 _perfFeeBps,
        uint16 _adminPerfFeeBps
    ) external onlyOwner {
        if (_nativeTokenEnabled) {
            require(_nativeTokenTokenId < tokens.length, ErrorReporter.WrongTokenId());
        } else {
            _nativeTokenTokenId = 0;
        }

        dynamicFeesEnabled = _dynamicFeesEnabled;

        require(_adminMintLPFeeBps <= MAX_FEE_BPS, ErrorReporter.FeeBpsExceedsMaximum());
        adminMintLPFeeBps = _adminMintLPFeeBps;

        require(_adminBurnLPFeeBps <= MAX_FEE_BPS, ErrorReporter.FeeBpsExceedsMaximum());
        adminBurnLPFeeBps = _adminBurnLPFeeBps;

        require(_feeBasisBps <= MAX_FEE_BPS, ErrorReporter.FeeBpsExceedsMaximum());
        feeBasisBps = _feeBasisBps;

        require(_taxBasisBps <= MAX_FEE_BPS, ErrorReporter.FeeBpsExceedsMaximum());
        taxBasisBps = _taxBasisBps;

        cooldownDuration = _cooldownDuration;

        require(_maxOracleAge <= MAX_ORACLE_AGE, ErrorReporter.MaxOracleAgeExceedsMaximum());
        maxOracleAge = _maxOracleAge;

        minLiquidityValueUsd = _minLiquidityValueUsd;
        maxLiquidityValueUsd = _maxLiquidityValueUsd;

        marketMakerLPShareEnabled = _marketMakerLPShareEnabled;

        require(
            _marketMakerLPShareBps <= MAX_MARKET_MAKER_LP_TOKENS_SHARE_BPS,
            ErrorReporter.MarketMakerLPShareExceedsMaximum()
        );
        marketMakerLPShareBps = _marketMakerLPShareBps;

        nativeTokenEnabled = _nativeTokenEnabled;
        nativeTokenTokenId = _nativeTokenTokenId;

        require(_adminFeeRecipient != address(0), ErrorReporter.ZeroAddress());
        adminFeeRecipient = _adminFeeRecipient;

        priceValidityPeriod = _priceValidityPeriod;
        baseMultiplier = _baseMultiplier;
        maxAllowedPriceDeviation = _maxAllowedPriceDeviation;

        require(_perfFeeBps <= MAX_PERFORMANCE_FEE_BPS, ErrorReporter.FeeBpsExceedsMaximum());
        perfFeeBps = _perfFeeBps;

        require(_adminPerfFeeBps <= BASIS_POINTS_DIVISOR, ErrorReporter.FeeBpsExceedsMaximum());
        adminPerfFeeBps = _adminPerfFeeBps;

        emit ConfigSet(
            _dynamicFeesEnabled,
            _adminMintLPFeeBps,
            _adminBurnLPFeeBps,
            _feeBasisBps,
            _taxBasisBps,
            _cooldownDuration,
            _maxOracleAge,
            _minLiquidityValueUsd,
            _maxLiquidityValueUsd,
            _marketMakerLPShareEnabled,
            _marketMakerLPShareBps,
            _nativeTokenEnabled,
            _nativeTokenTokenId,
            _adminFeeRecipient,
            _priceValidityPeriod,
            _baseMultiplier,
            _maxAllowedPriceDeviation,
            _perfFeeBps,
            _adminPerfFeeBps
        );
    }

    /// @notice Retrieves the current configuration of the LPManager.
    /// @dev Returns all configuration parameters set by the setConfig function.
    /// @return dynamicFeesEnabled Enable or disable dynamic fees adjustment based on token weight imbalances
    /// @return adminMintLPFeeBps The admin fee for minting LP tokens (in basis points).
    /// @return adminBurnLPFeeBps The admin fee for burning LP tokens (in basis points).
    /// @return feeBasisBps The base protocol fee (in basis points).
    /// @return taxBasisBps The additional tax fee for imbalanced operations (in basis points).
    /// @return cooldownDuration The lockup period after adding liquidity in seconds.
    /// @return maxOracleAge The maximum allowable age of oracle price data in seconds.
    /// @return minLiquidityValueUsd The minimum liquidity value in USD (scaled by 1e18).
    /// @return maxLiquidityValueUsd Maximum liquidity value in USD (scaled by 1e18).
    /// @return marketMakerLPShareEnabled Enable or disable minimum market maker share in LP tokens.
    /// @return marketMakerLPShareBps Minimum market maker share in LP tokens (100 = 1%, maximum 10000 = 100%).
    /// @return nativeTokenEnabled Flag to enable or disable the use of the native GAS token for transactions.
    /// @return nativeTokenTokenId The index of the token in the tokens array that is used as the native GAS token, if enabled.
    /// @return adminFeeRecipient The address that will receive the admin fees.
    /// @return priceValidityPeriod The period in seconds for which the LP token price is considered valid.
    /// @return baseMultiplier Base multiplier for calculating the allowed LP token price deviation (scaled by 1e18).
    /// @return maxAllowedPriceDeviation The maximum allowed deviation of the LP token price from the previous valid price.
    /// @return perfFeeBps Performance fee in basis points charged when LP token price reaches new high-water mark (100 = 1%, maximum 3000 = 30%).
    /// @return adminPerfFeeBps Admin's share of the performance fee in basis points (100 = 1%, maximum 10000 = 100%).
    /// @return slashingAvailableStatus Flag indicating whether slashing of market maker's LP tokens is currently available.
    function getConfig() external view returns (
        bool,
        uint16,
        uint16,
        uint16,
        uint16,
        uint24,
        uint16,
        uint128,
        uint128,
        bool,
        uint16,
        bool,
        uint8,
        address,
        uint24,
        uint64,
        uint64,
        uint16,
        uint16,
        bool
    ) {
        return (
            dynamicFeesEnabled,
            adminMintLPFeeBps,
            adminBurnLPFeeBps,
            feeBasisBps,
            taxBasisBps,
            cooldownDuration,
            maxOracleAge,
            minLiquidityValueUsd,
            maxLiquidityValueUsd,
            marketMakerLPShareEnabled,
            marketMakerLPShareBps,
            nativeTokenEnabled,
            nativeTokenTokenId,
            adminFeeRecipient,
            priceValidityPeriod,
            baseMultiplier,
            maxAllowedPriceDeviation,
            perfFeeBps,
            adminPerfFeeBps,
            slashingAvailableStatus
        );
    }

    /// @notice Updates the configuration for a specific token or adds a new token to the pool.
    /// @dev This function can only be called by the owner of the contract.
    /// @param _tokenAddress The address of the token to be updated or added.
    /// @param _isActive Determines whether the token is active or not.
    /// @param _targetWeight The target weight of the token in the pool.
    /// @param _lowerBoundWeight The lower bound weight of the token in the pool.
    /// @param _upperBoundWeight The upper bound weight of the token in the pool.
    /// @param _decimals The number of decimals the token uses, provided externally 
    ///                  since the decimals function may not be reliable or callable
    ///                  on the ERC20 token contract.
    /// @param _oracleConfRel The relative confidence interval for the oracle price.
    /// @param _oraclePriceId The identifier for the token's price in the oracle.
    function changeToken(
        address _tokenAddress,
        bool _isActive,
        uint16 _targetWeight,
        uint16 _lowerBoundWeight,
        uint16 _upperBoundWeight,
        uint8 _decimals,
        uint24 _oracleConfRel,
        bytes32 _oraclePriceId
    ) external onlyOwner {
        require(_tokenAddress != address(0), ErrorReporter.ZeroAddress());
        require(
            (_lowerBoundWeight <= _targetWeight) && (_targetWeight <= _upperBoundWeight),
            ErrorReporter.InvalidTokenWeights()
        );
        require(
            _oracleConfRel <= ORACLE_REL_CONF_DIVISOR,
            ErrorReporter.InvalidOracleConfidenceLevel()
        );

        TokenInfo memory newTokenInfo = TokenInfo({
            tokenAddress: _tokenAddress,
            isActive: _isActive,
            targetWeight: _targetWeight,
            lowerBoundWeight: _lowerBoundWeight,
            upperBoundWeight: _upperBoundWeight,
            decimals: _decimals,
            oracleConfRel: _oracleConfRel,
            oraclePriceId: _oraclePriceId
        });

        uint8 i;
        // changing token info
        for (i = 0; i < tokens.length; ++i) {
            if (tokens[i].tokenAddress == _tokenAddress) {
                uint16 oldWeight = tokens[i].targetWeight;
                totalWeight = (totalWeight - oldWeight + _targetWeight);

                tokens[i] = newTokenInfo;

                break;
            }
        }

        if (i == tokens.length) {
            tokens.push(newTokenInfo);

            totalWeight += _targetWeight;
        }

        uint8 tokenId = i;
        emit TokenChanged(
            tokenId,
            _tokenAddress,
            _isActive,
            _targetWeight,
            _lowerBoundWeight,
            _upperBoundWeight,
            _decimals,
            _oracleConfRel,
            _oraclePriceId
        );
    }

    /// @notice Updates the status of a market maker address
    /// @dev Only callable by the contract owner. Updates the marketMakers mapping to enable/disable a market maker
    /// @param marketMaker The address of the market maker to update
    /// @param isActive Boolean flag indicating whether the market maker should be active (true) or inactive (false)
    function changeMarketMaker(address marketMaker, bool isActive) external onlyOwner {
        marketMakers[marketMaker] = isActive;

        emit MarketMakerChanged(
            marketMaker,
            isActive
        );
    }

    /// @notice Changes the primary market maker address.
    /// @dev Only callable by the contract owner. If the new address matches the current one, the function returns early
    ///      The primary market maker has special privileges and responsibilities in the protocol.
    /// @param _primaryMarketMaker The address of the new primary market maker.
    function changePrimaryMarketMaker(address _primaryMarketMaker) external onlyOwner {
        if (primaryMarketMaker == _primaryMarketMaker) {
            return;
        }

        emit PrimaryMarketMakerChanged(
            primaryMarketMaker,
            _primaryMarketMaker
        );

        primaryMarketMaker = _primaryMarketMaker;
    }

    /// @notice Pause contract
    /// @dev Can be called by administrator and pauser
    function pause() external {
        require(msg.sender == owner() || msg.sender == pauser, ErrorReporter.Forbidden());
        _pause();
    }

    /// @notice Unpause contract
    /// @dev Can be called by administrator
    function unpause() external onlyOwner {
        _unpause();
    }

    /// @notice Change pauser by administrator
    /// @param pauser_ New pauser address
    /// @dev Can be called only by administrator
    function changePauser(address pauser_) external onlyOwner {
        if (pauser == pauser_) {
            return;
        }

        emit PauserChanged(pauser_, pauser);
        pauser = pauser_;
    }

    /// @notice Reduces the LP token share of the primary market maker.
    /// @dev Can only be called by the contract owner and requires the amount to be greater than zero and within the market maker's balance.
    /// @param amount The number of LP tokens to be burned from the market maker's balance.
    function slashMakersShares(uint256 amount) external onlyOwner {
        require(slashingAvailableStatus, ErrorReporter.SlashingUnAvailable());

        require(amount > 0, ErrorReporter.ZeroAmount());

        address marketMaker = primaryMarketMaker;

        require(liquidityToken.balanceOf(marketMaker) >= amount, ErrorReporter.InsufficientBalance());
        liquidityToken.burn(marketMaker, amount);

        emit MakersSharesSlashed(marketMaker, amount, liquidityToken.totalSupply());
    }

    /// @notice Disables the ability to slash the primary market maker's LP token share.
    /// @dev This function can only be called by the contract owner.
    function disableSlashingStatus() external onlyOwner {
        _changeSlashingStatus(false);
    }

    /// @notice Validates LP token price and distributes performance fees.
    /// @param priceUpdateData The array of price update data from Pyth oracle.
    function validateLPPriceAndDistributeFees(bytes[] calldata priceUpdateData) payable external {
        PythPriceHelper.updatePrices(pyth, priceUpdateData);
        _validateLPPriceAndDistributeFees();
    }

    /// @notice Adds liquidity to the pool for a specific token and mints LP tokens to the sender.
    /// @dev This function requires the token to be active and the amount to be greater than zero.
    ///      It also applies an admin fee and requires the transaction to not be expired.
    /// @param tokenId The index of the token in the tokens array for which liquidity is being added.
    /// @param amount The amount of the token to add to the liquidity pool.
    /// @param minUsdValue The minimum USD value the sender is willing to contribute in liquidity, before any fees are applied.
    /// @param minLPMinted The minimum amount of LP tokens the sender expects to receive.
    /// @param expires The timestamp until which this transaction is valid.
    /// @param priceUpdateData The array of price update data from Pyth oracle.
    /// @return The actual amount of LP tokens minted to the sender.
    function addLiquidity(
        uint8 tokenId,
        uint256 amount,
        uint256 minUsdValue,
        uint256 minLPMinted,
        uint256 expires,
        bytes[] calldata priceUpdateData
    ) external override ensure(expires) nonReentrant whenNotPaused payable returns (uint256) {
        require(tokenId < tokens.length, ErrorReporter.WrongTokenId());
        require(tokens[tokenId].isActive, ErrorReporter.TokenDisabled());
        require(amount > 0, ErrorReporter.ZeroAmount());

        PythPriceHelper.updatePrices(pyth, priceUpdateData);
        _validateLPPriceAndDistributeFees();

        (
            uint256 totalUSDValue,
            uint256 initialTokenUSDValue,
            uint256 tokenPrice,
            int32 tokenPriceExpo
        ) = proxyPyth.getReserves(tokenId, true);

        // For user convenience, we check minUsdValue before calculating fees, 
        // as it's much easier to calculate that way.
        uint256 tokenUSDValue = TokenValueCalculator.calcNormalizedValue(
            amount,
            tokens[tokenId].decimals,
            tokenPrice,
            tokenPriceExpo
        );
        require(tokenUSDValue >= minUsdValue, ErrorReporter.InsufficientUSDValue());

        uint256 adminAmount = amount.mulDivUp(adminMintLPFeeBps, BASIS_POINTS_DIVISOR);
        amount -= adminAmount;
        tokenUSDValue = TokenValueCalculator.calcNormalizedValue(
            amount,
            tokens[tokenId].decimals,
            tokenPrice,
            tokenPriceExpo
        );
        require(tokenUSDValue >= minLiquidityValueUsd, ErrorReporter.InsufficientLiquidityValue());

        uint256 nextTokenUSDValue = initialTokenUSDValue + tokenUSDValue;

        uint256 lpTokensToMint;

        uint256 lpTotalSupply = liquidityToken.totalSupply();
        uint256 protocolFee;
        if (lpTotalSupply != 0) {
            lpTokensToMint = tokenUSDValue * lpTotalSupply / totalUSDValue;
            uint256 protocolFeeBps = getFeeBasisPoints(
                totalUSDValue,
                initialTokenUSDValue,
                nextTokenUSDValue,
                tokens[tokenId].targetWeight
            );
            protocolFee = lpTokensToMint.mulDivUp(protocolFeeBps, BASIS_POINTS_DIVISOR);
            lpTokensToMint -= protocolFee;
        } else {
            // Adjusting the initial minting of LP tokens
            // to make the price of one LP token approximately equal to 1 USD
            lpTokensToMint = totalUSDValue + tokenUSDValue;
            // We add totalUSDValue for the unlikely event that someone transfers tokens
            // to the contract account before minting the initial liquidity.

            hwmLPPrice = 1e18;
        }

        lastAddedAt[msg.sender] = block.timestamp;

        // checks for weight and caps
        uint256 nextTotalUSDValue = totalUSDValue + tokenUSDValue;
        require(
            nextTotalUSDValue <= maxLiquidityValueUsd,
            ErrorReporter.MaxLiquidityValueExceeded()
        );
        require(
            nextTokenUSDValue * totalWeight <= nextTotalUSDValue * tokens[tokenId].upperBoundWeight,
            ErrorReporter.TokenWeightExceeded()
        );

        // actual token transfers
        IERC20 token = IERC20(tokens[tokenId].tokenAddress);
        if (adminAmount > 0) {
            token.safeTransferFrom(msg.sender, adminFeeRecipient, adminAmount);
        }
        token.safeTransferFrom(msg.sender, address(this), amount);

        require(lpTokensToMint >= minLPMinted, ErrorReporter.InsufficientMintedLP());
        liquidityToken.mint(msg.sender, lpTokensToMint);

        validateMarketMakerLPShare();

        emit LiquidityAdded(
            msg.sender,
            address(token),
            amount,
            tokenUSDValue,
            nextTotalUSDValue,
            protocolFee,
            lpTokensToMint,
            liquidityToken.balanceOf(msg.sender),
            lpTotalSupply + lpTokensToMint
        );

        _sync(tokenId);

        return lpTokensToMint;
    }

    /// @notice Removes liquidity from the pool and returns the underlying asset to the user.
    /// @dev This function burns LP tokens and sends the corresponding amount of the underlying asset to the user.
    ///      It also ensures that the operation respects the minimum USD value and token amount constraints.
    /// @param tokenId The ID of the token to remove liquidity from.
    /// @param burnLP The amount of LP tokens to burn in exchange for the underlying asset.
    /// @param minUsdValue The minimum USD value the user expects to receive; reverts if the value is not met.
    /// @param minTokenGet The minimum amount of the token the user expects to receive; reverts if the amount is not met.
    /// @param expires The timestamp until which this transaction is valid; reverts if the current time is beyond this point.
    /// @param priceUpdateData The array of price update data from Pyth oracle.
    /// @return tokenAmount The amount of the underlying asset returned to the user.
    function removeLiquidity(
        uint8 tokenId,
        uint256 burnLP,
        uint256 minUsdValue,
        uint256 minTokenGet,
        uint256 expires,
        bytes[] calldata priceUpdateData
    ) external override ensure(expires) nonReentrant whenNotPaused payable returns (uint256) {
        require(tokenId < tokens.length, ErrorReporter.WrongTokenId());
        require(burnLP > 0, ErrorReporter.ZeroAmount());
        checkCooldown(msg.sender);

        PythPriceHelper.updatePrices(pyth, priceUpdateData);
        _validateLPPriceAndDistributeFees();

        uint256 initialLPBalance = liquidityToken.balanceOf(msg.sender);
        require(initialLPBalance >= burnLP, ErrorReporter.InsufficientBalance());

        (
            uint256 totalUSDValue,
            uint256 initialTokenUSDValue,
            uint256 tokenPrice,
            int32 tokenPriceExpo
        ) = proxyPyth.getReserves(tokenId, false);

        uint256 lpTotalSupply = liquidityToken.totalSupply();

        uint256 lpUSDValue = totalUSDValue * burnLP / lpTotalSupply;
        require(lpUSDValue >= minUsdValue, ErrorReporter.InsufficientUSDValue());

        uint256 nextTokenUSDValue = _safeSubtract(initialTokenUSDValue, lpUSDValue);

        uint256 tokenAmount = TokenValueCalculator.calcTokenShares(
            lpUSDValue,
            tokens[tokenId].decimals,
            tokenPrice,
            tokenPriceExpo
        );

        uint256 protocolFee = 0;
        if (lpTotalSupply == burnLP) {
            proxyPyth.validatePriceMovement(0, 1, 1e18, 0);
        } else {
            uint256 protocolFeeBps = getFeeBasisPoints(
                totalUSDValue,
                initialTokenUSDValue,
                nextTokenUSDValue,
                tokens[tokenId].targetWeight
            );
            protocolFee = tokenAmount.mulDivUp(protocolFeeBps, BASIS_POINTS_DIVISOR);
        }

        // checks for weight
        uint256 protocolFeeUSDValue = TokenValueCalculator.calcNormalizedValue(
            protocolFee,
            tokens[tokenId].decimals,
            tokenPrice,
            tokenPriceExpo
        );

        totalUSDValue -= lpUSDValue - protocolFeeUSDValue;
        nextTokenUSDValue += protocolFeeUSDValue;
        require(
            nextTokenUSDValue * totalWeight >= totalUSDValue * tokens[tokenId].lowerBoundWeight,
            ErrorReporter.TokenWeightExceeded()
        );

        // actual token transfers
        liquidityToken.burn(msg.sender, burnLP);

        IERC20 token = IERC20(tokens[tokenId].tokenAddress);

        uint256 adminTokenAmount = tokenAmount.mulDivUp(adminBurnLPFeeBps, BASIS_POINTS_DIVISOR);
        if (adminTokenAmount > 0) {
            token.safeTransfer(adminFeeRecipient, adminTokenAmount);
        }

        tokenAmount -= (adminTokenAmount + protocolFee);
        require(tokenAmount >= minTokenGet, ErrorReporter.InsufficientTokenAmount());
        token.safeTransfer(msg.sender, tokenAmount);

        if (msg.sender == primaryMarketMaker) {
            validateMarketMakerLPShare();
        }

        emit LiquidityRemoved(
            msg.sender,
            address(token),
            tokenAmount,
            lpUSDValue,
            totalUSDValue,
            protocolFee,
            burnLP,
            initialLPBalance - burnLP,
            lpTotalSupply - burnLP
        );

        _sync(tokenId);

        return tokenAmount;
    }

    /// @notice Collects fees from all registered limit order books (LOBs) and withdraws tokens.
    /// @dev Iterates through all LOBs, calls transferFees to collect fees, and withdraws tokens to the LPManager.
    function collectFees() external nonReentrant whenNotPaused {
        for (uint8 i = 0; i < lobs.length; ++i) {
            if (!lobs[i].isActive) {
                continue;
            }
            IOnchainLOB lob = IOnchainLOB(lobs[i].lobAddress);
            lob.transferFees();
            lob.withdrawTokens(true, 0, 0);
        }
    }

    function getTokensCount() external view returns (uint256) {
        return tokens.length;
    }

    /// @notice Calculates the fee basis points for adding or removing liquidity based on the target weight of the token.
    /// @dev This function can return a reduced fee if the dynamic fees are enabled and the next token value is closer
    ///      to the target than the initial token value, or it can increase the fee if the next token value is further from the target.
    /// @param totalValue The total USD value of all tokens in the liquidity pool.
    /// @param initialTokenValue The USD value of the token before the liquidity event.
    /// @param nextTokenValue The USD value of the token after the liquidity event.
    /// @param targetTokenWeight The target weight of the token in the pool.
    /// @return The calculated fee basis points.
    function getFeeBasisPoints(
        uint256 totalValue,
        uint256 initialTokenValue,
        uint256 nextTokenValue,
        uint16 targetTokenWeight
    ) public view returns (uint256) {
        uint256 _feeBasisPoints = feeBasisBps;
        uint256 _taxBasisPoints = taxBasisBps;

        if (!dynamicFeesEnabled) {
            return _feeBasisPoints;
        }

        uint256 targetTokenValue = totalValue * targetTokenWeight / totalWeight;
        if (targetTokenValue == 0) {
            return _feeBasisPoints;
        }

        uint256 initialDiff = _absDiff(initialTokenValue, targetTokenValue);
        uint256 nextDiff = _absDiff(nextTokenValue, targetTokenValue);

        if (nextDiff < initialDiff) {
            uint256 rebateBps = initialDiff.mulDiv(_taxBasisPoints, targetTokenValue);
            return _safeSubtract(_feeBasisPoints, rebateBps);
        }

        uint256 averageDiff = (initialDiff + nextDiff) / 2;
        if (averageDiff > targetTokenValue) {
            averageDiff = targetTokenValue;
        }
        uint256 taxBps = averageDiff.mulDiv(_taxBasisPoints, targetTokenValue);
        return _feeBasisPoints + taxBps;
    }

    /// @notice Checks if the cooldown period has passed for the given account.
    /// @dev This function reverts if the cooldown duration has not yet passed since the last liquidity was added.
    ///      If the cooldown duration is set to zero, the check is bypassed.
    /// @param account The address of the account to check the cooldown for.
    function checkCooldown(address account) public view {
        if (cooldownDuration == 0) {
            return;
        }
        require(
            block.timestamp - lastAddedAt[account] >= cooldownDuration,
            ErrorReporter.CooldownDurationNotYetPassed()
        );
    }

    /// @notice Fetches the latest price of a token using the oracle, ensuring it's not older than maxOracleAge.
    /// @param tokenId The index of the token in the tokens array.
    /// @return price The latest price of the token scaled by the price exponent.
    /// @return priceExpo The exponent to scale the token price for normalization.
    function getPriceOf(uint8 tokenId) override public view returns (uint256, int32) {
        require(tokenId < tokens.length, ErrorReporter.WrongTokenId());

        PythStructs.Price memory pythPrice = pyth.getPriceNoOlderThan(
            tokens[tokenId].oraclePriceId,
            maxOracleAge
        );

        require(pythPrice.price > 0, ErrorReporter.NonPositivePrice());
        uint256 normalizedPrice = uint256(uint64(pythPrice.price));

        // Price confidence interval check
        require(
            ORACLE_REL_CONF_DIVISOR * pythPrice.conf <= tokens[tokenId].oracleConfRel * normalizedPrice,
            ErrorReporter.OracleConfTooHigh()
        );

        return (normalizedPrice, pythPrice.expo);
    }

    /// @notice Changes the state of a limit order book (LOB) on the exchange and updates token information.
    /// @dev Emits a LobChanged event with the parameters of the change.
    /// @param lobAddress The address of the limit order book on the exchange.
    /// @param isActive Indicates whether the limit order book is active.
    /// @param tokenIdX The identifier of token X in the tokens array.
    /// @param tokenIdY The identifier of token Y in the tokens array.
    /// @param maxOrderDistanceBps The maximum allowed distance, in basis points, 
    ///                            between the order price and the oracle price; this value is uncapped.
    function changeLob(
        address lobAddress,
        bool isActive,
        uint8 tokenIdX,
        uint8 tokenIdY,
        uint16 maxOrderDistanceBps
    ) external onlyOwner {
        require(lobAddress != address(0), ErrorReporter.ZeroAddress());

        uint8 i;
        for (i = 0; i < lobs.length; ++i) {
            if (lobs[i].lobAddress == lobAddress) {
                lobs[i].isActive = isActive;
                lobs[i].maxOrderDistanceBps = maxOrderDistanceBps;

                break;
            }
        }

        if (i == lobs.length) {
            // check token ids
            (
                ,
                ,
                address tokenX,
                address tokenY,
                ,
                ,
                ,
                ,
                ,
                ,
                ,
                ,
            ) = IOnchainLOB(payable(lobAddress)).getConfig();        

            require(tokens[tokenIdX].tokenAddress == tokenX, ErrorReporter.WrongTokenId());
            require(tokens[tokenIdY].tokenAddress == tokenY, ErrorReporter.WrongTokenId());

            // adding new lob info
            lobs.push(LobInfo({
                lobAddress: lobAddress,
                isActive: isActive,
                tokenIdX: tokenIdX,
                tokenIdY: tokenIdY,
                maxOrderDistanceBps: maxOrderDistanceBps
            }));

            IOnchainLOB(lobAddress).setClaimableStatus(false);
        }

        emit LobChanged(
            i,
            lobAddress,
            isActive,
            tokenIdX,
            tokenIdY,
            maxOrderDistanceBps
        );
    }

    /// @notice Approves a specific LOB (Limit Order Book) to spend tokens on behalf of the contract
    /// @dev Only callable by the contract owner. Validates both LOB and token existence/activity before approval
    /// @param lobId The identifier of the LOB in the lobs array
    /// @param tokenId The identifier of the token to be approved in the tokens array
    /// @param value The amount of tokens to approve for spending
    function approveForLOB(uint8 lobId, uint8 tokenId, uint256 value) external onlyOwner {
        _checkLOB(lobId);
        require(
            tokenId < tokens.length && tokens[tokenId].isActive, 
            ErrorReporter.WrongTokenId()
        );

        address lobAddress = lobs[lobId].lobAddress;

        IERC20 token = IERC20(tokens[tokenId].tokenAddress);
        token.approve(lobAddress, value);
    }

    /// @notice Validates if the primary market maker holds sufficient LP tokens share.
    /// @dev Checks if market maker's LP share meets the minimum required percentage when enabled.
    function validateMarketMakerLPShare() public view {
        if (!marketMakerLPShareEnabled) {
            return;
        }

        uint256 lpTotalSupply = liquidityToken.totalSupply();
        uint256 marketMakerLpShare = liquidityToken.balanceOf(primaryMarketMaker);

        require(
            marketMakerLpShare * BASIS_POINTS_DIVISOR >= lpTotalSupply * marketMakerLPShareBps,
            ErrorReporter.InsufficientMarketMakerLPShare()
        );
    }

    /// @dev Retrieves total USD value of the reserves.
    /// @return totalUSDValue The total USD value of all tokens in the contract.
    function _getTotalValueOfReserves() internal view returns (uint256 totalUSDValue) {
        for (uint8 i = 0; i < tokens.length; ++i) {
            IERC20 token = IERC20(tokens[i].tokenAddress);

            uint256 currentTokenShares = token.balanceOf(address(this)) + lobReservesByTokenId[i];
            (uint256 currentTokenPrice, int32 currentTokenPriceExpo) = getPriceOf(i);

            uint8 currentTokenDecimals = tokens[i].decimals;
            uint256 currentTokenValue = TokenValueCalculator.calcNormalizedValue(
                currentTokenShares,
                currentTokenDecimals,
                currentTokenPrice,
                currentTokenPriceExpo
            );
            totalUSDValue += currentTokenValue;
        }
    }

    /// @notice Validates the existence and active status of a Limit Order Book (LOB).
    /// @dev Performs two checks: existence of LOB ID and its active status.
    /// @param lobId The ID of the limit order book to validate.
    function _checkLOB(uint8 lobId) override internal view {
        require(lobId < lobs.length, ErrorReporter.UnknownLob());
        require(lobs[lobId].isActive, ErrorReporter.LobDisabled());
    }

    /// @notice Validates if the provided address is an authorized trader (market maker).
    /// @dev Checks if the address is registered in the marketMakers mapping.
    /// @param trader The address to validate.
    function _checkTrader(address trader) override internal view {
        require(marketMakers[trader], ErrorReporter.InvalidTrader());
    }

    /// @notice Gets information about a LOB by its ID.
    /// @dev Returns all relevant parameters for the specified Limit Order Book.
    /// @param lobId The ID of the limit order book to query.
    /// @return lobAddress The contract address of the LOB.
    /// @return tokenIdX The ID of the first token in the trading pair.
    /// @return tokenIdY The ID of the second token in the trading pair.
    /// @return maxOrderDistanceBps The maximum order distance in basis points.
    function _getLobById(uint8 lobId) override internal view returns (
        address lobAddress,
        uint8 tokenIdX,
        uint8 tokenIdY,
        uint16 maxOrderDistanceBps
    ) {
        return (lobs[lobId].lobAddress, lobs[lobId].tokenIdX, lobs[lobId].tokenIdY, lobs[lobId].maxOrderDistanceBps);
    }

    /// @notice Retrieves the number of decimals for a given token.
    /// @dev Internal helper function used to get token decimals from storage.
    /// @param tokenId The identifier of the token in the tokens array.
    /// @return uint8 The number of decimals for the specified token.
    function _getTokenDecimalsById(uint8 tokenId) override internal view returns (uint8) {
        return tokens[tokenId].decimals;
    }

    /// @notice Calculates the absolute difference between two numbers without overflow checking.
    /// @dev Uses unchecked for gas optimization, safe because it subtracts smaller from larger.
    /// @param a First number to compare.
    /// @param b Second number to compare.
    /// @return The absolute difference between numbers |a - b|.
    function _absDiff(uint256 a, uint256 b) internal pure returns (uint256) {
        unchecked {
            return a > b ? a - b : b - a;
        }
    }

    /// @notice Safely subtracts two numbers, returning 0 if result would be negative.
    /// @dev Uses unchecked for gas optimization, safe because result is bounded by 0.
    /// @param a The number to subtract from.
    /// @param b The number to subtract.
    /// @return The result of a - b if a >= b, otherwise 0.
    function _safeSubtract(uint256 a, uint256 b) internal pure returns (uint256) {
        unchecked {
            return b <= a ? a - b : 0;
        }
    }

    /// @notice Ensures that only the owner can authorize smart contract upgrades.
    /// @dev This function is an override of the UUPS upgradeable pattern's _authorizeUpgrade function.
    /// It restricts upgrade authorization to the contract owner only.
    /// @param newImplementation The address of the new contract implementation to which the upgrade will occur.
    function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}

    /// @notice Retrieves the address of the native GAS token used for transactions if enabled.
    /// @dev Returns the address of the token marked as the native GAS token within the tokens array.
    ///      Assumes that nativeTokenEnabled is a flag indicating the presence of a native GAS token and
    ///      nativeTokenTokenId is the index of the native GAS token in the tokens array.
    /// @return The address of the native GAS token if enabled, otherwise reverts.
    function _getGASTokenAddress() internal view returns (address) {
        require(nativeTokenEnabled && tokens[nativeTokenTokenId].isActive, ErrorReporter.NativeGasTokenDisabled());
        return tokens[nativeTokenTokenId].tokenAddress;
    }

    /// @notice Changes the slashing availability status.
    /// @param newStatus New status to set.
    /// @dev Emits SlashingAvailableStatusChanged event only if status actually changes.
    function _changeSlashingStatus(bool newStatus) internal {
        if (slashingAvailableStatus != newStatus) {
            slashingAvailableStatus = newStatus;
            emit SlashingAvailableStatusChanged(newStatus);
        }
    }

    /// @notice Validates LP token price and distributes performance fees.
    function _validateLPPriceAndDistributeFees() override internal {
        uint256 totalSupply = liquidityToken.totalSupply();
        if (totalSupply == 0) {
            return;
        }
        uint256 totalValue = _getTotalValueOfReserves();

        uint256 currentPrice = WAD.mulDivDown(totalValue, totalSupply);

        if (currentPrice > hwmLPPrice) {
            if (perfFeeBps > 0 && primaryMarketMaker != address(0x0)){
                uint256 deltaPrice;
                unchecked {
                    deltaPrice = currentPrice - hwmLPPrice;
                }
                uint256 hwmFeeLPTokens = totalSupply * deltaPrice * perfFeeBps / (currentPrice * BASIS_POINTS_DIVISOR);

                uint256 adminHwmFeeLPTokens = hwmFeeLPTokens * adminPerfFeeBps / BASIS_POINTS_DIVISOR;
                if (adminHwmFeeLPTokens > 0) {
                    liquidityToken.mint(adminFeeRecipient, adminHwmFeeLPTokens);
                }

                uint256 mmHwmFeeLPTokens;
                unchecked {
                    mmHwmFeeLPTokens = hwmFeeLPTokens - adminHwmFeeLPTokens;
                }
                if (mmHwmFeeLPTokens > 0) {
                    liquidityToken.mint(primaryMarketMaker, mmHwmFeeLPTokens);
                }

                emit PerformanceFeesDistributed(
                    currentPrice,
                    hwmLPPrice,
                    adminHwmFeeLPTokens,
                    mmHwmFeeLPTokens,
                    totalSupply
                );
            }

            hwmLPPrice = currentPrice.toUint96();
        }

        if (!proxyPyth.validatePriceMovement(currentPrice, priceValidityPeriod, baseMultiplier, maxAllowedPriceDeviation)) {
            _pause();
            _changeSlashingStatus(true);
        }
    }

    /// @notice Emits a Sync event with the current token balance and reserves for a given token ID.
    /// @param tokenId The ID of the token to sync. 
    /// @dev This internal function is called after operations that modify token balances or reserves
    ///      to keep the event log updated with the latest state.
    function _sync(uint8 tokenId) internal override {
        address tokenAddress = tokens[tokenId].tokenAddress;
        emit Sync(
            tokenAddress,
            IERC20(tokenAddress).balanceOf(address(this)),
            lobReservesByTokenId[tokenId]
        );
    }
}

File 2 of 54 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

File 3 of 54 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

import {Panic} from "../Panic.sol";
import {SafeCast} from "./SafeCast.sol";

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an success flag (no overflow).
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an success flag (no overflow).
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an success flag (no overflow).
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a success flag (no division by zero).
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.
     *
     * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.
     * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute
     * one branch when needed, making this function more expensive.
     */
    function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {
        unchecked {
            // branchless ternary works because:
            // b ^ (a ^ b) == a
            // b ^ 0 == b
            return b ^ ((a ^ b) * SafeCast.toUint(condition));
        }
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return ternary(a > b, a, b);
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return ternary(a < b, a, b);
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            Panic.panic(Panic.DIVISION_BY_ZERO);
        }

        // The following calculation ensures accurate ceiling division without overflow.
        // Since a is non-zero, (a - 1) / b will not overflow.
        // The largest possible result occurs when (a - 1) / b is type(uint256).max,
        // but the largest value we can obtain is type(uint256).max - 1, which happens
        // when a = type(uint256).max and b = 1.
        unchecked {
            return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);
        }
    }

    /**
     * @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
     * denominator == 0.
     *
     * Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
     * Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use
            // the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2²⁵⁶ + prod0.
            uint256 prod0 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.
            if (denominator <= prod1) {
                Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));
            }

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.
            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such
            // that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv ≡ 1 mod 2⁴.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
            // works in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2⁸
            inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶
            inverse *= 2 - denominator * inverse; // inverse mod 2³²
            inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴
            inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸
            inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2²⁵⁶. Since the preconditions guarantee that the outcome is
            // less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @dev Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);
    }

    /**
     * @dev Calculate the modular multiplicative inverse of a number in Z/nZ.
     *
     * If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.
     * If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.
     *
     * If the input value is not inversible, 0 is returned.
     *
     * NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the
     * inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.
     */
    function invMod(uint256 a, uint256 n) internal pure returns (uint256) {
        unchecked {
            if (n == 0) return 0;

            // The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)
            // Used to compute integers x and y such that: ax + ny = gcd(a, n).
            // When the gcd is 1, then the inverse of a modulo n exists and it's x.
            // ax + ny = 1
            // ax = 1 + (-y)n
            // ax ≡ 1 (mod n) # x is the inverse of a modulo n

            // If the remainder is 0 the gcd is n right away.
            uint256 remainder = a % n;
            uint256 gcd = n;

            // Therefore the initial coefficients are:
            // ax + ny = gcd(a, n) = n
            // 0a + 1n = n
            int256 x = 0;
            int256 y = 1;

            while (remainder != 0) {
                uint256 quotient = gcd / remainder;

                (gcd, remainder) = (
                    // The old remainder is the next gcd to try.
                    remainder,
                    // Compute the next remainder.
                    // Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd
                    // where gcd is at most n (capped to type(uint256).max)
                    gcd - remainder * quotient
                );

                (x, y) = (
                    // Increment the coefficient of a.
                    y,
                    // Decrement the coefficient of n.
                    // Can overflow, but the result is casted to uint256 so that the
                    // next value of y is "wrapped around" to a value between 0 and n - 1.
                    x - y * int256(quotient)
                );
            }

            if (gcd != 1) return 0; // No inverse exists.
            return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.
        }
    }

    /**
     * @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.
     *
     * From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is
     * prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that
     * `a**(p-2)` is the modular multiplicative inverse of a in Fp.
     *
     * NOTE: this function does NOT check that `p` is a prime greater than `2`.
     */
    function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {
        unchecked {
            return Math.modExp(a, p - 2, p);
        }
    }

    /**
     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)
     *
     * Requirements:
     * - modulus can't be zero
     * - underlying staticcall to precompile must succeed
     *
     * IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make
     * sure the chain you're using it on supports the precompiled contract for modular exponentiation
     * at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,
     * the underlying function will succeed given the lack of a revert, but the result may be incorrectly
     * interpreted as 0.
     */
    function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {
        (bool success, uint256 result) = tryModExp(b, e, m);
        if (!success) {
            Panic.panic(Panic.DIVISION_BY_ZERO);
        }
        return result;
    }

    /**
     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).
     * It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying
     * to operate modulo 0 or if the underlying precompile reverted.
     *
     * IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain
     * you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in
     * https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack
     * of a revert, but the result may be incorrectly interpreted as 0.
     */
    function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {
        if (m == 0) return (false, 0);
        assembly ("memory-safe") {
            let ptr := mload(0x40)
            // | Offset    | Content    | Content (Hex)                                                      |
            // |-----------|------------|--------------------------------------------------------------------|
            // | 0x00:0x1f | size of b  | 0x0000000000000000000000000000000000000000000000000000000000000020 |
            // | 0x20:0x3f | size of e  | 0x0000000000000000000000000000000000000000000000000000000000000020 |
            // | 0x40:0x5f | size of m  | 0x0000000000000000000000000000000000000000000000000000000000000020 |
            // | 0x60:0x7f | value of b | 0x<.............................................................b> |
            // | 0x80:0x9f | value of e | 0x<.............................................................e> |
            // | 0xa0:0xbf | value of m | 0x<.............................................................m> |
            mstore(ptr, 0x20)
            mstore(add(ptr, 0x20), 0x20)
            mstore(add(ptr, 0x40), 0x20)
            mstore(add(ptr, 0x60), b)
            mstore(add(ptr, 0x80), e)
            mstore(add(ptr, 0xa0), m)

            // Given the result < m, it's guaranteed to fit in 32 bytes,
            // so we can use the memory scratch space located at offset 0.
            success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)
            result := mload(0x00)
        }
    }

    /**
     * @dev Variant of {modExp} that supports inputs of arbitrary length.
     */
    function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {
        (bool success, bytes memory result) = tryModExp(b, e, m);
        if (!success) {
            Panic.panic(Panic.DIVISION_BY_ZERO);
        }
        return result;
    }

    /**
     * @dev Variant of {tryModExp} that supports inputs of arbitrary length.
     */
    function tryModExp(
        bytes memory b,
        bytes memory e,
        bytes memory m
    ) internal view returns (bool success, bytes memory result) {
        if (_zeroBytes(m)) return (false, new bytes(0));

        uint256 mLen = m.length;

        // Encode call args in result and move the free memory pointer
        result = abi.encodePacked(b.length, e.length, mLen, b, e, m);

        assembly ("memory-safe") {
            let dataPtr := add(result, 0x20)
            // Write result on top of args to avoid allocating extra memory.
            success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)
            // Overwrite the length.
            // result.length > returndatasize() is guaranteed because returndatasize() == m.length
            mstore(result, mLen)
            // Set the memory pointer after the returned data.
            mstore(0x40, add(dataPtr, mLen))
        }
    }

    /**
     * @dev Returns whether the provided byte array is zero.
     */
    function _zeroBytes(bytes memory byteArray) private pure returns (bool) {
        for (uint256 i = 0; i < byteArray.length; ++i) {
            if (byteArray[i] != 0) {
                return false;
            }
        }
        return true;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
     * towards zero.
     *
     * This method is based on Newton's method for computing square roots; the algorithm is restricted to only
     * using integer operations.
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        unchecked {
            // Take care of easy edge cases when a == 0 or a == 1
            if (a <= 1) {
                return a;
            }

            // In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a
            // sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between
            // the current value as `ε_n = | x_n - sqrt(a) |`.
            //
            // For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root
            // of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is
            // bigger than any uint256.
            //
            // By noticing that
            // `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`
            // we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar
            // to the msb function.
            uint256 aa = a;
            uint256 xn = 1;

            if (aa >= (1 << 128)) {
                aa >>= 128;
                xn <<= 64;
            }
            if (aa >= (1 << 64)) {
                aa >>= 64;
                xn <<= 32;
            }
            if (aa >= (1 << 32)) {
                aa >>= 32;
                xn <<= 16;
            }
            if (aa >= (1 << 16)) {
                aa >>= 16;
                xn <<= 8;
            }
            if (aa >= (1 << 8)) {
                aa >>= 8;
                xn <<= 4;
            }
            if (aa >= (1 << 4)) {
                aa >>= 4;
                xn <<= 2;
            }
            if (aa >= (1 << 2)) {
                xn <<= 1;
            }

            // We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).
            //
            // We can refine our estimation by noticing that the middle of that interval minimizes the error.
            // If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).
            // This is going to be our x_0 (and ε_0)
            xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)

            // From here, Newton's method give us:
            // x_{n+1} = (x_n + a / x_n) / 2
            //
            // One should note that:
            // x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a
            //              = ((x_n² + a) / (2 * x_n))² - a
            //              = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a
            //              = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)
            //              = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)
            //              = (x_n² - a)² / (2 * x_n)²
            //              = ((x_n² - a) / (2 * x_n))²
            //              ≥ 0
            // Which proves that for all n ≥ 1, sqrt(a) ≤ x_n
            //
            // This gives us the proof of quadratic convergence of the sequence:
            // ε_{n+1} = | x_{n+1} - sqrt(a) |
            //         = | (x_n + a / x_n) / 2 - sqrt(a) |
            //         = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |
            //         = | (x_n - sqrt(a))² / (2 * x_n) |
            //         = | ε_n² / (2 * x_n) |
            //         = ε_n² / | (2 * x_n) |
            //
            // For the first iteration, we have a special case where x_0 is known:
            // ε_1 = ε_0² / | (2 * x_0) |
            //     ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))
            //     ≤ 2**(2*e-4) / (3 * 2**(e-1))
            //     ≤ 2**(e-3) / 3
            //     ≤ 2**(e-3-log2(3))
            //     ≤ 2**(e-4.5)
            //
            // For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:
            // ε_{n+1} = ε_n² / | (2 * x_n) |
            //         ≤ (2**(e-k))² / (2 * 2**(e-1))
            //         ≤ 2**(2*e-2*k) / 2**e
            //         ≤ 2**(e-2*k)
            xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5)  -- special case, see above
            xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9)    -- general case with k = 4.5
            xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18)   -- general case with k = 9
            xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36)   -- general case with k = 18
            xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72)   -- general case with k = 36
            xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144)  -- general case with k = 72

            // Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision
            // ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either
            // sqrt(a) or sqrt(a) + 1.
            return xn - SafeCast.toUint(xn > a / xn);
        }
    }

    /**
     * @dev Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log2(uint256 x) internal pure returns (uint256 r) {
        // If value has upper 128 bits set, log2 result is at least 128
        r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;
        // If upper 64 bits of 128-bit half set, add 64 to result
        r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;
        // If upper 32 bits of 64-bit half set, add 32 to result
        r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;
        // If upper 16 bits of 32-bit half set, add 16 to result
        r |= SafeCast.toUint((x >> r) > 0xffff) << 4;
        // If upper 8 bits of 16-bit half set, add 8 to result
        r |= SafeCast.toUint((x >> r) > 0xff) << 3;
        // If upper 4 bits of 8-bit half set, add 4 to result
        r |= SafeCast.toUint((x >> r) > 0xf) << 2;

        // Shifts value right by the current result and use it as an index into this lookup table:
        //
        // | x (4 bits) |  index  | table[index] = MSB position |
        // |------------|---------|-----------------------------|
        // |    0000    |    0    |        table[0] = 0         |
        // |    0001    |    1    |        table[1] = 0         |
        // |    0010    |    2    |        table[2] = 1         |
        // |    0011    |    3    |        table[3] = 1         |
        // |    0100    |    4    |        table[4] = 2         |
        // |    0101    |    5    |        table[5] = 2         |
        // |    0110    |    6    |        table[6] = 2         |
        // |    0111    |    7    |        table[7] = 2         |
        // |    1000    |    8    |        table[8] = 3         |
        // |    1001    |    9    |        table[9] = 3         |
        // |    1010    |   10    |        table[10] = 3        |
        // |    1011    |   11    |        table[11] = 3        |
        // |    1100    |   12    |        table[12] = 3        |
        // |    1101    |   13    |        table[13] = 3        |
        // |    1110    |   14    |        table[14] = 3        |
        // |    1111    |   15    |        table[15] = 3        |
        //
        // The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the last 16 bytes.
        assembly ("memory-safe") {
            r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000))
        }
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 x) internal pure returns (uint256 r) {
        // If value has upper 128 bits set, log2 result is at least 128
        r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;
        // If upper 64 bits of 128-bit half set, add 64 to result
        r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;
        // If upper 32 bits of 64-bit half set, add 32 to result
        r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;
        // If upper 16 bits of 32-bit half set, add 16 to result
        r |= SafeCast.toUint((x >> r) > 0xffff) << 4;
        // Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8
        return (r >> 3) | SafeCast.toUint((x >> r) > 0xff);
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

File 4 of 54 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

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

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

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @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 {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @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 {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

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

File 5 of 54 : Ownable2StepUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.20;

import {OwnableUpgradeable} from "./OwnableUpgradeable.sol";
import {Initializable} from "../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.
 *
 * This extension of the {Ownable} contract includes a two-step mechanism to transfer
 * ownership, where the new owner must call {acceptOwnership} in order to replace the
 * old one. This can help prevent common mistakes, such as transfers of ownership to
 * incorrect accounts, or to contracts that are unable to interact with the
 * permission system.
 *
 * The initial owner is specified at deployment time in the constructor for `Ownable`. 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 {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable2Step
    struct Ownable2StepStorage {
        address _pendingOwner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable2Step")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant Ownable2StepStorageLocation = 0x237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00;

    function _getOwnable2StepStorage() private pure returns (Ownable2StepStorage storage $) {
        assembly {
            $.slot := Ownable2StepStorageLocation
        }
    }

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

    function __Ownable2Step_init() internal onlyInitializing {
    }

    function __Ownable2Step_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Returns the address of the pending owner.
     */
    function pendingOwner() public view virtual returns (address) {
        Ownable2StepStorage storage $ = _getOwnable2StepStorage();
        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.
     *
     * Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        Ownable2StepStorage storage $ = _getOwnable2StepStorage();
        $._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 {
        Ownable2StepStorage storage $ = _getOwnable2StepStorage();
        delete $._pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        if (pendingOwner() != sender) {
            revert OwnableUnauthorizedAccount(sender);
        }
        _transferOwnership(sender);
    }
}

File 6 of 54 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.20;

/**
 * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeCast {
    /**
     * @dev Value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);

    /**
     * @dev An int value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedIntToUint(int256 value);

    /**
     * @dev Value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);

    /**
     * @dev An uint value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedUintToInt(uint256 value);

    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        if (value > type(uint248).max) {
            revert SafeCastOverflowedUintDowncast(248, value);
        }
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        if (value > type(uint240).max) {
            revert SafeCastOverflowedUintDowncast(240, value);
        }
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        if (value > type(uint232).max) {
            revert SafeCastOverflowedUintDowncast(232, value);
        }
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        if (value > type(uint224).max) {
            revert SafeCastOverflowedUintDowncast(224, value);
        }
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        if (value > type(uint216).max) {
            revert SafeCastOverflowedUintDowncast(216, value);
        }
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        if (value > type(uint208).max) {
            revert SafeCastOverflowedUintDowncast(208, value);
        }
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        if (value > type(uint200).max) {
            revert SafeCastOverflowedUintDowncast(200, value);
        }
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        if (value > type(uint192).max) {
            revert SafeCastOverflowedUintDowncast(192, value);
        }
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        if (value > type(uint184).max) {
            revert SafeCastOverflowedUintDowncast(184, value);
        }
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        if (value > type(uint176).max) {
            revert SafeCastOverflowedUintDowncast(176, value);
        }
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        if (value > type(uint168).max) {
            revert SafeCastOverflowedUintDowncast(168, value);
        }
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        if (value > type(uint160).max) {
            revert SafeCastOverflowedUintDowncast(160, value);
        }
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        if (value > type(uint152).max) {
            revert SafeCastOverflowedUintDowncast(152, value);
        }
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        if (value > type(uint144).max) {
            revert SafeCastOverflowedUintDowncast(144, value);
        }
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        if (value > type(uint136).max) {
            revert SafeCastOverflowedUintDowncast(136, value);
        }
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        if (value > type(uint128).max) {
            revert SafeCastOverflowedUintDowncast(128, value);
        }
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        if (value > type(uint120).max) {
            revert SafeCastOverflowedUintDowncast(120, value);
        }
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        if (value > type(uint112).max) {
            revert SafeCastOverflowedUintDowncast(112, value);
        }
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        if (value > type(uint104).max) {
            revert SafeCastOverflowedUintDowncast(104, value);
        }
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        if (value > type(uint96).max) {
            revert SafeCastOverflowedUintDowncast(96, value);
        }
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        if (value > type(uint88).max) {
            revert SafeCastOverflowedUintDowncast(88, value);
        }
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        if (value > type(uint80).max) {
            revert SafeCastOverflowedUintDowncast(80, value);
        }
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        if (value > type(uint72).max) {
            revert SafeCastOverflowedUintDowncast(72, value);
        }
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        if (value > type(uint64).max) {
            revert SafeCastOverflowedUintDowncast(64, value);
        }
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        if (value > type(uint56).max) {
            revert SafeCastOverflowedUintDowncast(56, value);
        }
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        if (value > type(uint48).max) {
            revert SafeCastOverflowedUintDowncast(48, value);
        }
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        if (value > type(uint40).max) {
            revert SafeCastOverflowedUintDowncast(40, value);
        }
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        if (value > type(uint32).max) {
            revert SafeCastOverflowedUintDowncast(32, value);
        }
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        if (value > type(uint24).max) {
            revert SafeCastOverflowedUintDowncast(24, value);
        }
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        if (value > type(uint16).max) {
            revert SafeCastOverflowedUintDowncast(16, value);
        }
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        if (value > type(uint8).max) {
            revert SafeCastOverflowedUintDowncast(8, value);
        }
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        if (value < 0) {
            revert SafeCastOverflowedIntToUint(value);
        }
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(248, value);
        }
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(240, value);
        }
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(232, value);
        }
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(224, value);
        }
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(216, value);
        }
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(208, value);
        }
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(200, value);
        }
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(192, value);
        }
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(184, value);
        }
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(176, value);
        }
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(168, value);
        }
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(160, value);
        }
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(152, value);
        }
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(144, value);
        }
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(136, value);
        }
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(128, value);
        }
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(120, value);
        }
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(112, value);
        }
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(104, value);
        }
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(96, value);
        }
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(88, value);
        }
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(80, value);
        }
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(72, value);
        }
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(64, value);
        }
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(56, value);
        }
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(48, value);
        }
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(40, value);
        }
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(32, value);
        }
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(24, value);
        }
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(16, value);
        }
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(8, value);
        }
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        if (value > uint256(type(int256).max)) {
            revert SafeCastOverflowedUintToInt(value);
        }
        return int256(value);
    }

    /**
     * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.
     */
    function toUint(bool b) internal pure returns (uint256 u) {
        assembly ("memory-safe") {
            u := iszero(iszero(b))
        }
    }
}

File 7 of 54 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    /**
     * @dev An operation with an ERC-20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}

File 8 of 54 : UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.22;

import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol";
import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
import {Initializable} from "./Initializable.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.
 */
abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    address private immutable __self = address(this);

    /**
     * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`
     * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,
     * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.
     * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must
     * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function
     * during an upgrade.
     */
    string public constant UPGRADE_INTERFACE_VERSION = "5.0.0";

    /**
     * @dev The call is from an unauthorized context.
     */
    error UUPSUnauthorizedCallContext();

    /**
     * @dev The storage `slot` is unsupported as a UUID.
     */
    error UUPSUnsupportedProxiableUUID(bytes32 slot);

    /**
     * @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 ERC-1967) 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 ERC-1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        _checkProxy();
        _;
    }

    /**
     * @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() {
        _checkNotDelegated();
        _;
    }

    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Implementation of the ERC-1822 {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 notDelegated returns (bytes32) {
        return ERC1967Utils.IMPLEMENTATION_SLOT;
    }

    /**
     * @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);
    }

    /**
     * @dev Reverts if the execution is not performed via delegatecall or the execution
     * context is not of a proxy with an ERC-1967 compliant implementation pointing to self.
     * See {_onlyProxy}.
     */
    function _checkProxy() internal view virtual {
        if (
            address(this) == __self || // Must be called through delegatecall
            ERC1967Utils.getImplementation() != __self // Must be called through an active proxy
        ) {
            revert UUPSUnauthorizedCallContext();
        }
    }

    /**
     * @dev Reverts if the execution is performed via delegatecall.
     * See {notDelegated}.
     */
    function _checkNotDelegated() internal view virtual {
        if (address(this) != __self) {
            // Must not be called through delegatecall
            revert UUPSUnauthorizedCallContext();
        }
    }

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

    /**
     * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.
     *
     * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value
     * is expected to be the implementation slot in ERC-1967.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {
        try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
            if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {
                revert UUPSUnsupportedProxiableUUID(slot);
            }
            ERC1967Utils.upgradeToAndCall(newImplementation, data);
        } catch {
            // The implementation is not UUPS
            revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);
        }
    }
}

File 9 of 54 : FixedPointMathLib.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Arithmetic library with operations for fixed-point numbers.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)
/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)
library FixedPointMathLib {
    /*//////////////////////////////////////////////////////////////
                    SIMPLIFIED FIXED POINT OPERATIONS
    //////////////////////////////////////////////////////////////*/

    uint256 internal constant MAX_UINT256 = 2**256 - 1;

    uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.

    function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {
        return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.
    }

    function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {
        return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.
    }

    function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {
        return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.
    }

    function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {
        return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.
    }

    /*//////////////////////////////////////////////////////////////
                    LOW LEVEL FIXED POINT OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function mulDivDown(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))
            if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {
                revert(0, 0)
            }

            // Divide x * y by the denominator.
            z := div(mul(x, y), denominator)
        }
    }

    function mulDivUp(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))
            if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {
                revert(0, 0)
            }

            // If x * y modulo the denominator is strictly greater than 0,
            // 1 is added to round up the division of x * y by the denominator.
            z := add(gt(mod(mul(x, y), denominator), 0), div(mul(x, y), denominator))
        }
    }

    function rpow(
        uint256 x,
        uint256 n,
        uint256 scalar
    ) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            switch x
            case 0 {
                switch n
                case 0 {
                    // 0 ** 0 = 1
                    z := scalar
                }
                default {
                    // 0 ** n = 0
                    z := 0
                }
            }
            default {
                switch mod(n, 2)
                case 0 {
                    // If n is even, store scalar in z for now.
                    z := scalar
                }
                default {
                    // If n is odd, store x in z for now.
                    z := x
                }

                // Shifting right by 1 is like dividing by 2.
                let half := shr(1, scalar)

                for {
                    // Shift n right by 1 before looping to halve it.
                    n := shr(1, n)
                } n {
                    // Shift n right by 1 each iteration to halve it.
                    n := shr(1, n)
                } {
                    // Revert immediately if x ** 2 would overflow.
                    // Equivalent to iszero(eq(div(xx, x), x)) here.
                    if shr(128, x) {
                        revert(0, 0)
                    }

                    // Store x squared.
                    let xx := mul(x, x)

                    // Round to the nearest number.
                    let xxRound := add(xx, half)

                    // Revert if xx + half overflowed.
                    if lt(xxRound, xx) {
                        revert(0, 0)
                    }

                    // Set x to scaled xxRound.
                    x := div(xxRound, scalar)

                    // If n is even:
                    if mod(n, 2) {
                        // Compute z * x.
                        let zx := mul(z, x)

                        // If z * x overflowed:
                        if iszero(eq(div(zx, x), z)) {
                            // Revert if x is non-zero.
                            if iszero(iszero(x)) {
                                revert(0, 0)
                            }
                        }

                        // Round to the nearest number.
                        let zxRound := add(zx, half)

                        // Revert if zx + half overflowed.
                        if lt(zxRound, zx) {
                            revert(0, 0)
                        }

                        // Return properly scaled zxRound.
                        z := div(zxRound, scalar)
                    }
                }
            }
        }
    }

    /*//////////////////////////////////////////////////////////////
                        GENERAL NUMBER UTILITIES
    //////////////////////////////////////////////////////////////*/

    function sqrt(uint256 x) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            let y := x // We start y at x, which will help us make our initial estimate.

            z := 181 // The "correct" value is 1, but this saves a multiplication later.

            // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad
            // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.

            // We check y >= 2^(k + 8) but shift right by k bits
            // each branch to ensure that if x >= 256, then y >= 256.
            if iszero(lt(y, 0x10000000000000000000000000000000000)) {
                y := shr(128, y)
                z := shl(64, z)
            }
            if iszero(lt(y, 0x1000000000000000000)) {
                y := shr(64, y)
                z := shl(32, z)
            }
            if iszero(lt(y, 0x10000000000)) {
                y := shr(32, y)
                z := shl(16, z)
            }
            if iszero(lt(y, 0x1000000)) {
                y := shr(16, y)
                z := shl(8, z)
            }

            // Goal was to get z*z*y within a small factor of x. More iterations could
            // get y in a tighter range. Currently, we will have y in [256, 256*2^16).
            // We ensured y >= 256 so that the relative difference between y and y+1 is small.
            // That's not possible if x < 256 but we can just verify those cases exhaustively.

            // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.
            // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.
            // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.

            // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range
            // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.

            // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate
            // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.

            // There is no overflow risk here since y < 2^136 after the first branch above.
            z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.

            // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))

            // If x+1 is a perfect square, the Babylonian method cycles between
            // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.
            // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division
            // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.
            // If you don't care whether the floor or ceil square root is returned, you can remove this statement.
            z := sub(z, lt(div(x, z), z))
        }
    }

    function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            // Mod x by y. Note this will return
            // 0 instead of reverting if y is zero.
            z := mod(x, y)
        }
    }

    function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) {
        /// @solidity memory-safe-assembly
        assembly {
            // Divide x by y. Note this will return
            // 0 instead of reverting if y is zero.
            r := div(x, y)
        }
    }

    function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            // Add 1 to x * y if x % y > 0. Note this will
            // return 0 instead of reverting if y is zero.
            z := add(gt(mod(x, y), 0), div(x, y))
        }
    }
}

File 10 of 54 : IPyth.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import "./PythStructs.sol";
import "./IPythEvents.sol";

/// @title Consume prices from the Pyth Network (https://pyth.network/).
/// @dev Please refer to the guidance at https://docs.pyth.network/consumers/best-practices for how to consume prices safely.
/// @author Pyth Data Association
interface IPyth is IPythEvents {
    /// @notice Returns the period (in seconds) that a price feed is considered valid since its publish time
    function getValidTimePeriod() external view returns (uint validTimePeriod);

    /// @notice Returns the price and confidence interval.
    /// @dev Reverts if the price has not been updated within the last `getValidTimePeriod()` seconds.
    /// @param id The Pyth Price Feed ID of which to fetch the price and confidence interval.
    /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
    function getPrice(
        bytes32 id
    ) external view returns (PythStructs.Price memory price);

    /// @notice Returns the exponentially-weighted moving average price and confidence interval.
    /// @dev Reverts if the EMA price is not available.
    /// @param id The Pyth Price Feed ID of which to fetch the EMA price and confidence interval.
    /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
    function getEmaPrice(
        bytes32 id
    ) external view returns (PythStructs.Price memory price);

    /// @notice Returns the price of a price feed without any sanity checks.
    /// @dev This function returns the most recent price update in this contract without any recency checks.
    /// This function is unsafe as the returned price update may be arbitrarily far in the past.
    ///
    /// Users of this function should check the `publishTime` in the price to ensure that the returned price is
    /// sufficiently recent for their application. If you are considering using this function, it may be
    /// safer / easier to use either `getPrice` or `getPriceNoOlderThan`.
    /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
    function getPriceUnsafe(
        bytes32 id
    ) external view returns (PythStructs.Price memory price);

    /// @notice Returns the price that is no older than `age` seconds of the current time.
    /// @dev This function is a sanity-checked version of `getPriceUnsafe` which is useful in
    /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently
    /// recently.
    /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
    function getPriceNoOlderThan(
        bytes32 id,
        uint age
    ) external view returns (PythStructs.Price memory price);

    /// @notice Returns the exponentially-weighted moving average price of a price feed without any sanity checks.
    /// @dev This function returns the same price as `getEmaPrice` in the case where the price is available.
    /// However, if the price is not recent this function returns the latest available price.
    ///
    /// The returned price can be from arbitrarily far in the past; this function makes no guarantees that
    /// the returned price is recent or useful for any particular application.
    ///
    /// Users of this function should check the `publishTime` in the price to ensure that the returned price is
    /// sufficiently recent for their application. If you are considering using this function, it may be
    /// safer / easier to use either `getEmaPrice` or `getEmaPriceNoOlderThan`.
    /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
    function getEmaPriceUnsafe(
        bytes32 id
    ) external view returns (PythStructs.Price memory price);

    /// @notice Returns the exponentially-weighted moving average price that is no older than `age` seconds
    /// of the current time.
    /// @dev This function is a sanity-checked version of `getEmaPriceUnsafe` which is useful in
    /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently
    /// recently.
    /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
    function getEmaPriceNoOlderThan(
        bytes32 id,
        uint age
    ) external view returns (PythStructs.Price memory price);

    /// @notice Update price feeds with given update messages.
    /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling
    /// `getUpdateFee` with the length of the `updateData` array.
    /// Prices will be updated if they are more recent than the current stored prices.
    /// The call will succeed even if the update is not the most recent.
    /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid.
    /// @param updateData Array of price update data.
    function updatePriceFeeds(bytes[] calldata updateData) external payable;

    /// @notice Wrapper around updatePriceFeeds that rejects fast if a price update is not necessary. A price update is
    /// necessary if the current on-chain publishTime is older than the given publishTime. It relies solely on the
    /// given `publishTimes` for the price feeds and does not read the actual price update publish time within `updateData`.
    ///
    /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling
    /// `getUpdateFee` with the length of the `updateData` array.
    ///
    /// `priceIds` and `publishTimes` are two arrays with the same size that correspond to senders known publishTime
    /// of each priceId when calling this method. If all of price feeds within `priceIds` have updated and have
    /// a newer or equal publish time than the given publish time, it will reject the transaction to save gas.
    /// Otherwise, it calls updatePriceFeeds method to update the prices.
    ///
    /// @dev Reverts if update is not needed or the transferred fee is not sufficient or the updateData is invalid.
    /// @param updateData Array of price update data.
    /// @param priceIds Array of price ids.
    /// @param publishTimes Array of publishTimes. `publishTimes[i]` corresponds to known `publishTime` of `priceIds[i]`
    function updatePriceFeedsIfNecessary(
        bytes[] calldata updateData,
        bytes32[] calldata priceIds,
        uint64[] calldata publishTimes
    ) external payable;

    /// @notice Returns the required fee to update an array of price updates.
    /// @param updateData Array of price update data.
    /// @return feeAmount The required fee in Wei.
    function getUpdateFee(
        bytes[] calldata updateData
    ) external view returns (uint feeAmount);

    /// @notice Parse `updateData` and return price feeds of the given `priceIds` if they are all published
    /// within `minPublishTime` and `maxPublishTime`.
    ///
    /// You can use this method if you want to use a Pyth price at a fixed time and not the most recent price;
    /// otherwise, please consider using `updatePriceFeeds`. This method does not store the price updates on-chain.
    ///
    /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling
    /// `getUpdateFee` with the length of the `updateData` array.
    ///
    ///
    /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is
    /// no update for any of the given `priceIds` within the given time range.
    /// @param updateData Array of price update data.
    /// @param priceIds Array of price ids.
    /// @param minPublishTime minimum acceptable publishTime for the given `priceIds`.
    /// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`.
    /// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order).
    function parsePriceFeedUpdates(
        bytes[] calldata updateData,
        bytes32[] calldata priceIds,
        uint64 minPublishTime,
        uint64 maxPublishTime
    ) external payable returns (PythStructs.PriceFeed[] memory priceFeeds);
}

File 11 of 54 : PythStructs.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

contract PythStructs {
    // A price with a degree of uncertainty, represented as a price +- a confidence interval.
    //
    // The confidence interval roughly corresponds to the standard error of a normal distribution.
    // Both the price and confidence are stored in a fixed-point numeric representation,
    // `x * (10^expo)`, where `expo` is the exponent.
    //
    // Please refer to the documentation at https://docs.pyth.network/consumers/best-practices for how
    // to how this price safely.
    struct Price {
        // Price
        int64 price;
        // Confidence interval around the price
        uint64 conf;
        // Price exponent
        int32 expo;
        // Unix timestamp describing when the price was published
        uint publishTime;
    }

    // PriceFeed represents a current aggregate price from pyth publisher feeds.
    struct PriceFeed {
        // The price ID.
        bytes32 id;
        // Latest available price
        Price price;
        // Latest available exponentially-weighted moving average price
        Price emaPrice;
    }
}

File 12 of 54 : ErrorReporter.sol
// SPDX-License-Identifier: BUSL-1.1
// (c) Long Gamma Labs, 2024.
pragma solidity ^0.8.28;


contract ErrorReporter {
    error CooldownDurationNotYetPassed();
    // 0x5fba365d 

    error EmptyDomainName();
    // 0x2f601761 

    error EmptyTokenName();
    // 0xe2592aed 

    error EmptyTokenSymbol();
    // 0x19c7070a 

    error Expired();
    // 0x203d82d8 

    error FeeBpsExceedsMaximum();
    // 0x132df9c5 

    error Forbidden();
    // 0xee90c468 

    error InsufficientBalance();
    // 0xf4d678b8 

    error InsufficientFeeForPythUpdate();
    // 0xe4764c6f 

    error InsufficientLiquidityValue();
    // 0x5b635d0b 

    error InsufficientMarketMakerLPShare();
    // 0x28f53493 

    error InsufficientMintedLP();
    // 0x212c18d0 

    error InsufficientTokenAmount();
    // 0x2ec48042 

    error InsufficientUSDValue();
    // 0xd6f69157 

    error InvalidFloatingPointRepresentation();
    // 0xa25f85b7 

    error InvalidLob();
    // 0xb9c44f1a 

    error InvalidLobAddress();
    // 0xec09da35 

    error InvalidOracleConfidenceLevel();
    // 0xe6b9bbad 

    error InvalidSignature();
    // 0x8baa579f 

    error InvalidTokenWeights();
    // 0x4b8072c3 

    error InvalidTrader();
    // 0xfb7595a2 

    error InvalidTransfer();
    // 0x2f352531 

    error LobDisabled();
    // 0xa6876da4 

    error MarketMakerLPShareExceedsMaximum();
    // 0x84d3d6cb 

    error MaxLiquidityValueExceeded();
    // 0x9009a2d8 

    error MaxOracleAgeExceedsMaximum();
    // 0x8b7df994

    error NativeGasTokenDisabled();
    // 0x60787531 

    error NonPositivePrice();
    // 0x13caeeae 

    error NotImplementedYet();
    // 0xf88c75b4 

    error OracleConfTooHigh();
    // 0x004f2349 

    error OrderAlreadyUsed();
    // 0x88b39043 

    error PriceTooBig();
    // 0x9bec8e38 

    error PriceTooSmall();
    // 0x8460540d 

    error SlashingUnAvailable();
    // 0xd7b45887 

    error TokenDisabled();
    // 0x1931ea85 

    error TokenWeightExceeded();
    // 0x725ad4f5 

    error TransferFailed();
    // 0x90b8ec18 

    error UnknownLob();
    // 0x0b1066eb 

    error WrongNumber();
    // 0x3546a07e 

    error WrongTokenId();
    // 0x749aeece 

    error ZeroAddress();
    // 0xd92e233d 

    error ZeroAmount();
    // 0x1f2a2005 
}

File 13 of 54 : ILPManager.sol
// SPDX-License-Identifier: BUSL-1.1
// (c) Long Gamma Labs, 2024.
pragma solidity ^0.8.28;


interface ILPManager {
    // governance
    function setConfig(
        bool dynamicFeesEnabled,
        uint16 adminMintLPFeeBps,
        uint16 adminBurnLPFeeBps,
        uint16 feeBasisBps,
        uint16 taxBasisBps,
        uint24 cooldownDuration,
        uint16 maxOracleAge,
        uint128 minLiquidityValueUsd,
        uint128 maxLiquidityValueUsd,
        bool marketMakerLPShareEnabled,
        uint16 marketMakerLPShareBps,
        bool nativeTokenEnabled,
        uint8 nativeTokenTokenId,
        address adminFeeRecipient,
        uint24 priceValidityPeriod,
        uint64 baseMultiplier,
        uint64 maxAllowedPriceDeviation,
        uint16 perfFeeBps,
        uint16 adminPerfFeeBps
    ) external;

    function getConfig() external view returns (
        bool dynamicFeesEnabled,
        uint16 adminMintLPFeeBps,
        uint16 adminBurnLPFeeBps,
        uint16 feeBasisBps,
        uint16 taxBasisBps,
        uint24 cooldownDuration,
        uint16 maxOracleAge,
        uint128 minLiquidityValueUsd,
        uint128 maxLiquidityValueUsd,
        bool marketMakerLPShareEnabled,
        uint16 marketMakerLPShareBps,
        bool nativeTokenEnabled,
        uint8 nativeTokenTokenId,
        address adminFeeRecipient,
        uint24 priceValidityPeriod,
        uint64 baseMultiplier,
        uint64 maxAllowedPriceDeviation,
        uint16 perfFeeBps,
        uint16 adminPerfFeeBps,
        bool slashingAvailableStatus
    );

    function changeToken(
        address tokenAddress,
        bool isActive,
        uint16 targetWeight,
        uint16 lowerBoundWeight,
        uint16 upperBoundWeight,
        uint8 decimals,
        uint24 oracleConfRel,
        bytes32 oraclePriceId
    ) external;

    function changeLob(
        address lobAddress,
        bool isActive,
        uint8 tokenIdX,
        uint8 tokenIdY,
        uint16 maxOrderDistanceBps
    ) external;

    function slashMakersShares(uint256 amount) external;
    function disableSlashingStatus() external;
    function pause() external;
    function validateLPPriceAndDistributeFees(bytes[] calldata priceUpdateData) payable external;

    // client entries
    function addLiquidity(
        uint8 tokenID,
        uint256 amount,
        uint256 minUsdValue,
        uint256 minLPMinted,
        uint256 expires,
        bytes[] calldata priceUpdateData
    ) external payable returns (uint256);

    function removeLiquidity(
        uint8 tokenID,
        uint256 burnLP,
        uint256 minUsdValue,
        uint256 minTokenGet,
        uint256 expires,
        bytes[] calldata priceUpdateData
    ) external payable returns (uint256);

    function collectFees() external;

    // views
    function getFeeBasisPoints(
        uint256 totalValue,
        uint256 initialTokenValue,
        uint256 nextTokenValue,
        uint16 targetTokenWeight
    ) external view returns (uint256);
    function tokens(uint256 index) external view returns (
        address tokenAddress,
        bool isActive,
        uint16 targetWeight,
        uint16 lowerBoundWeight,
        uint16 upperBoundWeight,
        uint8 decimals,
        uint24 oracleConfRel,
        bytes32 oraclePriceId
    );
    function lastAddedAt(address account) external view returns (uint256);
    function totalWeight() external view returns (uint24);
    function checkCooldown(address account) external view;
    function getTokensCount() external view returns (uint256);
    function marketMakers(address account) external view returns (bool);
    function primaryMarketMaker() external view returns (address);
    function validateMarketMakerLPShare() external view;
    function lobs(uint256 index) external view returns (
        address lobAddress,
        uint8 tokenIdX,
        uint8 tokenIdY,
        bool isActive,
        uint16 maxOrderDistanceBps
    );
}

File 14 of 54 : IOnchainLOB.sol
// SPDX-License-Identifier: BUSL-1.1
// (c) Long Gamma Labs, 2024.
pragma solidity ^0.8.28;


interface IOnchainLOB {
    function getConfig() external view returns (
        uint256 scalingFactorTokenX,
        uint256 scalingFactorTokenY,
        address tokenX,
        address tokenY,
        bool supportsNativeEth,
        bool isTokenXWeth,
        address askTrie,
        address bidTrie,
        uint64 adminCommissionRate,
        uint64 totalAggressiveCommissionRate,
        uint64 totalPassiveCommissionRate,
        uint64 passiveOrderPayoutRate,
        bool shouldInvokeOnTrade
    );
    function placeOrder(
        bool isAsk,
        uint128 quantity,
        uint72 price,
        uint128 max_commission,
        bool market_only,
        bool post_only,
        bool transfer_executed_tokens,
        uint256 expires
    ) external payable returns (
        uint64 order_id,
        uint128 executed_shares,
        uint128 executed_value,
        uint128 aggressive_fee
    );
    function placeMarketOrderWithTargetValue(
        bool isAsk,
        uint128 target_token_y_value,
        uint72 price,
        uint128 max_commission,
        bool transfer_executed_tokens,
        uint256 expires
    ) external payable returns (
        uint128 executed_shares,
        uint128 executed_value,
        uint128 aggressive_fee
    );
    function claimOrder(
        uint64 order_id,
        bool only_claim,
        bool transfer_tokens,
        uint256 expires
    ) external;
    function setClaimableStatus(bool status) external;
    
    function transferFees() external;
    function depositTokens(uint128 token_x_amount, uint128 token_y_amount) external;
    function withdrawTokens(bool withdraw_all, uint128 token_x_amount, uint128 token_y_amount) external;
}

File 15 of 54 : IWGAS.sol
// SPDX-License-Identifier: BUSL-1.1
// (c) Long Gamma Labs, 2024.
pragma solidity ^0.8.28;


interface IWGAS {
    function deposit() external payable;
    function withdraw(uint wad) external;
}

File 16 of 54 : LPToken.sol
// SPDX-License-Identifier: BUSL-1.1
// (c) Long Gamma Labs, 2024.
pragma solidity ^0.8.28;


import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { ERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";


import { ILPManager } from "./interfaces/ILPManager.sol";
import { ErrorReporter } from "./ErrorReporter.sol";


contract LPToken is ERC20, ERC20Permit {
    address immutable public owner;

    event TokensMinted(address indexed to, uint256 amount);
    event TokensBurned(address indexed from, uint256 amount);

    modifier onlyOwner() {
        if (owner != msg.sender) {
            revert ErrorReporter.Forbidden();
        }
        _;
    }

    constructor(address owner_, string memory name_, string memory symbol_)
        ERC20(name_, symbol_)
        ERC20Permit(name_)
    {
        owner = owner_;
    }

    function transfer(address recipient, uint256 amount) public override returns (bool result) {
        ILPManager lpManager = ILPManager(owner);
        lpManager.checkCooldown(msg.sender);

        result = super.transfer(recipient, amount);

        if (msg.sender == lpManager.primaryMarketMaker()) {
            lpManager.validateMarketMakerLPShare();
        }
    }

    function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool result) {
        ILPManager lpManager = ILPManager(owner);
        lpManager.checkCooldown(sender);

        result = super.transferFrom(sender, recipient, amount);

        if (sender == lpManager.primaryMarketMaker()) {
            lpManager.validateMarketMakerLPShare();
        }
    }

    function mint(address account, uint256 value) onlyOwner public {
        _mint(account, value);
        emit TokensMinted(account, value);
    }

    function burn(address account, uint256 value) onlyOwner public {
        _burn(account, value);
        emit TokensBurned(account, value);
    }
}

File 17 of 54 : ProxyLOB.sol
// SPDX-License-Identifier: BUSL-1.1
// (c) Long Gamma Labs, 2024.
pragma solidity ^0.8.28;


import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";


import { IPyth } from "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
import { FixedPointMathLib } from "@solmate/src/utils/FixedPointMathLib.sol";


import { IOnchainLOB } from "./interfaces/IOnchainLOB.sol";
import { IOnchainTrie } from "./interfaces/IOnchainTrie.sol";
import { IProxyLOB } from "./interfaces/IProxyLOB.sol";
import { ErrorReporter } from "./ErrorReporter.sol";
import { PythPriceHelper } from "./utils/PythPriceHelper.sol";


abstract contract ProxyLOB is IProxyLOB, PausableUpgradeable, ReentrancyGuardUpgradeable {
    using FixedPointMathLib for uint256;

    uint8 constant nonceLength = 39;
    uint16 constant BASIS_POINTS_DIVISOR = 1e4;

    mapping (uint8 => uint256) public lobReservesByTokenId;
    IPyth immutable pyth;

    function placeOrder(
        uint8 lobId,
        bool isAsk,
        uint128 quantity,
        uint72 price,
        uint128 maxCommission,
        bool marketOnly,
        bool postOnly,
        uint256 expires,
        bytes[] calldata priceUpdateData
    ) external nonReentrant payable returns (uint64 orderId) {
        _checkTrader(msg.sender);
        _checkLOB(lobId);
        PythPriceHelper.updatePrices(pyth, priceUpdateData);

        (orderId,,,) = _placeOrder(
            lobId,
            isAsk,
            quantity,
            price,
            maxCommission,
            marketOnly,
            postOnly,
            expires
        );
    }

    function claimOrder(
        uint8 lobId,
        uint64 orderId,
        bool onlyClaim,
        uint256 expires
    ) external nonReentrant {
        _checkLOB(lobId);

        if (!onlyClaim) {
            _checkTrader(msg.sender);
        }

        _claimOrder(lobId, orderId, onlyClaim, expires);
    }

    function _checkTrader(address) virtual internal;
    function _checkLOB(uint8) virtual internal;
    function _getLobById(uint8) virtual internal returns (
        address lobAddress,
        uint8 tokenIdX,
        uint8 tokenIdY,
        uint16 maxOrderDistanceBps
    );
    function _getTokenDecimalsById(uint8) virtual internal returns (uint8);
    function getPriceOf(uint8 tokenId) virtual public view returns (uint256, int32);
    function _validateLPPriceAndDistributeFees() virtual internal;
    function _sync(uint8 tokenId) virtual internal;

    function _placeOrder(
        uint8 lobId,
        bool isAsk,
        uint128 quantity,
        uint72 price,
        uint128 maxCommission,
        bool marketOnly,
        bool postOnly,
        uint256 expires
    )
        internal
        returns (uint64 orderId, uint128 executedShares, uint128 executedValue, uint128 aggressiveFee)
    {
        _requireNotPaused();

        (address lobAddress, uint8 tokenIdX, uint8 tokenIdY, uint16 maxOrderDistanceBps) = _getLobById(lobId);
        IOnchainLOB lob = IOnchainLOB(payable(lobAddress));

        (
            uint256 scalingFactorTokenX,
            uint256 scalingFactorTokenY,
            ,
            ,
            ,
            ,
            ,
            ,
            ,
            ,
            uint64 passiveCommissionRate,
            ,
        ) = lob.getConfig();

        uint8 scalingFactorTokenXExpo = _log10(scalingFactorTokenX);
        uint8 scalingFactorTokenYExpo = _log10(scalingFactorTokenY);

        (uint256 priceX, int32 expoX) = getPriceOf(tokenIdX);
        (uint256 priceY, int32 expoY) = getPriceOf(tokenIdY);

        int256 decimalAdjustment;
        unchecked {
            // Safe to use unchecked as the maximum possible value fits within int256 range
            // Max value: ~2^32 + 255 + 255
            // Min value: ~-2^32 - 255 - 255
            // int256 range: ±2^255 - 1
            decimalAdjustment = (
                int256(expoX) - int256(expoY) - 
                int256(uint256(_getTokenDecimalsById(tokenIdX))) + int256(uint256(_getTokenDecimalsById(tokenIdY))) - 
                int256(uint256(scalingFactorTokenYExpo)) + int256(uint256(scalingFactorTokenXExpo))
            );
        }
        uint256 scaledPrice = priceY * price;
        uint256 scaledOraclePrice = priceX;

        if (decimalAdjustment > 0) {
            scaledOraclePrice *= 10 ** uint256(decimalAdjustment);
        } else {
            scaledPrice *= 10 ** uint256(-decimalAdjustment);
        }

        if (isAsk) {
            require(
                scaledPrice * (BASIS_POINTS_DIVISOR + uint256(maxOrderDistanceBps)) >= scaledOraclePrice * BASIS_POINTS_DIVISOR,
                ErrorReporter.PriceTooSmall()
            );
        } else {
            require(
                scaledPrice * BASIS_POINTS_DIVISOR <= scaledOraclePrice * (BASIS_POINTS_DIVISOR + uint256(maxOrderDistanceBps)),
                ErrorReporter.PriceTooBig()
            );
        }

        (orderId, executedShares, executedValue, aggressiveFee) = lob.placeOrder(
            isAsk,
            quantity,
            price,
            maxCommission,
            marketOnly,
            postOnly,
            true,
            expires
        );

        uint128 remainShares = marketOnly ? 0 : quantity - executedShares;

        // add remainShares to reserves
        if (remainShares > 0) {
            if (isAsk) {
                lobReservesByTokenId[tokenIdX] += remainShares * scalingFactorTokenX;

            } else {
                uint256 remainValue = remainShares * price;
                uint256 passiveFee = remainValue.mulWadUp(passiveCommissionRate);
                lobReservesByTokenId[tokenIdY] += (remainValue + passiveFee) * scalingFactorTokenY;
            }
        }

        _validateLPPriceAndDistributeFees();
        _sync(tokenIdX);
        _sync(tokenIdY);
    }

    function _claimOrder(uint8 lobId, uint64 orderId, bool onlyClaim, uint256 expires) internal whenNotPaused {
        (address lob, uint8 tokenIdX, uint8 tokenIdY,) = _getLobById(lobId);

        (
            uint256 scalingFactorTokenX,
            uint256 scalingFactorTokenY,
            ,
            ,
            ,
            ,
            address askTrie,
            address bidTrie,
            ,
            ,
            uint64 passiveCommissionRate,
            ,
        ) = IOnchainLOB(payable(lob)).getConfig();

        (bool isAsk, uint72 price) = _extractDirectionAndPrice(orderId);
        address trie = isAsk ? askTrie : bidTrie;

        (uint128 totalShares, uint128 remainShares) = IOnchainTrie(payable(trie)).getOrderInfo(orderId | 0x1);

        IOnchainLOB(payable(lob)).claimOrder(orderId, onlyClaim, true, expires);

        uint128 executedShares = totalShares - remainShares;
        uint128 returnedShares = onlyClaim
            ? executedShares
            : totalShares;

        if (isAsk) {
            lobReservesByTokenId[tokenIdX] -= returnedShares * scalingFactorTokenX;
        } else {
            uint256 returnedValue = returnedShares * price;
            uint256 passiveFee = returnedValue.mulWadUp(passiveCommissionRate);
            uint256 returnedAmount = (returnedValue + passiveFee) * scalingFactorTokenY;
            uint256 lobReservesTokenY = lobReservesByTokenId[tokenIdY];

            uint256 newReservesTokenY;
            // possible minor error accumulation in passiveFee
            if (returnedAmount <= lobReservesTokenY) {
                unchecked {
                    newReservesTokenY = lobReservesTokenY - returnedAmount;
                }
            }
            lobReservesByTokenId[tokenIdY] = newReservesTokenY;
        }

        _sync(tokenIdX);
        _sync(tokenIdY);
    }

    function _isAsk(uint64 orderId) internal pure returns (bool) {
        return (orderId & uint64(0x1)) == 0x1;
    }

    /// @notice Extracts the direction and price from the given order ID.
    /// @param orderId The unique identifier of the order.
    /// @return isAsk A boolean indicating if the order is an ask (true) or a bid (false).
    /// @return price The price of the order.
    function _extractDirectionAndPrice(uint64 orderId) internal pure returns (bool isAsk, uint72 price) {
        isAsk = _isAsk(orderId);

        uint24 packedPrice = uint24(orderId >> (nonceLength + 1));

        if (isAsk) {
            unchecked{
                packedPrice = type(uint24).max - packedPrice;
            }
        }

        price = _unPackFP24(packedPrice);
    }

    /// @dev Converts a uint24 floating point number into a uint72 number.
    /// @param p The uint24 floating point number to be converted.
    /// @return a The uint72 number representation of the input floating point number.
    function _unPackFP24(uint24 p) internal pure returns (uint72) {
        uint72 e = uint72(p >> 20);
        uint72 a = uint72(p & 0xfffff);

        require(0 < a && a <= 999999, ErrorReporter.InvalidFloatingPointRepresentation());
        a *= uint72(10 ** e);

        return a;
    }

    function _log10(uint256 value) internal pure returns (uint8 l) {
        require(value > 0, ErrorReporter.WrongNumber());

        while (value != 1) {
            require(value % 10 == 0, ErrorReporter.WrongNumber());
            l += 1;
            value /= 10;
        }
    }
}

File 18 of 54 : ProxyPyth.sol
// SPDX-License-Identifier: BUSL-1.1
// (c) Long Gamma Labs, 2024.
pragma solidity ^0.8.28;


import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";


import { FixedPointMathLib } from "@solmate/src/utils/FixedPointMathLib.sol";


import { IPyth } from "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
import { PythStructs } from "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";


import { ErrorReporter } from "./ErrorReporter.sol";
import { ILPManager } from "./interfaces/ILPManager.sol";
import { IProxyLOB } from "./interfaces/IProxyLOB.sol";
import { TokenValueCalculator } from "./utils/TokenValueCalculator.sol";


contract ProxyPyth {
    using FixedPointMathLib for uint256;
    using SafeCast for uint256;

    IPyth immutable pyth;
    uint24 constant ORACLE_REL_CONF_DIVISOR = 1e7;

    struct EpochPriceData {
        uint64 cMaxPrice;
        uint64 cMinPrice;
        uint64 pMaxPrice;
        uint64 pMinPrice;

        int32 expo;
        uint64 cTime;
        uint64 pTime;
    }

    struct TokenPriceData {
        uint128 price;
        uint128 timestamp;
    }

    mapping (address => mapping(bytes32 => EpochPriceData)) public epochPriceHistory;
    mapping (address => TokenPriceData) public tokenPriceDataByAddress;

    constructor(address _pythAddress) {
        pyth = IPyth(_pythAddress);
    }

    /// @notice Updates and retrieves the epoch price for a given oracle price ID.
    /// @dev This function updates the epoch price data and returns the current price and its exponent.
    ///      If the maximum price is required, cMaxPrice is used; otherwise, cMinPrice is used.
    /// @param oraclePriceId The identifier of the oracle price for which to get the epoch price.
    /// @param maxPriceRequired A flag indicating whether the maximum price should be used.
    /// @return price The price of the token.
    /// @return priceExpo The exponent of the token price.
    function updateAndGetEpochPrice(
        bytes32 oraclePriceId,
        uint24 maxOracleAge,
        uint24 oracleConfRel,
        bool maxPriceRequired
    ) public returns (uint256 price, int32 priceExpo) {
        // Fetching current pyth price.
        PythStructs.Price memory pythPrice = pyth.getPriceNoOlderThan(oraclePriceId, maxOracleAge);

        require(pythPrice.price > 0, ErrorReporter.NonPositivePrice());
        uint64 currentOraclePrice = uint64(pythPrice.price);

        // Price confidence interval check.
        require(
            uint256(ORACLE_REL_CONF_DIVISOR) * pythPrice.conf <= uint256(oracleConfRel) * currentOraclePrice,
            ErrorReporter.OracleConfTooHigh()
        );

        EpochPriceData memory epochPriceData = epochPriceHistory[msg.sender][oraclePriceId];

        int32 newPriceExpo = pythPrice.expo;
        if (epochPriceData.cTime == 0) { // initial setup
            epochPriceData.expo = newPriceExpo;
        }
        priceExpo = epochPriceData.expo;

        if (priceExpo != newPriceExpo) {
            // Generally, it seems that the exponent will change infrequently and not significantly,
            // so we can limit ourselves to a simple algorithm.

            if (priceExpo > newPriceExpo) {
                uint256 power;
                unchecked {
                    power = uint256(int256(priceExpo - newPriceExpo));
                }
                uint256 factor = 10 ** power;

                epochPriceData.cMinPrice = (epochPriceData.cMinPrice * factor).toUint64();
                epochPriceData.cMaxPrice = (epochPriceData.cMaxPrice * factor).toUint64();
                epochPriceData.pMaxPrice = (epochPriceData.pMaxPrice * factor).toUint64();
                epochPriceData.pMinPrice = (epochPriceData.pMinPrice * factor).toUint64();
            } else {
                uint256 power;
                unchecked {
                    power = uint256(int256(newPriceExpo - priceExpo));
                }
                uint256 factor = 10 ** power;

                epochPriceData.cMinPrice = uint64(epochPriceData.cMinPrice / factor);
                epochPriceData.cMaxPrice = uint64(epochPriceData.cMaxPrice / factor);
                epochPriceData.pMaxPrice = uint64(epochPriceData.pMaxPrice / factor);
                epochPriceData.pMinPrice = uint64(epochPriceData.pMinPrice / factor);
            }

            priceExpo = newPriceExpo;
            epochPriceData.expo = newPriceExpo;
        }

        // There are two possible cases:
        if (block.timestamp > epochPriceData.cTime + maxOracleAge) {
            // it's time to transfer the old epoch
            epochPriceData.pMaxPrice = epochPriceData.cMaxPrice;
            epochPriceData.pMinPrice = epochPriceData.cMinPrice;
            epochPriceData.pTime = epochPriceData.cTime;

            epochPriceData.cMaxPrice = currentOraclePrice;
            epochPriceData.cMinPrice = currentOraclePrice;
            epochPriceData.cTime = block.timestamp.toUint64();
        } else {
            // we are updating the current epoch
            if (currentOraclePrice > epochPriceData.cMaxPrice) {
                epochPriceData.cMaxPrice = currentOraclePrice;
            } else if (currentOraclePrice < epochPriceData.cMinPrice) {
                epochPriceData.cMinPrice = currentOraclePrice;
            }
        }

        // Selecting proper price.
        bool oldEpochActual = (block.timestamp < epochPriceData.pTime + 2 * maxOracleAge);
        if (maxPriceRequired) {
            price = epochPriceData.cMaxPrice;
            if (oldEpochActual && (epochPriceData.pMaxPrice > price)) {
                price = epochPriceData.pMaxPrice;
            }
        } else {
            price = epochPriceData.cMinPrice;
            if (oldEpochActual && epochPriceData.pMinPrice < price) {
                price = epochPriceData.pMinPrice;
            }
        }

        epochPriceHistory[msg.sender][oraclePriceId] = epochPriceData;
    }

    /// @notice Validates if the current price movement is within the allowed range.
    /// @param cPrice The current price to be validated.
    /// @param maxPriceAge The maximum allowed age of the previous price in seconds.
    /// @param baseMultiplier Base multiplier in WAD (1e18) format that defines the minimum allowed price 
    ///        relative to the previous price. For example, 0.95e18 means price cannot drop below 95% of previous price.
    /// @param maxPriceChange The maximum allowed price change per square root of time unit 
    ///        (√seconds). Used in formula: maxPriceDiff = sqrt(timeDelta) * maxPriceChange
    /// @return isOk A boolean indicating whether the current price movement is valid or not.
    function validatePriceMovement(
        uint256 cPrice,
        uint256 maxPriceAge,
        uint256 baseMultiplier,
        uint256 maxPriceChange
    ) external returns (bool isOk) {
        uint256 pPrice = tokenPriceDataByAddress[msg.sender].price;
        uint256 pTimestamp = tokenPriceDataByAddress[msg.sender].timestamp;

        if (cPrice >= pPrice) {
            isOk = true;
        } else {
            uint256 timeDelta = block.timestamp - pTimestamp;
            uint256 maxPriceDiff = Math.sqrt(timeDelta) * maxPriceChange;

            uint256 lowestValidPrice;
            if (baseMultiplier > maxPriceDiff) {
                lowestValidPrice = pPrice.mulWadDown(baseMultiplier - maxPriceDiff);
            }

            isOk = (cPrice >= lowestValidPrice);
            
            if (isOk && timeDelta <= maxPriceAge) {
                return true;
            }
        }

        tokenPriceDataByAddress[msg.sender].price = cPrice.toUint128();
        tokenPriceDataByAddress[msg.sender].timestamp = block.timestamp.toUint128();
    }

    /// @dev Retrieves the reserves and their USD value for a given token.
    /// @param tokenId The identifier of the token for which to retrieve the reserves.
    /// @param isAdding Flag indicating if tokens are being added (true) or removed (false).
    /// @return totalUSDValue The total USD value of all tokens in the contract.
    /// @return initialTokenUSDValue The USD value of the specified token (tokenId).
    /// @return tokenPrice The price of the specified token (tokenId).
    /// @return tokenPriceExpo The price exponent of the specified token (tokenId).
    function getReserves(
        uint8 tokenId,
        bool isAdding
    ) public returns (
        uint256 totalUSDValue,
        uint256 initialTokenUSDValue,
        uint256 tokenPrice,
        int32 tokenPriceExpo
    ) {
        address lpManagerAddress = msg.sender;

        ILPManager lpManager = ILPManager(lpManagerAddress);
        (,,,,,, uint16 maxOracleAge,,,,,,,,,,,,,) = lpManager.getConfig();

        IProxyLOB proxyLOB = IProxyLOB(lpManagerAddress);

        uint256 nTokens = lpManager.getTokensCount();
        for (uint8 i = 0; i < nTokens; ++i) {
            (
                address tokenAddress,
                ,
                ,
                ,
                ,
                uint8 decimals,
                uint24 oracleConfRel,
                bytes32 oraclePriceId
            ) = lpManager.tokens(i);
            IERC20 token = IERC20(tokenAddress);

            uint256 currentTokenShares = token.balanceOf(lpManagerAddress) + proxyLOB.lobReservesByTokenId(i);
            (uint256 currentTokenPrice, int32 currentTokenPriceExpo) = updateAndGetEpochPrice(
                oraclePriceId,
                maxOracleAge,
                oracleConfRel,
                isAdding != (i == tokenId)
                // This flag indicates whether to take the maximum oracle price.
                // If we are adding tokens, then all tokens, except for the one being added,
                // should be counted at the maximum price, and the added one - at the minimum.
                // If we are removing tokens, then the opposite applies.
            );

            uint256 currentTokenValue = TokenValueCalculator.calcNormalizedValue(
                currentTokenShares,
                decimals,
                currentTokenPrice,
                currentTokenPriceExpo
            );
            totalUSDValue += currentTokenValue;

            if (i == tokenId) {
                initialTokenUSDValue = currentTokenValue;
                tokenPrice = currentTokenPrice;
                tokenPriceExpo = currentTokenPriceExpo;
            }
        }
    }
}

File 19 of 54 : PythPriceHelper.sol
// SPDX-License-Identifier: BUSL-1.1
// (c) Long Gamma Labs, 2024.
pragma solidity ^0.8.28;


import { IPyth } from "@pythnetwork/pyth-sdk-solidity/IPyth.sol";


import { ErrorReporter } from "../ErrorReporter.sol";


library PythPriceHelper {
    function updatePrices(IPyth pyth, bytes[] calldata priceUpdateData) internal returns (uint256) {
        uint256 fee = 0;
        if (priceUpdateData.length != 0) {
            fee = pyth.getUpdateFee(priceUpdateData);
            require(msg.value >= fee, ErrorReporter.InsufficientFeeForPythUpdate());
            pyth.updatePriceFeeds{value: fee}(priceUpdateData);
        }

        uint256 rest;
        unchecked {
            rest = msg.value - fee;
        }
        sendGASToken(msg.sender, rest);
        return rest;
    }

    function sendGASToken(address to, uint256 value) internal {
        if (value == 0) {
            return;
        }
        (bool success, ) = to.call{value: value}("");
        require(success, ErrorReporter.TransferFailed());
    }
}

File 20 of 54 : TokenValueCalculator.sol
// SPDX-License-Identifier: BUSL-1.1
// (c) Long Gamma Labs, 2024.
pragma solidity ^0.8.28;


library TokenValueCalculator {

    /// @notice Calculates normalized USD value of tokens with 18 decimals precision.
    /// @param tokenShares The amount of token shares.
    /// @param tokenDecimals The number of decimals the token uses.
    /// @param price The price of one token in USD, scaled by 10^priceExpo.
    /// @param priceExpo The exponent that the price is scaled by.
    /// @return The normalized USD value of the token shares, normalized to 18 decimal places.
    function calcNormalizedValue(
        uint256 tokenShares,
        uint8 tokenDecimals,
        uint256 price,
        int32 priceExpo
    ) internal pure returns (uint256) {
        int256 decimalAdjustment;
        unchecked {
            decimalAdjustment = int256(uint256(tokenDecimals)) - priceExpo - 18;
        }
        
        uint256 normalizedValue = tokenShares * price;
        if (decimalAdjustment > 0) {
            normalizedValue /= 10 ** uint256(decimalAdjustment);
        } else {
            normalizedValue *= 10 ** uint256(-decimalAdjustment);
        }

        return normalizedValue;
    }

    /// @notice Calculates the amount of token shares corresponding to a given USD value, taking into account 
    /// token decimals and price normalization. This is the inverse operation of calcNormalizedValue.
    /// @param usdValue The value in USD for which to calculate the corresponding token shares.
    /// @param tokenDecimals The number of decimals of the token for which shares are being calculated.
    /// @param price The price of the token in USD, adjusted by the price exponent.
    /// @param priceExpo The exponent to which the price is normalized (e.g., -18 for wei normalization).
    /// @return tokenAmount The calculated amount of token shares.
    function calcTokenShares(
        uint256 usdValue,
        uint8 tokenDecimals,
        uint256 price,
        int32 priceExpo
    ) internal pure returns (uint256) {
        int256 decimalAdjustment;
        unchecked {
            decimalAdjustment = int256(uint256(tokenDecimals)) - priceExpo - 18;
        }

        uint256 tokenAmount;
        if (decimalAdjustment > 0) {
            // There is no practical benefit to using mulDiv with real data here.
            tokenAmount = usdValue * 10 ** uint256(decimalAdjustment) / price;
        } else {
            tokenAmount = usdValue / (price * 10 ** uint256(-decimalAdjustment));
        }
        
        return tokenAmount;
    }
}

File 21 of 54 : Panic.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)

pragma solidity ^0.8.20;

/**
 * @dev Helper library for emitting standardized panic codes.
 *
 * ```solidity
 * contract Example {
 *      using Panic for uint256;
 *
 *      // Use any of the declared internal constants
 *      function foo() { Panic.GENERIC.panic(); }
 *
 *      // Alternatively
 *      function foo() { Panic.panic(Panic.GENERIC); }
 * }
 * ```
 *
 * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].
 *
 * _Available since v5.1._
 */
// slither-disable-next-line unused-state
library Panic {
    /// @dev generic / unspecified error
    uint256 internal constant GENERIC = 0x00;
    /// @dev used by the assert() builtin
    uint256 internal constant ASSERT = 0x01;
    /// @dev arithmetic underflow or overflow
    uint256 internal constant UNDER_OVERFLOW = 0x11;
    /// @dev division or modulo by zero
    uint256 internal constant DIVISION_BY_ZERO = 0x12;
    /// @dev enum conversion error
    uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;
    /// @dev invalid encoding in storage
    uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;
    /// @dev empty array pop
    uint256 internal constant EMPTY_ARRAY_POP = 0x31;
    /// @dev array out of bounds access
    uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;
    /// @dev resource error (too large allocation or too large array)
    uint256 internal constant RESOURCE_ERROR = 0x41;
    /// @dev calling invalid internal function
    uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;

    /// @dev Reverts with a panic code. Recommended to use with
    /// the internal constants with predefined codes.
    function panic(uint256 code) internal pure {
        assembly ("memory-safe") {
            mstore(0x00, 0x4e487b71)
            mstore(0x20, code)
            revert(0x1c, 0x24)
        }
    }
}

File 22 of 54 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 23 of 54 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../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.
 *
 * The initial owner is set to the address provided by the deployer. 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 {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable
    struct OwnableStorage {
        address _owner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;

    function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
        assembly {
            $.slot := OwnableStorageLocation
        }
    }

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

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

    function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @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) {
        OwnableStorage storage $ = _getOwnableStorage();
        return $._owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @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 {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

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

File 24 of 54 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

/**
 * @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 Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._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 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._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() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @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 {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

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

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

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}

File 25 of 54 : IERC1363.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}

File 26 of 54 : draft-IERC1822.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.20;

/**
 * @dev ERC-1822: 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);
}

File 27 of 54 : ERC1967Utils.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (proxy/ERC1967/ERC1967Utils.sol)

pragma solidity ^0.8.22;

import {IBeacon} from "../beacon/IBeacon.sol";
import {IERC1967} from "../../interfaces/IERC1967.sol";
import {Address} from "../../utils/Address.sol";
import {StorageSlot} from "../../utils/StorageSlot.sol";

/**
 * @dev This library provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] slots.
 */
library ERC1967Utils {
    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev The `implementation` of the proxy is invalid.
     */
    error ERC1967InvalidImplementation(address implementation);

    /**
     * @dev The `admin` of the proxy is invalid.
     */
    error ERC1967InvalidAdmin(address admin);

    /**
     * @dev The `beacon` of the proxy is invalid.
     */
    error ERC1967InvalidBeacon(address beacon);

    /**
     * @dev An upgrade function sees `msg.value > 0` that may be lost.
     */
    error ERC1967NonPayable();

    /**
     * @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 ERC-1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        if (newImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(newImplementation);
        }
        StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Performs implementation upgrade with additional setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) internal {
        _setImplementation(newImplementation);
        emit IERC1967.Upgraded(newImplementation);

        if (data.length > 0) {
            Address.functionDelegateCall(newImplementation, data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using
     * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
     */
    function getAdmin() internal view returns (address) {
        return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the ERC-1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        if (newAdmin == address(0)) {
            revert ERC1967InvalidAdmin(address(0));
        }
        StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
    }

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

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    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 ERC-1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        if (newBeacon.code.length == 0) {
            revert ERC1967InvalidBeacon(newBeacon);
        }

        StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;

        address beaconImplementation = IBeacon(newBeacon).implementation();
        if (beaconImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(beaconImplementation);
        }
    }

    /**
     * @dev Change the beacon and trigger a setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-BeaconUpgraded} event.
     *
     * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
     * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
     * efficiency.
     */
    function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
        _setBeacon(newBeacon);
        emit IERC1967.BeaconUpgraded(newBeacon);

        if (data.length > 0) {
            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
     * if an upgrade doesn't perform an initialization call.
     */
    function _checkNonPayable() private {
        if (msg.value > 0) {
            revert ERC1967NonPayable();
        }
    }
}

File 28 of 54 : IPythEvents.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @title IPythEvents contains the events that Pyth contract emits.
/// @dev This interface can be used for listening to the updates for off-chain and testing purposes.
interface IPythEvents {
    /// @dev Emitted when the price feed with `id` has received a fresh update.
    /// @param id The Pyth Price Feed ID.
    /// @param publishTime Publish time of the given price update.
    /// @param price Price of the given price update.
    /// @param conf Confidence interval of the given price update.
    event PriceFeedUpdate(
        bytes32 indexed id,
        uint64 publishTime,
        int64 price,
        uint64 conf
    );

    /// @dev Emitted when a batch price update is processed successfully.
    /// @param chainId ID of the source chain that the batch price update comes from.
    /// @param sequenceNumber Sequence number of the batch price update.
    event BatchPriceFeedUpdate(uint16 chainId, uint64 sequenceNumber);
}

File 29 of 54 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC-20
 * applications.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

    mapping(address account => mapping(address spender => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `value`.
     */
    function transfer(address to, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, value);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Skips emitting an {Approval} event indicating an allowance update. This is not
     * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     *
     * ```solidity
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance < type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}

File 30 of 54 : ERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/ERC20Permit.sol)

pragma solidity ^0.8.20;

import {IERC20Permit} from "./IERC20Permit.sol";
import {ERC20} from "../ERC20.sol";
import {ECDSA} from "../../../utils/cryptography/ECDSA.sol";
import {EIP712} from "../../../utils/cryptography/EIP712.sol";
import {Nonces} from "../../../utils/Nonces.sol";

/**
 * @dev Implementation of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712, Nonces {
    bytes32 private constant PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");

    /**
     * @dev Permit deadline has expired.
     */
    error ERC2612ExpiredSignature(uint256 deadline);

    /**
     * @dev Mismatched signature.
     */
    error ERC2612InvalidSigner(address signer, address owner);

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC-20 token name.
     */
    constructor(string memory name) EIP712(name, "1") {}

    /**
     * @inheritdoc IERC20Permit
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        if (block.timestamp > deadline) {
            revert ERC2612ExpiredSignature(deadline);
        }

        bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));

        bytes32 hash = _hashTypedDataV4(structHash);

        address signer = ECDSA.recover(hash, v, r, s);
        if (signer != owner) {
            revert ERC2612InvalidSigner(signer, owner);
        }

        _approve(owner, spender, value);
    }

    /**
     * @inheritdoc IERC20Permit
     */
    function nonces(address owner) public view virtual override(IERC20Permit, Nonces) returns (uint256) {
        return super.nonces(owner);
    }

    /**
     * @inheritdoc IERC20Permit
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view virtual returns (bytes32) {
        return _domainSeparatorV4();
    }
}

File 31 of 54 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Pausable
    struct PausableStorage {
        bool _paused;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300;

    function _getPausableStorage() private pure returns (PausableStorage storage $) {
        assembly {
            $.slot := PausableStorageLocation
        }
    }

    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        PausableStorage storage $ = _getPausableStorage();
        $._paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        PausableStorage storage $ = _getPausableStorage();
        return $._paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        PausableStorage storage $ = _getPausableStorage();
        $._paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        PausableStorage storage $ = _getPausableStorage();
        $._paused = false;
        emit Unpaused(_msgSender());
    }
}

File 32 of 54 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
 * consider using {ReentrancyGuardTransient} instead.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant NOT_ENTERED = 1;
    uint256 private constant ENTERED = 2;

    /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard
    struct ReentrancyGuardStorage {
        uint256 _status;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;

    function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) {
        assembly {
            $.slot := ReentrancyGuardStorageLocation
        }
    }

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        $._status = NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if ($._status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

        // Any calls to nonReentrant after this point will fail
        $._status = ENTERED;
    }

    function _nonReentrantAfter() private {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        $._status = NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        return $._status == ENTERED;
    }
}

File 33 of 54 : IOnchainTrie.sol
// SPDX-License-Identifier: BUSL-1.1
// (c) Long Gamma Labs, 2024.
pragma solidity ^0.8.28;


interface IOnchainTrie {
    function getOrderInfo(uint64 orderId) external view returns (uint128 totalShares, uint128 remainShares);
}

File 34 of 54 : IProxyLOB.sol
// SPDX-License-Identifier: BUSL-1.1
// (c) Long Gamma Labs, 2024.
pragma solidity ^0.8.28;


interface IProxyLOB {
    function lobReservesByTokenId(uint8 tokenId) external view returns (uint256);
    function getPriceOf(uint8 tokenId) external view returns (uint256, int32);
    function placeOrder(
        uint8 lobId,
        bool isAsk,
        uint128 quantity,
        uint72 price,
        uint128 maxCommission,
        bool marketOnly,
        bool postOnly,
        uint256 expires,
        bytes[] calldata priceUpdateData
    ) external payable returns (uint64 orderId);
    function claimOrder(uint8 lobId, uint64 orderId, bool onlyClaim, uint256 expires) external;
}

File 35 of 54 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;
import {Initializable} from "../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;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 36 of 54 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";

File 37 of 54 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

File 38 of 54 : IBeacon.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.20;

/**
 * @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.
     *
     * {UpgradeableBeacon} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

File 39 of 54 : IERC1967.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1967.sol)

pragma solidity ^0.8.20;

/**
 * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
 */
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);
}

File 40 of 54 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Address.sol)

pragma solidity ^0.8.20;

import {Errors} from "./Errors.sol";

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert Errors.InsufficientBalance(address(this).balance, amount);
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert Errors.FailedCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {Errors.FailedCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert Errors.InsufficientBalance(address(this).balance, value);
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
     * of an unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {Errors.FailedCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
     */
    function _revert(bytes memory returndata) 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
            assembly ("memory-safe") {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert Errors.FailedCall();
        }
    }
}

File 41 of 54 : StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.20;

/**
 * @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 ERC-1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(newImplementation.code.length > 0);
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * TIP: Consider using this library along with {SlotDerivation}.
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct Int256Slot {
        int256 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) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

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

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

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

    /**
     * @dev Returns a `Int256Slot` with member `value` located at `slot`.
     */
    function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        assembly ("memory-safe") {
            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) {
        assembly ("memory-safe") {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns a `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        assembly ("memory-safe") {
            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) {
        assembly ("memory-safe") {
            r.slot := store.slot
        }
    }
}

File 42 of 54 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC-20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 43 of 54 : draft-IERC6093.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC-20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC-721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC-1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

File 44 of 54 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 45 of 54 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.20;

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS
    }

    /**
     * @dev The signature derives the `address(0)`.
     */
    error ECDSAInvalidSignature();

    /**
     * @dev The signature has an invalid length.
     */
    error ECDSAInvalidSignatureLength(uint256 length);

    /**
     * @dev The signature has an S value that is in the upper half order.
     */
    error ECDSAInvalidSignatureS(bytes32 s);

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
     * return address(0) without also returning an error description. Errors are documented using an enum (error type)
     * and a bytes32 providing additional information about the error.
     *
     * If no error is returned, then the address can be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     */
    function tryRecover(
        bytes32 hash,
        bytes memory signature
    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly ("memory-safe") {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
        unchecked {
            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
            // We do not check for an overflow here since the shift operation results in 0 or 1.
            uint8 v = uint8((uint256(vs) >> 255) + 27);
            return tryRecover(hash, v, r, s);
        }
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS, s);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature, bytes32(0));
        }

        return (signer, RecoverError.NoError, bytes32(0));
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
     */
    function _throwError(RecoverError error, bytes32 errorArg) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert ECDSAInvalidSignature();
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert ECDSAInvalidSignatureLength(uint256(errorArg));
        } else if (error == RecoverError.InvalidSignatureS) {
            revert ECDSAInvalidSignatureS(errorArg);
        }
    }
}

File 46 of 54 : EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/EIP712.sol)

pragma solidity ^0.8.20;

import {MessageHashUtils} from "./MessageHashUtils.sol";
import {ShortStrings, ShortString} from "../ShortStrings.sol";
import {IERC5267} from "../../interfaces/IERC5267.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose
 * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract
 * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to
 * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
 * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the
 * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
 *
 * @custom:oz-upgrades-unsafe-allow state-variable-immutable
 */
abstract contract EIP712 is IERC5267 {
    using ShortStrings for *;

    bytes32 private constant TYPE_HASH =
        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _cachedDomainSeparator;
    uint256 private immutable _cachedChainId;
    address private immutable _cachedThis;

    bytes32 private immutable _hashedName;
    bytes32 private immutable _hashedVersion;

    ShortString private immutable _name;
    ShortString private immutable _version;
    string private _nameFallback;
    string private _versionFallback;

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        _name = name.toShortStringWithFallback(_nameFallback);
        _version = version.toShortStringWithFallback(_versionFallback);
        _hashedName = keccak256(bytes(name));
        _hashedVersion = keccak256(bytes(version));

        _cachedChainId = block.chainid;
        _cachedDomainSeparator = _buildDomainSeparator();
        _cachedThis = address(this);
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
            return _cachedDomainSeparator;
        } else {
            return _buildDomainSeparator();
        }
    }

    function _buildDomainSeparator() private view returns (bytes32) {
        return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);
    }

    /**
     * @dev See {IERC-5267}.
     */
    function eip712Domain()
        public
        view
        virtual
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        )
    {
        return (
            hex"0f", // 01111
            _EIP712Name(),
            _EIP712Version(),
            block.chainid,
            address(this),
            bytes32(0),
            new uint256[](0)
        );
    }

    /**
     * @dev The name parameter for the EIP712 domain.
     *
     * NOTE: By default this function reads _name which is an immutable value.
     * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
     */
    // solhint-disable-next-line func-name-mixedcase
    function _EIP712Name() internal view returns (string memory) {
        return _name.toStringWithFallback(_nameFallback);
    }

    /**
     * @dev The version parameter for the EIP712 domain.
     *
     * NOTE: By default this function reads _version which is an immutable value.
     * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
     */
    // solhint-disable-next-line func-name-mixedcase
    function _EIP712Version() internal view returns (string memory) {
        return _version.toStringWithFallback(_versionFallback);
    }
}

File 47 of 54 : Nonces.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Nonces.sol)
pragma solidity ^0.8.20;

/**
 * @dev Provides tracking nonces for addresses. Nonces will only increment.
 */
abstract contract Nonces {
    /**
     * @dev The nonce used for an `account` is not the expected current nonce.
     */
    error InvalidAccountNonce(address account, uint256 currentNonce);

    mapping(address account => uint256) private _nonces;

    /**
     * @dev Returns the next unused nonce for an address.
     */
    function nonces(address owner) public view virtual returns (uint256) {
        return _nonces[owner];
    }

    /**
     * @dev Consumes a nonce.
     *
     * Returns the current value and increments nonce.
     */
    function _useNonce(address owner) internal virtual returns (uint256) {
        // For each account, the nonce has an initial value of 0, can only be incremented by one, and cannot be
        // decremented or reset. This guarantees that the nonce never overflows.
        unchecked {
            // It is important to do x++ and not ++x here.
            return _nonces[owner]++;
        }
    }

    /**
     * @dev Same as {_useNonce} but checking that `nonce` is the next valid for `owner`.
     */
    function _useCheckedNonce(address owner, uint256 nonce) internal virtual {
        uint256 current = _useNonce(owner);
        if (nonce != current) {
            revert InvalidAccountNonce(owner, current);
        }
    }
}

File 48 of 54 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 49 of 54 : Errors.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of common custom errors used in multiple contracts
 *
 * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
 * It is recommended to avoid relying on the error API for critical functionality.
 *
 * _Available since v5.1._
 */
library Errors {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error InsufficientBalance(uint256 balance, uint256 needed);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedCall();

    /**
     * @dev The deployment failed.
     */
    error FailedDeployment();

    /**
     * @dev A necessary precompile is missing.
     */
    error MissingPrecompile(address);
}

File 50 of 54 : MessageHashUtils.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/MessageHashUtils.sol)

pragma solidity ^0.8.20;

import {Strings} from "../Strings.sol";

/**
 * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.
 *
 * The library provides methods for generating a hash of a message that conforms to the
 * https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]
 * specifications.
 */
library MessageHashUtils {
    /**
     * @dev Returns the keccak256 digest of an ERC-191 signed data with version
     * `0x45` (`personal_sign` messages).
     *
     * The digest is calculated by prefixing a bytes32 `messageHash` with
     * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the
     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
     *
     * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with
     * keccak256, although any bytes32 value can be safely used because the final digest will
     * be re-hashed.
     *
     * See {ECDSA-recover}.
     */
    function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {
        assembly ("memory-safe") {
            mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash
            mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix
            digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)
        }
    }

    /**
     * @dev Returns the keccak256 digest of an ERC-191 signed data with version
     * `0x45` (`personal_sign` messages).
     *
     * The digest is calculated by prefixing an arbitrary `message` with
     * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the
     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
     *
     * See {ECDSA-recover}.
     */
    function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {
        return
            keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message));
    }

    /**
     * @dev Returns the keccak256 digest of an ERC-191 signed data with version
     * `0x00` (data with intended validator).
     *
     * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended
     * `validator` address. Then hashing the result.
     *
     * See {ECDSA-recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked(hex"19_00", validator, data));
    }

    /**
     * @dev Returns the keccak256 digest of an EIP-712 typed data (ERC-191 version `0x01`).
     *
     * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
     * `\x19\x01` and hashing the result. It corresponds to the hash signed by the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
     *
     * See {ECDSA-recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {
        assembly ("memory-safe") {
            let ptr := mload(0x40)
            mstore(ptr, hex"19_01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            digest := keccak256(ptr, 0x42)
        }
    }
}

File 51 of 54 : ShortStrings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ShortStrings.sol)

pragma solidity ^0.8.20;

import {StorageSlot} from "./StorageSlot.sol";

// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |
// | length  | 0x                                                              BB |
type ShortString is bytes32;

/**
 * @dev This library provides functions to convert short memory strings
 * into a `ShortString` type that can be used as an immutable variable.
 *
 * Strings of arbitrary length can be optimized using this library if
 * they are short enough (up to 31 bytes) by packing them with their
 * length (1 byte) in a single EVM word (32 bytes). Additionally, a
 * fallback mechanism can be used for every other case.
 *
 * Usage example:
 *
 * ```solidity
 * contract Named {
 *     using ShortStrings for *;
 *
 *     ShortString private immutable _name;
 *     string private _nameFallback;
 *
 *     constructor(string memory contractName) {
 *         _name = contractName.toShortStringWithFallback(_nameFallback);
 *     }
 *
 *     function name() external view returns (string memory) {
 *         return _name.toStringWithFallback(_nameFallback);
 *     }
 * }
 * ```
 */
library ShortStrings {
    // Used as an identifier for strings longer than 31 bytes.
    bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;

    error StringTooLong(string str);
    error InvalidShortString();

    /**
     * @dev Encode a string of at most 31 chars into a `ShortString`.
     *
     * This will trigger a `StringTooLong` error is the input string is too long.
     */
    function toShortString(string memory str) internal pure returns (ShortString) {
        bytes memory bstr = bytes(str);
        if (bstr.length > 31) {
            revert StringTooLong(str);
        }
        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
    }

    /**
     * @dev Decode a `ShortString` back to a "normal" string.
     */
    function toString(ShortString sstr) internal pure returns (string memory) {
        uint256 len = byteLength(sstr);
        // using `new string(len)` would work locally but is not memory safe.
        string memory str = new string(32);
        assembly ("memory-safe") {
            mstore(str, len)
            mstore(add(str, 0x20), sstr)
        }
        return str;
    }

    /**
     * @dev Return the length of a `ShortString`.
     */
    function byteLength(ShortString sstr) internal pure returns (uint256) {
        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
        if (result > 31) {
            revert InvalidShortString();
        }
        return result;
    }

    /**
     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
     */
    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
        if (bytes(value).length < 32) {
            return toShortString(value);
        } else {
            StorageSlot.getStringSlot(store).value = value;
            return ShortString.wrap(FALLBACK_SENTINEL);
        }
    }

    /**
     * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     */
    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
        if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {
            return toString(value);
        } else {
            return store;
        }
    }

    /**
     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using
     * {setWithFallback}.
     *
     * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
     */
    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
        if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {
            return byteLength(value);
        } else {
            return bytes(store).length;
        }
    }
}

File 52 of 54 : IERC5267.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol)

pragma solidity ^0.8.20;

interface IERC5267 {
    /**
     * @dev MAY be emitted to signal that the domain could have changed.
     */
    event EIP712DomainChanged();

    /**
     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
     * signature.
     */
    function eip712Domain()
        external
        view
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        );
}

File 53 of 54 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Strings.sol)

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SafeCast} from "./math/SafeCast.sol";
import {SignedMath} from "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    using SafeCast for *;

    bytes16 private constant HEX_DIGITS = "0123456789abcdef";
    uint8 private constant ADDRESS_LENGTH = 20;

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

    /**
     * @dev The string being parsed contains characters that are not in scope of the given base.
     */
    error StringsInvalidChar();

    /**
     * @dev The string being parsed is not a properly formatted address.
     */
    error StringsInvalidAddressFormat();

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            assembly ("memory-safe") {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                assembly ("memory-safe") {
                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toStringSigned(int256 value) internal pure returns (string memory) {
        return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        uint256 localValue = value;
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = HEX_DIGITS[localValue & 0xf];
            localValue >>= 4;
        }
        if (localValue != 0) {
            revert StringsInsufficientHexLength(value, length);
        }
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
     * representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its checksummed ASCII `string` hexadecimal
     * representation, according to EIP-55.
     */
    function toChecksumHexString(address addr) internal pure returns (string memory) {
        bytes memory buffer = bytes(toHexString(addr));

        // hash the hex part of buffer (skip length + 2 bytes, length 40)
        uint256 hashValue;
        assembly ("memory-safe") {
            hashValue := shr(96, keccak256(add(buffer, 0x22), 40))
        }

        for (uint256 i = 41; i > 1; --i) {
            // possible values for buffer[i] are 48 (0) to 57 (9) and 97 (a) to 102 (f)
            if (hashValue & 0xf > 7 && uint8(buffer[i]) > 96) {
                // case shift by xoring with 0x20
                buffer[i] ^= 0x20;
            }
            hashValue >>= 4;
        }
        return string(buffer);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
    }

    /**
     * @dev Parse a decimal string and returns the value as a `uint256`.
     *
     * Requirements:
     * - The string must be formatted as `[0-9]*`
     * - The result must fit into an `uint256` type
     */
    function parseUint(string memory input) internal pure returns (uint256) {
        return parseUint(input, 0, bytes(input).length);
    }

    /**
     * @dev Variant of {parseUint} that parses a substring of `input` located between position `begin` (included) and
     * `end` (excluded).
     *
     * Requirements:
     * - The substring must be formatted as `[0-9]*`
     * - The result must fit into an `uint256` type
     */
    function parseUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) {
        (bool success, uint256 value) = tryParseUint(input, begin, end);
        if (!success) revert StringsInvalidChar();
        return value;
    }

    /**
     * @dev Variant of {parseUint-string} that returns false if the parsing fails because of an invalid character.
     *
     * NOTE: This function will revert if the result does not fit in a `uint256`.
     */
    function tryParseUint(string memory input) internal pure returns (bool success, uint256 value) {
        return _tryParseUintUncheckedBounds(input, 0, bytes(input).length);
    }

    /**
     * @dev Variant of {parseUint-string-uint256-uint256} that returns false if the parsing fails because of an invalid
     * character.
     *
     * NOTE: This function will revert if the result does not fit in a `uint256`.
     */
    function tryParseUint(
        string memory input,
        uint256 begin,
        uint256 end
    ) internal pure returns (bool success, uint256 value) {
        if (end > bytes(input).length || begin > end) return (false, 0);
        return _tryParseUintUncheckedBounds(input, begin, end);
    }

    /**
     * @dev Implementation of {tryParseUint} that does not check bounds. Caller should make sure that
     * `begin <= end <= input.length`. Other inputs would result in undefined behavior.
     */
    function _tryParseUintUncheckedBounds(
        string memory input,
        uint256 begin,
        uint256 end
    ) private pure returns (bool success, uint256 value) {
        bytes memory buffer = bytes(input);

        uint256 result = 0;
        for (uint256 i = begin; i < end; ++i) {
            uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i)));
            if (chr > 9) return (false, 0);
            result *= 10;
            result += chr;
        }
        return (true, result);
    }

    /**
     * @dev Parse a decimal string and returns the value as a `int256`.
     *
     * Requirements:
     * - The string must be formatted as `[-+]?[0-9]*`
     * - The result must fit in an `int256` type.
     */
    function parseInt(string memory input) internal pure returns (int256) {
        return parseInt(input, 0, bytes(input).length);
    }

    /**
     * @dev Variant of {parseInt-string} that parses a substring of `input` located between position `begin` (included) and
     * `end` (excluded).
     *
     * Requirements:
     * - The substring must be formatted as `[-+]?[0-9]*`
     * - The result must fit in an `int256` type.
     */
    function parseInt(string memory input, uint256 begin, uint256 end) internal pure returns (int256) {
        (bool success, int256 value) = tryParseInt(input, begin, end);
        if (!success) revert StringsInvalidChar();
        return value;
    }

    /**
     * @dev Variant of {parseInt-string} that returns false if the parsing fails because of an invalid character or if
     * the result does not fit in a `int256`.
     *
     * NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`.
     */
    function tryParseInt(string memory input) internal pure returns (bool success, int256 value) {
        return _tryParseIntUncheckedBounds(input, 0, bytes(input).length);
    }

    uint256 private constant ABS_MIN_INT256 = 2 ** 255;

    /**
     * @dev Variant of {parseInt-string-uint256-uint256} that returns false if the parsing fails because of an invalid
     * character or if the result does not fit in a `int256`.
     *
     * NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`.
     */
    function tryParseInt(
        string memory input,
        uint256 begin,
        uint256 end
    ) internal pure returns (bool success, int256 value) {
        if (end > bytes(input).length || begin > end) return (false, 0);
        return _tryParseIntUncheckedBounds(input, begin, end);
    }

    /**
     * @dev Implementation of {tryParseInt} that does not check bounds. Caller should make sure that
     * `begin <= end <= input.length`. Other inputs would result in undefined behavior.
     */
    function _tryParseIntUncheckedBounds(
        string memory input,
        uint256 begin,
        uint256 end
    ) private pure returns (bool success, int256 value) {
        bytes memory buffer = bytes(input);

        // Check presence of a negative sign.
        bytes1 sign = begin == end ? bytes1(0) : bytes1(_unsafeReadBytesOffset(buffer, begin)); // don't do out-of-bound (possibly unsafe) read if sub-string is empty
        bool positiveSign = sign == bytes1("+");
        bool negativeSign = sign == bytes1("-");
        uint256 offset = (positiveSign || negativeSign).toUint();

        (bool absSuccess, uint256 absValue) = tryParseUint(input, begin + offset, end);

        if (absSuccess && absValue < ABS_MIN_INT256) {
            return (true, negativeSign ? -int256(absValue) : int256(absValue));
        } else if (absSuccess && negativeSign && absValue == ABS_MIN_INT256) {
            return (true, type(int256).min);
        } else return (false, 0);
    }

    /**
     * @dev Parse a hexadecimal string (with or without "0x" prefix), and returns the value as a `uint256`.
     *
     * Requirements:
     * - The string must be formatted as `(0x)?[0-9a-fA-F]*`
     * - The result must fit in an `uint256` type.
     */
    function parseHexUint(string memory input) internal pure returns (uint256) {
        return parseHexUint(input, 0, bytes(input).length);
    }

    /**
     * @dev Variant of {parseHexUint} that parses a substring of `input` located between position `begin` (included) and
     * `end` (excluded).
     *
     * Requirements:
     * - The substring must be formatted as `(0x)?[0-9a-fA-F]*`
     * - The result must fit in an `uint256` type.
     */
    function parseHexUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) {
        (bool success, uint256 value) = tryParseHexUint(input, begin, end);
        if (!success) revert StringsInvalidChar();
        return value;
    }

    /**
     * @dev Variant of {parseHexUint-string} that returns false if the parsing fails because of an invalid character.
     *
     * NOTE: This function will revert if the result does not fit in a `uint256`.
     */
    function tryParseHexUint(string memory input) internal pure returns (bool success, uint256 value) {
        return _tryParseHexUintUncheckedBounds(input, 0, bytes(input).length);
    }

    /**
     * @dev Variant of {parseHexUint-string-uint256-uint256} that returns false if the parsing fails because of an
     * invalid character.
     *
     * NOTE: This function will revert if the result does not fit in a `uint256`.
     */
    function tryParseHexUint(
        string memory input,
        uint256 begin,
        uint256 end
    ) internal pure returns (bool success, uint256 value) {
        if (end > bytes(input).length || begin > end) return (false, 0);
        return _tryParseHexUintUncheckedBounds(input, begin, end);
    }

    /**
     * @dev Implementation of {tryParseHexUint} that does not check bounds. Caller should make sure that
     * `begin <= end <= input.length`. Other inputs would result in undefined behavior.
     */
    function _tryParseHexUintUncheckedBounds(
        string memory input,
        uint256 begin,
        uint256 end
    ) private pure returns (bool success, uint256 value) {
        bytes memory buffer = bytes(input);

        // skip 0x prefix if present
        bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(buffer, begin)) == bytes2("0x"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty
        uint256 offset = hasPrefix.toUint() * 2;

        uint256 result = 0;
        for (uint256 i = begin + offset; i < end; ++i) {
            uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i)));
            if (chr > 15) return (false, 0);
            result *= 16;
            unchecked {
                // Multiplying by 16 is equivalent to a shift of 4 bits (with additional overflow check).
                // This guaratees that adding a value < 16 will not cause an overflow, hence the unchecked.
                result += chr;
            }
        }
        return (true, result);
    }

    /**
     * @dev Parse a hexadecimal string (with or without "0x" prefix), and returns the value as an `address`.
     *
     * Requirements:
     * - The string must be formatted as `(0x)?[0-9a-fA-F]{40}`
     */
    function parseAddress(string memory input) internal pure returns (address) {
        return parseAddress(input, 0, bytes(input).length);
    }

    /**
     * @dev Variant of {parseAddress} that parses a substring of `input` located between position `begin` (included) and
     * `end` (excluded).
     *
     * Requirements:
     * - The substring must be formatted as `(0x)?[0-9a-fA-F]{40}`
     */
    function parseAddress(string memory input, uint256 begin, uint256 end) internal pure returns (address) {
        (bool success, address value) = tryParseAddress(input, begin, end);
        if (!success) revert StringsInvalidAddressFormat();
        return value;
    }

    /**
     * @dev Variant of {parseAddress-string} that returns false if the parsing fails because the input is not a properly
     * formatted address. See {parseAddress} requirements.
     */
    function tryParseAddress(string memory input) internal pure returns (bool success, address value) {
        return tryParseAddress(input, 0, bytes(input).length);
    }

    /**
     * @dev Variant of {parseAddress-string-uint256-uint256} that returns false if the parsing fails because input is not a properly
     * formatted address. See {parseAddress} requirements.
     */
    function tryParseAddress(
        string memory input,
        uint256 begin,
        uint256 end
    ) internal pure returns (bool success, address value) {
        if (end > bytes(input).length || begin > end) return (false, address(0));

        bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(bytes(input), begin)) == bytes2("0x"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty
        uint256 expectedLength = 40 + hasPrefix.toUint() * 2;

        // check that input is the correct length
        if (end - begin == expectedLength) {
            // length guarantees that this does not overflow, and value is at most type(uint160).max
            (bool s, uint256 v) = _tryParseHexUintUncheckedBounds(input, begin, end);
            return (s, address(uint160(v)));
        } else {
            return (false, address(0));
        }
    }

    function _tryParseChr(bytes1 chr) private pure returns (uint8) {
        uint8 value = uint8(chr);

        // Try to parse `chr`:
        // - Case 1: [0-9]
        // - Case 2: [a-f]
        // - Case 3: [A-F]
        // - otherwise not supported
        unchecked {
            if (value > 47 && value < 58) value -= 48;
            else if (value > 96 && value < 103) value -= 87;
            else if (value > 64 && value < 71) value -= 55;
            else return type(uint8).max;
        }

        return value;
    }

    /**
     * @dev Reads a bytes32 from a bytes array without bounds checking.
     *
     * NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the
     * assembly block as such would prevent some optimizations.
     */
    function _unsafeReadBytesOffset(bytes memory buffer, uint256 offset) private pure returns (bytes32 value) {
        // This is not memory safe in the general case, but all calls to this private function are within bounds.
        assembly ("memory-safe") {
            value := mload(add(buffer, add(0x20, offset)))
        }
    }
}

File 54 of 54 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.20;

import {SafeCast} from "./SafeCast.sol";

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.
     *
     * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.
     * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute
     * one branch when needed, making this function more expensive.
     */
    function ternary(bool condition, int256 a, int256 b) internal pure returns (int256) {
        unchecked {
            // branchless ternary works because:
            // b ^ (a ^ b) == a
            // b ^ 0 == b
            return b ^ ((a ^ b) * int256(SafeCast.toUint(condition)));
        }
    }

    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return ternary(a > b, a, b);
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return ternary(a < b, a, b);
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // Formula from the "Bit Twiddling Hacks" by Sean Eron Anderson.
            // Since `n` is a signed integer, the generated bytecode will use the SAR opcode to perform the right shift,
            // taking advantage of the most significant (or "sign" bit) in two's complement representation.
            // This opcode adds new most significant bits set to the value of the previous most significant bit. As a result,
            // the mask will either be `bytes32(0)` (if n is positive) or `~bytes32(0)` (if n is negative).
            int256 mask = n >> 255;

            // A `bytes32(0)` mask leaves the input unchanged, while a `~bytes32(0)` mask complements it.
            return uint256((n + mask) ^ mask);
        }
    }
}

Settings
{
  "remappings": [
    "forge-std/=lib/forge-std/src/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@onchainclob/contracts/=lib/onchain-clob-contracts/src/",
    "@pythnetwork/pyth-sdk-solidity/=lib/pyth-sdk-solidity/",
    "@solmate/src/=lib/onchain-clob-contracts/lib/solmate/src/",
    "ds-test/=lib/solmate/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "onchain-clob-contracts/=lib/onchain-clob-contracts/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "pyth-sdk-solidity/=lib/pyth-sdk-solidity/",
    "solmate/=lib/solmate/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": true,
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_pythAddress","type":"address"},{"internalType":"address","name":"_proxyPythAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[],"name":"CooldownDurationNotYetPassed","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"Expired","type":"error"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[],"name":"FeeBpsExceedsMaximum","type":"error"},{"inputs":[],"name":"Forbidden","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InsufficientFeeForPythUpdate","type":"error"},{"inputs":[],"name":"InsufficientLiquidityValue","type":"error"},{"inputs":[],"name":"InsufficientMarketMakerLPShare","type":"error"},{"inputs":[],"name":"InsufficientMintedLP","type":"error"},{"inputs":[],"name":"InsufficientTokenAmount","type":"error"},{"inputs":[],"name":"InsufficientUSDValue","type":"error"},{"inputs":[],"name":"InvalidFloatingPointRepresentation","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidOracleConfidenceLevel","type":"error"},{"inputs":[],"name":"InvalidTokenWeights","type":"error"},{"inputs":[],"name":"InvalidTrader","type":"error"},{"inputs":[],"name":"LobDisabled","type":"error"},{"inputs":[],"name":"MarketMakerLPShareExceedsMaximum","type":"error"},{"inputs":[],"name":"MaxLiquidityValueExceeded","type":"error"},{"inputs":[],"name":"MaxOracleAgeExceedsMaximum","type":"error"},{"inputs":[],"name":"NativeGasTokenDisabled","type":"error"},{"inputs":[],"name":"NonPositivePrice","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"OracleConfTooHigh","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"PriceTooBig","type":"error"},{"inputs":[],"name":"PriceTooSmall","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"uint8","name":"bits","type":"uint8"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintDowncast","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"SlashingUnAvailable","type":"error"},{"inputs":[],"name":"TokenDisabled","type":"error"},{"inputs":[],"name":"TokenWeightExceeded","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"inputs":[],"name":"UnknownLob","type":"error"},{"inputs":[],"name":"WrongNumber","type":"error"},{"inputs":[],"name":"WrongTokenId","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"dynamicFeesEnabled","type":"bool"},{"indexed":false,"internalType":"uint16","name":"adminMintLPFeeBps","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"adminBurnLPFeeBps","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"feeBasisBps","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"taxBasisPoints","type":"uint16"},{"indexed":false,"internalType":"uint24","name":"cooldownDuration","type":"uint24"},{"indexed":false,"internalType":"uint16","name":"maxOracleAge","type":"uint16"},{"indexed":false,"internalType":"uint128","name":"minLiquidityValueUsd","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"maxLiquidityValueUsd","type":"uint128"},{"indexed":false,"internalType":"bool","name":"marketMakerLPShareEnabled","type":"bool"},{"indexed":false,"internalType":"uint16","name":"marketMakerLPShareBps","type":"uint16"},{"indexed":false,"internalType":"bool","name":"nativeTokenEnabled","type":"bool"},{"indexed":false,"internalType":"uint8","name":"nativeTokenTokenId","type":"uint8"},{"indexed":false,"internalType":"address","name":"adminFeeRecipient","type":"address"},{"indexed":false,"internalType":"uint24","name":"priceValidityPeriod","type":"uint24"},{"indexed":false,"internalType":"uint64","name":"baseMultiplier","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"maxAllowedPriceDeviation","type":"uint64"},{"indexed":false,"internalType":"uint16","name":"perfFeeBps","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"adminPerfFeeBps","type":"uint16"}],"name":"ConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenUSDValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalUSDValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"protocolFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintedLP","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountLpShares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalSupply","type":"uint256"}],"name":"LiquidityAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lpUSDValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalUSDValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"protocolFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"burnedLP","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountLpShares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalSupply","type":"uint256"}],"name":"LiquidityRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"lobId","type":"uint8"},{"indexed":false,"internalType":"address","name":"lobAddress","type":"address"},{"indexed":false,"internalType":"bool","name":"isActive","type":"bool"},{"indexed":false,"internalType":"uint8","name":"tokenIdX","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"tokenIdY","type":"uint8"},{"indexed":false,"internalType":"uint16","name":"maxOrderDistanceBps","type":"uint16"}],"name":"LobChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"marketMaker","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalSupply","type":"uint256"}],"name":"MakersSharesSlashed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"marketMaker","type":"address"},{"indexed":false,"internalType":"bool","name":"isActive","type":"bool"}],"name":"MarketMakerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newPauser","type":"address"},{"indexed":false,"internalType":"address","name":"oldPauser","type":"address"}],"name":"PauserChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"currentPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"previousHWM","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"adminFeeAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"marketMakerFeeAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalSupply","type":"uint256"}],"name":"PerformanceFeesDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldMarketMaker","type":"address"},{"indexed":false,"internalType":"address","name":"newMarketMaker","type":"address"}],"name":"PrimaryMarketMakerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"SlashingAvailableStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenReserved","type":"uint256"}],"name":"Sync","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"tokenId","type":"uint8"},{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"bool","name":"isActive","type":"bool"},{"indexed":false,"internalType":"uint16","name":"targetWeight","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"lowerBoundWeight","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"upperBoundWeight","type":"uint16"},{"indexed":false,"internalType":"uint8","name":"decimals","type":"uint8"},{"indexed":false,"internalType":"uint24","name":"oracleConfRel","type":"uint24"},{"indexed":false,"internalType":"bytes32","name":"oraclePriceId","type":"bytes32"}],"name":"TokenChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minUsdValue","type":"uint256"},{"internalType":"uint256","name":"minLPMinted","type":"uint256"},{"internalType":"uint256","name":"expires","type":"uint256"},{"internalType":"bytes[]","name":"priceUpdateData","type":"bytes[]"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint8","name":"lobId","type":"uint8"},{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approveForLOB","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"lobAddress","type":"address"},{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"uint8","name":"tokenIdX","type":"uint8"},{"internalType":"uint8","name":"tokenIdY","type":"uint8"},{"internalType":"uint16","name":"maxOrderDistanceBps","type":"uint16"}],"name":"changeLob","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"marketMaker","type":"address"},{"internalType":"bool","name":"isActive","type":"bool"}],"name":"changeMarketMaker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pauser_","type":"address"}],"name":"changePauser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_primaryMarketMaker","type":"address"}],"name":"changePrimaryMarketMaker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"bool","name":"_isActive","type":"bool"},{"internalType":"uint16","name":"_targetWeight","type":"uint16"},{"internalType":"uint16","name":"_lowerBoundWeight","type":"uint16"},{"internalType":"uint16","name":"_upperBoundWeight","type":"uint16"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"uint24","name":"_oracleConfRel","type":"uint24"},{"internalType":"bytes32","name":"_oraclePriceId","type":"bytes32"}],"name":"changeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"checkCooldown","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"lobId","type":"uint8"},{"internalType":"uint64","name":"orderId","type":"uint64"},{"internalType":"bool","name":"onlyClaim","type":"bool"},{"internalType":"uint256","name":"expires","type":"uint256"}],"name":"claimOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collectFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disableSlashingStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getConfig","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint24","name":"","type":"uint24"},{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint128","name":"","type":"uint128"},{"internalType":"uint128","name":"","type":"uint128"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint24","name":"","type":"uint24"},{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"totalValue","type":"uint256"},{"internalType":"uint256","name":"initialTokenValue","type":"uint256"},{"internalType":"uint256","name":"nextTokenValue","type":"uint256"},{"internalType":"uint16","name":"targetTokenWeight","type":"uint16"}],"name":"getFeeBasisPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"}],"name":"getPriceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"int32","name":"","type":"int32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokensCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hwmLPPrice","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_liquidityToken","type":"address"},{"internalType":"address","name":"_adminFeeRecipient","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastAddedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityToken","outputs":[{"internalType":"contract LPToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"}],"name":"lobReservesByTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lobs","outputs":[{"internalType":"address","name":"lobAddress","type":"address"},{"internalType":"uint8","name":"tokenIdX","type":"uint8"},{"internalType":"uint8","name":"tokenIdY","type":"uint8"},{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"uint16","name":"maxOrderDistanceBps","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"marketMakers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauser","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"lobId","type":"uint8"},{"internalType":"bool","name":"isAsk","type":"bool"},{"internalType":"uint128","name":"quantity","type":"uint128"},{"internalType":"uint72","name":"price","type":"uint72"},{"internalType":"uint128","name":"maxCommission","type":"uint128"},{"internalType":"bool","name":"marketOnly","type":"bool"},{"internalType":"bool","name":"postOnly","type":"bool"},{"internalType":"uint256","name":"expires","type":"uint256"},{"internalType":"bytes[]","name":"priceUpdateData","type":"bytes[]"}],"name":"placeOrder","outputs":[{"internalType":"uint64","name":"orderId","type":"uint64"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"primaryMarketMaker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"tokenId","type":"uint8"},{"internalType":"uint256","name":"burnLP","type":"uint256"},{"internalType":"uint256","name":"minUsdValue","type":"uint256"},{"internalType":"uint256","name":"minTokenGet","type":"uint256"},{"internalType":"uint256","name":"expires","type":"uint256"},{"internalType":"bytes[]","name":"priceUpdateData","type":"bytes[]"}],"name":"removeLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_dynamicFeesEnabled","type":"bool"},{"internalType":"uint16","name":"_adminMintLPFeeBps","type":"uint16"},{"internalType":"uint16","name":"_adminBurnLPFeeBps","type":"uint16"},{"internalType":"uint16","name":"_feeBasisBps","type":"uint16"},{"internalType":"uint16","name":"_taxBasisBps","type":"uint16"},{"internalType":"uint24","name":"_cooldownDuration","type":"uint24"},{"internalType":"uint16","name":"_maxOracleAge","type":"uint16"},{"internalType":"uint128","name":"_minLiquidityValueUsd","type":"uint128"},{"internalType":"uint128","name":"_maxLiquidityValueUsd","type":"uint128"},{"internalType":"bool","name":"_marketMakerLPShareEnabled","type":"bool"},{"internalType":"uint16","name":"_marketMakerLPShareBps","type":"uint16"},{"internalType":"bool","name":"_nativeTokenEnabled","type":"bool"},{"internalType":"uint8","name":"_nativeTokenTokenId","type":"uint8"},{"internalType":"address","name":"_adminFeeRecipient","type":"address"},{"internalType":"uint24","name":"_priceValidityPeriod","type":"uint24"},{"internalType":"uint64","name":"_baseMultiplier","type":"uint64"},{"internalType":"uint64","name":"_maxAllowedPriceDeviation","type":"uint64"},{"internalType":"uint16","name":"_perfFeeBps","type":"uint16"},{"internalType":"uint16","name":"_adminPerfFeeBps","type":"uint16"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"slashMakersShares","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"uint16","name":"targetWeight","type":"uint16"},{"internalType":"uint16","name":"lowerBoundWeight","type":"uint16"},{"internalType":"uint16","name":"upperBoundWeight","type":"uint16"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint24","name":"oracleConfRel","type":"uint24"},{"internalType":"bytes32","name":"oraclePriceId","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalWeight","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"priceUpdateData","type":"bytes[]"}],"name":"validateLPPriceAndDistributeFees","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"validateMarketMakerLPShare","outputs":[],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

Deployed Bytecode

0x61030060405260043610156100ba575b3615610019575f80fd5b600a5460ff8160981c168061009e575b1561008f5760ff61003d9160a01c166134ed565b50546001600160a01b0316803b1561008b575f60049160405192838092630d0e30db60e41b825234905af180156100805761007457005b5f61007e9161349d565b005b6040513d5f823e3d90fd5b5f80fd5b636078753160e01b5f5260045ffd5b5060ff6100af818360a01c166134ed565b505460a01c16610029565b5f5f3560e01c8063034907951461336d578063099924621461334c5780631c5269f214612da557806323c9e08114612976578063246451e5146129455780632cd271e71461291c5780632ea68d85146128ea5780633962f82d146128cd5780633f4ba83a1461284f57806343cd8f7e1461282757806349cd60da146127f35780634dd14852146127cb5780634f1ef286146125c25780634f64b2be1461252c57806352d1902d146124c65780635c975abb1461249857806368bd322f1461210a5780636c2f3523146120ab578063715018a61461202c57806379ba509714611fdf5780638456cb5914611f2b5780638933154114611ec75780638b770e1114611e8e5780638da5cb5b14611e5957806391f9307114611e3857806396c82e5714611e155780639fd0506d14611dec578063a4e4ac4014611dd3578063ad3cb1cc14611d77578063c0c53b8b14611b3b578063c3f909d4146119fe578063c46a242214611648578063c87965721461152b578063cd8e57e41461141f578063d50b3be8146113f2578063df490cc614610f41578063e30c397814610f0c578063e610ef8d14610cff578063eba8a92d146106d5578063f2fde38b1461064f578063f60559eb14610610578063f69b05f3146103215763faf29cb31461029e575061000f565b3461031e57604036600319011261031e577f4c46f3429672da12efead1c8b433ef2417c54d99fcb672d41b18a140d57cb54260406102da613405565b6102e261341b565b906102eb613c4b565b60018060a01b03169081855260066020528285209015159060ff1981541660ff831617905582519182526020820152a180f35b80fd5b503461031e5761010036600319011261031e5761033c613405565b61034461341b565b9061034d61342a565b61035561343b565b9061035e61344c565b9060a4359160ff831680930361060c5760c4359362ffffff85168095036106085760e4359561038b613c4b565b6001600160a01b03169283156105f95761ffff80911691169181831115806105eb575b156105dc576298968086116105cd576040519761010089018981106001600160401b038211176105b9579061ffff91604052858a521515918260208b01528360408b01528460608b015216938460808a01528560a08a01528660c08a01528760e08a0152895b60025460ff821610156105b3578161042b826134ed565b50546001600160a01b03161461044957610444906139fc565b610414565b9861ffff6104568b6134ed565b505460a81c166003549062ffffff82160362ffffff811161059f5761047f8662ffffff92613b63565b169062ffffff19161760035561049e816104988c6134ed565b90613b7b565b60ff6002549a1699808b1461050f575b8b7f587f6b4703452af3ef05bf8f6ec50e1fe7111809364b16198ecfd4e66f95fb6a6101208d8d8d8d8d8d8d8d8d604051988952602089015260408801526060870152608086015260a085015260c084015260e0830152610100820152a180f35b600160401b81101561058b579161055c6101209a989694926104988560017f587f6b4703452af3ef05bf8f6ec50e1fe7111809364b16198ecfd4e66f95fb6a9f9d9b9997016002556134ed565b60035462ffffff61056f85828416613b63565b169062ffffff19161760035591939597998193959799506104ae565b634e487b7160e01b8c52604160045260248cfd5b634e487b7160e01b8d52601160045260248dfd5b9861049e565b634e487b7160e01b8b52604160045260248bfd5b63e6b9bbad60e01b8952600489fd5b634b8072c360e01b8952600489fd5b5061ffff81168211156103ae565b63d92e233d60e01b8952600489fd5b8780fd5b8680fd5b503461031e57602036600319011261031e5760209060ff906040906001600160a01b0361063b613405565b168152600684522054166040519015158152f35b503461031e57602036600319011261031e57610669613405565b610671613c4b565b5f5160206149ee5f395f51905f5280546001600160a01b0319166001600160a01b039283169081179091555f51602061494e5f395f51905f52549091167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b506106df36613509565b90969294914211610cf0576106f2613c7e565b6106fa61456e565b6002549660ff871697881015610ce1578215610cd2576024949392916107499161072333613563565b7f0000000000000000000000002880ab155794e7179c9ee2e38200202908c17b43613dcc565b50610752613ff7565b6008546040516370a0823160e01b81523360048201529460209186919082906001600160a01b03165afa938415610afc578294610c9e575b50808410610c8f5760405163386e93bf60e01b81526004810197909752602487018290527f000000000000000000000000653fd819efede7b36cc87a6932e0974794f93f2e6001600160a01b03169360808860448186895af1928315610c8357808194829a8391610c41575b506008546040516318160ddd60e01b8152959493929190602090879060049082906001600160a01b03165afa958615610c36578396610c02575b506108448661083f8785613657565b6137f9565b978810610bf3578a9b60ff6108666108608b9d9e9c9d8b613fe6565b9b6134ed565b505460d81c16601119908360030b900301818582135f14610bc95761083f61089061089693613ed3565b8c613657565b9a5b8d8c869a8d8a8c145f14610b825750505050602085916084604051809481936303f3541960e11b835281600484015260016024840152670de0b6b3a764000060448401528160648401525af18015610b7757908e91610b1a575b506109196109309361093e959360ff61090d61092a956134ed565b505460d81c168c614595565b91610924838c613556565b90613556565b99613827565b62ffffff6003541690613657565b61095961ffff61094d8d6134ed565b505460b81c1689613657565b11610b0b576008546001600160a01b0316803b15610b0757604051632770a7eb60e21b8152336004820152602481018590529082908290604490829084905af18015610afc57908291610ae7575b50506109e76109b58b6134ed565b5060018060a01b0390541698610924876109d861ffff60095460181c16846145fe565b8c8180610ac8575b5050613827565b988910610ab9575093610a8b88947f416da91740862e15e3b162788493edb6d383e9b8f8bd96d9a7472ce2e7ad967e9484610a5381610a4d60209f9c988e9c610a939f8d610a3691339061473e565b6005546001600160a01b03163314610aac57613556565b93613556565b92604051968796339a8893909796959260c0959260e08601998652602086015260408501526060840152608083015260a08201520152565b0390a361466a565b60015f5160206149ae5f395f51905f5255604051908152f35b610ab46138e8565b613556565b631762402160e11b8152600490fd5b600b54610ae0926001600160a01b039091169061473e565b8c816109e0565b81610af19161349d565b61031e57805f6109a7565b6040513d84823e3d90fd5b5080fd5b63725ad4f560e01b8152600490fd5b90506020813d602011610b6f575b81610b356020938361349d565b81010312610b6b57610919610930938f9360ff61090d61093e9896610b5c61092a97613a21565b509550505093955093506108f2565b8480fd5b3d9150610b28565b6040513d87823e3d90fd5b839c5061092a945061090d610bc36109309894610bbd61093e9b999560ff9561ffff610bb06109199b6134ed565b505460a81c16918c613834565b906145fe565b9d6134ed565b50610be7610be1610bdc610bed93613ec3565b613ed3565b83613657565b8a6137f9565b9a610898565b63d6f6915760e01b8352600483fd5b9095506020813d602011610c2e575b81610c1e6020938361349d565b8101031261008b5751945f610830565b3d9150610c11565b6040513d85823e3d90fd5b915050600493929950610c6d91945060803d608011610c7c575b610c65818361349d565b810190613b3d565b909a91959394919392916107f6565b503d610c5b565b604051903d90823e3d90fd5b631e9acf1760e31b8252600482fd5b9093506020813d602011610cca575b81610cba6020938361349d565b8101031261008b5751925f61078a565b3d9150610cad565b631f2a200560e01b8452600484fd5b633a4d776760e11b8452600484fd5b630407b05b60e31b8352600483fd5b503461031e57602036600319011261031e57600435610d1c613c4b565b60ff600c5460601c1615610efd578015610eee576005546008546040516370a0823160e01b81526001600160a01b0392831660048201819052939290911690602081602481855afa8015610b775783918691610eb9575b5010610eaa578084913b15610b0757604051632770a7eb60e21b81526001600160a01b0385166004820152602481018490529082908290604490829084905af18015610afc57610e91575b50506008546040516318160ddd60e01b81529190602090839060049082906001600160a01b03165afa918215610e86578492610e30575b50916060917f9d52b2e24c6b671929244bb7206f02c03a564369efc6e79609db728c531638789360405192835260208301526040820152a180f35b9150916020823d602011610e7e575b81610e4c6020938361349d565b8101031261008b57905190917f9d52b2e24c6b671929244bb7206f02c03a564369efc6e79609db728c53163878610df5565b3d9150610e3f565b6040513d86823e3d90fd5b81610e9b9161349d565b610ea657825f610dbe565b8280fd5b631e9acf1760e31b8452600484fd5b9150506020813d602011610ee6575b81610ed56020938361349d565b8101031261008b578290515f610d73565b3d9150610ec8565b631f2a200560e01b8252600482fd5b63d7b4588760e01b8252600482fd5b503461031e578060031936011261031e575f5160206149ee5f395f51905f52546040516001600160a01b039091168152602090f35b50610f4b36613509565b90939594969142116113e357610f5f613c7e565b610f6761456e565b6002549360ff8616948510156113d45760ff610f82876134ed565b505460a01c16156113c55787156113b65790610fbe917f0000000000000000000000002880ab155794e7179c9ee2e38200202908c17b43613dcc565b50610fc7613ff7565b60405163386e93bf60e01b8152600481019390935260016024840152608083604481847f000000000000000000000000653fd819efede7b36cc87a6932e0974794f93f2e6001600160a01b03165af1908115610c8357809581908295839461138a575b5061103b848760ff61090d8b6134ed565b1061137b576001600160801b036110826009549461106a61106361ffff8860081c168d6145fe565b809c613556565b9760ff6110768b6134ed565b505460d81c1689614595565b9360701c16831061136c576110978382613827565b6008546040516318160ddd60e01b815291959192906001600160a01b0316602084600481845afa938415610b77578594611338575b5084841561130e5750509061112d8561111861111161110b8d8b89988f9b9a6110ff610bc38561083f61ffff948c613657565b505460a81c1692613834565b886145fe565b8097613556565b9a5b3386526001602052426040872055613827565b956001600160801b03600a541687116112ff576111529062ffffff6003541690613657565b61116d61ffff6111618b6134ed565b505460c81c1688613657565b106112f05761117b886134ed565b50546001600160a01b031699806112d2575b5061119a8730338d61461f565b88106112c3576008546001600160a01b0316803b15610ea6576040516340c10f1960e01b8152336004820152602481018a90529083908290604490829084905af18015610c36579083916112ae575b50506111f36138e8565b6008546040516370a0823160e01b815233600482015290602090829060249082906001600160a01b03165afa928315610c835792611268575b5092610a8b7f228674ca516ab8f32325e25d1e16656e747d977df7f664467fd5f7b4e64ba00f9360209a96938a610a5381610a939c9b99613827565b98949150919594926020893d6020116112a6575b816112896020938361349d565b8101031261008b5797519397949592949093909291610a8b61122c565b3d915061127c565b816112b89161349d565b610b0757815f6111e9565b630212c18d60e41b8252600482fd5b600b546112ea91906001600160a01b0316338d61461f565b5f61118d565b63725ad4f560e01b8352600483fd5b631201345b60e31b8452600484fd5b94939291509885816113238261112d94613827565b6503782dace9d960b21b909c1760085561111a565b9093506020813d602011611364575b816113546020938361349d565b8101031261008b5751925f6110cc565b3d9150611347565b635b635d0b60e01b8252600482fd5b63d6f6915760e01b8252600482fd5b9297509450506113a9915060803d608011610c7c57610c65818361349d565b949296919094925f61102a565b631f2a200560e01b8352600483fd5b631931ea8560e01b8352600483fd5b633a4d776760e11b8352600483fd5b630407b05b60e31b8252600482fd5b503461031e57602036600319011261031e5761141c61140f613405565b611417613c4b565b613ad5565b80f35b503461031e57606036600319011261031e5761143961345d565b6024359060ff821680830361152757611450613c4b565b61145982613ce6565b6002541180611510575b156113d4576114c8839261148c61147b6020946133d9565b50546001600160a01b0316916134ed565b505460405163095ea7b360e01b81526001600160a01b039283166004820152604480356024830152909586949390921692849291839190820190565b03925af18015610afc576114da575080f35b6020813d602011611508575b816114f36020938361349d565b81010312610b075761150490613a21565b5080f35b3d91506114e6565b5060ff61151c836134ed565b505460a01c16611463565b8380fd5b503461031e578060031936011261031e57611544613c7e565b61154c61456e565b805b60045460ff821610156116335760ff611566826133d9565b505460b01c161561162a578161157b826133d9565b50546001600160a01b0316803b15610b07576040516330bef9ef60e21b8152828160048183865af1908115610c36578391611615575b5050803b15610b075781809160646040518094819363795d488160e11b8352600160048401528160248401528160448401525af18015610afc57611600575b50506115fb906139fc565b61154e565b8161160a9161349d565b610b0757815f6115f0565b8161161f9161349d565b610b0757815f6115b1565b6115fb906139fc565b5060015f5160206149ae5f395f51905f525580f35b503461031e5760a036600319011261031e57611662613405565b61166a61341b565b906044359160ff831690818403610b6b576064359160ff83169182840361060c5761169361344c565b9461169c613c4b565b6001600160a01b031680156119ef57875b60045460ff821610156119e357816116c4826133d9565b50546001600160a01b0316146116e2576116dd906139fc565b6116ad565b90919293949596611714846116f6846133d9565b50805460ff60b01b191691151560b01b60ff60b01b16919091179055565b61174188611721846133d9565b50805461ffff60b81b191660b89290921b61ffff60b81b16919091179055565b60ff6004549216968288146117a4575b897fde08855192d091097fe4fe410210cc1a9751cc909989ede13bc402cf98bc290560c08a61ffff8d8c8c8c8c604051968752602087015215156040860152606085015260808401521660a0820152a180f35b6040516330fe427560e21b81526101a081600481885afa9283156119d8578b918c94611993575b506117d5906134ed565b50546001600160a01b03908116911603611984576117f2906134ed565b50546001600160a01b03908116911603611975576040519060a082018281106001600160401b0382111761196157604052828252602082018581526040830187815260608401918615158352608085019361ffff8c168552600160401b81101561194d5780600161186692016004556133d9565b959095611939575185549151925193516001600160b81b03199092166001600160a01b03919091161760a09290921b60ff60a01b169190911760a89290921b60ff60a81b169190911790151560b01b60ff60b01b161782556118e3919061ffff9051825461ffff60b81b1916911660b81b61ffff60b81b16179055565b803b1561060c5786604051635671e8c960e01b8152816004820152818160248183875af18015610afc57611918575b80611751565b81611929919894979693959861349d565b61060c579293909491865f611912565b634e487b7160e01b8d5260048d905260248dfd5b634e487b7160e01b8d52604160045260248dfd5b634e487b7160e01b8a52604160045260248afd5b633a4d776760e11b8852600488fd5b633a4d776760e11b8a5260048afd5b6119bb9194506117d592506101a03d81116119d1575b6119b3818361349d565b810190613a2e565b50505050505050505093925090509193906117cb565b503d6119a9565b6040513d8d823e3d90fd5b90919293949596611741565b63d92e233d60e01b8852600488fd5b503461031e578060031936011261031e5761028060095460ff600a546001600160401b03600b5483600c54936001600160801b03604051978381161515895261ffff8160081c1660208a015261ffff8160181c1660408a015261ffff8160281c1660608a015261ffff8160381c1660808a015262ffffff8160481c1660a08a015261ffff8160601c1660c08a015260701c1660e08801526001600160801b038116610100880152818160801c16151561012088015261ffff8160881c16610140880152818160981c16151561016088015260a01c1661018086015260018060a01b0381166101a086015262ffffff8160a01c166101c086015260b81c166101e08401526001600160401b03811661020084015261ffff8160401c1661022084015261ffff8160501c1661024084015260601c161515610260820152f35b503461031e57606036600319011261031e57611b55613405565b6024356001600160a01b03811690819003610ea6576044356001600160a01b0381169190829003611527575f5160206149ce5f395f51905f52549260ff8460401c1615936001600160401b03811680159081611d6f575b6001149081611d65575b159081611d5c575b50611d4d5767ffffffffffffffff1981166001175f5160206149ce5f395f51905f525584611d21575b50611bf061486c565b611bf861486c565b611c0061486c565b6001600160a01b03811615611d0d57611c1890614503565b611c2061486c565b611c2861486c565b611c3061486c565b60015f5160206149ae5f395f51905f5255611c4961486c565b611c5161486c565b60ff195f51602061498e5f395f51905f5254165f51602061498e5f395f51905f52556001600160601b0360a01b60085416176008558015611cfe576001600160601b0360a01b600b541617600b55611ca65780f35b68ff0000000000000000195f5160206149ce5f395f51905f5254165f5160206149ce5f395f51905f52557fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602060405160018152a180f35b63d92e233d60e01b8352600483fd5b631e4fbdf760e01b85526004859052602485fd5b68ffffffffffffffffff191668010000000000000001175f5160206149ce5f395f51905f52555f611be7565b63f92ee8a960e01b8652600486fd5b9050155f611bbe565b303b159150611bb6565b869150611bac565b503461031e578060031936011261031e5760408051611d96828261349d565b6005815260208101640352e302e360dc1b81528251938492602084525180928160208601528585015e828201840152601f01601f19168101030190f35b503461031e578060031936011261031e5761141c6138e8565b503461031e578060031936011261031e576007546040516001600160a01b039091168152602090f35b503461031e578060031936011261031e57602062ffffff60035416604051908152f35b503461031e578060031936011261031e57602060085460a01c604051908152f35b503461031e578060031936011261031e575f51602061494e5f395f51905f52546040516001600160a01b039091168152602090f35b503461031e57602036600319011261031e576020906040906001600160a01b03611eb6613405565b168152600183522054604051908152f35b503461031e578060031936011261031e57611ee0613c4b565b600c5460ff8160601c16611ef2575080f35b60ff60601b1916600c556040518181527f154f4c2d3db88c89ac52eb17f38f40b42ab52e0e6bc571f9632fca7fda47c83490602090a180f35b503461031e578060031936011261031e575f51602061494e5f395f51905f52546001600160a01b031633148015611fcb575b15611fbc57611f6a61456e565b600160ff195f51602061498e5f395f51905f525416175f51602061498e5f395f51905f52557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b631dd2188d60e31b8152600490fd5b506007546001600160a01b03163314611f5d565b503461031e578060031936011261031e575f5160206149ee5f395f51905f5254336001600160a01b03909116036120195761141c33614503565b63118cdaa760e01b815233600452602490fd5b503461031e578060031936011261031e57612045613c4b565b5f5160206149ee5f395f51905f5280546001600160a01b03199081169091555f51602061494e5f395f51905f528054918216905581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50602036600319011261031e576004356001600160401b038111610b07576120da61210191369060040161346d565b907f0000000000000000000000002880ab155794e7179c9ee2e38200202908c17b43613dcc565b5061141c613ff7565b503461008b57608036600319011261008b5761212461345d565b906024356001600160401b0381169081810361008b5760443590811580159586840361008b5761217191612156613c7e565b61215f82613ce6565b61248a575b61216c61456e565b6147d6565b506040516330fe427560e21b81529095919490926001600160a01b0316916101a084600481865afa918215610080575f945f945f935f925f9661244f575b5060018981161498602881901c62ffffff168a612442575b620fffff81169060141c600f1681151580612435575b1561242657604d81116124125768ffffffffffffffffff90600a0a16029568ffffffffffffffffff87169687036124125760246040926001926001600160401b03978e5f1461240b57505b845163626e521160e11b8152919093179096166004870152859182906001600160a01b03165afa9c8d15610080575f935f9e6123c2575b50823b1561008b5760845f9283604051958694859363e4e117c160e01b8552600485015260248401526001604484015260643560648401525af1801561008057612394575b5090816122be6123069b9c6123019a999897969594613ef5565b911561238c5750945b1561231a575050506001600160801b036122e19216613657565b60ff82168652856020526122fa60408720918254613556565b905561466a565b61466a565b60015f5160206149ae5f395f51905f525580f35b61234f9293506001600160401b036001600160801b036123406123499361235498613f15565b169216826145d1565b90613827565b613657565b60ff841680875286602052604087205491879280821115612382575b5050865285602052604086205561466a565b0391505f80612370565b9050946122c7565b6123069a50906123ae5f6123019a9998979695949361349d565b6122be5f9b505090919293949596976122a4565b93509c506040833d604011612403575b816123df6040938361349d565b8101031261008b576123fc60206123f585613ee1565b9401613ee1565b9c5f61225f565b3d91506123d2565b9050612228565b634e487b7160e01b5f52601160045260245ffd5b63a25f85b760e01b5f5260045ffd5b50620f423f8211156121dd565b62ffffff908103166121c7565b939650945095505061247091506101a03d81116119d1576119b3818361349d565b50509750505096925097949892505096959391945f6121af565b61249333613cb6565b612164565b3461008b575f36600319011261008b57602060ff5f51602061498e5f395f51905f5254166040519015158152f35b3461008b575f36600319011261008b577f0000000000000000000000007c81250ec71b2c5e65e1535c42ffc2b75608ef286001600160a01b0316300361251d5760206040515f51602061496e5f395f51905f528152f35b63703e46dd60e11b5f5260045ffd5b3461008b57602036600319011261008b5760043560025481101561008b57612556610100916134ed565b506001815491015462ffffff6040519260018060a01b038116845260ff8160a01c161515602085015261ffff8160a81c16604085015261ffff8160b81c16606085015261ffff8160c81c16608085015260ff8160d81c1660a085015260e01c1660c083015260e0820152f35b604036600319011261008b576125d6613405565b602435906001600160401b03821161008b573660238301121561008b57816004013590612602826134d2565b91612610604051938461349d565b8083526020830193366024838301011161008b57815f926024602093018737840101526001600160a01b037f0000000000000000000000007c81250ec71b2c5e65e1535c42ffc2b75608ef28163081149081156127a9575b5061251d57612675613c4b565b6040516352d1902d60e01b81526001600160a01b0382169390602081600481885afa5f9181612775575b506126b75784634c9c8ce360e01b5f5260045260245ffd5b805f51602061496e5f395f51905f528692036127635750823b15612751575f51602061496e5f395f51905f5280546001600160a01b031916821790557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b5f80a2825115612738575f809161007e945190845af461273261477a565b916148ef565b5050503461274257005b63b398979f60e01b5f5260045ffd5b634c9c8ce360e01b5f5260045260245ffd5b632a87526960e21b5f5260045260245ffd5b9091506020813d6020116127a1575b816127916020938361349d565b8101031261008b5751908661269f565b3d9150612784565b5f51602061496e5f395f51905f52546001600160a01b03161415905084612668565b3461008b575f36600319011261008b576005546040516001600160a01b039091168152602090f35b3461008b57608036600319011261008b57602061281f61281161343b565b604435602435600435613834565b604051908152f35b3461008b575f36600319011261008b576008546040516001600160a01b039091168152602090f35b3461008b575f36600319011261008b57612867613c4b565b5f51602061498e5f395f51905f525460ff8116156128be5760ff19165f51602061498e5f395f51905f52557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b638dfc202b60e01b5f5260045ffd5b3461008b575f36600319011261008b576020600254604051908152f35b3461008b57602036600319011261008b57604061290d61290861345d565b61366a565b825191825260030b6020820152f35b3461008b57602036600319011261008b5761007e612938613405565b612940613c4b565b6135b0565b3461008b57602036600319011261008b5760ff61296061345d565b165f525f602052602060405f2054604051908152f35b61012036600319011261008b5761298b61345d565b61299361341b565b90604435906001600160801b0382169081830361008b576064359368ffffffffffffffffff851680950361008b57608435936001600160801b03851680950361008b5760a435938415159384860361008b5760c4359081151580920361008b5761010435906001600160401b03821161008b57612a35612a1a612a3e93369060040161346d565b90612a23613c7e565b612a2c33613cb6565b61072384613ce6565b5061216c61456e565b6040516330fe427560e21b8152919992989096919591939091906001600160a01b03166101a087600481845afa958615610080578b988b8f5f9b5f9b5f9b612d5b575b50612ac491612aee918d8f60ff612aa1612a9b8293614826565b93614826565b9381612ada612aaf8b61366a565b83612abc869d939d61366a565b93909e6134ed565b505460d81c169160030b9060030b0303926134ed565b505460d81c16019216921690030193613657565b91815f821315612d41575090612b06612b0c92613ed3565b90613657565b915b8c15612d0c57612b2e91612b0661ffff612b289316613817565b9161363f565b11612cfd578d935b6040519d8e958695633d44fbd360e21b87528d15156004880152602487015260448601526064850152608484015260a483015260c482016001905260e43560e48301525a925f61010492608095f1908115610080575f995f92612c81575b5099612301969492612bd1999896949260209c5f14612c735750505f5b6001600160801b0381169586612bf3575b50505050505050612301613ff7565b60015f5160206149ae5f395f51905f52556001600160401b0360405191168152f35b15612c2c5750505050612c0591613657565b60ff82165f525f8752612c1d60405f20918254613827565b90555b86808080808080612bc2565b612c54955061234f9394506001600160801b03612340612349936001600160401b0393613f15565b60ff84165f525f8752612c6c60405f20918254613827565b9055612c20565b612c7c91613ef5565b612bb1565b96949298979593915098506080863d608011612cf5575b81612ca56080938361349d565b8101031261008b57602099612bd19887612cc16123019961361d565b9b612ccd8e8301613ee1565b9c612cdf60606123f560408601613ee1565b909d925050929c50929496989950929496612b94565b3d9150612c98565b638460540d60e01b5f5260045ffd5b91612b0661ffff612d1f612d269461363f565b9416613817565b10612d32578d93612b36565b63137d91c760e31b5f5260045ffd5b939290612d559250610bdc612b0691613ec3565b90612b0e565b929c50995099506101a03d8111612d9e575b612d77818361349d565b8101612d8291613a2e565b5050989750505050505050509b91809c9b8c929b915091612a81565b503d612d6d565b3461008b5761026036600319011261008b57600435610140819052801515900361008b576024356102e081905261ffff8116900361008b57612de561342a565b60a052612df061343b565b60c052612dfb61344c565b60e05260a43561010081905262ffffff8116900361008b5760c43561012081905261ffff8116900361008b5760e4356101608190526001600160801b038116900361008b57610104356101808190526001600160801b038116900361008b57610124356101c0819052801515900361008b576101443561020081905261ffff8116900361008b5761016435610220819052801515900361008b576101843560ff8116810361008b576101a4356102408190526001600160a01b038116900361008b576101c43561026081905262ffffff8116900361008b576101e4356102808190526001600160401b038116900361008b57610204356102a08190526001600160401b038116900361008b57610224356102c081905261ffff8116900361008b57610244356101e081905261ffff8116900361008b57612f39613c4b565b6101a05261022051156133425760025460ff6101a051161015613333575b6009546103e861ffff6102e05116116132f7576103e861ffff60a05116116132f7576103e861ffff60c05116116132f7576103e861ffff60e05116116132f757610e1061ffff610120511611613324576001600160801b0360701b6101605160701b16906001600160801b0360701b199061ffff60601b199062ffffff60481b199061ffff60381b199066ffff0000000000199060ff610140511515169064ffffffffff1916171662ffff006102e05160081b16171664ffff00000060a05160181b16171666ffff000000000060c05160281b16171661ffff60381b60e05160381b16171662ffffff60481b6101005160481b161761ffff60601b6101205160601b161717600955600a5461271061ffff610200511611613315576101a051610180516101c0516102005161022051151560981b60ff60981b1660889190911b61ffff60881b166001600160a81b03199095166001600160801b03939093169290921790151560801b60ff60801b1617929092179190911760a09190911b60ff60a01b1617600a55610240516001600160a01b03161561330657600b546001600160401b0360b81b6102805160b81b169060018060a01b0361024051169060ff60f81b161762ffffff60a01b6102605160a01b161717600b55600c54610bb861ffff6102c05116116132f75761271061ffff6101e05116116132f75761ffff60501b6101e05160501b16906001600160401b036102a05116906001600160601b0319161769ffff00000000000000006102c05160401b161717600c556040516080526101405115156080515261ffff6102e051166020608051015261ffff60a051166040608051015261ffff60c051166060608051015261ffff60e0511660808051015262ffffff610100511660a0608051015261ffff610120511660c060805101526001600160801b03610160511660e060805101526001600160801b03610180511661010060805101526101c0511515610120608051015261ffff61020051166101406080510152610220511515610160608051015260ff6101a05116610180608051015260018060a01b0361024051166101a0608051015262ffffff61026051166101c060805101526001600160401b0361028051166101e060805101526001600160401b036102a05116610200608051015261ffff6102c05116610220608051015261ffff6101e0511661024060805101527f318100d9c9c9ae5f71bbd6ef3f99cc92750069c3856d163cf483aaa5a57aef5a610260608051a1005b63132df9c560e01b5f5260045ffd5b63d92e233d60e01b5f5260045ffd5b6384d3d6cb60e01b5f5260045ffd5b6322df7e6560e21b5f5260045ffd5b633a4d776760e11b5f5260045ffd5b5f6101a052612f57565b3461008b57602036600319011261008b5761007e613368613405565b613563565b3461008b57602036600319011261008b5760043560045481101561008b5761339660a0916133d9565b505461ffff60405191600180851b038116835260ff81851c16602084015260ff8160a81c16604084015260ff8160b01c161515606084015260b81c166080820152f35b6004548110156133f15760045f5260205f2001905f90565b634e487b7160e01b5f52603260045260245ffd5b600435906001600160a01b038216820361008b57565b60243590811515820361008b57565b6044359061ffff8216820361008b57565b6064359061ffff8216820361008b57565b6084359061ffff8216820361008b57565b6004359060ff8216820361008b57565b9181601f8401121561008b578235916001600160401b03831161008b576020808501948460051b01011161008b57565b90601f801991011681019081106001600160401b038211176134be57604052565b634e487b7160e01b5f52604160045260245ffd5b6001600160401b0381116134be57601f01601f191660200190565b6002548110156133f15760025f5260205f209060011b01905f90565b9060c060031983011261008b5760043560ff8116810361008b57916024359160443591606435916084359160a435906001600160401b03821161008b576135529160040161346d565b9091565b9190820391821161241257565b62ffffff60095460481c169081156135ac576001600160a01b03165f908152600160205260409020546135969042613556565b1061359d57565b635fba365d60e01b5f5260045ffd5b5050565b6007546001600160a01b038281169290821683811461361757604080516001600160a01b0393841681529190921660208201527f95bb211a5a393c4d30c3edc9a745825fba4e6ad3e3bb949e6bf8ccdfe431a8119190a16001600160a01b03191617600755565b50505050565b51906001600160401b038216820361008b57565b51908160030b820361008b57565b90612710820291808304612710149015171561241257565b8181029291811591840414171561241257565b9060025460ff83161015613333576001613683836134ed565b50015460095460405163052571af60e51b8152600481019290925260601c61ffff1660248201526080816044817f0000000000000000000000002880ab155794e7179c9ee2e38200202908c17b436001600160a01b03165afa908115610080575f91613770575b505f815160070b1315613761576001600160401b03815116926001600160401b036020830151166298968002906001600160401b038216918203612412578462ffffff613739613744936134ed565b505460e01c16613657565b10613753576040015160030b90565b624f234960e01b5f5260045ffd5b6309e5775760e11b5f5260045ffd5b90506080813d6080116137f1575b8161378b6080938361349d565b8101031261008b5760405190608082018281106001600160401b038211176134be576040528051908160070b820361008b5760609183526137ce6020820161361d565b60208401526137df60408201613631565b6040840152015160608201525f6136ea565b3d915061377e565b8115613803570490565b634e487b7160e01b5f52601260045260245ffd5b6127100190816127101161241257565b9190820180921161241257565b9291926009549061ffff8260281c169360ff61ffff8460381c169316156138df576138759161ffff613867921690613657565b62ffffff60035416906137f9565b9182156138d7578261388a8161389093613f38565b95613f38565b8481106138c257906138a961234993926138b896613827565b60011c8281116138bb57613f49565b90565b5081613f49565b50906138d1916138b894613f49565b90613fe6565b505050905090565b50505050905090565b600a5460ff8160801c16156139f9576008546040516318160ddd60e01b81526001600160a01b0390911690602081600481855afa908115610080575f916139c7575b50602060018060a01b03600554166024604051809581936370a0823160e01b835260048301525afa918215610080575f92613991575b5061ffff61397061397b9361363f565b9360881c1690613657565b1161398257565b6328f5349360e01b5f5260045ffd5b91506020823d6020116139bf575b816139ac6020938361349d565b8101031261008b5790519061ffff613960565b3d915061399f565b90506020813d6020116139f1575b816139e26020938361349d565b8101031261008b57515f61392a565b3d91506139d5565b50565b60ff1660ff81146124125760010190565b51906001600160a01b038216820361008b57565b5190811515820361008b57565b90816101a091031261008b57805191602082015191613a4f60408201613a0d565b91613a5c60608301613a0d565b91613a6960808201613a21565b91613a7660a08301613a21565b91613a8360c08201613a0d565b91613a9060e08301613a0d565b91613a9e610100820161361d565b91613aac610120830161361d565b91613aba610140820161361d565b916138b8610180613ace610160850161361d565b9301613a21565b6005546001600160a01b03828116929082169083821461361757604080516001600160a01b0393841681529190921660208201527fafeea024e1cfd31dcb5f85d59d9360763f98ff913fd4cea522f992f5e4a34e7a9190a16001600160a01b03191617600555565b919082608091031261008b578151916020810151916138b8606060408401519301613631565b9062ffffff8091169116019062ffffff821161241257565b9190613c3857805182546020830151604084015160608501516001600160c81b03199093166001600160a01b03949094169390931790151560a01b60ff60a01b161760a89290921b61ffff60a81b169190911760b89190911b61ffff60b81b1617825560019060e0906080810151845460a083015160c084015165ffffffffffff60c81b1990921660c89390931b61ffff60c81b169290921760d89290921b60ff60d81b169190911762ffffff91909116831b1784550151910155565b634e487b7160e01b5f525f60045260245ffd5b5f51602061494e5f395f51905f52546001600160a01b03163303613c6b57565b63118cdaa760e01b5f523360045260245ffd5b60025f5160206149ae5f395f51905f525414613ca75760025f5160206149ae5f395f51905f5255565b633ee5aeb560e01b5f5260045ffd5b6001600160a01b03165f9081526006602052604090205460ff1615613cd757565b637dbacad160e11b5f5260045ffd5b60045460ff82161015613d1a57613cfe60ff916133d9565b505460b01c1615613d0b57565b6329a1db6960e21b5f5260045ffd5b630b1066eb60e01b5f5260045ffd5b9180602084016020855252604083019060408160051b85010193835f91601e1982360301905b848410613d60575050505050505090565b90919293949596603f1982820301875287358381121561008b57840190602082359201916001600160401b03811161008b57803603831361008b576020828280600196849695859652848401375f828201840152601f01601f1916010199019701959401929190613d4f565b91905f9282613de5575b50505034036138b881336147a9565b60405163d47eed4560e01b81526001600160a01b039091169350909160208280613e13848760048401613d29565b0381875afa918215610080575f92613e8f575b508193823410613e8057803b1561008b57604051631df3cbc560e31b8152935f93859384928391613e5a9160048401613d29565b03925af1801561008057613e70575b8080613dd6565b5f613e7a9161349d565b5f613e69565b63e4764c6f60e01b5f5260045ffd5b9091506020813d602011613ebb575b81613eab6020938361349d565b8101031261008b5751905f613e26565b3d9150613e9e565b600160ff1b8114612412575f0390565b604d811161241257600a0a90565b51906001600160801b038216820361008b57565b906001600160801b03809116911603906001600160801b03821161241257565b906001600160801b03809116911602906001600160801b03821691820361241257565b81811115613f44570390565b900390565b91818302915f1981850993838086109503948086039514613fd95784831115613fc15790829109815f0382168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b82634e487b715f52156003026011186020526024601cfd5b5050906138b892506137f9565b808211613ff1570390565b50505f90565b6008546040516318160ddd60e01b815290916001600160a01b03831691905f602083600481875afa928315610080575f936144cf575b5082156144c8576002545f959394909390865b60ff88169086821015614116576024602061405a8b6134ed565b50546040516370a0823160e01b815230600482015292839182906001600160a01b03165afa8015610080578a915f916140de575b506140c66140d293926140b3612349936140d8975f525f60205260405f205490613827565b60ff6140be8361366a565b9490936134ed565b505460d81c1690614595565b976139fc565b96614040565b929150506020823d821161410e575b816140fa6020938361349d565b8101031261008b57905189906140c661408e565b3d91506140ed565b92955050929550939093805f1904670de0b6b3a76400001181021582021561008b578190670de0b6b3a764000002049260a01c8084116142c6575b505050600b546001600160401b0380600c541691604051936303f3541960e11b8552600485015262ffffff8160a01c16602485015260b81c16604483015260648201526020816084818560018060a01b037f000000000000000000000000653fd819efede7b36cc87a6932e0974794f93f2e165af1918215610c83578092614289575b5050156141dd57565b6141e561456e565b600160ff195f51602061498e5f395f51905f525416175f51602061498e5f395f51905f52557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1600c54600160ff8260601c1615150361424a5750565b60ff60601b1916600160601b17600c55604051600181527f154f4c2d3db88c89ac52eb17f38f40b42ab52e0e6bc571f9632fca7fda47c83490602090a1565b9091506020823d6020116142be575b816142a56020938361349d565b8101031261031e57506142b790613a21565b5f806141d4565b3d9150614298565b600c549061ffff8260401c16801515806144b4575b614332575b50505050506001600160601b03811161431a57600880546001600160a01b031660a083901b6001600160a01b0319161790555f8080614151565b6306dfcc6560e41b8252606060045260245260449150fd5b61ffff61435d61434e6143689361234f612710968b0389613657565b6143578961363f565b906137f9565b9360501c1683613657565b04928361444e575b50829003806143cc575b9160a0917f975a692916dad04b2fcf1b61f9705a8d73578b211fe9267464ae1f52e5ed784493600854841c92604051938785526020850152604084015260608301526080820152a15f808080806142e0565b6008546005546001600160a01b039182169116813b1561060c576040516340c10f1960e01b81526001600160a01b03919091166004820152602481018390529086908290604490829084905af180156144435790869161442e575b505061437a565b816144389161349d565b610b6b57845f614427565b6040513d88823e3d90fd5b600b546001600160a01b031690803b1561008b576040516340c10f1960e01b81526001600160a01b03929092166004830152602482018590525f908290604490829084905af180156100805715614370576144ac9195505f9061349d565b5f935f614370565b506005546001600160a01b031615156142db565b5092505050565b9092506020813d6020116144fb575b816144eb6020938361349d565b8101031261008b5751915f61402d565b3d91506144de565b5f5160206149ee5f395f51905f5280546001600160a01b03199081169091555f51602061494e5f395f51905f5280549182166001600160a01b0393841690811790915591167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3565b60ff5f51602061498e5f395f51905f52541661458657565b63d93c066560e01b5f5260045ffd5b926145ae929160ff6011199260030b9116030192613657565b5f8213156145c2576143576138b892613ed3565b612b06610bdc6138b893613ec3565b815f19048111820215670de0b6b3a7640000021561008b5702670de0b6b3a7640000808204910615150190565b815f19048111820215612710021561008b5702612710808204910615150190565b6040516323b872dd60e01b60208201526001600160a01b0392831660248201529290911660448301526064808301939093529181526146689161466360848361349d565b614897565b565b614673816134ed565b50546040516370a0823160e01b81523060048201526001600160a01b039091169190602081602481865afa908115610080575f916146ec575b5060409060ff7ff10fc780c78f994a214c79a2ae8d8b7bfe7cc3f0f935a8f05a29525e71d7f12793165f525f602052815f205482519182526020820152a2565b90506020813d602011614736575b816147076020938361349d565b8101031261008b57517ff10fc780c78f994a214c79a2ae8d8b7bfe7cc3f0f935a8f05a29525e71d7f1276146ac565b3d91506146fa565b60405163a9059cbb60e01b60208201526001600160a01b039290921660248301526044808301939093529181526146689161466360648361349d565b3d156147a4573d9061478b826134d2565b91614799604051938461349d565b82523d5f602084013e565b606090565b81156135ac575f80809381935af16147bf61477a565b50156147c757565b6312171d8360e31b5f5260045ffd5b6147df816133d9565b50546001600160a01b031660ff6147f5836133d9565b505460a01c169261ffff61481960ff61480d866133d9565b505460a81c16946133d9565b505460b81c169193929190565b905f91801561485d575b6001810361483b5750565b91600a830661485d5760ff600191160160ff811161241257600a909204614830565b631aa3503f60e11b5f5260045ffd5b60ff5f5160206149ce5f395f51905f525460401c161561488857565b631afcd79f60e31b5f5260045ffd5b905f602091828151910182855af115610080575f513d6148e657506001600160a01b0381163b155b6148c65750565b635274afe760e01b5f9081526001600160a01b0391909116600452602490fd5b600114156148bf565b90614913575080511561490457805190602001fd5b63d6bda27560e01b5f5260045ffd5b81511580614944575b614924575090565b639996b31560e01b5f9081526001600160a01b0391909116600452602490fd5b50803b1561491c56fe9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbccd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00a264697066735822122079dea8510bb5fb7cc2074ad3f5fe7bae681ecb4b4d4c841a483706c541a9966764736f6c634300081c0033

Deployed Bytecode Sourcemap

1424:46014:43:-:0;;;;;;;;;-1:-1:-1;1424:46014:43;;;;;;;;44388:18;1424:46014;;;;;;44388:57;;;1424:46014;;;;;44503:26;1424:46014;;;;44503:26;:::i;:::-;-1:-1:-1;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;6335:32;;;;;-1:-1:-1;1424:46014:43;;;;;;;;;;;6335:32;;6355:9;6335:32;;;;;;;;;1424:46014;6335:32;-1:-1:-1;6335:32:43;;;:::i;:::-;-1:-1:-1;6335:32:43;1424:46014;;;-1:-1:-1;1424:46014:43;;;;;6335:32;-1:-1:-1;1424:46014:43;;;;;;-1:-1:-1;1424:46014:43;;-1:-1:-1;1424:46014:43;44388:57;1424:46014;;44410:26;1424:46014;;;;;44410:26;:::i;:::-;1424:46014;;;;;44388:57;;1424:46014;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;19038:75;1424:46014;;;:::i;:::-;;;:::i;:::-;2303:62:2;;;:::i;:::-;1424:46014:43;;;;;;;;;;18986:12;1424:46014;;;;;;;;;3166:3;1424:46014;;;;;;;;;;;;;;;;;;;19038:75;1424:46014;;;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;;;:::i;:::-;;;:::i;:::-;;;;:::i;:::-;;;:::i;:::-;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;2303:62:2;;;:::i;:::-;-1:-1:-1;;;;;1424:46014:43;;16951:27;;3166:3;;1424:46014;;;;;;17040:34;;;;;17039:76;;;1424:46014;;;;3225:3;17205:41;;1424:46014;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;;17357:353;;1424:46014;17357:353;;1424:46014;17357:353;1424:46014;17357:353;;1424:46014;17357:353;1424:46014;17357:353;;1424:46014;;17357:353;;1424:46014;17357:353;;1424:46014;17357:353;1424:46014;17357:353;;1424:46014;17357:353;1424:46014;17357:353;;1424:46014;17357:353;1424:46014;17357:353;;1424:46014;17774:5;17800:3;17785:6;1424:46014;;;;17781:17;;;;17823:9;;;;:::i;:::-;-1:-1:-1;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;17823:39;17819:259;;17800:3;;;:::i;:::-;17774:5;;17819:259;17901:9;1424:46014;17901:9;;;:::i;:::-;1424:46014;;;;;17956:11;1424:46014;;;;;;;;;;;17956:39;;1424:46014;17956:39;;:::i;:::-;1424:46014;;;;;;17956:11;1424:46014;18015:24;:9;;;;:::i;:::-;:24;;:::i;:::-;1424:46014;17785:6;1424:46014;;;18102:18;;;;18098:117;;17769:319;1424:46014;18257:261;1424:46014;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18257:261;1424:46014;;18098:117;-1:-1:-1;;;1424:46014:43;;;;;;;;;;;;;;;;18257:261;1424:46014;;;;;;17785:6;1424:46014;;:::i;:::-;18176:28;1424:46014;;18176:28;1424:46014;;;;18176:28;:::i;:::-;1424:46014;;;;;;18176:28;1424:46014;18098:117;;;;;;;;;;;;;1424:46014;-1:-1:-1;;;1424:46014:43;;;;;;;;;-1:-1:-1;;;1424:46014:43;;;;;;;;17781:17;;;;1424:46014;-1:-1:-1;;;1424:46014:43;;;;;;;;;-1:-1:-1;;;1424:46014:43;;;;;;-1:-1:-1;;;1424:46014:43;;;;;17039:76;1424:46014;;;;17080:34;;;17039:76;;3166:3;-1:-1:-1;;;3166:3:43;;1424:46014;3166:3;;1424:46014;;;;;;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;:::i;:::-;;;;2259:45;1424:46014;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;;;:::i;:::-;2303:62:2;;:::i;:::-;-1:-1:-1;;;;;;;;;;;3166:3:43;;-1:-1:-1;;;;;;3166:3:43;-1:-1:-1;;;;;1424:46014:43;;;3166:3;;;;;;-1:-1:-1;;;;;;;;;;;1424:46014:43;;;;2721:43:1;;;;1424:46014:43;;;;;;;:::i;:::-;5949:15;;;;;;:25;5945:86;;3361:103:7;;:::i;:::-;2281:72:6;;:::i;:::-;28254:6:43;1424:46014;;;;;28244:23;;;1424:46014;;;28316:10;;1424:46014;;28535:36;28379:10;;;;28401:51;28379:10;;;;:::i;:::-;28430:4;28401:51;:::i;:::-;;;;:::i;:::-;28535:14;1424:46014;;;-1:-1:-1;;;28535:36:43;;28379:10;1424:46014;28535:36;;1424:46014;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;28535:36;;;;;;;;;;;1424:46014;28589:26;;;;1424:46014;;;;-1:-1:-1;;;28820:37:43;;1424:46014;28820:37;;1424:46014;;;;28535:36;1424:46014;;;;;28820:9;-1:-1:-1;;;;;1424:46014:43;;28820:37;1424:46014;28820:37;1424:46014;;;28820:37;;;;;;;;1424:46014;;;;;28820:37;;;1424:46014;-1:-1:-1;28535:14:43;1424:46014;;;-1:-1:-1;;;28892:28:43;;1424:46014;;;;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;28892:28;;;;;;;;;;;1424:46014;28952:22;:38;:22;;;;;:::i;:::-;:38;:::i;:::-;29008:25;;;1424:46014;;29111:47;;1424:46014;29265:15;29111:47;;;;;;;;:::i;:::-;29265:15;;:::i;:::-;1424:46014;;;;;;;;;;;;;;2225:21:53;;;;2221:298;1424:46014:43;;;2358:43:53;2369:32;2358:51;2369:32;;:::i;:::-;2358:43;;:::i;:51::-;2221:298;;29362:23:43;;;29399;;;;;29395:423;29399:23;;;1424:46014;;;;;;;29438:46;1424:46014;;;;;;;;;29438:46;;;1424:46014;29438:46;;1424:46014;;28535:36;1424:46014;;;29476:4;28820:37;1424:46014;;;;;;;;29438:46;;;;;;;;;;;29395:423;;29887:165;30122:40;29395:423;30193:31;29395:423;;1424:46014;29966:15;30063:49;29395:423;29966:15;:::i;:::-;1424:46014;;;;;29887:165;;:::i;:::-;30080:32;;;;;:::i;:::-;30063:49;;:::i;:::-;30122:40;;:::i;:::-;1424:46014;;;;30193:31;;:::i;:::-;30228:48;1424:46014;30244:15;;;:::i;:::-;1424:46014;;;;;30228:48;;:::i;:::-;-1:-1:-1;1424:46014:43;;28535:14;1424:46014;-1:-1:-1;;;;;1424:46014:43;30380:39;;;;;1424:46014;;-1:-1:-1;;;30380:39:43;;28379:10;1424:46014;30380:39;;1424:46014;;;;;;;;;;;;;;;;;;30380:39;;;;;;;;;;;29395:423;30452:15;;30706:47;30452:15;;;:::i;:::-;1424:46014;;;;;;;;;;30722:30;1424:46014;30519:61;1424:46014;30540:17;1424:46014;;;;30519:61;;:::i;:::-;30594:20;;;30590:106;;29395:423;30722:30;;;:::i;30706:47::-;30771:26;;;1424:46014;;28379:10;;31009:274;28379:10;;31009:274;28379:10;;31251:22;28379:10;31212:25;1424:46014;28379:10;;;;;31300:7;28379:10;;30880:11;28379:10;;30880:11;;:::i;:::-;30921:18;1424:46014;-1:-1:-1;;;;;1424:46014:43;28379:10;30907:32;30903:91;;31212:25;:::i;:::-;31251:22;;:::i;:::-;1424:46014;;;28379:10;;;;31009:274;;1424:46014;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;31009:274;;;;31300:7;:::i;:::-;1424:46014;-1:-1:-1;;;;;;;;;;;1424:46014:43;;;;;;;30903:91;;;:::i;:::-;31212:25;:::i;1424:46014::-;-1:-1:-1;;;1424:46014:43;;;;;30590:106;30649:17;1424:46014;30668:16;;-1:-1:-1;;;;;1424:46014:43;;;;30668:16;:::i;:::-;30590:106;;;;30380:39;;;;;:::i;:::-;1424:46014;;30380:39;;;;;1424:46014;;;;;;;;;30380:39;1424:46014;;;;-1:-1:-1;;;1424:46014:43;;;;;29438:46;;;1424:46014;29438:46;;1424:46014;29438:46;;;;;;1424:46014;29438:46;;;:::i;:::-;;;1424:46014;;;;29887:165;30122:40;1424:46014;;;;29966:15;30193:31;1424:46014;;;30063:49;1424:46014;;:::i;:::-;;29438:46;;;;;;;;;;;1424:46014;;;;29438:46;;;-1:-1:-1;29438:46:43;;;1424:46014;;;;;;;;;29395:423;29679:15;;;30063:49;29679:15;;29966;29749:58;30122:40;29679:15;;29540:181;30193:31;29679:15;;;1424:46014;29679:15;1424:46014;29679:15;29887:165;29679:15;;:::i;:::-;1424:46014;;;;;29540:181;;;:::i;:::-;29749:58;;:::i;:::-;29395:423;29966:15;:::i;2221:298:53:-;2488:18;2466:41;2474:33;2488:18;2454:54;2488:18;;:::i;:::-;2474:33;:::i;:::-;2466:41;;:::i;:::-;2454:54;;:::i;:::-;2221:298;;;1424:46014:43;-1:-1:-1;;;1424:46014:43;;;;;28892:28;;;;1424:46014;28892:28;;1424:46014;28892:28;;;;;;1424:46014;28892:28;;;:::i;:::-;;;1424:46014;;;;;28892:28;;;;;;;-1:-1:-1;28892:28:43;;;1424:46014;;;;;;;;;28820:37;;;;1424:46014;28820:37;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1424:46014;;;;;;;;;;;-1:-1:-1;;;1424:46014:43;;;;;28535:36;;;;1424:46014;28535:36;;1424:46014;28535:36;;;;;;1424:46014;28535:36;;;:::i;:::-;;;1424:46014;;;;;28535:36;;;;;;;-1:-1:-1;28535:36:43;;1424:46014;-1:-1:-1;;;1424:46014:43;;;;;;-1:-1:-1;;;1424:46014:43;;;;;5945:86;-1:-1:-1;;;5997:23:43;;1424:46014;5997:23;;1424:46014;;;;;;;-1:-1:-1;;1424:46014:43;;;;;;2303:62:2;;:::i;:::-;1424:46014:43;20944:23;1424:46014;;;;;;;21024:10;;1424:46014;;21096:18;1424:46014;21133:14;1424:46014;;;-1:-1:-1;;;21133:37:43;;-1:-1:-1;;;;;1424:46014:43;;;;21133:37;;1424:46014;;;;;;;;;;;21133:37;1424:46014;;21133:37;;;;;;;;;;;;1424:46014;21133:47;;1424:46014;;21228:40;;;;;;;1424:46014;;-1:-1:-1;;;21228:40:43;;-1:-1:-1;;;;;1424:46014:43;;;21228:40;;1424:46014;;;;;;;;;;;;;;;;;;21228:40;;;;;;;;1424:46014;-1:-1:-1;;21133:14:43;1424:46014;;;-1:-1:-1;;;21325:28:43;;1424:46014;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;21325:28;;;;;;;;;;;1424:46014;;;;;21284:70;1424:46014;;;;;;;;;;;;;;21284:70;1424:46014;;21325:28;;;;1424:46014;21325:28;;1424:46014;21325:28;;;;;;1424:46014;21325:28;;;:::i;:::-;;;1424:46014;;;;;;21325:28;;21284:70;21325:28;;;;;-1:-1:-1;21325:28:43;;;1424:46014;;;;;;;;;21228:40;;;;;:::i;:::-;1424:46014;;21228:40;;;;1424:46014;;;;;-1:-1:-1;;;1424:46014:43;;;;;21133:37;;;;1424:46014;21133:37;;1424:46014;21133:37;;;;;;1424:46014;21133:37;;;:::i;:::-;;;1424:46014;;;;;;;21133:37;;;;;;-1:-1:-1;21133:37:43;;1424:46014;-1:-1:-1;;;1424:46014:43;;;;;;-1:-1:-1;;;1424:46014:43;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1424:46014:43;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;:::i;:::-;5949:15;;;;;;;:25;5945:86;;3361:103:7;;:::i;:::-;2281:72:6;;:::i;:::-;23219:6:43;1424:46014;;;;;23209:23;;;1424:46014;;;;23281:15;;;:::i;:::-;1424:46014;;;;;;;;23355:10;;1424:46014;;23434:4;23405:51;23434:4;;23405:51;:::i;:::-;;;;:::i;:::-;1424:46014;;-1:-1:-1;;;23668:36:43;;1424:46014;23668:36;;1424:46014;;;;23699:4;1424:46014;;;;23668:36;1424:46014;23668:36;1424:46014;;23668:9;-1:-1:-1;;;;;1424:46014:43;23668:36;;;;;;;;1424:46014;;;;;;23668:36;;;1424:46014;23947:15;23873:160;23947:15;;1424:46014;23947:15;;;:::i;23873:160::-;24051:28;1424:46014;;-1:-1:-1;;;;;24264:160:43;24167:17;1424:46014;;24217:21;24151:56;1424:46014;;;;;24151:56;;:::i;:::-;24217:21;;;:::i;:::-;24338:15;1424:46014;24338:15;;;:::i;:::-;1424:46014;;;;;24264:160;;:::i;:::-;1424:46014;;;;24442:37;;1424:46014;;24563:36;;;;:::i;:::-;1424:46014;;;;-1:-1:-1;;;24667:28:43;;24610:22;;1424:46014;;;-1:-1:-1;;;;;1424:46014:43;;;;;;24667:28;;;;;;;;;;;1424:46014;-1:-1:-1;24705:19:43;24738:18;;;;24789:29;;;25736;24789;25157;25082:61;24873:181;24789:29;;;;;;;25012:15;24789:45;:29;;1424:46014;24789:29;;;:::i;25012:15::-;1424:46014;;;;;24873:181;;:::i;:::-;25082:61;;:::i;:::-;25157:29;;;:::i;:::-;24734:874;;25630:10;1424:46014;;23699:4;1424:46014;;5949:15;1424:46014;;;;25736:29;:::i;:::-;1424:46014;-1:-1:-1;;;;;25817:20:43;1424:46014;;25796:41;;1424:46014;;25933:31;1424:46014;;25953:11;1424:46014;;25933:31;;:::i;:::-;25968:52;1424:46014;25988:15;;;:::i;:::-;1424:46014;;;;;25968:52;;:::i;:::-;-1:-1:-1;1424:46014:43;;26146:15;;;:::i;:::-;-1:-1:-1;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;;26189:15;26185:112;;24734:874;26349:4;26356:6;26349:4;;25630:10;26356:6;;:::i;:::-;26382:29;;1424:46014;;;;-1:-1:-1;;;;;1424:46014:43;26460:47;;;;;1424:46014;;-1:-1:-1;;;26460:47:43;;25630:10;1424:46014;26460:47;;1424:46014;;;;;;;;;;;;;;;;;;26460:47;;;;;;;;;;;24734:874;26460:47;;;;:::i;:::-;1424:46014;;;;-1:-1:-1;;;26773:36:43;;25630:10;1424:46014;26773:36;;1424:46014;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;26773:36;;;;;;;;;;24734:874;26823:30;;26562:301;;26823:30;1424:46014;26823:30;;;;;;26880:7;26823:30;;;;:::i;26773:36::-;;;;;;;;;1424:46014;26773:36;;1424:46014;26773:36;;;;;;1424:46014;26773:36;;;:::i;:::-;;;1424:46014;;;;;;26773:36;;;;;;;;;;1424:46014;26562:301;26773:36;;;;;-1:-1:-1;26773:36:43;;26460:47;;;;;:::i;:::-;1424:46014;;26460:47;;;;1424:46014;-1:-1:-1;;;1424:46014:43;;;;;26185:112;26255:17;1424:46014;26274:11;;1424:46014;-1:-1:-1;;;;;1424:46014:43;25630:10;26274:11;;:::i;:::-;26185:112;;;1424:46014;-1:-1:-1;;;1424:46014:43;;;;;;-1:-1:-1;;;1424:46014:43;;;;;24734:874;25370:29;;;;;;;;;;25736;25370;;:::i;:::-;-1:-1:-1;;;1424:46014:43;;;;;24734:874;;24667:28;;;;1424:46014;24667:28;;1424:46014;24667:28;;;;;;1424:46014;24667:28;;;:::i;:::-;;;1424:46014;;;;;24667:28;;;;;;;-1:-1:-1;24667:28:43;;1424:46014;-1:-1:-1;;;1424:46014:43;;;;;;-1:-1:-1;;;1424:46014:43;;;;;23668:36;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;1424:46014;-1:-1:-1;;;1424:46014:43;;;;;;-1:-1:-1;;;1424:46014:43;;;;;;-1:-1:-1;;;1424:46014:43;;;;;5945:86;-1:-1:-1;;;5997:23:43;;1424:46014;5997:23;;1424:46014;;;;;;;-1:-1:-1;;1424:46014:43;;;;2357:1:2;1424:46014:43;;:::i;:::-;2303:62:2;;:::i;:::-;2357:1;:::i;:::-;1424:46014:43;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;;;:::i;:::-;;;;;;;;;;;;2303:62:2;;:::i;:::-;38514:5:43;;;:::i;:::-;38561:6;1424:46014;-1:-1:-1;38551:51:43;;;1424:46014;;;;38781:32;38687:11;;38742:15;38687:11;1424:46014;38687:11;;:::i;:::-;-1:-1:-1;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;;38742:15;:::i;:::-;-1:-1:-1;1424:46014:43;;;-1:-1:-1;;;38781:32:43;;-1:-1:-1;;;;;1424:46014:43;;;;38781:32;;1424:46014;;;;;;;;;;;;;;;;;;;;;;;;;;;38781:32;;;;;;;;;;;1424:46014;;;38781:32;1424:46014;38781:32;;1424:46014;38781:32;;;;;;1424:46014;38781:32;;;:::i;:::-;;;1424:46014;;;;;;;:::i;:::-;;;;38781:32;;;-1:-1:-1;38781:32:43;;38551:51;38578:15;1424:46014;38578:15;;;:::i;:::-;1424:46014;;;;;38551:51;;1424:46014;;;;;;;;;;;;;;;;;3361:103:7;;:::i;:::-;2281:72:6;;:::i;:::-;31636:11:43;31666:3;1424:46014;;;;;31649:15;;;;1424:46014;31690:7;;;:::i;:::-;1424:46014;;;;;31689:17;31685:64;;31792:7;;;;:::i;:::-;-1:-1:-1;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;31825:18;;;;;1424:46014;;-1:-1:-1;;;31825:18:43;;;1424:46014;;;31825:18;;;;;;;;;;;;;31666:3;31857:30;;;;;;;1424:46014;;;31857:30;1424:46014;;;;;;;;;31857:30;;31876:4;1424:46014;31857:30;;1424:46014;;;;;;;;;;;31857:30;;;;;;;;31666:3;;;;;;:::i;:::-;31636:11;;31857:30;;;;;:::i;:::-;1424:46014;;31857:30;;;;31825:18;;;;;:::i;:::-;1424:46014;;31825:18;;;;31685:64;31666:3;31726:8;31666:3;:::i;31649:15::-;;31876:4;-1:-1:-1;;;;;;;;;;;1424:46014:43;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;;;:::i;:::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2303:62:2;;;:::i;:::-;-1:-1:-1;;;;;1424:46014:43;36521:24;;3166:3;;36608:5;36632:3;1424:46014;;;;;36615:15;;;;36655:7;;;;:::i;:::-;-1:-1:-1;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;36655:32;36651:189;;36632:3;;;:::i;:::-;36608:5;;36651:189;36707:7;;;;;;;:27;:7;;;;:::i;:::-;-1:-1:-1;1424:46014:43;;-1:-1:-1;;;;1424:46014:43;;;;;;-1:-1:-1;;;1424:46014:43;;;;;;;;36707:27;36752:49;:7;;;;:::i;:::-;-1:-1:-1;1424:46014:43;;-1:-1:-1;;;;1424:46014:43;3166:3;;;;;-1:-1:-1;;;3166:3:43;1424:46014;;;;;;;36752:49;1424:46014;;;;;36864:16;;;;36860:931;;36603:247;1424:46014;37806:158;1424:46014;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;37806:158;1424:46014;;36860:931;1424:46014;;-1:-1:-1;;;37189:44:43;;;1424:46014;;;37189:44;;;;;;;;1424:46014;;;37189:44;;;36860:931;37264:16;;;;:::i;:::-;-1:-1:-1;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;;;;;37264:39;1424:46014;;37356:16;;;:::i;:::-;-1:-1:-1;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;;;;;37356:39;1424:46014;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;37486:229;;1424:46014;;;;37486:229;;1424:46014;;;;37486:229;;1424:46014;;;;;;;37486:229;;1424:46014;;;;;;-1:-1:-1;;;1424:46014:43;;;;;;;;;;;;;:::i;:::-;;;;;;;3166:3;;1424:46014;;;;;;-1:-1:-1;;;;;;1424:46014:43;;;-1:-1:-1;;;;;1424:46014:43;;;;;;3166:3;;;;-1:-1:-1;;;3166:3:43;1424:46014;;;;;;;;;-1:-1:-1;;;1424:46014:43;;;;;;;;;;-1:-1:-1;;;1424:46014:43;;;;;;;;;;;;-1:-1:-1;;;;1424:46014:43;;;3166:3;;-1:-1:-1;;;3166:3:43;1424:46014;;;;;37731:49;;;;;1424:46014;;;;;;37731:49;;;1424:46014;37731:49;;1424:46014;37731:49;;1424:46014;37731:49;;;;;;;;;;;36860:931;;;;37731:49;;;;;;;;;;;;:::i;:::-;1424:46014;;37731:49;;;;;;;;;1424:46014;-1:-1:-1;;;1424:46014:43;;;;;;;;;;-1:-1:-1;;;1424:46014:43;;;;;;;;;-1:-1:-1;;;1424:46014:43;;;;;;;;;-1:-1:-1;;;1424:46014:43;;;;;;-1:-1:-1;;;1424:46014:43;;;;;37189:44;;;;;37264:16;37189:44;;;;;;;;;;;;;:::i;:::-;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;1424:46014;;;;;;;;;36615:15;;;;;;;;;;3166:3;-1:-1:-1;;;3166:3:43;;1424:46014;3166:3;;1424:46014;;;;;;;;;;;;;;15061:18;1424:46014;;15295:20;1424:46014;-1:-1:-1;;;;;15467:17:43;1424:46014;;15559:24;1424:46014;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;;;:::i;:::-;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;-1:-1:-1;;;;;;;;;;;1424:46014:43;;;;;;;4301:16:3;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;;4726:16:3;;:34;;;;1424:46014:43;4805:1:3;4790:16;:50;;;;1424:46014:43;4855:13:3;:30;;;;1424:46014:43;4851:91:3;;;-1:-1:-1;;3166:3:43;;4805:1:3;3166:3:43;-1:-1:-1;;;;;;;;;;;3166:3:43;;4979:67:3;;1424:46014:43;6893:76:3;;;:::i;:::-;;;:::i;:::-;;;:::i;:::-;-1:-1:-1;;;;;1424:46014:43;;2076:26:2;2072:95;;2195:12;;;:::i;:::-;6893:76:3;;:::i;:::-;;;:::i;:::-;;;:::i;:::-;4805:1;-1:-1:-1;;;;;;;;;;;1424:46014:43;6893:76:3;;:::i;:::-;;;:::i;:::-;3166:3:43;1424:46014;-1:-1:-1;;;;;;;;;;;1424:46014:43;;-1:-1:-1;;;;;;;;;;;1424:46014:43;-1:-1:-1;;;;;3166:3:43;;6689:41;3166:3;;;6689:41;3166:3;6749:32;;3166:3;;-1:-1:-1;;;;;3166:3:43;;6821:38;3166:3;;;6821:38;3166:3;5066:101:3;;1424:46014:43;;5066:101:3;1424:46014:43;;-1:-1:-1;;;;;;;;;;;1424:46014:43;;-1:-1:-1;;;;;;;;;;;1424:46014:43;5142:14:3;1424:46014:43;;;4805:1:3;1424:46014:43;;5142:14:3;1424:46014:43;;3166:3;-1:-1:-1;;;3166:3:43;;1424:46014;3166:3;;2072:95:2;-1:-1:-1;;;2125:31:2;;1424:46014:43;;;;;2125:31:2;;4979:67:3;-1:-1:-1;;1424:46014:43;;;-1:-1:-1;;;;;;;;;;;1424:46014:43;4979:67:3;;;4851:91;-1:-1:-1;;;4908:23:3;;1424:46014:43;4908:23:3;;4855:30;4872:13;;;4855:30;;;4790:50;4818:4;4810:25;:30;;-1:-1:-1;4790:50:3;;4726:34;;;-1:-1:-1;4726:34:3;;1424:46014:43;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;2310:21;1424:46014;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;;2161:25;1424:46014;;;;;;;;;;;;;;;;;;;;;;2373:24;1424:46014;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1424:46014:43;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;:::i;:::-;;;;2076:47;1424:46014;;;;;;;;;;;;;;;;;;;;;;;2303:62:2;;:::i;:::-;44816:23:43;1424:46014;;;;;;44812:162;;1424:46014;;;44812:162;-1:-1:-1;;;;1424:46014:43;44816:23;1424:46014;;;;;;44922:41;;1424:46014;;44922:41;1424:46014;;;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;19963:10;:21;:45;;;;1424:46014;;;;2281:72:6;;:::i;:::-;3496:4;3166:3:43;1424:46014;-1:-1:-1;;;;;;;;;;;1424:46014:43;;;-1:-1:-1;;;;;;;;;;;1424:46014:43;3515:20:6;1424:46014:43;;;19963:10;1424:46014;;3515:20:6;1424:46014:43;;;-1:-1:-1;;;1424:46014:43;;;;;19963:45;-1:-1:-1;20002:6:43;1424:46014;-1:-1:-1;;;;;1424:46014:43;19963:10;19988:20;19963:45;;1424:46014;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1424:46014:43;966:10:5;-1:-1:-1;;;;;1424:46014:43;;;3352:24:1;3348:96;;3472:6;966:10:5;3472:6:1;:::i;3348:96::-;-1:-1:-1;;;3399:34:1;;966:10:5;1424:46014:43;;;;3399:34:1;1424:46014:43;;;;;;;;;;;;;2303:62:2;;:::i;:::-;-1:-1:-1;;;;;;;;;;;1424:46014:43;;-1:-1:-1;;;;;;1424:46014:43;;;;;;-1:-1:-1;;;;;;;;;;;1424:46014:43;;3166:3;;;;;1424:46014;;-1:-1:-1;;;;;1424:46014:43;3975:40:2;1424:46014:43;;3975:40:2;1424:46014:43;;;-1:-1:-1;1424:46014:43;;-1:-1:-1;;1424:46014:43;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;21886:51;1424:46014;;;;;;:::i;:::-;21915:4;;21886:51;:::i;:::-;;;;:::i;1424:46014::-;;;;;;;-1:-1:-1;;1424:46014:43;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;6158:18:45;3361:103:7;;;:::i;:::-;1904:5:45;;;:::i;:::-;1921:65;;1424:46014:43;2281:72:6;;:::i;:::-;6158:18:45;:::i;:::-;-1:-1:-1;1424:46014:43;;-1:-1:-1;;;6481:37:45;;1424:46014:43;;;;;;-1:-1:-1;;;;;1424:46014:43;;6481:37:45;1424:46014:43;;;;6481:37:45;;;;;;;1424:46014:43;;;;;;;;;6481:37:45;;;1424:46014:43;-1:-1:-1;1424:46014:43;7932:21:45;;;7931:30;;1424:46014:43;;;;;;7931:30:45;8456:121;;1424:46014:43;8991:7:45;8987:11;;;8956:2;1424:46014:43;;;9018:5:45;;;;:20;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;;;;;6617:25:45;1424:46014:43;6617:25:45;-1:-1:-1;;;;;6617:25:45;;;;;;;;1424:46014:43;;-1:-1:-1;;;6699:55:45;;6740:13;;;;1424:46014:43;;;;6699:55:45;;1424:46014:43;;;;;-1:-1:-1;;;;;1424:46014:43;6699:55:45;;;;;;;1424:46014:43;;;6699:55:45;;;6617:25;6765:71;;;;;;;1424:46014:43;;;;;;;;;;;;;6765:71:45;;1424:46014:43;6765:71:45;;1424:46014:43;;;;;;;;;;;;;;;;6765:71:45;;;;;;;;6617:25;6872:26;;;;7831:8;6872:26;;7806:8;6872:26;;;;;;;;:::i;:::-;6933:64;;;;;;;7008:782;;;1424:46014:43;;;-1:-1:-1;;;;;7067:36:45;1424:46014:43;;7067:36:45;:::i;:::-;1424:46014:43;;;;;;;;7033:70:45;1424:46014:43;;;;;;7033:70:45;:::i;:::-;1424:46014:43;;7806:8:45;:::i;:::-;7831;:::i;:::-;1424:46014:43;-1:-1:-1;;;;;;;;;;;1424:46014:43;;;7008:782:45;7300:26;7158:22;;;-1:-1:-1;;;;;;;;;;7158:22:45;963:19:0;7158:22:45;7299:50;7158:22;;:::i;:::-;1424:46014:43;;;963:19:0;;:::i;:::-;7300:26:45;;:::i;:::-;7299:50;:::i;:::-;1424:46014:43;;;;;;;;;;;;;7436:25:45;;7542:35;;;;;7538:178;;7008:782;1424:46014:43;;;;;;;;;;;7806:8:45;:::i;7538:178::-;1424:46014:43;;-1:-1:-1;7538:178:45;;;;6933:64;;;;;;6765:71;7831:8;6765:71;;;;1424:46014:43;7806:8:45;6765:71;;;;;;;;;:::i;:::-;6872:26;1424:46014:43;6765:71:45;;;;;;;;;;;;;6699:55;;;;;1424:46014:43;6699:55:45;;1424:46014:43;6699:55:45;;;;;;1424:46014:43;6699:55:45;;;:::i;:::-;;;1424:46014:43;;;;;;;;;:::i;:::-;;;;:::i;:::-;6699:55:45;;;;;;;-1:-1:-1;6699:55:45;;6617:25;;;;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;9018:20:45;9027:11;9032:6;9027:11;;;9018:20;;8456:121;1424:46014:43;928:2:45;;;1424:46014:43;8456:121:45;;6481:37;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;1921:65;1964:10;;;:::i;:::-;1921:65;;1424:46014:43;;;;;;-1:-1:-1;;1424:46014:43;;;;;;-1:-1:-1;;;;;;;;;;;1424:46014:43;;;;;;;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;5115:6:4;-1:-1:-1;;;;;1424:46014:43;5106:4:4;5098:23;5094:145;;1424:46014:43;;;-1:-1:-1;;;;;;;;;;;1424:46014:43;;;5094:145:4;4869:29;;;1424:46014:43;5199:29:4;1424:46014:43;;5199:29:4;1424:46014:43;;;;;;-1:-1:-1;;1424:46014:43;;;;;;2130:25;1424:46014;2130:25;;;;;;1424:46014;2130:25;;:::i;:::-;1424:46014;;;;2130:25;;1424:46014;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;4692:6:4;1424:46014:43;4683:4:4;4675:23;;;:120;;;;1424:46014:43;4658:251:4;;;2303:62:2;;:::i;:::-;1424:46014:43;;-1:-1:-1;;;6156:52:4;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;6156:52:4;;1424:46014:43;;6156:52:4;;;1424:46014:43;-1:-1:-1;6152:437:4;;1805:47:16;;;;1424:46014:43;6518:60:4;1424:46014:43;;;;6518:60:4;6152:437;6250:40;-1:-1:-1;;;;;;;;;;;6250:40:4;;;6246:120;;1748:29:16;;;:34;1744:119;;-1:-1:-1;;;;;;;;;;;3166:3:43;;-1:-1:-1;;;;;;3166:3:43;;;;;2407:36:16;-1:-1:-1;;2407:36:16;1424:46014:43;;2458:15:16;:11;;1424:46014:43;4049:25:24;;4091:55;4049:25;;;;;;;;:::i;:::-;4091:55;;:::i;2454:148:16:-;6163:9;;;;6159:70;;1424:46014:43;6159:70:16;6199:19;;;1424:46014:43;6199:19:16;1424:46014:43;;6199:19:16;1744:119;1805:47;;;1424:46014:43;1805:47:16;1424:46014:43;;;;1805:47:16;6246:120:4;6317:34;;;1424:46014:43;6317:34:4;1424:46014:43;;;;6317:34:4;6156:52;;;;1424:46014:43;6156:52:4;;1424:46014:43;6156:52:4;;;;;;1424:46014:43;6156:52:4;;;:::i;:::-;;;1424:46014:43;;;;;6156:52:4;;;;;;;-1:-1:-1;6156:52:4;;4675:120;-1:-1:-1;;;;;;;;;;;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;4753:42:4;;;-1:-1:-1;4675:120:4;;;1424:46014:43;;;;;;-1:-1:-1;;1424:46014:43;;;;2220:33;1424:46014;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;2338:29;1424:46014;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;2303:62:2;;:::i;:::-;-1:-1:-1;;;;;;;;;;;1424:46014:43;;;;3167:9:6;3163:62;;3166:3:43;1424:46014;;-1:-1:-1;;;;;;;;;;;1424:46014:43;3823:22:6;1424:46014:43;;;966:10:5;1424:46014:43;;3823:22:6;1424:46014:43;3163:62:6;3199:15;;;1424:46014:43;3199:15:6;1424:46014:43;;3199:15:6;1424:46014:43;;;;;;-1:-1:-1;;1424:46014:43;;;;;31985:6;1424:46014;;;;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;2357:1:2;1424:46014:43;;:::i;:::-;2303:62:2;;:::i;:::-;2357:1;:::i;1424:46014:43:-;;;;;;-1:-1:-1;;1424:46014:43;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;;;:::i;:::-;;;:::i;:::-;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;1458:51:45;1424:46014:43;3082:18:45;1424:46014:43;;;;;;:::i;:::-;3361:103:7;;;:::i;:::-;1411:10:45;;;:::i;:::-;1442:5;;;:::i;1458:51::-;;2932:21;;:::i;3082:18::-;1424:46014:43;;-1:-1:-1;;;3435:15:45;;1424:46014:43;;;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;3435:15:45;1424:46014:43;;;;3435:15:45;;;;;;;;;;;1424:46014:43;;;;;3435:15:45;;;1424:46014:43;3493:27:45;42351:15:43;3493:27:45;4350:14;3493:27;;;1424:46014:43;3562:27:45;3493;;;;:::i;:::-;3562;;:::i;:::-;3632:20;;42351:15:43;3632:20:45;;;:::i;:::-;3694;;;;;;;:::i;:::-;42351:15:43;;;;:::i;:::-;1424:46014;;;;;;;;;;;;;42351:15;;:::i;:::-;1424:46014;;;;;;;;;;;;;4350:14:45;;:::i;:::-;4374:34;;1424:46014:43;4423:21:45;;1424:46014:43;;;4481:32:45;;;4460:53;4481:32;;:::i;:::-;4460:53;;:::i;:::-;4419:184;;4613:459;;;;4734:40;1424:46014:43;4678:51:45;1424:46014:43;4663:67:45;1424:46014:43;;4678:51:45;:::i;4663:67::-;4734:40;;:::i;:::-;-1:-1:-1;1424:46014:43;;4613:459:45;;;1424:46014:43;;;;;;;;;;5140:196:45;;1424:46014:43;;;;5140:196:45;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5140:196:45;;1424:46014:43;;5140:196:45;1424:46014:43;5140:196:45;;;;;;;1424:46014:43;;;;5140:196:45;;4613:459;5370:42;;5946:8;5370:42;;;5971:8;5370:42;;;;;1424:46014:43;5370:42:45;;;;;;;1424:46014:43;5370:42:45;-1:-1:-1;;;;;1424:46014:43;;5467:16:45;;5463:422;;5370:42;5463:422;;;;;;;;;:::i;5971:8::-;1424:46014:43;-1:-1:-1;;;;;;;;;;;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;;;;;;;5463:422:45;5499:376;;;5562:34;;;;;;;:::i;:::-;1424:46014:43;;;;;;;;5528:68:45;1424:46014:43;;;;;;5528:68:45;:::i;:::-;1424:46014:43;;5499:376:45;5463:422;;;;;;;;;5499:376;5812:48;5658:20;;5813:24;5658:20;;;-1:-1:-1;;;;;5658:20:45;963:19:0;5658:20:45;-1:-1:-1;;;;;5658:20:45;;:::i;5812:48::-;1424:46014:43;;;;;;;;5778:82:45;1424:46014:43;;;;;;5778:82:45;:::i;:::-;1424:46014:43;;5499:376:45;;5370:42;5387:25;;;:::i;:::-;5370:42;;5140:196;;;;;;;;;;;;1424:46014:43;5140:196:45;;1424:46014:43;5140:196:45;;;;;;1424:46014:43;5140:196:45;;;:::i;:::-;;;1424:46014:43;;;;;;5971:8:45;1424:46014:43;;;5946:8:45;1424:46014:43;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;:::i;:::-;5140:196:45;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5140:196:45;;1424:46014:43;;;;;;;;;4613:459:45;4891:34;4950:51;1424:46014:43;4891:34:45;4929:73;4891:34;;:::i;:::-;1424:46014:43;;4950:51:45;:::i;4929:73::-;-1:-1:-1;1424:46014:43;;4613:459:45;;;;1424:46014:43;;;;;;;;;4419:184:45;4573:18;;;4544:48;4573:18;;;4559:33;4573:18;;:::i;4544:48::-;4419:184;;;3435:15;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1424:46014:43;;;;;;-1:-1:-1;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::i;:::-;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2303:62:2;;:::i;:::-;2357:1;;9800:178:43;;;;;9869:6;1424:46014;;9847:35;;1424:46014;9847:35;1424:46014;;;9800:178;9988:40;1424:46014;3035:3;1424:46014;;;;10047:33;3035:3;;;1424:46014;10186:33;;1424:46014;10186:33;3035:3;;;1424:46014;10325:27;;1424:46014;10325:27;3035:3;;;1424:46014;10446:27;;1424:46014;10446:27;3035:3;;3267:4;1424:46014;;;;10614:31;3267:4;;-1:-1:-1;;;;;3267:4:43;;;;;;;;-1:-1:-1;;;;;3267:4:43;;;;;;;;3035:3;-1:-1:-1;;;3035:3:43;;-1:-1:-1;;;3035:3:43;;;;1424:46014;;;;;;;3035:3;;;;;;;10047:33;;3035:3;;;;;;10186:33;;3035:3;;;;;;10325:27;;3035:3;;;;3267:4;-1:-1:-1;;;10446:27:43;;3035:3;;;3267:4;;-1:-1:-1;;;3035:3:43;;;;;3267:4;;;;10614:31;;1424:46014;3267:4;;;;9988:40;3267:4;10793:44;3267:4;3166:3;1424:46014;;;;10934:62;3166:3;;;;1424:46014;;;;10934:62;;1424:46014;;;;3166:3;;-1:-1:-1;;;3166:3:43;;;;;;-1:-1:-1;;;3166:3:43;-1:-1:-1;;;;;;3166:3:43;;;-1:-1:-1;;;;;1424:46014:43;;;;3166:3;;;;1424:46014;;;3267:4;;-1:-1:-1;;;3267:4:43;3166:3;;;;;;;;;;;;;;-1:-1:-1;;;3166:3:43;;10793:44;3166:3;1424:46014;;-1:-1:-1;;;;;1424:46014:43;11244:32;3166:3;;11316:38;3166:3;-1:-1:-1;;;;;3166:3:43;;;;;;;1424:46014;;;;;;;;;3166:3;;;;;;1424:46014;3166:3;;;;1424:46014;3166:3;;;;11316:38;3166:3;11459:52;3166:3;3094;1424:46014;;;;11530:38;3035:3;;3166;1424:46014;;;;11660:40;3035:3;;3267:4;975:3:45;;11660:40:43;;975:3:45;;;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;;;975:3:45;-1:-1:-1;;;;;975:3:45;;;3094::43;11530:38;;1424:46014;3094:3;;975::45;;11459:52:43;975:3:45;1424:46014:43;;11799:627;;1424:46014;;;;;;;;;;;;975:3:45;;;1424:46014:43;;10186:33;;1424:46014;;975:3:45;;;1424:46014:43;;10325:27;;1424:46014;;975:3:45;;;1424:46014:43;;10446:27;;1424:46014;;975:3:45;;;1424:46014:43;;;;;;975:3:45;;;1424:46014:43;;;;;;975:3:45;;;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;;;;975:3:45;;;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;;;;975:3:45;;;1424:46014:43;;;;;;975:3:45;;;1424:46014:43;;;;;;975:3:45;;;1424:46014:43;;;;;;975:3:45;;;1424:46014:43;;3166:3;;1424:46014;;975:3:45;;;1424:46014:43;;;;;;;;;;975:3:45;;;1424:46014:43;;;;;;975:3:45;;;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;;;;975:3:45;;;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;;;;975:3:45;;;1424:46014:43;;;;;;975:3:45;;;1424:46014:43;;;;;;975:3:45;;;1424:46014:43;11799:627;1424:46014;11799:627;;;1424:46014;3035:3;;;;1424:46014;3035:3;1424:46014;;3035:3;3166;;;;1424:46014;3166:3;1424:46014;;3166:3;;;;;1424:46014;3166:3;1424:46014;;3166:3;3267:4;;;;1424:46014;3267:4;1424:46014;;3267:4;1424:46014;;;;;;;;;9800:178;1424:46014;9944:23;;9800:178;;1424:46014;;;;;;-1:-1:-1;;1424:46014:43;;;;;;;:::i;:::-;;:::i;:::-;;;;;;-1:-1:-1;;1424:46014:43;;;;;;;;2193:21;;;;;;1424:46014;2193:21;;:::i;:::-;1424:46014;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1424:46014:43;;-1:-1:-1;1424:46014:43;;;-1:-1:-1;1424:46014:43;:::o;:::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;:::o;:::-;;;;;;;;;;;:::o;:::-;;;;;;;;;;;:::o;:::-;;;;;;;;;;;:::o;:::-;;;;;;;;;;;:::o;:::-;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;:::o;:::-;;;;-1:-1:-1;1424:46014:43;;;;;-1:-1:-1;1424:46014:43;;-1:-1:-1;;;;;1424:46014:43;;;;;;-1:-1:-1;;1424:46014:43;;;;:::o;:::-;42351:6;1424:46014;;;;;;42351:6;-1:-1:-1;1424:46014:43;;-1:-1:-1;1424:46014:43;;;;;;-1:-1:-1;1424:46014:43;:::o;:::-;;;-1:-1:-1;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;:::o;34293:283::-;1424:46014;34359:16;1424:46014;;;;34359:21;;;34355:58;;-1:-1:-1;;;;;1424:46014:43;-1:-1:-1;1424:46014:43;;;;;;;;;;34443:38;;:15;:38;:::i;:::-;:58;1424:46014;;34293:283::o;1424:46014::-;;;;-1:-1:-1;1424:46014:43;;-1:-1:-1;1424:46014:43;34355:58;34396:7;;:::o;20353:200::-;20425:6;1424:46014;-1:-1:-1;;;;;1424:46014:43;;;;;;;20425:17;;;20421:54;;1424:46014;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;20490:30;;1424:46014;20490:30;-1:-1:-1;;;;;;3166:3:43;;20425:6;3166:3;20353:200::o;20421:54::-;20458:7;;;;:::o;1424:46014::-;;;-1:-1:-1;;;;;1424:46014:43;;;;;;:::o;:::-;;;;;;;;;;:::o;3225:3::-;;1424:46014;3225:3;;;;;;1424:46014;3225:3;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;:::o;34927:726::-;;35036:6;1424:46014;;;;35026:23;1424:46014;;;35166:29;:15;;;:::i;:::-;-1:-1:-1;35166:29:43;1424:46014;35209:12;1424:46014;;;-1:-1:-1;;;35128:103:43;;;;;1424:46014;;;;;;;;;;;;35128:103;1424:46014;35128:103;1424:46014;35128:4;-1:-1:-1;;;;;1424:46014:43;35128:103;;;;;;;-1:-1:-1;35128:103:43;;;34927:726;1424:46014;-1:-1:-1;1424:46014:43;;;;35250:19;1424:46014;;;-1:-1:-1;;;;;1424:46014:43;;;35473:14;-1:-1:-1;;;;;1424:46014:43;35473:14;;3225:3;1424:46014;3225:3;;1424:46014;-1:-1:-1;;;;;1424:46014:43;;3225:3;;;;;35491:15;1424:46014;35491:15;:47;:15;;:::i;:::-;1424:46014;;;;;35491:47;:::i;:::-;-1:-1:-1;3225:3:43;;1424:46014;35631:14;3225:3;1424:46014;;34927:726;:::o;3225:3::-;;;;-1:-1:-1;3225:3:43;35128:103;-1:-1:-1;3225:3:43;1424:46014;;;;-1:-1:-1;1424:46014:43;35128:103;-1:-1:-1;1424:46014:43;35128:103;;;;;;;;;;;;;;;;;:::i;:::-;;;1424:46014;;;;;;;35128:103;1424:46014;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;:::i;:::-;;;;;;;;;;;35128:103;;;;;;-1:-1:-1;35128:103:43;;1424:46014;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;:::o;32769:1169::-;;;;32997:11;1424:46014;;;;;;;;;;;;;;;;33070:19;33066:72;;33175:44;1424:46014;;33175:30;1424:46014;;33175:30;;:::i;:::-;1424:46014;33208:11;1424:46014;;33175:44;;:::i;:::-;33233:21;;;33229:74;;33335:45;;;33409:42;33335:45;;:::i;:::-;33409:42;;:::i;:::-;33466:22;;;33462:188;;33683:22;;33837:53;33683:22;;33907:24;33683:22;;:::i;:::-;1424:46014;;33724:30;;;33720:91;;33837:53;:::i;33907:24::-;32769:1169;:::o;33720:91::-;33770:30;;33837:53;:::i;33462:188::-;33524:53;;;;33598:41;33524:53;;:::i;:::-;33598:41;;:::i;33229:74::-;33270:22;;;;;;:::o;33066:72::-;33105:22;;;;;;;:::o;39013:459::-;39078:25;1424:46014;;;;;;39077:26;39073:63;;39170:14;1424:46014;;;-1:-1:-1;;;39170:28:43;;-1:-1:-1;;;;;1424:46014:43;;;;39170:28;1424:46014;39170:28;1424:46014;;39170:28;;;;;;;-1:-1:-1;39170:28:43;;;39013:459;1424:46014;39170:28;1424:46014;;;;;39262:18;1424:46014;;39237:44;1424:46014;;;;;;;;;39237:44;;39170:28;39237:44;;1424:46014;39237:44;;;;;;;-1:-1:-1;39237:44:43;;;39013:459;39313:41;1424:46014;39313:41;39358:37;39313:41;;:::i;:::-;1424:46014;;;;39358:37;;:::i;:::-;-1:-1:-1;1424:46014:43;;39013:459::o;1424:46014::-;;;;-1:-1:-1;1424:46014:43;39170:28;-1:-1:-1;1424:46014:43;39237:44;;;39170:28;39237:44;;39170:28;39237:44;;;;;;1424:46014;39237:44;;;:::i;:::-;;;1424:46014;;;;;;;;39237:44;;;;;-1:-1:-1;39237:44:43;;39170:28;;;;;;;;;;;;;1424:46014;39170:28;;;:::i;:::-;;;1424:46014;;;;;39170:28;;;;;;-1:-1:-1;39170:28:43;;39073:63;39119:7;:::o;1424:46014::-;;;;;;;;;;;:::o;:::-;;;-1:-1:-1;;;;;1424:46014:43;;;;;;:::o;:::-;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;:::i;:::-;;;;:::i;19484:343::-;19580:18;1424:46014;-1:-1:-1;;;;;1424:46014:43;;;;;;;;19580:41;;;19576:78;;1424:46014;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;19669:100;;1424:46014;19669:100;-1:-1:-1;;;;;;3166:3:43;;19580:18;3166:3;19484:343::o;1424:46014::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;:::o;:::-;;;;;;;3166:3;;1424:46014;;;;;;;;;;;;-1:-1:-1;;;;;;1424:46014:43;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;3166:3;-1:-1:-1;;;3166:3:43;1424:46014;;;;;;-1:-1:-1;;;1424:46014:43;;;;;3166:3;;;;;-1:-1:-1;;;3166:3:43;1424:46014;;;;;;;;;;;;;3166:3;1424:46014;;;;;;;-1:-1:-1;;;;1424:46014:43;;;;;;;;-1:-1:-1;;;1424:46014:43;;;;;;;;;;-1:-1:-1;;;1424:46014:43;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;2658:162:2;-1:-1:-1;;;;;;;;;;;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;966:10:5;2717:23:2;2713:101;;2658:162::o;2713:101::-;3399:34:1;;;-1:-1:-1;2763:40:2;966:10:5;2763:40:2;1424:46014:43;;-1:-1:-1;2763:40:2;3470:384:7;1991:1;-1:-1:-1;;;;;;;;;;;1424:46014:43;3670:20:7;3666:88;;1991:1;-1:-1:-1;;;;;;;;;;;1424:46014:43;3470:384:7:o;3666:88::-;3713:30;;;-1:-1:-1;3713:30:7;;-1:-1:-1;3713:30:7;41017:138:43;-1:-1:-1;;;;;1424:46014:43;-1:-1:-1;1424:46014:43;;;41096:12;1424:46014;;;;;;;;;;;41017:138::o;1424:46014::-;;;;-1:-1:-1;1424:46014:43;;-1:-1:-1;1424:46014:43;40600:196;40681:4;1424:46014;;;;40673:19;1424:46014;;;40739:11;1424:46014;40739:11;;:::i;:::-;1424:46014;;;;;;;;40600:196::o;1424:46014::-;;;;-1:-1:-1;1424:46014:43;40681:4;-1:-1:-1;1424:46014:43;;;;;-1:-1:-1;1424:46014:43;40681:4;-1:-1:-1;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1424:46014:43;;;;;;;;;;;;;;;248:533:52;;;367:1;382:27;;378:247;;248:533;688:9;;;;1424:46014:43;748:4:52;736:10;;748:4;:::i;378:247::-;1424:46014:43;;-1:-1:-1;;;431:34:52;;-1:-1:-1;;;;;1424:46014:43;;;;-1:-1:-1;1424:46014:43;;431:34:52;1424:46014:43;;431:34:52;1424:46014:43;;431:34:52;;;;:::i;:::-;;;;;;;;;;;367:1;431:34;;;378:247;425:40;;487:9;;;:16;1424:46014:43;;564:50:52;;;;;1424:46014:43;;-1:-1:-1;;;564:50:52;;1424:46014:43;367:1:52;;1424:46014:43;;;;;;564:50:52;;431:34;564:50;;;:::i;:::-;;;;;;;;;;;378:247;;;;;564:50;367:1;564:50;;;:::i;:::-;367:1;564:50;;1424:46014:43;;;;367:1:52;1424:46014:43;431:34:52;367:1;1424:46014:43;431:34:52;;;;;;;;;;;;;;1424:46014:43;431:34:52;;;:::i;:::-;;;1424:46014:43;;;;;431:34:52;;;;;;;-1:-1:-1;431:34:52;;1424:46014:43;-1:-1:-1;;;1424:46014:43;;;;;;;:::o;:::-;;;;;;;;;:::o;:::-;;;-1:-1:-1;;;;;1424:46014:43;;;;;;:::o;:::-;;-1:-1:-1;;;;;1424:46014:43;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;:::o;:::-;;-1:-1:-1;;;;;1424:46014:43;;;;;;;-1:-1:-1;;;;;1424:46014:43;;;;;;;:::o;42733:151::-;42846:5;;;;;;1424:46014;42733:151;:::o;42846:21::-;1424:46014;;42733:151;:::o;4996:4226:36:-;;1424:46014:43;;;;-1:-1:-1;;1424:46014:43;4996:4226:36;5584:131;;;;;;;;;;;;5796:10;;5792:368;;6270:20;;;;6266:143;;6695:300;;;;1424:46014:43;;;7214:31:36;;7259:375;;;8094:1;1424:46014:43;8075:1:36;1424:46014:43;8074:21:36;1424:46014:43;;;8094:1:36;1424:46014:43;;;;;8094:1:36;1424:46014:43;;;;;8094:1:36;1424:46014:43;;;;;8094:1:36;1424:46014:43;;;;;8094:1:36;1424:46014:43;;;;;8094:1:36;1424:46014:43;;7259:375:36;;;;1424:46014:43;7259:375:36;;;6695:300;;;;;;1424:46014:43;6695:300:36;;7259:375;7700:21;1424:46014:43;4996:4226:36;:::o;6266:143::-;1829:135:28;;1424:46014:43;1829:135:28;6330:16:36;3066:5;1424:46014:43;940:4:28;3060:42:36;1829:135:28;;;;;5792:368:36;6126:19;;;;;;;:::i;43211:153:43:-;43329:6;;;;;1424:46014;43211:153;:::o;43329:18::-;;;-1:-1:-1;43211:153:43;:::o;45061:1774::-;45156:14;1424:46014;;;-1:-1:-1;;;45156:28:43;;1424:46014;;-1:-1:-1;;;;;1424:46014:43;;;;-1:-1:-1;45156:28:43;1424:46014;45156:28;1424:46014;;45156:28;;;;;;;-1:-1:-1;45156:28:43;;;45061:1774;45198:16;;;45194:53;;39729:6;1424:46014;-1:-1:-1;;45277:26:43;;1424:46014;;45277:26;-1:-1:-1;39744:3:43;1424:46014;;;39725:17;;;;;;;39852:30;45156:28;39785:9;;;:::i;:::-;-1:-1:-1;1424:46014:43;;;-1:-1:-1;;;39852:30:43;;39876:4;45156:28;39852:30;;1424:46014;;;;;;-1:-1:-1;;;;;1424:46014:43;39852:30;;;;;;;;-1:-1:-1;39852:30:43;;;39744:3;1424:46014;40038:9;40314:34;1424:46014;;39852:56;40098:202;1424:46014;39744:3;1424:46014;-1:-1:-1;1424:46014:43;-1:-1:-1;45156:28:43;1424:46014;;-1:-1:-1;1424:46014:43;;39852:56;;:::i;:::-;1424:46014;39981:13;;;:::i;:::-;40038:9;;;;:::i;:::-;1424:46014;;;;;40098:202;;:::i;40314:34::-;39744:3;;:::i;:::-;39712:11;;;39852:30;;;;;45156:28;39852:30;;;;;;;;;1424:46014;39852:30;;;:::i;:::-;;;1424:46014;;;;;;;;40038:9;39852:30;;;;;-1:-1:-1;39852:30:43;;39725:17;;;;;;;;;;;5584:131:36;;;1744:340:0;3310:4:43;1744:340:0;;;;;;;;;;;3310:4:43;1744:340:0;;1424:46014:43;;;45391:25;;;45387:1243;;39707:652;1424:46014;;;46691:19;1424:46014;-1:-1:-1;;;;;1424:46014:43;46728:24;1424:46014;;;;;;;;;46645:108;;45156:28;46645:108;;1424:46014;;;;;;39852:30;3310:4;;1424:46014;;;;3310:4;;;1424:46014;3310:4;;;1424:46014;45156:28;1424:46014;46645:108;1424:46014;;;;;;;46645:9;1424:46014;46645:108;;;;;;;;;;;39707:652;46644:109;;;46640:189;;45061:1774::o;46640:189::-;2281:72:6;;:::i;:::-;3496:4;3166:3:43;1424:46014;-1:-1:-1;;;;;;;;;;;1424:46014:43;;;-1:-1:-1;;;;;;;;;;;1424:46014:43;3515:20:6;45156:28:43;1424:46014;;966:10:5;1424:46014:43;;3515:20:6;46728:24:43;1424:46014;3496:4:6;1424:46014:43;;;;;;;44816:36;44812:162;;46640:189;45061:1774::o;44812:162::-;-1:-1:-1;;;;1424:46014:43;-1:-1:-1;;;1424:46014:43;46728:24;1424:46014;;;;;;44922:41;;45156:28;;44922:41;39119:7::o;46645:108::-;;;;45156:28;46645:108;;45156:28;46645:108;;;;;;45156:28;46645:108;;;:::i;:::-;;;1424:46014;;;;;;;;:::i;:::-;46645:108;;;;;;;-1:-1:-1;46645:108:43;;45387:1243;45436:10;1424:46014;;;;;;;45436:14;;;:52;;;45387:1243;45432:1137;;45387:1243;11374:24:37;;;;;-1:-1:-1;;;;;11374:24:37;;11370:103;;45156:14:43;1424:46014;;-1:-1:-1;;;;;1424:46014:43;3166:3;;;;-1:-1:-1;;;;;;3166:3:43;1424:46014;;;-1:-1:-1;;;45387:1243:43;;11370:103:37;-1:-1:-1;;;11421:41:37;;11452:2;45156:28:43;1424:46014;39852:30;1424:46014;;;-1:-1:-1;11421:41:37;45432:1137:43;1424:46014;45674:77;:37;45800:32;1424:46014;45674:24;1424:46014;;;;45674:24;;:::i;:37::-;45715:35;;;:::i;:::-;45674:77;;:::i;:::-;1424:46014;;;;45800:32;;:::i;:::-;1424:46014;45877:23;;45873:129;;45432:1137;-1:-1:-1;1424:46014:43;;;;46185:124;;45432:1137;3310:4;1424:46014;3310:4;46332:222;3310:4;45156:14;3310:4;1424:46014;;;;;;;;;45156:28;3310:4;;1424:46014;;3310:4;;1424:46014;3310:4;;;1424:46014;3310:4;;;1424:46014;46332:222;45432:1137;;;;;;;46185:124;45156:14;1424:46014;46253:18;1424:46014;-1:-1:-1;;;;;1424:46014:43;;;;;46233:57;;;;;1424:46014;;-1:-1:-1;;;46233:57:43;;-1:-1:-1;;;;;1424:46014:43;;;;45156:28;46233:57;;1424:46014;;;;;;;;;;;;;;;;;;46233:57;;;;;;;;;;;46185:124;;;;;46233:57;;;;;:::i;:::-;1424:46014;;46233:57;;;;;1424:46014;;;;;;;;;45873:129;45944:17;1424:46014;-1:-1:-1;;;;;1424:46014:43;;45924:59;;;;;1424:46014;;-1:-1:-1;;;45924:59:43;;-1:-1:-1;;;;;1424:46014:43;;;;45156:28;45924:59;;1424:46014;;;;;;;-1:-1:-1;;1424:46014:43;;;;;;-1:-1:-1;;45924:59:43;;;;;;;45873:129;45924:59;;;;;-1:-1:-1;45924:59:43;;:::i;:::-;-1:-1:-1;45924:59:43;;45873:129;;45436:52;-1:-1:-1;45454:18:43;1424:46014;-1:-1:-1;;;;;1424:46014:43;45454:34;;45436:52;;45194:53;45230:7;;;;;:::o;45156:28::-;;;;;;;;;;;;;;1424:46014;45156:28;;;:::i;:::-;;;1424:46014;;;;;45156:28;;;;;;;-1:-1:-1;45156:28:43;;2955:222:1;-1:-1:-1;;;;;;;;;;;1424:46014:43;;-1:-1:-1;;;;;;1424:46014:43;;;;;;-1:-1:-1;;;;;;;;;;;1424:46014:43;;3166:3;;;-1:-1:-1;;;;;1424:46014:43;;;3166:3;;;;;;1424:46014;;3975:40:2;-1:-1:-1;;3975:40:2;2955:222:1:o;2905:128:6:-;1424:46014:43;-1:-1:-1;;;;;;;;;;;1424:46014:43;;2966:61:6;;2905:128::o;2966:61::-;3001:15;;;-1:-1:-1;3001:15:6;;-1:-1:-1;3001:15:6;577:617:53;;940:19;577:617;;1424:46014:43;;;;;;;;;;940:19:53;;:::i;:::-;-1:-1:-1;973:21:53;;-1:-1:-1;;;1029:32:53;1010:51;1029:32;;:::i;969:186::-;1111:33;1125:18;1092:52;1125:18;;:::i;2096:672:0:-;5584:131:36;;;2274:488:0;;;;;;3310:4:43;2274:488:0;;;;;3310:4:43;2274:488:0;;;;;;;;2096:672;:::o;:::-;5584:131:36;;;2274:488:0;;;;;;1424:46014:43;2274:488:0;;;;;1424:46014:43;2274:488:0;;;;;;;;2096:672;:::o;1618:188:23:-;1424:46014:43;;-1:-1:-1;;;1745:53:23;;;;-1:-1:-1;;;;;1424:46014:43;;;1745:53:23;;;1424:46014:43;;;;;;;;;;;;;;;;;1745:53:23;;;;;;;1424:46014:43;1745:53:23;:::i;:::-;;:::i;:::-;1618:188::o;47163:273:43:-;47244:15;;;:::i;:::-;-1:-1:-1;1424:46014:43;;;-1:-1:-1;;;47331:45:43;;47370:4;47331:45;;;1424:46014;-1:-1:-1;;;;;1424:46014:43;;;;;;;47331:45;1424:46014;;47331:45;;;;;;;-1:-1:-1;47331:45:43;;;47163:273;1424:46014;;;;47287:142;1424:46014;;-1:-1:-1;1424:46014:43;-1:-1:-1;1424:46014:43;;;-1:-1:-1;1424:46014:43;;;;;;;;;;;47287:142;47163:273::o;47331:45::-;;;1424:46014;47331:45;;1424:46014;47331:45;;;;;;1424:46014;47331:45;;;:::i;:::-;;;1424:46014;;;;;47287:142;47331:45;;;;;-1:-1:-1;47331:45:43;;1219:160:23;1424:46014:43;;-1:-1:-1;;;1328:43:23;;;;-1:-1:-1;;;;;1424:46014:43;;;;1328:43:23;;;1424:46014:43;;;;;;;;;1328:43:23;;;;;;1424:46014:43;;1328:43:23;:::i;1424:46014:43:-;;;;;;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;-1:-1:-1;1424:46014:43;;;;:::o;:::-;;;:::o;787:233:52:-;859:10;;855:47;;868:1;930:25;;;;;;;;;:::i;:::-;;1424:46014:43;;;787:233:52:o;1424:46014:43:-;;;;868:1:52;1424:46014:43;;868:1:52;1424:46014:43;41645:309;41847:11;;;:::i;:::-;-1:-1:-1;1424:46014:43;-1:-1:-1;;;;;1424:46014:43;;41871:11;;;:::i;:::-;1424:46014;;;;;41893:11;1424:46014;41915:11;1424:46014;41893:11;;;:::i;:::-;1424:46014;;;;;41915:11;;:::i;:::-;1424:46014;;;;;41839:108;;;;41645:309;:::o;9153:279:45:-;;1424:46014:43;9234:9:45;;;1424:46014:43;;9291:10:45;9300:1;9291:10;;;;9153:279;:::o;9284:142::-;1424:46014:43;9333:2:45;1424:46014:43;;;;;9300:1:45;9384:6;1424:46014:43;;;;;;;9333:2:45;9384:6;1424:46014:43;;9284:142:45;;1424:46014:43;;;;;;;;;7084:141:3;1424:46014:43;-1:-1:-1;;;;;;;;;;;1424:46014:43;;;;7150:18:3;7146:73;;7084:141::o;7146:73::-;7191:17;;;-1:-1:-1;7191:17:3;;-1:-1:-1;7191:17:3;7686:720:23;;-1:-1:-1;7823:421:23;7686:720;7823:421;;;;;;;;;;;;-1:-1:-1;7823:421:23;;8258:15;;-1:-1:-1;;;;;;1424:46014:43;;8276:26:23;:31;8258:68;8254:146;;7686:720;:::o;8254:146::-;-1:-1:-1;;;;8349:40:23;;;-1:-1:-1;;;;;1424:46014:43;;;;8349:40:23;1424:46014:43;;;8349:40:23;8258:68;8325:1;8310:16;;8258:68;;4421:582:24;;4593:8;;-1:-1:-1;1424:46014:43;;5674:21:24;:17;;5799:158;;;;;;5670:354;5994:19;;;5694:1;5994:19;;5694:1;5994:19;4589:408;1424:46014:43;;4841:22:24;:49;;;4589:408;4837:119;;4969:17;;:::o;4837:119::-;-1:-1:-1;;;4862:1:24;4917:24;;;-1:-1:-1;;;;;1424:46014:43;;;;4917:24:24;1424:46014:43;;;4917:24:24;4841:49;4867:18;;;:23;4841:49;

Swarm Source

ipfs://79dea8510bb5fb7cc2074ad3f5fe7bae681ecb4b4d4c841a483706c541a99667

Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

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

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