ETH Price: $3,452.85 (+3.21%)

Contract

0x5D27813C32dD705404d1A78c9444dAb523331717
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Update Cycle237221432025-11-03 23:41:234 days ago1762213283IN
0x5D27813C...523331717
0 ETH0.000073430.28
Claim Rewards236482162025-10-24 15:28:1114 days ago1761319691IN
0x5D27813C...523331717
0 ETH0.000069520.78916681
Claim Rewards235793312025-10-14 23:51:1124 days ago1760485871IN
0x5D27813C...523331717
0 ETH0.000008810.1241713
Batch Claim Rewa...234144242025-09-21 22:33:1147 days ago1758493991IN
0x5D27813C...523331717
0 ETH0.000008150.09543204
Claim Rewards233513992025-09-13 3:16:1155 days ago1757733371IN
0x5D27813C...523331717
0 ETH0.000142181.16253944
Update Cycle233507162025-09-13 0:58:3556 days ago1757725115IN
0x5D27813C...523331717
0 ETH0.00006290.24
Batch Claim Rewa...233327902025-09-10 12:49:5958 days ago1757508599IN
0x5D27813C...523331717
0 ETH0.000190411.58469996
Batch Claim Rewa...233323972025-09-10 11:30:2358 days ago1757503823IN
0x5D27813C...523331717
0 ETH0.000185911.20013435
Claim Rewards232980012025-09-05 16:08:1163 days ago1757088491IN
0x5D27813C...523331717
0 ETH0.000125611.76920279
Batch Claim Rewa...232878122025-09-04 5:59:1164 days ago1756965551IN
0x5D27813C...523331717
0 ETH0.000143451.25722071
Update Cycle232788522025-09-02 23:58:4766 days ago1756857527IN
0x5D27813C...523331717
0 ETH0.00005880.24
Claim Rewards232772602025-09-02 18:38:2366 days ago1756838303IN
0x5D27813C...523331717
0 ETH0.00003370.47478637
Batch Claim Rewa...232172752025-08-25 9:38:1174 days ago1756114691IN
0x5D27813C...523331717
0 ETH0.000119331.19483327
Batch Claim Rewa...231569002025-08-16 23:30:3583 days ago1755387035IN
0x5D27813C...523331717
0 ETH0.000357052.18060638
Batch Claim Rewa...231222272025-08-12 3:17:5987 days ago1754968679IN
0x5D27813C...523331717
0 ETH0.000073870.8648046
Batch Claim Rewa...230838602025-08-06 18:36:5993 days ago1754505419IN
0x5D27813C...523331717
0 ETH0.000216962.53938515
Claim Rewards230711372025-08-04 23:58:2395 days ago1754351903IN
0x5D27813C...523331717
0 ETH0.000028810.27388808
Batch Claim Rewa...230142882025-07-28 1:12:59103 days ago1753665179IN
0x5D27813C...523331717
0 ETH0.000252991.00900569
Batch Claim Rewa...230056932025-07-26 20:25:59104 days ago1753561559IN
0x5D27813C...523331717
0 ETH0.000372872.21560581
Batch Claim Rewa...229946482025-07-25 7:22:59105 days ago1753428179IN
0x5D27813C...523331717
0 ETH0.000251512.31524987
Batch Claim Rewa...229889572025-07-24 12:16:47106 days ago1753359407IN
0x5D27813C...523331717
0 ETH0.000076990.57414714
Batch Claim Rewa...229338872025-07-16 19:37:23114 days ago1752694643IN
0x5D27813C...523331717
0 ETH0.0036941611.79072754
Claim Rewards228922232025-07-11 0:00:23120 days ago1752192023IN
0x5D27813C...523331717
0 ETH0.00022693.19585882
Claim Rewards228919282025-07-10 23:00:59120 days ago1752188459IN
0x5D27813C...523331717
0 ETH0.000581018.18345852
Batch Claim Rewa...228368692025-07-03 6:19:47127 days ago1751523587IN
0x5D27813C...523331717
0 ETH0.000636972.32016844
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StaxVault

Compiler Version
v0.8.26+commit.8a97fa7a

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;

import "@openzeppelin/contracts/interfaces/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import "./interfaces/IStaxNFT.sol";
import "./interfaces/IX28.sol";
import "./lib/OracleLibrary.sol";
import "./lib/TickMath.sol";
import "./lib/constants.sol";

/// @title Stax Vault Contract
contract StaxVault is Ownable2Step {
    using SafeERC20 for IERC20;

    // -------------------------- STATE VARIABLES -------------------------- //

    address public immutable STAX;
    address public STAX_NFT;
    address public STAX_BANK;
    address public immutable STAX_BUY_BURN;
    address public immutable STAX_DEV;

    /// @notice Timestamp of the last cycle update in seconds.
    uint256 public lastCycleTs;
    /// @notice Total NFT multipliers in previous cycle.
    uint256 public lastCycleMultipliers;

    /// @notice The max amount of TitanX tokens to purchase X28 in a single call.
    uint256 public maxSwapValue = 50_000_000_000 ether;
    /// @notice X28 Tokens stored for Diamond Hand holders.
    uint256 public diamondHandPool;
    /// @notice The total amount of rewards paid out to holders.
    uint256 public totalRewadsPaid;
    /// @notice The total amount of rewards accumulated.
    uint256 public totalRewardPool;
    /// @notice The minimum pool size required to trigger a new cycle.
    uint256 public minCyclePool = 200_000_000 ether;

    /// @notice Basis point incentive fee paid out for updating the cycle.
    uint16 public incentiveFeeBPS = 30;
    /// @notice Time used for TWAP calculation.
    uint32 public secondsAgo = 5 * 60;
    /// @notice Allowed deviation of the minAmountOut from historical price.
    uint32 public twapDeviation = 500;
    /// @notice Allowed deviation of the X28 price from TitanX.
    uint32 public x28Deviation = 1000;

    /// @notice Number of tokens per paid 1 multiplier in a specific cycle.
    mapping(uint256 cycleId => uint256) public tokensPerMultiplier;
    /// @notice A mapping of token IDs to the cycle ID of the last claim for each token.
    mapping(uint256 tokenId => uint32) public lastClaimed;
    /// @notice A mapping of user addresses to the total amount of X28 tokens claimed by each user.
    mapping(address user => uint256) public totalClaimed;

    // ------------------------------- EVENTS ------------------------------ //

    event CycleUpdated();

    // ------------------------------- ERRORS ------------------------------ //

    error Unauthorized();
    error ZeroAddress();
    error ZeroInput();
    error InsufficientBalance();
    error Cooldown();
    error NoCyclesAvailable();
    error TokenExists();
    error Prohibited();
    error TWAP();

    // ------------------------------ MODIFIERS ---------------------------- //

    modifier onlyToken() {
        if (msg.sender != STAX) revert Unauthorized();
        _;
    }

    // ----------------------------- CONSTRUCTOR --------------------------- //

    constructor(address _owner, address _stax, address _staxBuyBurn, address _devWallet) Ownable(_owner) {
        if (_stax == address(0)) revert ZeroAddress();
        if (_staxBuyBurn == address(0)) revert ZeroAddress();
        if (_devWallet == address(0)) revert ZeroAddress();

        STAX = _stax;
        STAX_DEV = _devWallet;
        STAX_BUY_BURN = _staxBuyBurn;
        lastCycleTs = block.timestamp;
    }

    // --------------------------- PUBLIC FUNCTIONS ------------------------ //

    /// @notice Updates the cycle and distributes rewards accumulated.
    /// @param minAmountOut Minimum amount of X28 tokens to receive from TitanX/X28 swap (if applicable).
    /// @param deadline Deadline for executing the swap (if applicable).
    function updateCycle(uint256 minAmountOut, uint256 deadline) external {
        if (getNextCycleTime() > block.timestamp) revert Cooldown();
        lastCycleTs = block.timestamp;
        (uint32 cycle, uint256 totalMultipliers) = IStaxNFT(STAX_NFT).updateCycle();
        (
            uint256 bankShare,
            uint256 buyBurnShare,
            uint256 genesisShare,
            uint256 nftHolderShare,
            uint256 diamondPoolShare
        ) = getCycleDistribution(cycle);
        uint256 titanXPool = getTitanXPool();
        uint256 x28InitialPool = getX28Pool();
        uint256 x28BankAmount = _calculateBpsPercentage(x28InitialPool, bankShare);
        uint256 incentivePool = x28InitialPool;
        uint256 x28Pool = x28InitialPool;
        if (titanXPool >= minCyclePool) {
            incentivePool += titanXPool;
            uint256 titanXBankAmount = _calculateBpsPercentage(titanXPool, bankShare);
            IERC20(TITANX).safeTransfer(STAX_BANK, titanXBankAmount);
            x28Pool += _transformTitanXtoX28(titanXPool - titanXBankAmount, minAmountOut, deadline);
        }

        if (x28Pool < minCyclePool) revert InsufficientBalance();
        x28Pool -= x28BankAmount;
        uint256 incentive = _calculateBpsPercentage(incentivePool, incentiveFeeBPS);
        x28Pool -= incentive;
        uint256 buyBurnAmount = _calculateBpsPercentage(x28Pool, buyBurnShare);
        uint256 devAmount = _calculateBpsPercentage(x28Pool, genesisShare);
        uint256 rewardsAmount = _processRewardPool(x28Pool, totalMultipliers, nftHolderShare, diamondPoolShare);

        uint256 perMultiplier = rewardsAmount / totalMultipliers;
        tokensPerMultiplier[cycle] = tokensPerMultiplier[cycle - 1] + perMultiplier;
        totalRewardPool += perMultiplier * totalMultipliers;

        IERC20 x28 = IERC20(X28);
        x28.safeTransfer(STAX_BANK, x28BankAmount);
        x28.safeTransfer(STAX_BUY_BURN, buyBurnAmount);
        x28.safeTransfer(STAX_DEV, devAmount);
        x28.safeTransfer(msg.sender, incentive);
        emit CycleUpdated();
    }

    /// @notice Claims the accumulated rewards for a single NFT.
    /// @param tokenId Token ID for which rewards are being claimed.
    function claimRewards(uint256 tokenId) external {
        (uint256 tokenData, uint32 currentCycle) = IStaxNFT(STAX_NFT).getPackedTokenData(tokenId, msg.sender);
        uint32 nftLastClaimed = lastClaimed[tokenId];
        uint32 nftBurnCycle = _getBurnCycle(tokenData);
        uint32 startCycle = nftLastClaimed == 0 ? _getMintCycle(tokenData) : nftLastClaimed;
        uint32 endCycle = nftBurnCycle == 0 ? currentCycle : nftBurnCycle;
        uint16 nftMultiplier = _getMultiplier(tokenData);
        uint256 payout = _calculatePayout(startCycle, endCycle, nftMultiplier);
        lastClaimed[tokenId] = endCycle;
        totalRewadsPaid += payout;
        totalClaimed[msg.sender] += payout;
        IERC20(X28).safeTransfer(msg.sender, payout);
    }

    /// @notice Claims the accumulated rewards for a batch of NFT tokens.
    /// @param tokenIds An array of token IDs for which rewards are being claimed.
    function batchClaimRewards(uint256[] calldata tokenIds) external {
        uint256 amount = tokenIds.length;
        if (amount == 0) revert ZeroInput();
        (uint256[] memory nftData, uint32 currentCycle) =
            IStaxNFT(STAX_NFT).batchGetPackedTokenData(tokenIds, msg.sender);
        uint256 totalPayout;
        for (uint256 i = 0; i < amount; i++) {
            uint256 tokenId = tokenIds[i];
            uint256 tokenData = nftData[i];
            uint32 nftLastClaimed = lastClaimed[tokenId];
            uint32 nftBurnCycle = _getBurnCycle(tokenData);
            uint32 startCycle = nftLastClaimed == 0 ? _getMintCycle(tokenData) : nftLastClaimed;
            uint32 endCycle = nftBurnCycle == 0 ? currentCycle : nftBurnCycle;
            uint16 nftMultiplier = _getMultiplier(tokenData);
            totalPayout += _calculatePayout(startCycle, endCycle, nftMultiplier);
            lastClaimed[tokenId] = endCycle;
        }
        totalRewadsPaid += totalPayout;
        totalClaimed[msg.sender] += totalPayout;
        IERC20(X28).safeTransfer(msg.sender, totalPayout);
    }

    // ----------------------- ADMINISTRATIVE FUNCTIONS -------------------- //

    /// @notice Sets a new distribution incentive fee basis points.
    /// @param bps Incentive fee in basis points (1% = 100 bps).
    function setIncentiveFee(uint16 bps) external onlyOwner {
        if (bps == 0 || bps > 1000) revert Prohibited();
        incentiveFeeBPS = bps;
    }

    /// @notice Sets the maximum amount of TitanX token to be used in market buys of X28.
    /// @param limit TitanX amount in wei.
    function setMaxSwapValue(uint256 limit) external onlyOwner {
        maxSwapValue = limit;
    }

    /// @notice Sets the minimum pool size required to trigger a new cycle.
    /// @param limit The new minimum pool size in WEI.
    function setMinCyclePool(uint256 limit) external onlyOwner {
        minCyclePool = limit;
    }

    /// @notice Sets the number of seconds to look back for TWAP price calculations.
    /// @param limit The number of seconds to use for TWAP price lookback.
    function setSecondsAgo(uint32 limit) external onlyOwner {
        if (limit == 0) revert ZeroInput();
        secondsAgo = limit;
    }

    /// @notice Sets the allowed price deviation for TWAP checks.
    /// @param limit The allowed deviation in basis points (e.g. 500 = 5%).
    function setTwapDeviation(uint32 limit) external onlyOwner {
        if (limit == 0) revert ZeroInput();
        if (limit > BPS_BASE) revert Prohibited();
        twapDeviation = limit;
    }

    /// @notice Sets the minimum price deviation required for initiating X28 buy on market.
    /// @param limit The required deviation in basis points (e.g. 500 = 5% and swaps will be enabled when 1 TitanX = 1.05 X28).
    /// @dev Setting to 10000 will fire when 1 TitanX = 2 X28.
    function setX28PriceDeviation(uint32 limit) external onlyOwner {
        if (limit == 0) revert ZeroInput();
        x28Deviation = limit;
    }

    /// @notice Sets the Stax Protocol addresses.
    /// @param _staxNft The address of the Stax NFT contract.
    /// @param _staxBank The address of the Stax Bank contract.
    /// @dev Only callable by Stax contract.
    function setProtocolAddresses(address _staxNft, address _staxBank) external onlyToken {
        STAX_NFT = _staxNft;
        STAX_BANK = _staxBank;
    }

    /// @notice Updates the timestamp for first cycle to be created 9 days after the start of presale.
    /// @dev Only callable by Stax contract.
    function handleStartPresale() external onlyToken {
        lastCycleTs = block.timestamp - 8 days;
    }

    // ---------------------------- VIEW FUNCTIONS ------------------------- //

    /// @notice Returns the date a new cycle will be available.
    function getNextCycleTime() public view returns (uint256) {
        return lastCycleTs + CYCLE_COOLDOWN;
    }

    /// @notice Returns total TitanX available for next cycle creation.
    function getTitanXPool() public view returns (uint256) {
        return IERC20(TITANX).balanceOf(address(this));
    }

    /// @notice Returns total X28 available for next cycle creation.
    function getX28Pool() public view returns (uint256) {
        return IERC20(X28).balanceOf(address(this)) + totalRewadsPaid - totalRewardPool - diamondHandPool;
    }

    /// @notice Get basis point percentages for distributing cycle pool based on the cycle ID.
    /// @return bankShare Percentage of the pool reinvested back to Stax Bank.
    /// @return buyBurnShare Percentage of the pool sent to Stax Buy & Burn.
    /// @return genesisShare Percentage of the pool sent to Genesis wallet.
    /// @return nftHolderShare Percentage of the pool allocated as a reward for NFT holders.
    /// @return diamondPoolShare Percentage of the pool allocated to a Diamond Hand pool.
    function getCycleDistribution(uint256 cycleId)
        public
        pure
        returns (
            uint256 bankShare,
            uint256 buyBurnShare,
            uint256 genesisShare,
            uint256 nftHolderShare,
            uint256 diamondPoolShare
        )
    {
        if (cycleId > 35) return (20_00, 75_00, 10_00, 12_50, 2_50);
        if (cycleId < 5) return (0, 80_00, 8_00, 10_00, 2_00);
        uint256 eligibleCycles = cycleId - 5;
        bankShare = BANK_ALLOCATION_BPS - eligibleCycles * CYCLE_COMPOUND_REDUCTION;
        uint256 remainder = BPS_BASE - bankShare;
        buyBurnShare = (eligibleCycles * CYCLE_COMPOUND_REDUCTION) * BPS_BASE / remainder;
        genesisShare = GENESIS_BASE_BPS / remainder;
        nftHolderShare = HOLDER_BASE_BPS / remainder;
        diamondPoolShare = DIANOND_BASE_BPS / remainder;
    }

    /// @notice Returns the availability and total claimable tokens for a batch of NFT token IDs.
    /// @param tokenIds An array of token IDs to query.
    /// @param account The address of the tokens owner.
    /// @return availability A boolean array indicating whether each token is eligible for claims.
    /// @return totalPayout The total amount of X28 tokens the account can claim for the eligible provided tokens.
    function getRewards(uint256[] calldata tokenIds, address account)
        external
        view
        returns (bool[] memory availability, uint256 totalPayout)
    {
        if (tokenIds.length == 0) revert ZeroInput();
        availability = new bool[](tokenIds.length);
        (uint256[] memory nftData, uint32 currentCycle) = IStaxNFT(STAX_NFT).batchGetPackedTokenData(tokenIds, account);
        for (uint256 i = 0; i < tokenIds.length; i++) {
            uint256 tokenId = tokenIds[i];
            uint256 tokenData = nftData[i];
            uint32 nftLastClaimed = lastClaimed[tokenId];
            uint32 nftBurnCycle = _getBurnCycle(tokenData);
            uint32 startCycle = nftLastClaimed == 0 ? _getMintCycle(tokenData) : nftLastClaimed;
            uint32 endCycle = nftBurnCycle == 0 ? currentCycle : nftBurnCycle;
            uint16 nftMultiplier = _getMultiplier(tokenData);
            bool available = startCycle < endCycle;
            availability[i] = available;
            if (available) {
                totalPayout += _calculatePayout(startCycle, endCycle, nftMultiplier);
            }
        }
    }

    function getX28MintStatus() public view returns (bool isNativeMint) {
        (uint160 sqrtPriceX96,,,,,,) = IUniswapV3Pool(TITANX_X28_POOL).slot0();
        uint256 amountIn = 1 ether;
        uint256 target = amountIn * (BPS_BASE + x28Deviation) / BPS_BASE;
        uint256 x28Quote = OracleLibrary.getQuoteForSqrtRatioX96(sqrtPriceX96, amountIn, TITANX, X28);
        return x28Quote < target;
    }

    // -------------------------- INTERNAL FUNCTIONS ----------------------- //

    function _calculatePayout(uint32 startCycle, uint32 endCycle, uint16 nftMultiplier)
        internal
        view
        returns (uint256)
    {
        if (startCycle == endCycle) revert NoCyclesAvailable();
        uint256 totalPerMultiplier = tokensPerMultiplier[endCycle - 1] - tokensPerMultiplier[startCycle - 1];
        return totalPerMultiplier * nftMultiplier;
    }

    function _calculateBpsPercentage(uint256 amount, uint256 bps) internal pure returns (uint256) {
        return amount * bps / BPS_BASE;
    }

    function _processRewardPool(uint256 x28Pool, uint256 totalMultipliers, uint256 rewardBps, uint256 diamondBps)
        internal
        returns (uint256 rewardsAmount)
    {
        if (totalMultipliers > 120_000) {
            rewardsAmount = _calculateBpsPercentage(x28Pool, rewardBps);
            if (totalMultipliers < lastCycleMultipliers) {
                uint256 additionalRewards = _calculateBpsPercentage(diamondHandPool, DIAMOND_HAND_PAYOUT_BPS);
                diamondHandPool -= additionalRewards;
                rewardsAmount += additionalRewards;
            }
            diamondHandPool += _calculateBpsPercentage(x28Pool, diamondBps);
            lastCycleMultipliers = totalMultipliers;
        } else {
            rewardsAmount = _calculateBpsPercentage(x28Pool, rewardBps + diamondBps);

            if (diamondHandPool > 0) {
                rewardsAmount += diamondHandPool;
                diamondHandPool = 0;
            }
        }
    }

    function _transformTitanXtoX28(uint256 amount, uint256 minAmountOut, uint256 deadline) internal returns (uint256) {
        bool isNativeMint = getX28MintStatus();
        if (isNativeMint) {
            IERC20(TITANX).safeIncreaseAllowance(X28, amount);
            IX28(X28).mintX28withTitanX(amount);
            return amount;
        } else {
            if (amount > maxSwapValue) {
                uint256 x28FromSwap = _swapTitanXToX28(maxSwapValue, minAmountOut, deadline);
                uint256 difference = amount - maxSwapValue;
                IERC20(TITANX).safeIncreaseAllowance(X28, difference);
                IX28(X28).mintX28withTitanX(difference);
                return x28FromSwap + difference;
            } else {
                return _swapTitanXToX28(amount, minAmountOut, deadline);
            }
        }
    }

    function _swapTitanXToX28(uint256 amountIn, uint256 minAmountOut, uint256 deadline) internal returns (uint256) {
        _twapCheck(TITANX, X28, amountIn, minAmountOut);
        ISwapRouter.ExactInputSingleParams memory params = ISwapRouter.ExactInputSingleParams({
            tokenIn: TITANX,
            tokenOut: X28,
            fee: POOL_FEE_1PERCENT,
            recipient: address(this),
            deadline: deadline,
            amountIn: amountIn,
            amountOutMinimum: minAmountOut,
            sqrtPriceLimitX96: 0
        });
        IERC20(TITANX).safeIncreaseAllowance(UNISWAP_V3_ROUTER, amountIn);
        return ISwapRouter(UNISWAP_V3_ROUTER).exactInputSingle(params);
    }

    function _twapCheck(address tokenIn, address tokenOut, uint256 amountIn, uint256 minAmountOut) internal view {
        address poolAddress = TITANX_X28_POOL;
        uint32 _secondsAgo = secondsAgo;
        uint32 oldestObservation = OracleLibrary.getOldestObservationSecondsAgo(poolAddress);
        if (oldestObservation < _secondsAgo) {
            _secondsAgo = oldestObservation;
        }

        (int24 arithmeticMeanTick,) = OracleLibrary.consult(poolAddress, _secondsAgo);
        uint160 sqrtPriceX96 = TickMath.getSqrtRatioAtTick(arithmeticMeanTick);
        uint256 twapAmountOut =
            OracleLibrary.getQuoteForSqrtRatioX96(sqrtPriceX96, uint128(amountIn), tokenIn, tokenOut);
        uint256 lowerBound = (twapAmountOut * (BPS_BASE - twapDeviation)) / BPS_BASE;

        if (minAmountOut < lowerBound) revert TWAP();
    }

    function _getMultiplier(uint256 packedData) internal pure returns (uint16) {
        return uint16((packedData >> BITPOS_MULTIPLIER) & BITMASK_MULTIPLIER);
    }

    function _getMintCycle(uint256 packedData) internal pure returns (uint32) {
        return uint32((packedData >> BITPOS_MINT_CYCLE) & BITMASK_MINT_CYCLE);
    }

    function _getBurnCycle(uint256 packedData) internal pure returns (uint32) {
        return uint32((packedData >> BITPOS_BURN_CYCLE) & BITMASK_BURN_CYCLE);
    }
}

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

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

pragma solidity ^0.8.20;

import {Ownable} from "./Ownable.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.
 *
 * 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 Ownable2Step is Ownable {
    address private _pendingOwner;

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

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

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

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

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

File 4 of 25 : 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";

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 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 {
    using Address for address;

    /**
     * @dev An operation with an ERC20 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.
     */
    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.
     */
    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.
     */
    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 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).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            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 silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

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

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

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

    /**
     * @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 AddressInsufficientBalance(address(this));
        }

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

    /**
     * @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
     * {FailedInnerCall} 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 AddressInsufficientBalance(address(this));
        }
        (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 {FailedInnerCall}) 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 {FailedInnerCall} 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 {FailedInnerCall}.
     */
    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
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}

// 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;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    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 overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

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

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        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 division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

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

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

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return 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.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
     * denominator == 0.
     * @dev 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^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + 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^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 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^256 / 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^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            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^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // 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^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, 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;
        }
    }

    /**
     * @notice 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) {
        uint256 result = mulDiv(x, y, denominator);
        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
     * towards zero.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice 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 + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

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

    /**
     * @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 + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @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 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @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 + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

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

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Callback for IUniswapV3PoolActions#swap
/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface
interface IUniswapV3SwapCallback {
    /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
    /// @dev In the implementation you must pay the pool tokens owed for the swap.
    /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.
    /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.
    /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
    /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
    /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call
    function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external;
}

File 12 of 25 : IUniswapV3Pool.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import "./pool/IUniswapV3PoolImmutables.sol";
import "./pool/IUniswapV3PoolState.sol";
import "./pool/IUniswapV3PoolDerivedState.sol";
import "./pool/IUniswapV3PoolActions.sol";
import "./pool/IUniswapV3PoolOwnerActions.sol";
import "./pool/IUniswapV3PoolEvents.sol";

/// @title The interface for a Uniswap V3 Pool
/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform
/// to the ERC20 specification
/// @dev The pool interface is broken up into many smaller pieces
interface IUniswapV3Pool is
    IUniswapV3PoolImmutables,
    IUniswapV3PoolState,
    IUniswapV3PoolDerivedState,
    IUniswapV3PoolActions,
    IUniswapV3PoolOwnerActions,
    IUniswapV3PoolEvents
{}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissionless pool actions
/// @notice Contains pool methods that can be called by anyone
interface IUniswapV3PoolActions {
    /// @notice Sets the initial price for the pool
    /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
    /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
    function initialize(uint160 sqrtPriceX96) external;

    /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
    /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback
    /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
    /// on tickLower, tickUpper, the amount of liquidity, and the current price.
    /// @param recipient The address for which the liquidity will be created
    /// @param tickLower The lower tick of the position in which to add liquidity
    /// @param tickUpper The upper tick of the position in which to add liquidity
    /// @param amount The amount of liquidity to mint
    /// @param data Any data that should be passed through to the callback
    /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
    /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
    function mint(address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes calldata data)
        external
        returns (uint256 amount0, uint256 amount1);

    /// @notice Collects tokens owed to a position
    /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.
    /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or
    /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the
    /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
    /// @param recipient The address which should receive the fees collected
    /// @param tickLower The lower tick of the position for which to collect fees
    /// @param tickUpper The upper tick of the position for which to collect fees
    /// @param amount0Requested How much token0 should be withdrawn from the fees owed
    /// @param amount1Requested How much token1 should be withdrawn from the fees owed
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);

    /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position
    /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0
    /// @dev Fees must be collected separately via a call to #collect
    /// @param tickLower The lower tick of the position for which to burn liquidity
    /// @param tickUpper The upper tick of the position for which to burn liquidity
    /// @param amount How much liquidity to burn
    /// @return amount0 The amount of token0 sent to the recipient
    /// @return amount1 The amount of token1 sent to the recipient
    function burn(int24 tickLower, int24 tickUpper, uint128 amount)
        external
        returns (uint256 amount0, uint256 amount1);

    /// @notice Swap token0 for token1, or token1 for token0
    /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
    /// @param recipient The address to receive the output of the swap
    /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
    /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
    /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
    /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
    /// @param data Any data to be passed through to the callback
    /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
    /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
    function swap(
        address recipient,
        bool zeroForOne,
        int256 amountSpecified,
        uint160 sqrtPriceLimitX96,
        bytes calldata data
    ) external returns (int256 amount0, int256 amount1);

    /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback
    /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback
    /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
    /// with 0 amount{0,1} and sending the donation amount(s) from the callback
    /// @param recipient The address which will receive the token0 and token1 amounts
    /// @param amount0 The amount of token0 to send
    /// @param amount1 The amount of token1 to send
    /// @param data Any data to be passed through to the callback
    function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external;

    /// @notice Increase the maximum number of price and liquidity observations that this pool will store
    /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
    /// the input observationCardinalityNext.
    /// @param observationCardinalityNext The desired minimum number of observations for the pool to store
    function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that is not stored
/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the
/// blockchain. The functions here may have variable gas costs.
interface IUniswapV3PoolDerivedState {
    /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
    /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
    /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
    /// you must call it with secondsAgos = [3600, 0].
    /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
    /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
    /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
    /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
    /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
    /// timestamp
    function observe(uint32[] calldata secondsAgos)
        external
        view
        returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);

    /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
    /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
    /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
    /// snapshot is taken and the second snapshot is taken.
    /// @param tickLower The lower tick of the range
    /// @param tickUpper The upper tick of the range
    /// @return tickCumulativeInside The snapshot of the tick accumulator for the range
    /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
    /// @return secondsInside The snapshot of seconds per liquidity for the range
    function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
        external
        view
        returns (int56 tickCumulativeInside, uint160 secondsPerLiquidityInsideX128, uint32 secondsInside);
}

File 15 of 25 : IUniswapV3PoolEvents.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Events emitted by a pool
/// @notice Contains all events emitted by the pool
interface IUniswapV3PoolEvents {
    /// @notice Emitted exactly once by a pool when #initialize is first called on the pool
    /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
    /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
    /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
    event Initialize(uint160 sqrtPriceX96, int24 tick);

    /// @notice Emitted when liquidity is minted for a given position
    /// @param sender The address that minted the liquidity
    /// @param owner The owner of the position and recipient of any minted liquidity
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity minted to the position range
    /// @param amount0 How much token0 was required for the minted liquidity
    /// @param amount1 How much token1 was required for the minted liquidity
    event Mint(
        address sender,
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted when fees are collected by the owner of a position
    /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees
    /// @param owner The owner of the position for which fees are collected
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount0 The amount of token0 fees collected
    /// @param amount1 The amount of token1 fees collected
    event Collect(
        address indexed owner,
        address recipient,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount0,
        uint128 amount1
    );

    /// @notice Emitted when a position's liquidity is removed
    /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect
    /// @param owner The owner of the position for which liquidity is removed
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity to remove
    /// @param amount0 The amount of token0 withdrawn
    /// @param amount1 The amount of token1 withdrawn
    event Burn(
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted by the pool for any swaps between token0 and token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the output of the swap
    /// @param amount0 The delta of the token0 balance of the pool
    /// @param amount1 The delta of the token1 balance of the pool
    /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
    /// @param liquidity The liquidity of the pool after the swap
    /// @param tick The log base 1.0001 of price of the pool after the swap
    event Swap(
        address indexed sender,
        address indexed recipient,
        int256 amount0,
        int256 amount1,
        uint160 sqrtPriceX96,
        uint128 liquidity,
        int24 tick
    );

    /// @notice Emitted by the pool for any flashes of token0/token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the tokens from flash
    /// @param amount0 The amount of token0 that was flashed
    /// @param amount1 The amount of token1 that was flashed
    /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee
    /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee
    event Flash(
        address indexed sender,
        address indexed recipient,
        uint256 amount0,
        uint256 amount1,
        uint256 paid0,
        uint256 paid1
    );

    /// @notice Emitted by the pool for increases to the number of observations that can be stored
    /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index
    /// just before a mint/swap/burn.
    /// @param observationCardinalityNextOld The previous value of the next observation cardinality
    /// @param observationCardinalityNextNew The updated value of the next observation cardinality
    event IncreaseObservationCardinalityNext(
        uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew
    );

    /// @notice Emitted when the protocol fee is changed by the pool
    /// @param feeProtocol0Old The previous value of the token0 protocol fee
    /// @param feeProtocol1Old The previous value of the token1 protocol fee
    /// @param feeProtocol0New The updated value of the token0 protocol fee
    /// @param feeProtocol1New The updated value of the token1 protocol fee
    event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);

    /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner
    /// @param sender The address that collects the protocol fees
    /// @param recipient The address that receives the collected protocol fees
    /// @param amount0 The amount of token0 protocol fees that is withdrawn
    /// @param amount0 The amount of token1 protocol fees that is withdrawn
    event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that never changes
/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
interface IUniswapV3PoolImmutables {
    /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
    /// @return The contract address
    function factory() external view returns (address);

    /// @notice The first of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token0() external view returns (address);

    /// @notice The second of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token1() external view returns (address);

    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
    /// @return The fee
    function fee() external view returns (uint24);

    /// @notice The pool tick spacing
    /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
    /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
    /// This value is an int24 to avoid casting even though it is always positive.
    /// @return The tick spacing
    function tickSpacing() external view returns (int24);

    /// @notice The maximum amount of position liquidity that can use any tick in the range
    /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
    /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
    /// @return The max amount of liquidity per tick
    function maxLiquidityPerTick() external view returns (uint128);
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissioned pool actions
/// @notice Contains pool methods that may only be called by the factory owner
interface IUniswapV3PoolOwnerActions {
    /// @notice Set the denominator of the protocol's % share of the fees
    /// @param feeProtocol0 new protocol fee for token0 of the pool
    /// @param feeProtocol1 new protocol fee for token1 of the pool
    function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;

    /// @notice Collect the protocol fee accrued to the pool
    /// @param recipient The address to which collected protocol fees should be sent
    /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1
    /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0
    /// @return amount0 The protocol fee collected in token0
    /// @return amount1 The protocol fee collected in token1
    function collectProtocol(address recipient, uint128 amount0Requested, uint128 amount1Requested)
        external
        returns (uint128 amount0, uint128 amount1);
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that can change
/// @notice These methods compose the pool's state, and can change with any frequency including multiple times
/// per transaction
interface IUniswapV3PoolState {
    /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
    /// when accessed externally.
    /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
    /// tick The current tick of the pool, i.e. according to the last tick transition that was run.
    /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
    /// boundary.
    /// observationIndex The index of the last oracle observation that was written,
    /// observationCardinality The current maximum number of observations stored in the pool,
    /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.
    /// feeProtocol The protocol fee for both tokens of the pool.
    /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
    /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
    /// unlocked Whether the pool is currently locked to reentrancy
    function slot0()
        external
        view
        returns (
            uint160 sqrtPriceX96,
            int24 tick,
            uint16 observationIndex,
            uint16 observationCardinality,
            uint16 observationCardinalityNext,
            uint8 feeProtocol,
            bool unlocked
        );

    /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal0X128() external view returns (uint256);

    /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal1X128() external view returns (uint256);

    /// @notice The amounts of token0 and token1 that are owed to the protocol
    /// @dev Protocol fees will never exceed uint128 max in either token
    function protocolFees() external view returns (uint128 token0, uint128 token1);

    /// @notice The currently in range liquidity available to the pool
    /// @dev This value has no relationship to the total liquidity across all ticks
    function liquidity() external view returns (uint128);

    /// @notice Look up information about a specific tick in the pool
    /// @param tick The tick to look up
    /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or
    /// tick upper,
    /// liquidityNet how much liquidity changes when the pool price crosses the tick,
    /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
    /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
    /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
    /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
    /// secondsOutside the seconds spent on the other side of the tick from the current tick,
    /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.
    /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.
    /// In addition, these values are only relative and must be used only in comparison to previous snapshots for
    /// a specific position.
    function ticks(int24 tick)
        external
        view
        returns (
            uint128 liquidityGross,
            int128 liquidityNet,
            uint256 feeGrowthOutside0X128,
            uint256 feeGrowthOutside1X128,
            int56 tickCumulativeOutside,
            uint160 secondsPerLiquidityOutsideX128,
            uint32 secondsOutside,
            bool initialized
        );

    /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information
    function tickBitmap(int16 wordPosition) external view returns (uint256);

    /// @notice Returns the information about a position by the position's key
    /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper
    /// @return _liquidity The amount of liquidity in the position,
    /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
    /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
    /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
    /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke
    function positions(bytes32 key)
        external
        view
        returns (
            uint128 _liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    /// @notice Returns data about a specific observation index
    /// @param index The element of the observations array to fetch
    /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time
    /// ago, rather than at a specific index in the array.
    /// @return blockTimestamp The timestamp of the observation,
    /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
    /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
    /// Returns initialized whether the observation has been initialized and the values are safe to use
    function observations(uint256 index)
        external
        view
        returns (
            uint32 blockTimestamp,
            int56 tickCumulative,
            uint160 secondsPerLiquidityCumulativeX128,
            bool initialized
        );
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;

import "@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol";

/// @title Router token swapping functionality
/// @notice Functions for swapping tokens via Uniswap V3
interface ISwapRouter is IUniswapV3SwapCallback {
    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);

    struct ExactInputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);

    struct ExactOutputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);

    struct ExactOutputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}

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

interface IStaxNFT {
    function startMint(uint256 _presaleEnd) external;
    function setDirectTransfer() external;
    function setProtocolAddresses(address _vault, address _bank) external;
    function updateCycle() external returns (uint32 cycle, uint256 totalMultipliers);
    function getPackedTokenData(uint256 tokenId, address account) external view returns (uint256, uint32);
    function batchGetPackedTokenData(uint256[] memory tokenIds, address account)
        external
        view
        returns (uint256[] memory data, uint32);
}

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

interface ITitanOnBurn {
    function onBurn(address user, uint256 amount) external;
}

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

import "@openzeppelin/contracts/interfaces/IERC20.sol";

interface IX28 is IERC20 {
    function mintX28withTitanX(uint256 amount) external;
    function decimals() external view returns (uint256);
}

File 23 of 25 : constants.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;

import "../interfaces/ITitanOnBurn.sol";
import "@openzeppelin/contracts/interfaces/IERC20.sol";

// ===================== Contract Addresses =====================================

address constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address constant TITANX = 0xF19308F923582A6f7c465e5CE7a9Dc1BEC6665B1;
address constant X28 = 0x5c47902c8C80779CB99235E42C354E53F38C3B0d;
address constant HYPER = 0xE2cfD7a01ec63875cd9Da6C7c1B7025166c2fA2F;
address constant HELIOS = 0x2614f29C39dE46468A921Fd0b41fdd99A01f2EDf;
address constant BLAZE = 0xfcd7cceE4071aA4ecFAC1683b7CC0aFeCAF42A36;
address constant FLUX = 0xBFDE5ac4f5Adb419A931a5bF64B0f3BB5a623d06;
address constant E280 = 0xe9A53C43a0B58706e67341C4055de861e29Ee943;

address constant BLAZE_STAKING = 0xBc0043bc5b0c394D9d05d49768f9548F8CF9587b;
address constant FLUX_STAKING = 0xd605a87187563C94c577a6E57e4a36eC8433B9aE;

address constant TITANX_WETH_POOL = 0xc45A81BC23A64eA556ab4CdF08A86B61cdcEEA8b;
address constant TITANX_X28_POOL = 0x99f60479da6A49D55eBA34893958cdAACc710eE9;
address constant TITANX_HYPER_POOL = 0x14d725edB1299fF560d96f42462f0234B65B00AF;
address constant TITANX_HELIOS_POOL = 0x2C83C54C5612BfD62a78124D4A0eA001278a689c;
address constant INFERNO = 0x00F116ac0c304C570daAA68FA6c30a86A04B5C5F;
address constant TITANX_INFERNO_POOL = 0x1E90B67149e688DfB95fD73Acacd8ADefd16d88D;
address constant INFERNO_FLUX_POOL = 0x09848D115e085942E6fa9D85b6B6C73fb0E63CB1;


// ===================== MINT ===================================================

uint256 constant PRESALE_LENGTH = 28 days;
uint256 constant COOLDOWN_PERIOD = 48 hours;
uint256 constant LP_POOL_SIZE = 200_000_000_000 ether;

uint8 constant PERCENTAGE_BASE = 100;
uint16 constant BPS_BASE = 100_00;

uint256 constant COMMON_BASE_PRICE = 100_000_000 ether;
uint256 constant RARE_BASE_PRICE = 1_000_000_000 ether;
uint256 constant LEGENDARY_BASE_PRICE = 10_000_000_000 ether;

uint16 constant COMMON_BASE_MULTIPLIER = 10;
uint16 constant RARE_BASE_MULTIPLIER = 100;
uint16 constant LEGENDARY_BASE_MULTIPLIER = 1000;

// ===================== NFT ===================================================

uint8 constant NFT_CLAIM_COOLDOWN = 2;
uint256 constant BITPOS_NFT_TIER = 0;
uint256 constant BITMASK_NFT_TIER = (1 << 8) - 1;

uint256 constant BITPOS_MULTIPLIER = 8;
uint256 constant BITMASK_MULTIPLIER = (1 << 16) - 1;

uint256 constant BITPOS_MINT_CYCLE = 24;
uint256 constant BITMASK_MINT_CYCLE = (1 << 32) - 1;

uint256 constant BITPOS_BURN_CYCLE = 56;
uint256 constant BITMASK_BURN_CYCLE = (1 << 32) - 1;

uint256 constant BITPOS_BURN_ADDRESS = 88;
uint256 constant BITMASK_BURN_ADDRESS = (1 << 160) - 1;

// ===================== VAULT ==================================================

uint256 constant CYCLE_COOLDOWN = 9 days;

uint16 constant BANK_ALLOCATION_BPS = 80_00;
uint64 constant GENESIS_BASE_BPS = 8_00 * uint64(BPS_BASE);
uint64 constant HOLDER_BASE_BPS = 10_00 * uint64(BPS_BASE);
uint64 constant DIANOND_BASE_BPS = 2_00 * uint64(BPS_BASE);
uint16 constant DIAMOND_HAND_PAYOUT_BPS = 8_00;
uint16 constant CYCLE_COMPOUND_REDUCTION = 2_00;

// ===================== UNISWAP Interface ======================================

address constant UNISWAP_V2_FACTORY = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
address constant UNISWAP_V2_ROUTER = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address constant UNISWAP_V3_ROUTER = 0xE592427A0AEce92De3Edee1F18E0157C05861564;
uint24 constant POOL_FEE_1PERCENT = 10000;

// ===================== Interface IDs ==========================================

bytes4 constant INTERFACE_ID_ERC165 = 0x01ffc9a7;
bytes4 constant INTERFACE_ID_ERC20 = type(IERC20).interfaceId;
bytes4 constant INTERFACE_ID_ERC721 = 0x80ac58cd;
bytes4 constant INTERFACE_ID_ERC721Metadata = 0x5b5e139f;
bytes4 constant INTERFACE_ID_ITITANONBURN = type(ITitanOnBurn).interfaceId;

// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

// Uniswap
import {IUniswapV3Pool} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";

// OpenZeppelin
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {TickMath} from "./TickMath.sol";

/**
 * @notice Adapted Uniswap V3 OracleLibrary computation to be compliant with Solidity 0.8.x and later.
 *
 * Documentation for Auditors:
 *
 * Solidity Version: Updated the Solidity version pragma to ^0.8.0. This change ensures compatibility
 * with Solidity version 0.8.x.
 *
 * Safe Arithmetic Operations: Solidity 0.8.x automatically checks for arithmetic overflows/underflows.
 * Therefore, the code no longer needs to use SafeMath library (or similar) for basic arithmetic operations.
 * This change simplifies the code and reduces the potential for errors related to manual overflow/underflow checking.
 *
 * Overflow/Underflow: With the introduction of automatic overflow/underflow checks in Solidity 0.8.x, the code is inherently
 * safer and less prone to certain types of arithmetic errors.
 *
 * Removal of SafeMath Library: Since Solidity 0.8.x handles arithmetic operations safely, the use of SafeMath library
 * is omitted in this update.
 *
 * Git-style diff for the `consult` function:
 *
 * ```diff
 * function consult(address pool, uint32 secondsAgo)
 *     internal
 *     view
 *     returns (int24 arithmeticMeanTick, uint128 harmonicMeanLiquidity)
 * {
 *     require(secondsAgo != 0, 'BP');
 *
 *     uint32[] memory secondsAgos = new uint32[](2);
 *     secondsAgos[0] = secondsAgo;
 *     secondsAgos[1] = 0;
 *
 *     (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s) =
 *         IUniswapV3Pool(pool).observe(secondsAgos);
 *
 *     int56 tickCumulativesDelta = tickCumulatives[1] - tickCumulatives[0];
 *     uint160 secondsPerLiquidityCumulativesDelta =
 *         secondsPerLiquidityCumulativeX128s[1] - secondsPerLiquidityCumulativeX128s[0];
 *
 * -   arithmeticMeanTick = int24(tickCumulativesDelta / secondsAgo);
 * +   int56 secondsAgoInt56 = int56(uint56(secondsAgo));
 * +   arithmeticMeanTick = int24(tickCumulativesDelta / secondsAgoInt56);
 *     // Always round to negative infinity
 * -   if (tickCumulativesDelta < 0 && (tickCumulativesDelta % secondsAgo != 0)) arithmeticMeanTick--;
 * +   if (tickCumulativesDelta < 0 && (tickCumulativesDelta % secondsAgoInt56 != 0)) arithmeticMeanTick--;
 *
 * -   uint192 secondsAgoX160 = uint192(secondsAgo) * type(uint160).max;
 * +   uint192 secondsAgoUint192 = uint192(secondsAgo);
 * +   uint192 secondsAgoX160 = secondsAgoUint192 * type(uint160).max;
 *     harmonicMeanLiquidity = uint128(secondsAgoX160 / (uint192(secondsPerLiquidityCumulativesDelta) << 32));
 * }
 * ```
 */

/// @title Oracle library
/// @notice Provides functions to integrate with V3 pool oracle
library OracleLibrary {
    /// @notice Calculates time-weighted means of tick and liquidity for a given Uniswap V3 pool
    /// @param pool Address of the pool that we want to observe
    /// @param secondsAgo Number of seconds in the past from which to calculate the time-weighted means
    /// @return arithmeticMeanTick The arithmetic mean tick from (block.timestamp - secondsAgo) to block.timestamp
    /// @return harmonicMeanLiquidity The harmonic mean liquidity from (block.timestamp - secondsAgo) to block.timestamp
    function consult(address pool, uint32 secondsAgo)
        internal
        view
        returns (int24 arithmeticMeanTick, uint128 harmonicMeanLiquidity)
    {
        require(secondsAgo != 0, "BP");

        uint32[] memory secondsAgos = new uint32[](2);
        secondsAgos[0] = secondsAgo;
        secondsAgos[1] = 0;

        (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s) =
            IUniswapV3Pool(pool).observe(secondsAgos);

        int56 tickCumulativesDelta = tickCumulatives[1] - tickCumulatives[0];
        uint160 secondsPerLiquidityCumulativesDelta =
            secondsPerLiquidityCumulativeX128s[1] - secondsPerLiquidityCumulativeX128s[0];

        // Safe casting of secondsAgo to int56 for division
        int56 secondsAgoInt56 = int56(uint56(secondsAgo));
        arithmeticMeanTick = int24(tickCumulativesDelta / secondsAgoInt56);
        // Always round to negative infinity
        if (tickCumulativesDelta < 0 && (tickCumulativesDelta % secondsAgoInt56 != 0)) arithmeticMeanTick--;

        // Safe casting of secondsAgo to uint192 for multiplication
        uint192 secondsAgoUint192 = uint192(secondsAgo);
        harmonicMeanLiquidity = uint128(
            (secondsAgoUint192 * uint192(type(uint160).max)) / (uint192(secondsPerLiquidityCumulativesDelta) << 32)
        );
    }

    /// @notice Given a tick and a token amount, calculates the amount of token received in exchange
    /// @param tick Tick value used to calculate the quote
    /// @param baseAmount Amount of token to be converted
    /// @param baseToken Address of an ERC20 token contract used as the baseAmount denomination
    /// @param quoteToken Address of an ERC20 token contract used as the quoteAmount denomination
    /// @return quoteAmount Amount of quoteToken received for baseAmount of baseToken
    function getQuoteAtTick(int24 tick, uint128 baseAmount, address baseToken, address quoteToken)
        internal
        pure
        returns (uint256 quoteAmount)
    {
        uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(tick);

        // Calculate quoteAmount with better precision if it doesn't overflow when multiplied by itself
        if (sqrtRatioX96 <= type(uint128).max) {
            uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;
            quoteAmount = baseToken < quoteToken
                ? Math.mulDiv(ratioX192, baseAmount, 1 << 192)
                : Math.mulDiv(1 << 192, baseAmount, ratioX192);
        } else {
            uint256 ratioX128 = Math.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);
            quoteAmount = baseToken < quoteToken
                ? Math.mulDiv(ratioX128, baseAmount, 1 << 128)
                : Math.mulDiv(1 << 128, baseAmount, ratioX128);
        }
    }

    /// @notice Given a pool, it returns the number of seconds ago of the oldest stored observation
    /// @param pool Address of Uniswap V3 pool that we want to observe
    /// @return secondsAgo The number of seconds ago of the oldest observation stored for the pool
    function getOldestObservationSecondsAgo(address pool) internal view returns (uint32 secondsAgo) {
        (,, uint16 observationIndex, uint16 observationCardinality,,,) = IUniswapV3Pool(pool).slot0();
        require(observationCardinality > 0, "NI");

        (uint32 observationTimestamp,,, bool initialized) =
            IUniswapV3Pool(pool).observations((observationIndex + 1) % observationCardinality);

        // The next index might not be initialized if the cardinality is in the process of increasing
        // In this case the oldest observation is always in index 0
        if (!initialized) {
            (observationTimestamp,,,) = IUniswapV3Pool(pool).observations(0);
        }

        secondsAgo = uint32(block.timestamp) - observationTimestamp;
    }

    /// @notice Given a tick and a token amount, calculates the amount of token received in exchange
    /// a slightly modified version of the UniSwap library getQuoteAtTick to accept a sqrtRatioX96 as input parameter
    /// @param sqrtRatioX96 The sqrt ration
    /// @param baseAmount Amount of token to be converted
    /// @param baseToken Address of an ERC20 token contract used as the baseAmount denomination
    /// @param quoteToken Address of an ERC20 token contract used as the quoteAmount denomination
    /// @return quoteAmount Amount of quoteToken received for baseAmount of baseToken
    function getQuoteForSqrtRatioX96(uint160 sqrtRatioX96, uint256 baseAmount, address baseToken, address quoteToken)
        internal
        pure
        returns (uint256 quoteAmount)
    {
        // Calculate quoteAmount with better precision if it doesn't overflow when multiplied by itself
        if (sqrtRatioX96 <= type(uint128).max) {
            uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;
            quoteAmount = baseToken < quoteToken
                ? Math.mulDiv(ratioX192, baseAmount, 1 << 192)
                : Math.mulDiv(1 << 192, baseAmount, ratioX192);
        } else {
            uint256 ratioX128 = Math.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);
            quoteAmount = baseToken < quoteToken
                ? Math.mulDiv(ratioX128, baseAmount, 1 << 128)
                : Math.mulDiv(1 << 128, baseAmount, ratioX128);
        }
    }
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

/// @title Math library for computing sqrt prices from ticks and vice versa
/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports
/// prices between 2**-128 and 2**128
library TickMath {
    error T();
    error R();

    /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
    int24 internal constant MIN_TICK = -887272;
    /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128
    int24 internal constant MAX_TICK = -MIN_TICK;

    /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
    uint160 internal constant MIN_SQRT_RATIO = 4295128739;
    /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
    uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;

    /// @notice Calculates sqrt(1.0001^tick) * 2^96
    /// @dev Throws if |tick| > max tick
    /// @param tick The input tick for the above formula
    /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)
    /// at the given tick
    function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
        unchecked {
            uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
            if (absTick > uint256(int256(MAX_TICK))) revert T();

            uint256 ratio =
                absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;
            if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
            if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
            if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
            if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;
            if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
            if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
            if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
            if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
            if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
            if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
            if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
            if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
            if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
            if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
            if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;
            if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
            if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;
            if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;
            if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;

            if (tick > 0) ratio = type(uint256).max / ratio;

            // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.
            // we then downcast because we know the result always fits within 160 bits due to our tick input constraint
            // we round up in the division so getTickAtSqrtRatio of the output price is always consistent
            sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
        }
    }

    /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio
    /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may
    /// ever return.
    /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96
    /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio
    function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {
        unchecked {
            // second inequality must be < because the price can never reach the price at the max tick
            if (!(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO)) revert R();
            uint256 ratio = uint256(sqrtPriceX96) << 32;

            uint256 r = ratio;
            uint256 msb = 0;

            assembly {
                let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(5, gt(r, 0xFFFFFFFF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(4, gt(r, 0xFFFF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(3, gt(r, 0xFF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(2, gt(r, 0xF))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := shl(1, gt(r, 0x3))
                msb := or(msb, f)
                r := shr(f, r)
            }
            assembly {
                let f := gt(r, 0x1)
                msb := or(msb, f)
            }

            if (msb >= 128) r = ratio >> (msb - 127);
            else r = ratio << (127 - msb);

            int256 log_2 = (int256(msb) - 128) << 64;

            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(63, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(62, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(61, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(60, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(59, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(58, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(57, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(56, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(55, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(54, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(53, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(52, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(51, f))
                r := shr(f, r)
            }
            assembly {
                r := shr(127, mul(r, r))
                let f := shr(128, r)
                log_2 := or(log_2, shl(50, f))
            }

            int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number

            int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);
            int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);

            tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;
        }
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_stax","type":"address"},{"internalType":"address","name":"_staxBuyBurn","type":"address"},{"internalType":"address","name":"_devWallet","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"Cooldown","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[],"name":"NoCyclesAvailable","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":"Prohibited","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"T","type":"error"},{"inputs":[],"name":"TWAP","type":"error"},{"inputs":[],"name":"TokenExists","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroInput","type":"error"},{"anonymous":false,"inputs":[],"name":"CycleUpdated","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"},{"inputs":[],"name":"STAX","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAX_BANK","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAX_BUY_BURN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAX_DEV","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAX_NFT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"batchClaimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"diamondHandPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"cycleId","type":"uint256"}],"name":"getCycleDistribution","outputs":[{"internalType":"uint256","name":"bankShare","type":"uint256"},{"internalType":"uint256","name":"buyBurnShare","type":"uint256"},{"internalType":"uint256","name":"genesisShare","type":"uint256"},{"internalType":"uint256","name":"nftHolderShare","type":"uint256"},{"internalType":"uint256","name":"diamondPoolShare","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getNextCycleTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"address","name":"account","type":"address"}],"name":"getRewards","outputs":[{"internalType":"bool[]","name":"availability","type":"bool[]"},{"internalType":"uint256","name":"totalPayout","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTitanXPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getX28MintStatus","outputs":[{"internalType":"bool","name":"isNativeMint","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getX28Pool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"handleStartPresale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"incentiveFeeBPS","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"lastClaimed","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastCycleMultipliers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastCycleTs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSwapValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minCyclePool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"secondsAgo","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"bps","type":"uint16"}],"name":"setIncentiveFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"setMaxSwapValue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"setMinCyclePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_staxNft","type":"address"},{"internalType":"address","name":"_staxBank","type":"address"}],"name":"setProtocolAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"limit","type":"uint32"}],"name":"setSecondsAgo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"limit","type":"uint32"}],"name":"setTwapDeviation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"limit","type":"uint32"}],"name":"setX28PriceDeviation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cycleId","type":"uint256"}],"name":"tokensPerMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"totalClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRewadsPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRewardPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"twapDeviation","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"updateCycle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"x28Deviation","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"}]

60e0346101b157601f612ec538819003918201601f19168301916001600160401b038311848410176101b6578084926080946040528339810103126101b157610047816101cc565b90610054602082016101cc565b9161006d6060610066604085016101cc565b93016101cc565b6001600160a01b0390911692831561019b57600180546001600160a01b0319908116909155600080549182168617815560405195916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a36ba18f07d736b90be5500000006006556aa56fa5b99019a5c8000000600a55600b80546001600160701b0319166b03e8000001f40000012c001e1790556001600160a01b0381161561018a576001600160a01b0383161561018a576001600160a01b0382161561018a5760805260c05260a05242600455612ce490816101e182396080518181816104c801528181610a050152610b07015260a0518181816106db0152610982015260c0518181816107010152610ece0152f35b63d92e233d60e01b60005260046000fd5b631e4fbdf760e01b600052600060045260246000fd5b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036101b15756fe6080604052600436101561001257600080fd5b60003560e01c80630141a57a146112ca5780630962ef791461119857806309c85e241461117a578063121420aa1461115f57806312165f0c14611141578063179397f7146111185780631a60ca0e146110f15780631ad7b127146110a05780631d881fc41461107f5780632918387214610efd57806330843c9514610eb8578063312828b414610e935780633260c8c714610e7157806338352b7514610e535780633a81104d14610e2a57806341db6dbf14610e0c57806350b88c4214610dee57806352049ace14610dbc5780636168973714610d68578063633dd14514610d41578063715018a614610cdc5780637263779114610c8b57806379ba509714610c025780638cd499a914610b8f5780638da5cb5b14610b6657806390f73d3c14610ae35780639d7f39cf14610ac8578063b38c554214610a9c578063b7d67f5014610a7e578063bbed0a5e14610a57578063bcc35ef314610a34578063c465a8dc146109ef578063d82a4faa146109b1578063dfac55c71461096c578063e30c397814610943578063e50bab681461052f578063e8148a37146104b5578063eaddbe0a14610497578063ef5d9ae81461045d578063f2fde38b146103e95763fb2f897a146101df57600080fd5b346103e45760403660031901126103e45760043567ffffffffffffffff81116103e4576102109036906004016112eb565b90610219611332565b60009183156103d35761027e61022e856113b1565b9461023c6040519687611348565b808652600061024a826113b1565b602088019590601f190136873760018060a01b03600254166040518080968194626cf0a360e91b8352878a60048501611452565b03915afa9081156103c75760009260009261039f575b5060005b8181106102eb57878787604051916040830193604084525180945260608301916000945b8086106102d157505082935060208301520390f35b9092602080600192865115158152019401950194906102bc565b6102f681838761148e565b3561030182866114d1565b5190600052600d60205263ffffffff604060002054169063ffffffff8160381c16918015600014610399575063ffffffff8160181c16915b80610393575084905b63ffffffff8281169084161080610359868e6114d1565b5261036a575b505050600101610298565b61038a926001949a9261ffff6103849360081c16916118ec565b90611391565b9690388061035f565b90610342565b91610339565b9092506103bf91503d806000833e6103b78183611348565b8101906113c9565b909138610294565b6040513d6000823e3d90fd5b63af458c0760e01b60005260046000fd5b600080fd5b346103e45760203660031901126103e45761040261131c565b61040a6118d8565b60018060a01b0316806bffffffffffffffffffffffff60a01b600154161760015560018060a01b03600054167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700600080a3005b346103e45760203660031901126103e4576001600160a01b0361047e61131c565b16600052600e6020526020604060002054604051908152f35b346103e45760003660031901126103e4576020600854604051908152f35b346103e45760003660031901126103e4577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330361051f57620a8bff19420142811161050957600455005b634e487b7160e01b600052601160045260246000fd5b6282b42960e81b60005260046000fd5b346103e45760403660031901126103e45761054861139e565b421061093257426004556000604060018060a01b0360025416600482518094819363632d7b1160e11b83525af180156103c75760009182916108ee575b5063ffffffff8216610596816117fe565b95926105a69792979591956116e7565b966105af611765565b976127106105bd888b611593565b0496898092600a5481101561084a575b505050600a5481106108395761061961271061061161060a826106026105f48d8398611758565b9e61ffff600b541690611593565b04809d611758565b9586611593565b049a84611593565b04966201d4c08611156107d4576106336127109184611593565b0491826005548710610752575b508561072b9a956106d99563ffffffff61069161068b6106ff9b6107259e9d9961067f6127106106766106c59c6106bd9c611593565b04600754611391565b600755816005556115a6565b936118bf565b16600052600c6020526106a982604060002054611391565b90600052600c602052604060002055611593565b600954611391565b6009556003546001600160a01b0316611965565b7f0000000000000000000000000000000000000000000000000000000000000000611965565b7f0000000000000000000000000000000000000000000000000000000000000000611965565b33611965565b7f660465679b26507e49dd0ba2ed076b0f87ed6197141d45e8b75afc3ae2f1026f600080a1005b9399949796925060075495610320870298878a0461032014881517156105095761072b9b63ffffffff61069161068b856106bd976107259f6127106106ff9f6106c59c6106d99f610676926107b9916107b18661067f98048093611758565b600755611391565b9e9f509c5050505097509b5050505095989950959a50610640565b8561072b9a956106d99563ffffffff61069161068b6106ff9b6127106107259f9e9a6108109061080a6106c59c6106bd9c611391565b90611593565b04806007549081610823575b50506115a6565b61082d9250611391565b6000600755388061081c565b631e9acf1760e31b60005260046000fd5b81929b506108e6935061271061086d6108668361038495611391565b9d83611593565b60035460405163a9059cbb60e01b60208201526001600160a01b0390911660248201529190046044820181905291906108d1906108b781606481015b03601f198101835282611348565b73f19308f923582a6f7c465e5ce7a9dc1bec6665b1611b14565b6108e16024359260043592611758565b6119ba565b8a80806105cd565b9190506040823d60401161092a575b8161090a60409383611348565b810103126109275750602061091e82611380565b91015182610585565b80fd5b3d91506108fd565b63b0782df760e01b60005260046000fd5b346103e45760003660031901126103e4576001546040516001600160a01b039091168152602090f35b346103e45760003660031901126103e4576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346103e45760203660031901126103e45760a06109cf6004356117fe565b926040929192519485526020850152604084015260608301526080820152f35b346103e45760003660031901126103e4576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346103e45760003660031901126103e4576020610a4f611765565b604051908152f35b346103e45760003660031901126103e457602063ffffffff600b5460501c16604051908152f35b346103e45760003660031901126103e4576020600454604051908152f35b346103e45760203660031901126103e457600435600052600c6020526020604060002054604051908152f35b346103e45760003660031901126103e4576020610a4f6116e7565b346103e45760403660031901126103e457610afc61131c565b610b04611332565b907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330361051f57600280546001600160a01b039283166001600160a01b03199182161790915560038054939092169216919091179055005b346103e45760003660031901126103e4576000546040516001600160a01b039091168152602090f35b346103e45760203660031901126103e45760043563ffffffff81168082036103e457610bb96118d8565b80156103d35761271010610bf15769ffffffff000000000000600b549160301b169069ffffffff000000000000191617600b55600080f35b632b0039c760e21b60005260046000fd5b346103e45760003660031901126103e457600154336001600160a01b0390911603610c7657600180546001600160a01b03199081169091556000805433928116831782556001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3005b63118cdaa760e01b6000523360045260246000fd5b346103e45760203660031901126103e45760043561ffff81168091036103e457610cb36118d8565b80158015610cd1575b610bf15761ffff19600b541617600b55600080f35b506103e88111610cbc565b346103e45760003660031901126103e457610cf56118d8565b600180546001600160a01b0319908116909155600080549182168155906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346103e45760003660031901126103e457602063ffffffff600b5460101c16604051908152f35b346103e45760203660031901126103e45760043563ffffffff81168082036103e457610d926118d8565b156103d357600b805463ffffffff60501b191660509290921b63ffffffff60501b16919091179055005b346103e45760203660031901126103e457600435600052600d602052602063ffffffff60406000205416604051908152f35b346103e45760003660031901126103e4576020600754604051908152f35b346103e45760003660031901126103e4576020600654604051908152f35b346103e45760003660031901126103e4576002546040516001600160a01b039091168152602090f35b346103e45760003660031901126103e4576020600554604051908152f35b346103e45760003660031901126103e457602061ffff600b5416604051908152f35b346103e45760003660031901126103e4576020610eae6115c6565b6040519015158152f35b346103e45760003660031901126103e4576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346103e45760203660031901126103e45760043567ffffffffffffffff81116103e457610f2e9036906004016112eb565b9081156103d357600254604051626cf0a360e91b81529060009082906001600160a01b03168180610f6433898960048501611452565b03915afa80156103c757600091600091611062575b5060009360005b818110610fbd57610fbb86610f9781600854611391565b60085533600052600e6020526040600020610fb3828254611391565b905533611965565b005b8061ffff61102d610fd1600194868a61148e565b3598610384610fe0858a6114d1565b518b600052600d60205263ffffffff604060002054169063ffffffff8160381c1691801560001461105c575063ffffffff8160181c16915b806110545750899586915b60081c16916118ec565b97600052600d60205263ffffffff6040600020911663ffffffff1982541617905501610f80565b958691611023565b91611018565b905061107991503d806000833e6103b78183611348565b84610f79565b346103e45760203660031901126103e4576110986118d8565b600435600655005b346103e45760203660031901126103e45760043563ffffffff81168082036103e4576110ca6118d8565b156103d35765ffffffff0000600b549160101b169065ffffffff0000191617600b55600080f35b346103e45760003660031901126103e457602063ffffffff600b5460301c16604051908152f35b346103e45760003660031901126103e4576003546040516001600160a01b039091168152602090f35b346103e45760003660031901126103e4576020600a54604051908152f35b346103e45760003660031901126103e4576020610a4f61139e565b346103e45760003660031901126103e4576020600954604051908152f35b346103e45760203660031901126103e4576044600435604060018060a01b03600254168151938480926337a5b34760e21b82528560048301523360248301525afa9182156103c757600090819361127d575b50611240610fbb9361ffff9284600052600d60205263ffffffff604060002054169163ffffffff8260381c16928015600014611277575063ffffffff8260181c16925b8061126d575093849160081c16916118ec565b91600052600d60205263ffffffff6040600020911663ffffffff19825416179055610f9781600854611391565b9050938491611023565b9261122d565b92506040833d6040116112c2575b8161129860409383611348565b81010312610927575061ffff611240836112b96020610fbb96519201611380565b945091506111ea565b3d915061128b565b346103e45760203660031901126103e4576112e36118d8565b600435600a55005b9181601f840112156103e45782359167ffffffffffffffff83116103e4576020808501948460051b0101116103e457565b600435906001600160a01b03821682036103e457565b602435906001600160a01b03821682036103e457565b90601f8019910116810190811067ffffffffffffffff82111761136a57604052565b634e487b7160e01b600052604160045260246000fd5b519063ffffffff821682036103e457565b9190820180921161050957565b600454620bdd8081018091116105095790565b67ffffffffffffffff811161136a5760051b60200190565b91906040838203126103e457825167ffffffffffffffff81116103e45783019080601f830112156103e45781516113ff816113b1565b9261140d6040519485611348565b81845260208085019260051b8201019283116103e457602001905b82821061144257505050602061143f919301611380565b90565b8151815260209182019101611428565b60408082528101839052929392916001600160fb1b0381116103e45760209160609160051b8091838601378301019360018060a01b0316910152565b919081101561149e5760051b0190565b634e487b7160e01b600052603260045260246000fd5b80511561149e5760200190565b80516001101561149e5760400190565b805182101561149e5760209160051b010190565b51906001600160a01b03821682036103e457565b519061ffff821682036103e457565b519081151582036103e457565b908160e09103126103e457611529816114e5565b9160208201518060020b81036103e45791611546604082016114f9565b91611553606083016114f9565b91611560608082016114f9565b9160a082015160ff811681036103e45760c061143f919301611508565b9060c882029180830460c8149015171561050957565b8181029291811591840414171561050957565b81156115b0570490565b634e487b7160e01b600052601260045260246000fd5b604051633850c7bd60e01b815260e0816004817399f60479da6a49d55eba34893958cdaacc710ee95afa9081156103c7576000916116b2575b5063ffffffff600b5460501c166127100163ffffffff81116105095763ffffffff1680670de0b6b3a76400000290670de0b6b3a7640000820403610509576127109004906000906001600160a01b03166001600160801b038111611695578061166791611593565b901561168357670de0b6b3a764000061167f91611d10565b1090565b61167f90670de0b6b3a7640000611c8b565b61167f9150806116a491611b8a565b670de0b6b3a7640000611be9565b6116d4915060e03d60e0116116e0575b6116cc8183611348565b810190611515565b505050505050386115ff565b503d6116c2565b6040516370a0823160e01b815230600482015260208160248173f19308f923582a6f7c465e5ce7a9dc1bec6665b15afa9081156103c757600091611729575090565b90506020813d602011611750575b8161174460209383611348565b810103126103e4575190565b3d9150611737565b9190820391821161050957565b6040516370a0823160e01b8152306004820152602081602481735c47902c8c80779cb99235e42c354e53f38c3b0d5afa9081156103c7576000916117ca575b506117c16117b861143f9260085490611391565b60095490611758565b60075490611758565b90506020813d6020116117f6575b816117e560209383611348565b810103126103e457516117c16117a4565b3d91506117d8565b602381116118a95760058110611894576004198101908111610509576118238161157d565b9182611f4003611f40811161050957926107d0019161271083116105095761184a9061157d565b61271081029080820461271014901517156105095782611869916115a6565b91627a120081156115b057819004916298968082156115b05782900491621e848081156115b0570490565b50600090611f4090610320906103e89060c890565b506107d090611d4c906103e8906104e29060fa90565b63ffffffff6000199116019063ffffffff821161050957565b6000546001600160a01b03163303610c7657565b91909163ffffffff831663ffffffff8216146119545761194c61ffff9163ffffffff61191a61143f966118bf565b16600052600c60205263ffffffff611937604060002054926118bf565b16600052600c60205260406000205490611758565b911690611593565b63e6097abf60e01b60005260046000fd5b60405163a9059cbb60e01b60208201526001600160a01b03909116602482015260448101919091526119b89061199e81606481016108a9565b735c47902c8c80779cb99235e42c354e53f38c3b0d611b14565b565b9092916000936119c86115c6565b15611a5357505090916119da82612a15565b735c47902c8c80779cb99235e42c354e53f38c3b0d3b15610927576040516302c190dd60e61b815260048101839052818160248183735c47902c8c80779cb99235e42c354e53f38c3b0d5af18015611a4857611a3557505090565b611a40828092611348565b610927575090565b6040513d84823e3d90fd5b600654831115611b0757611a7791611a6d91600654611d5f565b9160065490611758565b90611a8182612a15565b735c47902c8c80779cb99235e42c354e53f38c3b0d3b15611b03576040516302c190dd60e61b81526004810183905293808560248183735c47902c8c80779cb99235e42c354e53f38c3b0d5af1948515611af65761143f9495611ae6575b5050611391565b81611af091611348565b38611adf565b50604051903d90823e3d90fd5b8380fd5b909161143f939450611d5f565b600080611b3d9260018060a01b03169360208151910182865af1611b36612bc4565b9083612c4d565b8051908115159182611b67575b5050611b535750565b635274afe760e01b60005260045260246000fd5b81925090602091810103126103e4576020611b829101611508565b153880611b4a565b8181029160009160001982820992848085109403938085039414611bde5783600160401b1115611bcf575090600160401b910990828211900360c01b910360401c1790565b63227bc15360e01b8152600490fd5b925050505060401c90565b90608082901b9060001983600160801b0992828085109403938085039414611c7f5783821115611c6e578190600160801b09816000038216809204600281600302188082026002030280820260020302808202600203028082026002030280820260020302809102600203029360018380600003040190848311900302920304170290565b63227bc15360e01b60005260046000fd5b509061143f92506115a6565b9060c082901b9060001983600160c01b0992828085109403938085039414611c7f5783821115611c6e578190600160c01b09816000038216809204600281600302188082026002030280820260020302808202600203028082026002030280820260020302809102600203029360018380600003040190848311900302920304170290565b6000908281029260001981830992848085109403938085039414611d5457600160c01b841015611bcf5750600160c01b910990828211900360401b910360c01c1790565b925050505060c01c90565b600b54604051633850c7bd60e01b8152939290601081901c63ffffffff1660e0866004817399f60479da6a49d55eba34893958cdaacc710ee95afa80156103c7576000966000916129e8575b5061ffff169586156129be5761ffff600191160161ffff81116105095761ffff600097816040519363252c09d760e01b855216061660048201526080816024817399f60479da6a49d55eba34893958cdaacc710ee95afa9081156128b95787908892612999575b509015612918575b63ffffffff1663ffffffff42160363ffffffff81116127205790818163ffffffff80941610612910575b501680156128e65760405190611e5b606083611348565b600282526020820191604036843781611e73826114b4565b5287611e7e826114c1565b5287604051809463883bdbfd60e01b825260248201936020600484015251809452604482019093835b8181106128c45750508192935003817399f60479da6a49d55eba34893958cdaacc710ee95afa9182156128b95787908893612795575b50611ef4611eea826114c1565b5160060b916114b4565b5160060b900391667fffffffffffff198312667fffffffffffff84131761274a576001600160a01b03611f26826114c1565b5116906001600160a01b0390611f3b906114b4565b51169003906001600160a01b03821161274a578060060b9260060b831561278157667fffffffffffff19811460001985141661276d5783810560020b93898212918261275e575b5050612734575b6001600160a01b038181026001600160c01b03169190910490036127205760201b640100000000600160c01b0316156124d75760020b8581121561271a57808603905b620d89e8821161270b57869060018316156126f9576001600160881b036ffffcb933bd6fad37aa2d162d1a5940015b1692600281166126dd575b600481166126c1575b600881166126a5575b60108116612689575b6020811661266d575b60408116612651575b60808116612635575b6101008116612619575b61020081166125fd575b61040081166125e1575b61080081166125c5575b61100081166125a9575b612000811661258d575b6140008116612571575b6180008116612555575b620100008116612539575b62020000811661251e575b620400008116612503575b62080000166124eb575b136124c8575b63ffffffff908082166124c05786905b6001600160801b0386811692899260201c60ff91909116016001600160a01b03169081116124a457806120ff91611593565b9015612496579061210f91611d10565b915b60301c166127100363ffffffff8111612482576127109163ffffffff612138921690611593565b0481106124735760405192610100840184811067ffffffffffffffff82111761245f5760405273f19308f923582a6f7c465e5ce7a9dc1bec6665b184526020840190735c47902c8c80779cb99235e42c354e53f38c3b0d82526040850191612710835260608601903082526080870192835260a087019386855260c0880195865260e088019689885260405190636eb1769f60e11b825230600483015273e592427a0aece92de3edee1f18e0157c05861564602483015260208260448173f19308f923582a6f7c465e5ce7a9dc1bec6665b15afa8015612454578b9061241e575b6122239250611391565b91898060405194602086019063095ea7b360e01b825273e592427a0aece92de3edee1f18e0157c058615646024880152604487015260448652612267606487611348565b8551908273f19308f923582a6f7c465e5ce7a9dc1bec6665b15af19261228b612bc4565b93806123d6575b62ffffff9450806123b8575b1561236c575b5060405163414bf38960e01b815298516001600160a01b0390811660048b01529051811660248a0152905191909116604488015290518116606487015290516084860152905160a4850152905160c484015290511660e4820152602081610104818573e592427a0aece92de3edee1f18e0157c058615645af191821561236057809261232f57505090565b9091506020823d602011612358575b8161234b60209383611348565b8101031261092757505190565b3d915061233e565b604051903d90823e3d90fd5b6123b2906108b760405163095ea7b360e01b602082015273e592427a0aece92de3edee1f18e0157c0586156460248201528d6044820152604481526108b7606482611348565b386122a4565b5073f19308f923582a6f7c465e5ce7a9dc1bec6665b13b151561229e565b5083519384159081156123f0575b5062ffffff9450612292565b6020915080929394958101031261241a5790612414602062ffffff95949301611508565b386123e4565b8a80fd5b50906020813d60201161244c575b8161243960209383611348565b8101031261241a57906122239151612219565b3d915061242c565b6040513d8d823e3d90fd5b634e487b7160e01b86526041600452602486fd5b63431653f160e11b8452600484fd5b634e487b7160e01b86526011600452602486fd5b61249f91611c8b565b61210f565b6124ba929150806124b491611b8a565b90611be9565b91612111565b6001906120cd565b80156124d757600019046120bd565b634e487b7160e01b86526012600452602486fd5b916b048a170391f7dc42444e8fa20260801c916120b7565b6d2216e584f5fa1ea926041bedfe9890930260801c926120ad565b926e5d6af8dedb81196699c329225ee6040260801c926120a2565b926f09aa508b5b7a84e1c677de54f3e99bc90260801c92612097565b926f31be135f97d08fd981231505542fcfa60260801c9261208c565b926f70d869a156d2a1b890bb3df62baf32f70260801c92612082565b926fa9f746462d870fdf8a65dc1f90e061e50260801c92612078565b926fd097f3bdfd2022b8845ad8f792aa58250260801c9261206e565b926fe7159475a2c29b7443b29c7fa6e889d90260801c92612064565b926ff3392b0822b70005940c7a398e4b70f30260801c9261205a565b926ff987a7253ac413176f2b074cf7815e540260801c92612050565b926ffcbe86c7900a88aedcffc83b479aa3a40260801c92612046565b926ffe5dee046a99a2a811c461f1969c30530260801c9261203c565b926fff2ea16466c96a3843ec78b326b528610260801c92612033565b926fff973b41fa98c081472e6896dfb254c00260801c9261202a565b926fffcb9843d60f6159c9db58835c9266440260801c92612021565b926fffe5caca7e10e4e61c3624eaa0941cd00260801c92612018565b926ffff2e50f5f656932ef12357cf3c7fdcc0260801c9261200f565b926ffff97272373d413259a46990580e213a0260801c92612006565b6001600160881b03600160801b611ffb565b6315e4079d60e11b8752600487fd5b80611fcc565b634e487b7160e01b87526011600452602487fd5b91627fffff19811461274a576000190191611f89565b634e487b7160e01b88526011600452602488fd5b0760060b151590503880611f82565b634e487b7160e01b89526011600452602489fd5b634e487b7160e01b89526012600452602489fd5b9250503d8088843e6127a78184611348565b8201916040818403126128b557805167ffffffffffffffff81116128915781019083601f83011215612891578151916127df836113b1565b926127ed6040519485611348565b80845260208085019160051b830101918683116128b157602001905b8282106128995750505060208101519067ffffffffffffffff821161289557019280601f85011215612891578351612840816113b1565b9461284e6040519687611348565b81865260208087019260051b82010192831161241a57602001905b8282106128795750505038611edd565b60208091612886846114e5565b815201910190612869565b8880fd5b8980fd5b602080916128a684612c04565b815201910190612809565b8b80fd5b8780fd5b6040513d89823e3d90fd5b855163ffffffff1683526020958601958d955088945090920191600101611ea7565b60405162461bcd60e51b8152602060048201526002602482015261042560f41b6044820152606490fd5b905038611e44565b5060405163252c09d760e01b8152600481018790526080816024817399f60479da6a49d55eba34893958cdaacc710ee95afa9081156128b9579063ffffffff918891612967575b509050611e1a565b612989915060803d608011612992575b6129818183611348565b810190612c12565b5050503861295f565b503d612977565b90506129b4915060803d608011612992576129818183611348565b9291505038611e12565b60405162461bcd60e51b81526020600482015260026024820152614e4960f01b6044820152606490fd5b61ffff9750612a06915060e03d60e0116116e0576116cc8183611348565b50505098925090509690611dab565b604051636eb1769f60e11b8152306004820152735c47902c8c80779cb99235e42c354e53f38c3b0d60248201529060208260448173f19308f923582a6f7c465e5ce7a9dc1bec6665b15afa80156103c757600090612b90575b612a789250611391565b60008060405192602084019063095ea7b360e01b8252735c47902c8c80779cb99235e42c354e53f38c3b0d6024860152604485015260448452612abc606485611348565b8351908273f19308f923582a6f7c465e5ce7a9dc1bec6665b15af1612adf612bc4565b81612b59575b5080612b3b575b15612af45750565b6119b8906108b760405163095ea7b360e01b6020820152735c47902c8c80779cb99235e42c354e53f38c3b0d602482015260006044820152604481526108b7606482611348565b5073f19308f923582a6f7c465e5ce7a9dc1bec6665b13b1515612aec565b8051801592508215612b6e575b505038612ae5565b81925090602091810103126103e4576020612b899101611508565b3880612b66565b506020823d602011612bbc575b81612baa60209383611348565b810103126103e457612a789151612a6e565b3d9150612b9d565b3d15612bff573d9067ffffffffffffffff821161136a5760405191612bf3601f8201601f191660200184611348565b82523d6000602084013e565b606090565b51908160060b82036103e457565b91908260809103126103e457612c2782611380565b91612c3460208201612c04565b9161143f6060612c46604085016114e5565b9301611508565b90612c735750805115612c6257805190602001fd5b630a12f52160e11b60005260046000fd5b81511580612ca5575b612c84575090565b639996b31560e01b60009081526001600160a01b0391909116600452602490fd5b50803b15612c7c56fea26469706673582212204ab2539c2fee0b712f19c4628e4705514d020ea1e4c6f1aa2edcc6b989587b9964736f6c634300081a0033000000000000000000000000eb430c15ff72fec66f382e6905e2dcb88a805c510000000000000000000000004bd0f1886010253a18bbb401a788d8972c155b9d0000000000000000000000001698a3e248ff7f0f1f91fe82eedaa3f1212d1f7f00000000000000000000000055868cf3f370fa5daadb21f6d5543244a5770ad6

Deployed Bytecode

0x6080604052600436101561001257600080fd5b60003560e01c80630141a57a146112ca5780630962ef791461119857806309c85e241461117a578063121420aa1461115f57806312165f0c14611141578063179397f7146111185780631a60ca0e146110f15780631ad7b127146110a05780631d881fc41461107f5780632918387214610efd57806330843c9514610eb8578063312828b414610e935780633260c8c714610e7157806338352b7514610e535780633a81104d14610e2a57806341db6dbf14610e0c57806350b88c4214610dee57806352049ace14610dbc5780636168973714610d68578063633dd14514610d41578063715018a614610cdc5780637263779114610c8b57806379ba509714610c025780638cd499a914610b8f5780638da5cb5b14610b6657806390f73d3c14610ae35780639d7f39cf14610ac8578063b38c554214610a9c578063b7d67f5014610a7e578063bbed0a5e14610a57578063bcc35ef314610a34578063c465a8dc146109ef578063d82a4faa146109b1578063dfac55c71461096c578063e30c397814610943578063e50bab681461052f578063e8148a37146104b5578063eaddbe0a14610497578063ef5d9ae81461045d578063f2fde38b146103e95763fb2f897a146101df57600080fd5b346103e45760403660031901126103e45760043567ffffffffffffffff81116103e4576102109036906004016112eb565b90610219611332565b60009183156103d35761027e61022e856113b1565b9461023c6040519687611348565b808652600061024a826113b1565b602088019590601f190136873760018060a01b03600254166040518080968194626cf0a360e91b8352878a60048501611452565b03915afa9081156103c75760009260009261039f575b5060005b8181106102eb57878787604051916040830193604084525180945260608301916000945b8086106102d157505082935060208301520390f35b9092602080600192865115158152019401950194906102bc565b6102f681838761148e565b3561030182866114d1565b5190600052600d60205263ffffffff604060002054169063ffffffff8160381c16918015600014610399575063ffffffff8160181c16915b80610393575084905b63ffffffff8281169084161080610359868e6114d1565b5261036a575b505050600101610298565b61038a926001949a9261ffff6103849360081c16916118ec565b90611391565b9690388061035f565b90610342565b91610339565b9092506103bf91503d806000833e6103b78183611348565b8101906113c9565b909138610294565b6040513d6000823e3d90fd5b63af458c0760e01b60005260046000fd5b600080fd5b346103e45760203660031901126103e45761040261131c565b61040a6118d8565b60018060a01b0316806bffffffffffffffffffffffff60a01b600154161760015560018060a01b03600054167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700600080a3005b346103e45760203660031901126103e4576001600160a01b0361047e61131c565b16600052600e6020526020604060002054604051908152f35b346103e45760003660031901126103e4576020600854604051908152f35b346103e45760003660031901126103e4577f0000000000000000000000004bd0f1886010253a18bbb401a788d8972c155b9d6001600160a01b0316330361051f57620a8bff19420142811161050957600455005b634e487b7160e01b600052601160045260246000fd5b6282b42960e81b60005260046000fd5b346103e45760403660031901126103e45761054861139e565b421061093257426004556000604060018060a01b0360025416600482518094819363632d7b1160e11b83525af180156103c75760009182916108ee575b5063ffffffff8216610596816117fe565b95926105a69792979591956116e7565b966105af611765565b976127106105bd888b611593565b0496898092600a5481101561084a575b505050600a5481106108395761061961271061061161060a826106026105f48d8398611758565b9e61ffff600b541690611593565b04809d611758565b9586611593565b049a84611593565b04966201d4c08611156107d4576106336127109184611593565b0491826005548710610752575b508561072b9a956106d99563ffffffff61069161068b6106ff9b6107259e9d9961067f6127106106766106c59c6106bd9c611593565b04600754611391565b600755816005556115a6565b936118bf565b16600052600c6020526106a982604060002054611391565b90600052600c602052604060002055611593565b600954611391565b6009556003546001600160a01b0316611965565b7f0000000000000000000000001698a3e248ff7f0f1f91fe82eedaa3f1212d1f7f611965565b7f00000000000000000000000055868cf3f370fa5daadb21f6d5543244a5770ad6611965565b33611965565b7f660465679b26507e49dd0ba2ed076b0f87ed6197141d45e8b75afc3ae2f1026f600080a1005b9399949796925060075495610320870298878a0461032014881517156105095761072b9b63ffffffff61069161068b856106bd976107259f6127106106ff9f6106c59c6106d99f610676926107b9916107b18661067f98048093611758565b600755611391565b9e9f509c5050505097509b5050505095989950959a50610640565b8561072b9a956106d99563ffffffff61069161068b6106ff9b6127106107259f9e9a6108109061080a6106c59c6106bd9c611391565b90611593565b04806007549081610823575b50506115a6565b61082d9250611391565b6000600755388061081c565b631e9acf1760e31b60005260046000fd5b81929b506108e6935061271061086d6108668361038495611391565b9d83611593565b60035460405163a9059cbb60e01b60208201526001600160a01b0390911660248201529190046044820181905291906108d1906108b781606481015b03601f198101835282611348565b73f19308f923582a6f7c465e5ce7a9dc1bec6665b1611b14565b6108e16024359260043592611758565b6119ba565b8a80806105cd565b9190506040823d60401161092a575b8161090a60409383611348565b810103126109275750602061091e82611380565b91015182610585565b80fd5b3d91506108fd565b63b0782df760e01b60005260046000fd5b346103e45760003660031901126103e4576001546040516001600160a01b039091168152602090f35b346103e45760003660031901126103e4576040517f0000000000000000000000001698a3e248ff7f0f1f91fe82eedaa3f1212d1f7f6001600160a01b03168152602090f35b346103e45760203660031901126103e45760a06109cf6004356117fe565b926040929192519485526020850152604084015260608301526080820152f35b346103e45760003660031901126103e4576040517f0000000000000000000000004bd0f1886010253a18bbb401a788d8972c155b9d6001600160a01b03168152602090f35b346103e45760003660031901126103e4576020610a4f611765565b604051908152f35b346103e45760003660031901126103e457602063ffffffff600b5460501c16604051908152f35b346103e45760003660031901126103e4576020600454604051908152f35b346103e45760203660031901126103e457600435600052600c6020526020604060002054604051908152f35b346103e45760003660031901126103e4576020610a4f6116e7565b346103e45760403660031901126103e457610afc61131c565b610b04611332565b907f0000000000000000000000004bd0f1886010253a18bbb401a788d8972c155b9d6001600160a01b0316330361051f57600280546001600160a01b039283166001600160a01b03199182161790915560038054939092169216919091179055005b346103e45760003660031901126103e4576000546040516001600160a01b039091168152602090f35b346103e45760203660031901126103e45760043563ffffffff81168082036103e457610bb96118d8565b80156103d35761271010610bf15769ffffffff000000000000600b549160301b169069ffffffff000000000000191617600b55600080f35b632b0039c760e21b60005260046000fd5b346103e45760003660031901126103e457600154336001600160a01b0390911603610c7657600180546001600160a01b03199081169091556000805433928116831782556001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3005b63118cdaa760e01b6000523360045260246000fd5b346103e45760203660031901126103e45760043561ffff81168091036103e457610cb36118d8565b80158015610cd1575b610bf15761ffff19600b541617600b55600080f35b506103e88111610cbc565b346103e45760003660031901126103e457610cf56118d8565b600180546001600160a01b0319908116909155600080549182168155906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346103e45760003660031901126103e457602063ffffffff600b5460101c16604051908152f35b346103e45760203660031901126103e45760043563ffffffff81168082036103e457610d926118d8565b156103d357600b805463ffffffff60501b191660509290921b63ffffffff60501b16919091179055005b346103e45760203660031901126103e457600435600052600d602052602063ffffffff60406000205416604051908152f35b346103e45760003660031901126103e4576020600754604051908152f35b346103e45760003660031901126103e4576020600654604051908152f35b346103e45760003660031901126103e4576002546040516001600160a01b039091168152602090f35b346103e45760003660031901126103e4576020600554604051908152f35b346103e45760003660031901126103e457602061ffff600b5416604051908152f35b346103e45760003660031901126103e4576020610eae6115c6565b6040519015158152f35b346103e45760003660031901126103e4576040517f00000000000000000000000055868cf3f370fa5daadb21f6d5543244a5770ad66001600160a01b03168152602090f35b346103e45760203660031901126103e45760043567ffffffffffffffff81116103e457610f2e9036906004016112eb565b9081156103d357600254604051626cf0a360e91b81529060009082906001600160a01b03168180610f6433898960048501611452565b03915afa80156103c757600091600091611062575b5060009360005b818110610fbd57610fbb86610f9781600854611391565b60085533600052600e6020526040600020610fb3828254611391565b905533611965565b005b8061ffff61102d610fd1600194868a61148e565b3598610384610fe0858a6114d1565b518b600052600d60205263ffffffff604060002054169063ffffffff8160381c1691801560001461105c575063ffffffff8160181c16915b806110545750899586915b60081c16916118ec565b97600052600d60205263ffffffff6040600020911663ffffffff1982541617905501610f80565b958691611023565b91611018565b905061107991503d806000833e6103b78183611348565b84610f79565b346103e45760203660031901126103e4576110986118d8565b600435600655005b346103e45760203660031901126103e45760043563ffffffff81168082036103e4576110ca6118d8565b156103d35765ffffffff0000600b549160101b169065ffffffff0000191617600b55600080f35b346103e45760003660031901126103e457602063ffffffff600b5460301c16604051908152f35b346103e45760003660031901126103e4576003546040516001600160a01b039091168152602090f35b346103e45760003660031901126103e4576020600a54604051908152f35b346103e45760003660031901126103e4576020610a4f61139e565b346103e45760003660031901126103e4576020600954604051908152f35b346103e45760203660031901126103e4576044600435604060018060a01b03600254168151938480926337a5b34760e21b82528560048301523360248301525afa9182156103c757600090819361127d575b50611240610fbb9361ffff9284600052600d60205263ffffffff604060002054169163ffffffff8260381c16928015600014611277575063ffffffff8260181c16925b8061126d575093849160081c16916118ec565b91600052600d60205263ffffffff6040600020911663ffffffff19825416179055610f9781600854611391565b9050938491611023565b9261122d565b92506040833d6040116112c2575b8161129860409383611348565b81010312610927575061ffff611240836112b96020610fbb96519201611380565b945091506111ea565b3d915061128b565b346103e45760203660031901126103e4576112e36118d8565b600435600a55005b9181601f840112156103e45782359167ffffffffffffffff83116103e4576020808501948460051b0101116103e457565b600435906001600160a01b03821682036103e457565b602435906001600160a01b03821682036103e457565b90601f8019910116810190811067ffffffffffffffff82111761136a57604052565b634e487b7160e01b600052604160045260246000fd5b519063ffffffff821682036103e457565b9190820180921161050957565b600454620bdd8081018091116105095790565b67ffffffffffffffff811161136a5760051b60200190565b91906040838203126103e457825167ffffffffffffffff81116103e45783019080601f830112156103e45781516113ff816113b1565b9261140d6040519485611348565b81845260208085019260051b8201019283116103e457602001905b82821061144257505050602061143f919301611380565b90565b8151815260209182019101611428565b60408082528101839052929392916001600160fb1b0381116103e45760209160609160051b8091838601378301019360018060a01b0316910152565b919081101561149e5760051b0190565b634e487b7160e01b600052603260045260246000fd5b80511561149e5760200190565b80516001101561149e5760400190565b805182101561149e5760209160051b010190565b51906001600160a01b03821682036103e457565b519061ffff821682036103e457565b519081151582036103e457565b908160e09103126103e457611529816114e5565b9160208201518060020b81036103e45791611546604082016114f9565b91611553606083016114f9565b91611560608082016114f9565b9160a082015160ff811681036103e45760c061143f919301611508565b9060c882029180830460c8149015171561050957565b8181029291811591840414171561050957565b81156115b0570490565b634e487b7160e01b600052601260045260246000fd5b604051633850c7bd60e01b815260e0816004817399f60479da6a49d55eba34893958cdaacc710ee95afa9081156103c7576000916116b2575b5063ffffffff600b5460501c166127100163ffffffff81116105095763ffffffff1680670de0b6b3a76400000290670de0b6b3a7640000820403610509576127109004906000906001600160a01b03166001600160801b038111611695578061166791611593565b901561168357670de0b6b3a764000061167f91611d10565b1090565b61167f90670de0b6b3a7640000611c8b565b61167f9150806116a491611b8a565b670de0b6b3a7640000611be9565b6116d4915060e03d60e0116116e0575b6116cc8183611348565b810190611515565b505050505050386115ff565b503d6116c2565b6040516370a0823160e01b815230600482015260208160248173f19308f923582a6f7c465e5ce7a9dc1bec6665b15afa9081156103c757600091611729575090565b90506020813d602011611750575b8161174460209383611348565b810103126103e4575190565b3d9150611737565b9190820391821161050957565b6040516370a0823160e01b8152306004820152602081602481735c47902c8c80779cb99235e42c354e53f38c3b0d5afa9081156103c7576000916117ca575b506117c16117b861143f9260085490611391565b60095490611758565b60075490611758565b90506020813d6020116117f6575b816117e560209383611348565b810103126103e457516117c16117a4565b3d91506117d8565b602381116118a95760058110611894576004198101908111610509576118238161157d565b9182611f4003611f40811161050957926107d0019161271083116105095761184a9061157d565b61271081029080820461271014901517156105095782611869916115a6565b91627a120081156115b057819004916298968082156115b05782900491621e848081156115b0570490565b50600090611f4090610320906103e89060c890565b506107d090611d4c906103e8906104e29060fa90565b63ffffffff6000199116019063ffffffff821161050957565b6000546001600160a01b03163303610c7657565b91909163ffffffff831663ffffffff8216146119545761194c61ffff9163ffffffff61191a61143f966118bf565b16600052600c60205263ffffffff611937604060002054926118bf565b16600052600c60205260406000205490611758565b911690611593565b63e6097abf60e01b60005260046000fd5b60405163a9059cbb60e01b60208201526001600160a01b03909116602482015260448101919091526119b89061199e81606481016108a9565b735c47902c8c80779cb99235e42c354e53f38c3b0d611b14565b565b9092916000936119c86115c6565b15611a5357505090916119da82612a15565b735c47902c8c80779cb99235e42c354e53f38c3b0d3b15610927576040516302c190dd60e61b815260048101839052818160248183735c47902c8c80779cb99235e42c354e53f38c3b0d5af18015611a4857611a3557505090565b611a40828092611348565b610927575090565b6040513d84823e3d90fd5b600654831115611b0757611a7791611a6d91600654611d5f565b9160065490611758565b90611a8182612a15565b735c47902c8c80779cb99235e42c354e53f38c3b0d3b15611b03576040516302c190dd60e61b81526004810183905293808560248183735c47902c8c80779cb99235e42c354e53f38c3b0d5af1948515611af65761143f9495611ae6575b5050611391565b81611af091611348565b38611adf565b50604051903d90823e3d90fd5b8380fd5b909161143f939450611d5f565b600080611b3d9260018060a01b03169360208151910182865af1611b36612bc4565b9083612c4d565b8051908115159182611b67575b5050611b535750565b635274afe760e01b60005260045260246000fd5b81925090602091810103126103e4576020611b829101611508565b153880611b4a565b8181029160009160001982820992848085109403938085039414611bde5783600160401b1115611bcf575090600160401b910990828211900360c01b910360401c1790565b63227bc15360e01b8152600490fd5b925050505060401c90565b90608082901b9060001983600160801b0992828085109403938085039414611c7f5783821115611c6e578190600160801b09816000038216809204600281600302188082026002030280820260020302808202600203028082026002030280820260020302809102600203029360018380600003040190848311900302920304170290565b63227bc15360e01b60005260046000fd5b509061143f92506115a6565b9060c082901b9060001983600160c01b0992828085109403938085039414611c7f5783821115611c6e578190600160c01b09816000038216809204600281600302188082026002030280820260020302808202600203028082026002030280820260020302809102600203029360018380600003040190848311900302920304170290565b6000908281029260001981830992848085109403938085039414611d5457600160c01b841015611bcf5750600160c01b910990828211900360401b910360c01c1790565b925050505060c01c90565b600b54604051633850c7bd60e01b8152939290601081901c63ffffffff1660e0866004817399f60479da6a49d55eba34893958cdaacc710ee95afa80156103c7576000966000916129e8575b5061ffff169586156129be5761ffff600191160161ffff81116105095761ffff600097816040519363252c09d760e01b855216061660048201526080816024817399f60479da6a49d55eba34893958cdaacc710ee95afa9081156128b95787908892612999575b509015612918575b63ffffffff1663ffffffff42160363ffffffff81116127205790818163ffffffff80941610612910575b501680156128e65760405190611e5b606083611348565b600282526020820191604036843781611e73826114b4565b5287611e7e826114c1565b5287604051809463883bdbfd60e01b825260248201936020600484015251809452604482019093835b8181106128c45750508192935003817399f60479da6a49d55eba34893958cdaacc710ee95afa9182156128b95787908893612795575b50611ef4611eea826114c1565b5160060b916114b4565b5160060b900391667fffffffffffff198312667fffffffffffff84131761274a576001600160a01b03611f26826114c1565b5116906001600160a01b0390611f3b906114b4565b51169003906001600160a01b03821161274a578060060b9260060b831561278157667fffffffffffff19811460001985141661276d5783810560020b93898212918261275e575b5050612734575b6001600160a01b038181026001600160c01b03169190910490036127205760201b640100000000600160c01b0316156124d75760020b8581121561271a57808603905b620d89e8821161270b57869060018316156126f9576001600160881b036ffffcb933bd6fad37aa2d162d1a5940015b1692600281166126dd575b600481166126c1575b600881166126a5575b60108116612689575b6020811661266d575b60408116612651575b60808116612635575b6101008116612619575b61020081166125fd575b61040081166125e1575b61080081166125c5575b61100081166125a9575b612000811661258d575b6140008116612571575b6180008116612555575b620100008116612539575b62020000811661251e575b620400008116612503575b62080000166124eb575b136124c8575b63ffffffff908082166124c05786905b6001600160801b0386811692899260201c60ff91909116016001600160a01b03169081116124a457806120ff91611593565b9015612496579061210f91611d10565b915b60301c166127100363ffffffff8111612482576127109163ffffffff612138921690611593565b0481106124735760405192610100840184811067ffffffffffffffff82111761245f5760405273f19308f923582a6f7c465e5ce7a9dc1bec6665b184526020840190735c47902c8c80779cb99235e42c354e53f38c3b0d82526040850191612710835260608601903082526080870192835260a087019386855260c0880195865260e088019689885260405190636eb1769f60e11b825230600483015273e592427a0aece92de3edee1f18e0157c05861564602483015260208260448173f19308f923582a6f7c465e5ce7a9dc1bec6665b15afa8015612454578b9061241e575b6122239250611391565b91898060405194602086019063095ea7b360e01b825273e592427a0aece92de3edee1f18e0157c058615646024880152604487015260448652612267606487611348565b8551908273f19308f923582a6f7c465e5ce7a9dc1bec6665b15af19261228b612bc4565b93806123d6575b62ffffff9450806123b8575b1561236c575b5060405163414bf38960e01b815298516001600160a01b0390811660048b01529051811660248a0152905191909116604488015290518116606487015290516084860152905160a4850152905160c484015290511660e4820152602081610104818573e592427a0aece92de3edee1f18e0157c058615645af191821561236057809261232f57505090565b9091506020823d602011612358575b8161234b60209383611348565b8101031261092757505190565b3d915061233e565b604051903d90823e3d90fd5b6123b2906108b760405163095ea7b360e01b602082015273e592427a0aece92de3edee1f18e0157c0586156460248201528d6044820152604481526108b7606482611348565b386122a4565b5073f19308f923582a6f7c465e5ce7a9dc1bec6665b13b151561229e565b5083519384159081156123f0575b5062ffffff9450612292565b6020915080929394958101031261241a5790612414602062ffffff95949301611508565b386123e4565b8a80fd5b50906020813d60201161244c575b8161243960209383611348565b8101031261241a57906122239151612219565b3d915061242c565b6040513d8d823e3d90fd5b634e487b7160e01b86526041600452602486fd5b63431653f160e11b8452600484fd5b634e487b7160e01b86526011600452602486fd5b61249f91611c8b565b61210f565b6124ba929150806124b491611b8a565b90611be9565b91612111565b6001906120cd565b80156124d757600019046120bd565b634e487b7160e01b86526012600452602486fd5b916b048a170391f7dc42444e8fa20260801c916120b7565b6d2216e584f5fa1ea926041bedfe9890930260801c926120ad565b926e5d6af8dedb81196699c329225ee6040260801c926120a2565b926f09aa508b5b7a84e1c677de54f3e99bc90260801c92612097565b926f31be135f97d08fd981231505542fcfa60260801c9261208c565b926f70d869a156d2a1b890bb3df62baf32f70260801c92612082565b926fa9f746462d870fdf8a65dc1f90e061e50260801c92612078565b926fd097f3bdfd2022b8845ad8f792aa58250260801c9261206e565b926fe7159475a2c29b7443b29c7fa6e889d90260801c92612064565b926ff3392b0822b70005940c7a398e4b70f30260801c9261205a565b926ff987a7253ac413176f2b074cf7815e540260801c92612050565b926ffcbe86c7900a88aedcffc83b479aa3a40260801c92612046565b926ffe5dee046a99a2a811c461f1969c30530260801c9261203c565b926fff2ea16466c96a3843ec78b326b528610260801c92612033565b926fff973b41fa98c081472e6896dfb254c00260801c9261202a565b926fffcb9843d60f6159c9db58835c9266440260801c92612021565b926fffe5caca7e10e4e61c3624eaa0941cd00260801c92612018565b926ffff2e50f5f656932ef12357cf3c7fdcc0260801c9261200f565b926ffff97272373d413259a46990580e213a0260801c92612006565b6001600160881b03600160801b611ffb565b6315e4079d60e11b8752600487fd5b80611fcc565b634e487b7160e01b87526011600452602487fd5b91627fffff19811461274a576000190191611f89565b634e487b7160e01b88526011600452602488fd5b0760060b151590503880611f82565b634e487b7160e01b89526011600452602489fd5b634e487b7160e01b89526012600452602489fd5b9250503d8088843e6127a78184611348565b8201916040818403126128b557805167ffffffffffffffff81116128915781019083601f83011215612891578151916127df836113b1565b926127ed6040519485611348565b80845260208085019160051b830101918683116128b157602001905b8282106128995750505060208101519067ffffffffffffffff821161289557019280601f85011215612891578351612840816113b1565b9461284e6040519687611348565b81865260208087019260051b82010192831161241a57602001905b8282106128795750505038611edd565b60208091612886846114e5565b815201910190612869565b8880fd5b8980fd5b602080916128a684612c04565b815201910190612809565b8b80fd5b8780fd5b6040513d89823e3d90fd5b855163ffffffff1683526020958601958d955088945090920191600101611ea7565b60405162461bcd60e51b8152602060048201526002602482015261042560f41b6044820152606490fd5b905038611e44565b5060405163252c09d760e01b8152600481018790526080816024817399f60479da6a49d55eba34893958cdaacc710ee95afa9081156128b9579063ffffffff918891612967575b509050611e1a565b612989915060803d608011612992575b6129818183611348565b810190612c12565b5050503861295f565b503d612977565b90506129b4915060803d608011612992576129818183611348565b9291505038611e12565b60405162461bcd60e51b81526020600482015260026024820152614e4960f01b6044820152606490fd5b61ffff9750612a06915060e03d60e0116116e0576116cc8183611348565b50505098925090509690611dab565b604051636eb1769f60e11b8152306004820152735c47902c8c80779cb99235e42c354e53f38c3b0d60248201529060208260448173f19308f923582a6f7c465e5ce7a9dc1bec6665b15afa80156103c757600090612b90575b612a789250611391565b60008060405192602084019063095ea7b360e01b8252735c47902c8c80779cb99235e42c354e53f38c3b0d6024860152604485015260448452612abc606485611348565b8351908273f19308f923582a6f7c465e5ce7a9dc1bec6665b15af1612adf612bc4565b81612b59575b5080612b3b575b15612af45750565b6119b8906108b760405163095ea7b360e01b6020820152735c47902c8c80779cb99235e42c354e53f38c3b0d602482015260006044820152604481526108b7606482611348565b5073f19308f923582a6f7c465e5ce7a9dc1bec6665b13b1515612aec565b8051801592508215612b6e575b505038612ae5565b81925090602091810103126103e4576020612b899101611508565b3880612b66565b506020823d602011612bbc575b81612baa60209383611348565b810103126103e457612a789151612a6e565b3d9150612b9d565b3d15612bff573d9067ffffffffffffffff821161136a5760405191612bf3601f8201601f191660200184611348565b82523d6000602084013e565b606090565b51908160060b82036103e457565b91908260809103126103e457612c2782611380565b91612c3460208201612c04565b9161143f6060612c46604085016114e5565b9301611508565b90612c735750805115612c6257805190602001fd5b630a12f52160e11b60005260046000fd5b81511580612ca5575b612c84575090565b639996b31560e01b60009081526001600160a01b0391909116600452602490fd5b50803b15612c7c56fea26469706673582212204ab2539c2fee0b712f19c4628e4705514d020ea1e4c6f1aa2edcc6b989587b9964736f6c634300081a0033

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

000000000000000000000000eb430c15ff72fec66f382e6905e2dcb88a805c510000000000000000000000004bd0f1886010253a18bbb401a788d8972c155b9d0000000000000000000000001698a3e248ff7f0f1f91fe82eedaa3f1212d1f7f00000000000000000000000055868cf3f370fa5daadb21f6d5543244a5770ad6

-----Decoded View---------------
Arg [0] : _owner (address): 0xeB430C15Ff72feC66f382E6905e2DCB88a805C51
Arg [1] : _stax (address): 0x4bd0F1886010253a18BBb401a788d8972c155b9d
Arg [2] : _staxBuyBurn (address): 0x1698a3e248FF7F0f1f91FE82Eedaa3F1212D1F7F
Arg [3] : _devWallet (address): 0x55868cf3f370fa5daADB21f6D5543244A5770Ad6

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000eb430c15ff72fec66f382e6905e2dcb88a805c51
Arg [1] : 0000000000000000000000004bd0f1886010253a18bbb401a788d8972c155b9d
Arg [2] : 0000000000000000000000001698a3e248ff7f0f1f91fe82eedaa3f1212d1f7f
Arg [3] : 00000000000000000000000055868cf3f370fa5daadb21f6d5543244a5770ad6


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

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