false
true
0

Contract Address Details

0xAbEaBFE146F347537b82426B4c4d8F1E768721C7

Token
testt (TSTT)
Creator
0x7dc818–79b113 at 0xf40acd–64a1de
Balance
0 PLS ( )
Tokens
Fetching tokens...
Transactions
22 Transactions
Transfers
133 Transfers
Gas Used
3,943,909
Last Balance Update
26413911
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been partially verified via Sourcify. View contract in Sourcify repository
Contract name:
TokenTax




Optimization enabled
true
Compiler version
v0.8.31+commit.fd3a2265




Optimization runs
1
EVM Version
shanghai




Verified at
2026-04-17T11:58:35.833769Z

Constructor Arguments

000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000b1ae112d59513618a04fd5e83bd7efba05a3f000000000000000000000000a0419404ef7b81d9ec64367eb68e5f425eace6180000000000000000000000000000000000000000033b2e3c9fd0803ce80000000000000000000000000000000000000000000000000000000000000000000240000000000000000000000000cae394005c9c4c309621c53d53db9ceb701fc8d8000000000000000000000000000b1ae112d59513618a04fd5e83bd7efba05a3f000000000000000000000000d3397b405a2272f5c27fc673be20579f22f59d6c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000574657374740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004545354540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000145000000000000000000000000a0419404ef7b81d9ec64367eb68e5f425eace61800000000000000000000000057fde0a71132198bbec939b98976993d8d89d225000000000000000000000000000000000000000000000000000000000000dead000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064000000000000000000000000a0419404ef7b81d9ec64367eb68e5f425eace61800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000dead00000000000000000000000090f055196778e541018482213ca50648cea1a050000000000000000000000000000000000000000000000000000000000000dead00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dead00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
              

src/Tokens/TokenFactoryTaxV2.sol

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

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "./interfaces/IVestingHub.sol";

// contracts/Tokens/interfaces/Helpers.sol

interface IWETH_0 {
    function withdraw(uint256 wad) external;
}
interface Helpers {
    enum TaxType {
        Burn,
        ExternalBurn,
        Dev,
        Reflection,
        Yield,
        Liquify
    }
    enum TaxMoment {
        Both,
        Buy,
        Sell
    }

    struct Tax {
        uint256 id;
        TaxType taxType;
        TaxMoment taxMoment;
        uint256 percentage;
        address receiver;
        address tokenAddress;
        address burnAddress; //not used for ExternalBurn
        bool rewardInPls; //not used for ExternalBurn
        uint256 amountAccumulated;
    }

    function getBestPair(
        address tokenA,
        address tokenB,
        address[] memory routers
    ) external view returns (address bestPair, address bestRouter);

    function isPair(
        address _address,
        address _tokenAddress
    ) external view returns (bool);

    function isBuy(
        address _from,
        address _to,
        address _tokenAddress
    ) external view returns (bool);

    function isSell(
        address _from,
        address _to,
        address _tokenAddress
    ) external view returns (bool);

    function getTokenWPLSPath(
        address tokenAddress
    ) external pure returns (address[] memory path);

    function getWPLSBuyBurnPath(
        address tokenAddress
    ) external pure returns (address[] memory path);

    function getProcessingAmount(
        uint256 accumulatedAmount,
        uint256 currentSwapAmount
    )
        external
        pure
        returns (uint256 processAmount, uint256 newAccumulatedAmount);

    function calculateTaxAmount(
        uint256 originalAmount,
        uint256 taxPercentage,
        uint256 Fee,
        bool FeeEnabled,
        uint256 globalDivider
    ) external pure returns (uint256 taxAmount, uint256 FeeAmount);

    function hasAccumulatedTaxes(
        Tax[] memory taxes
    ) external pure returns (bool);

    function getTotalTaxs(Tax[] memory taxes) external pure returns (uint256);

    function cleanPendingReflections(
        address account,
        address tokenAddress,
        uint256 reflectionsPerShareAmount,
        uint256 reflectionDebt,
        uint256 precision
    ) external view returns (uint256);

    function pendingYields(
        address account,
        address tokenAddress,
        uint256 reflectionsPerShareAmount,
        uint256 reflectionDebt,
        uint256 precision
    ) external view returns (uint256);

    function isExcludedFromTax(
        address from,
        address to,
        address SmartTrader,
        address deployer,
        address thisContract
    ) external pure returns (bool);

    function taxesInitialize(
        Helpers.Tax[] memory _taxes
    )
        external
        pure
        returns (bool, bool, bool, Helpers.Tax[] memory, address[] memory);

    function isDeadAddress(address _address) external pure returns (bool);
}

// contracts/Tokens/interfaces/ISmartTokenFactory.sol

interface ISmartTokenFactory {
    function FEE() external view returns (uint256);
    function WALLET() external view returns (address);
    function NEON_LP_FEE() external view returns (uint256);
    function NEON_LP_RECEIVER() external view returns (address);
}

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

// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol

// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

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

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

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

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

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

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

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

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

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

// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

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

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

// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)

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

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

    uint256 private _status;

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

    constructor() {
        _status = NOT_ENTERED;
    }

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

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

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

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

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

// lib/v2-core/contracts/interfaces/IUniswapV2Factory.sol

interface IUniswapV2Factory {
    event PairCreated(
        address indexed token0,
        address indexed token1,
        address pair,
        uint
    );

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(
        address tokenA,
        address tokenB
    ) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(
        address tokenA,
        address tokenB
    ) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}

// lib/v2-core/contracts/interfaces/IUniswapV2Pair.sol

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(
        address owner,
        address spender
    ) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(
        address from,
        address to,
        uint value
    ) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(
        address owner,
        address spender,
        uint value,
        uint deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(
        address indexed sender,
        uint amount0,
        uint amount1,
        address indexed to
    );
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves()
        external
        view
        returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(
        uint amount0Out,
        uint amount1Out,
        address to,
        bytes calldata data
    ) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

// lib/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    )
        external
        payable
        returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable returns (uint[] memory amounts);
    function swapTokensForExactETH(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactTokensForETH(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapETHForExactTokens(
        uint amountOut,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable returns (uint[] memory amounts);

    function quote(
        uint amountA,
        uint reserveA,
        uint reserveB
    ) external pure returns (uint amountB);
    function getAmountOut(
        uint amountIn,
        uint reserveIn,
        uint reserveOut
    ) external pure returns (uint amountOut);
    function getAmountIn(
        uint amountOut,
        uint reserveIn,
        uint reserveOut
    ) external pure returns (uint amountIn);
    function getAmountsOut(
        uint amountIn,
        address[] calldata path
    ) external view returns (uint[] memory amounts);
    function getAmountsIn(
        uint amountOut,
        address[] calldata path
    ) external view returns (uint[] memory amounts);
}

// lib/openzeppelin-contracts/contracts/access/Ownable.sol

// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.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);
    }
}

// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol

// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)

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

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

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

// lib/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external returns (uint amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}

// contracts/Tokens/Manager.sol

contract Manager {
    // For yield tax tokens
    struct UserYield {
        uint256 reflectionDebt;
    }
    struct YieldToken {
        address tokenAddress;
        uint256 reflectionsPerShareAmount;
    }
    YieldToken[] internal yieldTokens;

    uint256 internal PRECISION;
    uint256 internal reflectionsPerShareAmount;
    uint256 internal wethYieldBalance;
    address internal helpers;
    address internal wethAddress = 0xA1077a294dDE1B09bB078844df40758a5D0f9a27; // WPLS on PulseChain

    mapping(address => uint256) internal reflectionDebt;
    mapping(address => bool) public isReflectionExcluded;
    mapping(address => mapping(address => UserYield)) internal userYields;
    mapping(address => uint256[]) internal yieldTokenReflectionDebts;

    bool internal inSwap;

    modifier lockSwap() {
        inSwap = true;
        _;
        inSwap = false;
    }

    constructor() // address _helpers
    {
        PRECISION = 10 ** 28;
        helpers = 0xd3397b405A2272F5C27fc673BE20579f22f59D6C;
    }

    // ------------------------------------------ REFLECTIONS -------------------------------------------------//
    function getCurrentReflectionsPerShareAmount()
        external
        view
        returns (uint256)
    {
        return reflectionsPerShareAmount;
    }

    function isExcludedFromReflections(
        address account
    ) public view returns (bool) {
        return isReflectionExcluded[account];
    }

    function pendingReflections(address account) public view returns (uint256) {
        if (isExcludedFromReflections(account)) {
            return 0;
        }
        return cleanPendingReflections(account);
    }

    function cleanPendingReflections(
        address account
    ) internal view returns (uint256) {
        return
            Helpers(helpers).cleanPendingReflections(
                account,
                address(this),
                reflectionsPerShareAmount,
                reflectionDebt[account],
                PRECISION
            );
    }

    function updateAndClaimReflections(
        address from,
        address to,
        address deployer
    )
        internal
        returns (uint256 fromAmount, uint256 toAmount, uint256 deployerAmount)
    {
        if (from == to) {
            fromAmount = isExcludedFromReflections(from)
                ? 0
                : pendingReflections(from);
            toAmount = 0; // Set to zero to avoid double claiming
        } else {
            fromAmount = isExcludedFromReflections(from)
                ? 0
                : pendingReflections(from);
            toAmount = isExcludedFromReflections(to)
                ? 0
                : pendingReflections(to);
        }
        deployerAmount = cleanPendingReflections(deployer);
        reflectionDebt[deployer] = reflectionsPerShareAmount;
        reflectionDebt[from] = reflectionsPerShareAmount;
        reflectionDebt[to] = reflectionsPerShareAmount;
    }

    // function tokenPendingReflections() public view returns (uint256) {
    //     uint256 currentBalance = IERC20(address(this)).balanceOf(address(this));
    //     uint256 newReflectionDebt = reflectionsPerShareAmount;
    //     if (newReflectionDebt <= reflectionDebt[address(this)]) {
    //         return 0;
    //     }
    //     return (newReflectionDebt - reflectionDebt[address(this)]) * currentBalance / PRECISION;
    // }

    // ------------------------------------------ YIELD TOKENS REFLECTIONS -------------------------------------------------//

    function addYieldToken(
        address tokenAddress
    ) internal returns (uint256 tokenIndex) {
        for (uint256 i = 0; i < yieldTokens.length; i++) {
            if (yieldTokens[i].tokenAddress == tokenAddress) {
                return i;
            }
        }

        yieldTokens.push(
            YieldToken({
                tokenAddress: tokenAddress,
                reflectionsPerShareAmount: 0
            })
        );

        return yieldTokens.length - 1;
    }

    function pendingYields(
        address account,
        uint256 tokenIndex
    ) public view returns (uint256) {
        if (tokenIndex >= yieldTokenReflectionDebts[account].length) {
            return 0;
        }
        return
            Helpers(helpers).pendingYields(
                account,
                address(this),
                yieldTokens[tokenIndex].reflectionsPerShareAmount,
                yieldTokenReflectionDebts[account][tokenIndex],
                PRECISION
            );
    }

    function updateAndClaimYield(
        address from,
        address to,
        address deployer
    ) internal {
        for (uint256 i = 0; i < yieldTokens.length; i++) {
            while (yieldTokenReflectionDebts[from].length <= i) {
                yieldTokenReflectionDebts[from].push(
                    yieldTokens[i].reflectionsPerShareAmount
                );
            }
            while (yieldTokenReflectionDebts[to].length <= i) {
                yieldTokenReflectionDebts[to].push(
                    yieldTokens[i].reflectionsPerShareAmount
                );
            }
            while (yieldTokenReflectionDebts[deployer].length <= i) {
                yieldTokenReflectionDebts[deployer].push(
                    yieldTokens[i].reflectionsPerShareAmount
                );
            }

            uint256 fromAmount = isExcludedFromReflections(from)
                ? 0
                : pendingYields(from, i);
            uint256 toAmount = 0; // Initialize to 0

            if (from != to) {
                toAmount = isExcludedFromReflections(to)
                    ? 0
                    : pendingYields(to, i);
            }

            uint256[] memory transferAmounts = new uint256[](2);
            address[] memory recipients = new address[](2);
            uint256 recipientCount = 0;
            if (fromAmount > 0) {
                transferAmounts[recipientCount] = fromAmount;
                recipients[recipientCount] = from;
                recipientCount++;
            }
            if (toAmount > 0) {
                transferAmounts[recipientCount] = toAmount;
                recipients[recipientCount] = to;
                recipientCount++;
            }

            for (uint256 j = 0; j < recipientCount; j++) {
                if (transferAmounts[j] > 0) {
                    try
                        IERC20(yieldTokens[i].tokenAddress).transfer(
                            recipients[j],
                            transferAmounts[j]
                        )
                    {
                        if (yieldTokens[i].tokenAddress == wethAddress) {
                            wethYieldBalance -= transferAmounts[j];
                        }
                        yieldTokenReflectionDebts[recipients[j]][
                            i
                        ] = yieldTokens[i].reflectionsPerShareAmount;
                    } catch {}
                }
            }
        }
    }

    function getYieldTokens() public view returns (YieldToken[] memory) {
        return yieldTokens;
    }

    function getYieldTokenReflectionDebts(
        address account
    ) public view returns (uint256[] memory) {
        return yieldTokenReflectionDebts[account];
    }
}

// contracts/Tokens/ERC20.sol

// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/ERC20.sol)

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

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

        emit Transfer(from, to, value);
    }

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

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

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

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

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

// contracts/Tokens/SmartTrader.sol

contract SmartTrader is Ownable {
    constructor() Ownable(msg.sender) {}

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        address _router,
        address _receiver,
        uint256 amountIn,
        address[] memory path
    ) public {
        IERC20(path[0]).transferFrom(msg.sender, address(this), amountIn);
        IERC20(path[0]).approve(_router, amountIn);

        IUniswapV2Router02(_router)
            .swapExactTokensForTokensSupportingFeeOnTransferTokens(
                amountIn,
                0,
                path,
                address(this),
                block.timestamp
            );

        uint256 receivedAmount = IERC20(path[path.length - 1]).balanceOf(
            address(this)
        );
        IERC20(path[path.length - 1]).transfer(_receiver, receivedAmount);
    }

    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        address _router,
        address _receiver,
        uint256 amountIn,
        address[] calldata path
    ) public {
        IERC20(path[0]).transferFrom(msg.sender, address(this), amountIn);
        IERC20(path[0]).approve(_router, amountIn);

        IUniswapV2Router02(_router)
            .swapExactTokensForETHSupportingFeeOnTransferTokens(
                amountIn,
                0,
                path,
                _receiver,
                block.timestamp
            );

        payable(_receiver).transfer(address(this).balance);
    }

    function buyToken(
        address _router,
        address _receiver,
        uint256 amountIn,
        address[] memory path
    ) public {
        IERC20(path[0]).transferFrom(msg.sender, address(this), amountIn);
        IERC20(path[0]).approve(_router, amountIn);
        IUniswapV2Router02(_router)
            .swapExactTokensForTokensSupportingFeeOnTransferTokens(
                amountIn,
                0,
                path,
                _receiver,
                block.timestamp
            );
    }

    function addLiquidity(
        address _router,
        address tokenA,
        address tokenB,
        uint256 amountA,
        uint256 amountB,
        address lpReceiver
    ) public {
        IERC20(tokenA).transferFrom(msg.sender, address(this), amountA);
        IERC20(tokenB).transferFrom(msg.sender, address(this), amountB);
        IERC20(tokenA).approve(_router, amountA);
        IERC20(tokenB).approve(_router, amountB);
        IUniswapV2Router02(_router).addLiquidity(
            tokenA, tokenB, amountA, amountB, 0, 0, lpReceiver, block.timestamp
        );
        // Return any dust
        uint256 dustA = IERC20(tokenA).balanceOf(address(this));
        if (dustA > 0) IERC20(tokenA).transfer(msg.sender, dustA);
        uint256 dustB = IERC20(tokenB).balanceOf(address(this));
        if (dustB > 0) IERC20(tokenB).transfer(msg.sender, dustB);
    }

    function withdrawPLS() external onlyOwner {
        uint256 balance = address(this).balance;
        require(balance > 0, "No PLS to withdraw");
        payable(owner()).transfer(balance);
    }

    function withdrawToken(address tokenAddress) external onlyOwner {
        IERC20 token = IERC20(tokenAddress);
        uint256 balance = token.balanceOf(address(this));
        require(balance > 0, "No tokens to withdraw");
        token.transfer(owner(), balance);
    }

    receive() external payable {}
}

interface IWETH_1 {
    function withdraw(uint256 wad) external;
}

contract TokenTax is ERC20, Ownable, Manager {
    //
    //       ███╗   ██╗███████╗██╗  ██╗██╗ ██████╗ ███╗   ██╗
    //       ████╗  ██║██╔════╝╚██╗██╔╝██║██╔═══██╗████╗  ██║
    //       ██╔██╗ ██║█████╗   ╚███╔╝ ██║██║   ██║██╔██╗ ██║
    //       ██║╚██╗██║██╔══╝   ██╔██╗ ██║██║   ██║██║╚██╗██║
    //       ██║ ╚████║███████╗██╔╝ ██╗██║╚██████╔╝██║ ╚████║
    //       ╚═╝  ╚═══╝╚══════╝╚═╝  ╚═╝╚═╝ ╚═════╝ ╚═╝  ╚═══╝
    //
    //            * .    *       *    .      * .      *
    //     .   *         *              .        .  *
    //                    .                *         .
    //    .    *     *         *    .   *          .  *
    //         _____                         _____
    //       .|     |.    *     .   *     .|     |.
    //       ||     ||        .          *||     ||
    //       || ___ ||  *         .       || ___ ||
    //  *    |:_____:|        *           |:_____:|
    //       |_______|    .   *      *    |_______|. *
    //  .    | .   . |              .     | .   . |
    //       | .   . |   *    .           | .   . |    *
    //       '._____.'.       *     *    .'._____.'.
    //
    // Revolutionary Hyper-Deflationary and Bonded Liquidity Ecosystem
    //
    // Telegram: https://t.me/NexionPulse
    // Website: https://nexionpulse.com/
    // X: https://x.com/nexionpulse
    // Contract: 0xF2Da3942616880E52e841E5C504B5A9Fba23FFF0
    //

    uint256 public initialSupply;
    bool public tradingEnabled;
    uint64 public enableTradingAt; // timestamp for auto-enable (0 = manual only)

    error TradingDisabled();
    error AlreadyEnabled();
    event TradingEnabled();

    address payable private smartTrader;
    address private deployer;
    address private factory;

    address[] private routers = [
        0x98bf93ebf5c380C0e6Ae8e192A7e2AE08edAcc02,
        0x165C3410fC91EF562C50559f7d2289fEbed552d9,
        0xcC73b59F8D7b7c532703bDfea2808a28a488cF47,
        0xeB45a3c4aedd0F47F345fB4c8A1802BB5740d725
    ];
    mapping(address => bool) isTaxExcluded;
    uint256 private currentSwapAmount;
    uint256 private accumulatedFee;
    // Parallel platform-style bucket for the Neon LP autoBuy/autoLP feed.
    // Funded the same way as `accumulatedFee` (bps of each user tax) but
    // routed to NEON_LP_RECEIVER instead of getWallet() during processAccumulatedTaxes.
    // Never cannibalises the creator's tax bucket.
    uint256 private accumulatedNeonFee;

    bool private shouldAccumulateFee;
    bool private reflectionsEnabled;
    bool private yieldEnabled;
    bool private firstPairInteractionHappened;
    bool private processedTaxesInTx;

    // Add all the events for tax tracking
    event TaxCollected(
        uint256 indexed taxId,
        Helpers.TaxType taxType,
        Helpers.TaxMoment taxMoment,
        address from,
        address to,
        uint256 amount,
        uint256 timestamp
    );
    event noRouter();

    event BurnTaxProcessed(uint256 amount, uint256 timestamp);

    event ExternalBurnProcessed(
        uint256 tokenAmount,
        uint256 taxid,
        uint256 wethAmount,
        address receiver,
        address tokenToBurn,
        uint256 timestamp
    );

    event ReflectionTaxProcessed(
        uint256 amount,
        uint256 newReflectionsPerShareAmount,
        uint256 timestamp
    );

    event ReflectionDistributed(
        address from,
        address to,
        uint256 fromAmount,
        uint256 toAmount,
        uint256 deployerAmount,
        uint256 reflectionsPerShareAmount,
        uint256 timestamp
    );

    event YieldTaxProcessed(
        uint256 tokenAmount,
        uint256 wethAmount,
        address yieldTokenAddress,
        uint256 timestamp
    );

    event YieldDistributed(
        address tokenAddress,
        address recipient,
        uint256 amount,
        uint256 reflectionsPerShareAmount,
        uint256 timestamp
    );

    Helpers.Tax[] public taxes;
    error ZeroTaxPercentage();

    uint256 public totalBurned; // Track burn taxes
    uint256 public totalSupport; // Track external burn taxes
    uint256 public totalReflection; // Track reflection taxes
    uint256 public totalYield; // Track yield taxes
    uint256 public totalLiquify; // Track liquify taxes

    address internal constant deadAddress = 0x000000000000000000000000000000000000dEaD;

    constructor(
        DeployTokenParams memory p
    ) ERC20(p.name_, p.symbol_) Ownable(p.owner_) Manager() {
        tradingEnabled = p.tradingEnabled;
        enableTradingAt = p.enableTradingAt;
        _mint(p.mintTo, p.initialSupply);

        // Burn on deploy: real _burn that reduces totalSupply
        if (p.burnOnDeployPct > 0) {
            uint256 burnAmount = (p.initialSupply * p.burnOnDeployPct) / 10000;
            _burn(p.mintTo, burnAmount);
        }

        // Transfer vested tokens to vesting contract
        if (p.vestAmount > 0 && p.vestingContract != address(0)) {
            super._transfer(p.mintTo, p.vestingContract, p.vestAmount);
        }

        deployer = p.mintTo;
        initialSupply = p.initialSupply;
        smartTrader = payable(p.smartTrader);
        factory = p.factory;

        // Inline taxesInitialize (can't rely on deployed Helpers for Liquify enum)
        _initializeTaxes(p.taxes);

        inititlizeTaxExclusions();

        if (reflectionsEnabled || yieldEnabled)
            initializeReflectionExclusions();

        for (uint256 i; i < p.taxes.length; i++) {
            if (p.taxes[i].percentage <= 0) revert ZeroTaxPercentage();
        }
        IERC20(wethAddress).approve(smartTrader, 2 ** 256 - 1);
        _approve(address(this), smartTrader, 2 ** 256 - 1);
    }

    function _initializeTaxes(Helpers.Tax[] memory _taxes) internal {
        uint256 totalTaxPct;

        for (uint256 i; i < _taxes.length; i++) {
            taxes.push(_taxes[i]);
            taxes[i].id = i;

            require(_taxes[i].percentage <= 5000, "Tax percentage too high");

            if (_taxes[i].taxMoment == Helpers.TaxMoment.Both) {
                totalTaxPct += _taxes[i].percentage * 2;
            } else {
                totalTaxPct += _taxes[i].percentage;
            }

            if (_taxes[i].taxType == Helpers.TaxType.Reflection) {
                reflectionsEnabled = true;
            }

            if (_taxes[i].taxType == Helpers.TaxType.Yield) {
                yieldEnabled = true;
                if (_taxes[i].tokenAddress != address(0)) {
                    addYieldToken(_taxes[i].tokenAddress);
                }
            }

            if (_taxes[i].taxType == Helpers.TaxType.ExternalBurn) {
                require(_taxes[i].receiver != address(0), "ExternalBurn: receiver cannot be zero");
                require(_taxes[i].tokenAddress != address(0), "ExternalBurn: tokenAddress cannot be zero");
                shouldAccumulateFee = true;
            } else if (_taxes[i].taxType == Helpers.TaxType.Dev) {
                require(_taxes[i].receiver != address(0), "Dev: receiver cannot be zero");
                if (_taxes[i].rewardInPls) {
                    shouldAccumulateFee = true;
                }
            } else if (_taxes[i].taxType == Helpers.TaxType.Yield) {
                require(_taxes[i].tokenAddress != address(0), "Yield: tokenAddress cannot be zero");
                shouldAccumulateFee = true;
            } else if (_taxes[i].taxType == Helpers.TaxType.Liquify) {
                shouldAccumulateFee = true;
            }
        }

        require(totalTaxPct <= 8000, "Total tax percentage too high");
    }

    function _transfer(
        address from,
        address to,
        uint256 value
    ) internal override {
        processedTaxesInTx = false;

        // Auto-enable trading if timer has passed
        if (!tradingEnabled && enableTradingAt > 0 && block.timestamp >= enableTradingAt) {
            tradingEnabled = true;
            emit TradingEnabled();
        }

        if (isDeadAddress(to)) {
            super._burn(from, value);
            return;
        }

        // Block non-excluded transfers when trading is disabled
        if (!tradingEnabled && !isTaxExcluded[from]) revert TradingDisabled();

        bool _isPairTo = isPair(to);

        if (
            taxes.length == 0 ||
            !firstPairInteractionHappened ||
            isTaxExcluded[from] ||
            isTaxExcluded[to] ||
            inSwap
        ) {
            if (!firstPairInteractionHappened && _isPairTo)
                firstPairInteractionHappened = true;

            _claimYield(from, to);
            super._transfer(from, to, value);
            return;
        }

        if (_isPairTo && !isReflectionExcluded[to])
            isReflectionExcluded[to] = true;

        currentSwapAmount = value;
        uint256 amountAfterTaxs = processTaxes(from, to, value);

        if (
            (hasAccumulatedTaxes() &&
                firstPairInteractionHappened &&
                !inSwap &&
                !processedTaxesInTx) || shouldAccumulateFee
        ) {
            if (!isBuy(from, to)) {
                processAccumulatedTaxes();
                processedTaxesInTx = true;
            }
        }

        _claimYield(from, to);
        _claimReflections(from, to);

        super._transfer(from, to, amountAfterTaxs);
    }

    function processTaxes(
        address from,
        address to,
        uint256 amount
    ) internal returns (uint256) {
        uint256 totalTaxAmount;
        uint256 totalFee;
        uint256 totalNeonFee;

        bool _isBuy = isBuy(from, to);
        bool _isSell = isSell(from, to);

        // Parallel Neon LP fee, taken in bps of each user-tax slice (NOT volume,
        // NOT from the platform Fee bucket, NOT from creator's leftover WPLS).
        // Only fires when shouldAccumulateFee is true — i.e. the token has a
        // tax type that requires the WPLS swap pipeline. Otherwise the neon
        // tokens would have no path out and would just sit in the contract.
        uint256 neonFeeBps = 0;
        if (shouldAccumulateFee && getNeonLpReceiver() != address(0)) {
            neonFeeBps = getNeonLpFee();
        }

        for (uint256 i; i < taxes.length; i++) {
            (uint256 _taxAmount, uint256 _Fee, uint256 _neonFee) = _processOneTaxLeg(
                from, amount, taxes[i], _isBuy, _isSell, neonFeeBps
            );
            totalTaxAmount += _taxAmount;
            totalFee       += _Fee;
            totalNeonFee   += _neonFee;
        }

        if (totalFee > 0) {
            if (shouldAccumulateFee) {
                super._transfer(from, address(this), totalFee);
                accumulatedFee += totalFee;
            } else {
                super._transfer(from, getWallet(), totalFee);
            }
        }

        if (totalNeonFee > 0) {
            // Neon fee always accumulates for the swap pipeline (gated above
            // on shouldAccumulateFee, so we know the swap path will run).
            super._transfer(from, address(this), totalNeonFee);
            accumulatedNeonFee += totalNeonFee;
        }

        return amount - totalTaxAmount - totalFee - totalNeonFee;
    }

    /// @dev Per-tax-leg helper extracted from processTaxes() to keep that
    ///      frame under the stack-too-deep limit. Computes the user-tax /
    ///      dev-fee / neon-fee triple, routes the user-tax portion to its
    ///      destination, and returns the three amounts so the caller can
    ///      accumulate totals.
    function _processOneTaxLeg(
        address from,
        uint256 amount,
        Helpers.Tax memory tax,
        bool _isBuy,
        bool _isSell,
        uint256 neonFeeBps
    ) internal returns (uint256 taxAmount, uint256 Fee, uint256 neonFee) {
        bool fired;
        if (tax.taxMoment == Helpers.TaxMoment.Both) {
            (taxAmount, Fee) = calculateTaxAmount(amount, tax);
            fired = true;
        } else if (tax.taxMoment == Helpers.TaxMoment.Buy && _isBuy) {
            (taxAmount, Fee) = calculateTaxAmount(amount, tax);
            fired = true;
        } else if (tax.taxMoment == Helpers.TaxMoment.Sell && _isSell) {
            (taxAmount, Fee) = calculateTaxAmount(amount, tax);
            fired = true;
        }
        if (!fired) return (0, 0, 0);

        // Slice neon out of the user-tax portion (NOT out of dev Fee).
        if (neonFeeBps > 0 && taxAmount > 0) {
            neonFee = (taxAmount * neonFeeBps) / 10000;
            taxAmount -= neonFee;
        }

        processTaxType(from, taxAmount, tax);
    }

    function calculateTaxAmount(
        uint256 originalAmount,
        Helpers.Tax memory tax
    ) internal view returns (uint256 taxAmount, uint256 Fee) {
        return
            Helpers(helpers).calculateTaxAmount(
                originalAmount,
                tax.percentage,
                getFee(),
                true,
                10000
            );
    }

    function processTaxType(
        address from,
        uint256 taxAmount,
        Helpers.Tax memory tax
    ) internal {
        // Emit tax collection event for all types
        emit TaxCollected(
            tax.id,
            tax.taxType,
            tax.taxMoment,
            from,
            _msgSender(),
            taxAmount,
            block.timestamp
        );

        if (tax.taxType == Helpers.TaxType.Burn) {
            processBurnTax(from, taxAmount);
        } else if (tax.taxType == Helpers.TaxType.Reflection) {
            processReflectionTax(from, taxAmount);
        } else if (tax.taxType == Helpers.TaxType.Dev) {
            processTreasuryTax(from, taxAmount, tax);
        } else if (tax.taxType == Helpers.TaxType.ExternalBurn) {
            processSupportTax(from, taxAmount, tax);
        } else if (tax.taxType == Helpers.TaxType.Yield) {
            processYieldTax(from, taxAmount, tax);
        } else if (tax.taxType == Helpers.TaxType.Liquify) {
            processLiquifyTax(from, taxAmount, tax);
        }
    }

    function processBurnTax(address from, uint256 taxAmount) internal {
        totalBurned += taxAmount;
        emit BurnTaxProcessed(taxAmount, block.timestamp);
        super._burn(from, taxAmount);
    }

    function processTreasuryTax(
        address from,
        uint256 taxAmount,
        Helpers.Tax memory tax
    ) internal {
        if (!isTaxExcluded[tax.receiver]) isTaxExcluded[tax.receiver] = true;
        if (tax.rewardInPls) {
            super._transfer(from, address(this), taxAmount);
            taxes[tax.id].amountAccumulated += taxAmount;
        } else {
            super._transfer(from, tax.receiver, taxAmount);
        }
    }

    function processReflectionTax(address from, uint256 taxAmount) internal {
        super._transfer(from, address(this), taxAmount);
        uint256 supply = totalSupply() - balanceOf(address(this));

        if (supply > 0) {
            reflectionsPerShareAmount += (taxAmount * PRECISION) / supply;
            totalReflection += taxAmount;
        }

        emit ReflectionTaxProcessed(
            taxAmount,
            reflectionsPerShareAmount,
            block.timestamp
        );
    }

    function processSupportTax(
        address from,
        uint256 taxAmount,
        Helpers.Tax memory tax
    ) internal lockSwap {
        super._transfer(from, address(this), taxAmount);
        taxes[tax.id].amountAccumulated += taxAmount;
        totalSupport += taxAmount;
        emit ExternalBurnProcessed(
            taxAmount,
            tax.id,
            0,
            tax.receiver,
            tax.tokenAddress,
            block.timestamp
        );
    }

    function processYieldTax(
        address from,
        uint256 taxAmount,
        Helpers.Tax memory tax
    ) internal lockSwap {
        super._transfer(from, address(this), taxAmount);
        taxes[tax.id].amountAccumulated += taxAmount;
        totalYield += taxAmount;
        emit YieldTaxProcessed(
            taxAmount,
            0, // wethAmount (will be updated when processed)
            tax.tokenAddress,
            block.timestamp
        );
    }

    function processLiquifyTax(
        address from,
        uint256 taxAmount,
        Helpers.Tax memory tax
    ) internal lockSwap {
        super._transfer(from, address(this), taxAmount);
        taxes[tax.id].amountAccumulated += taxAmount;
        totalLiquify += taxAmount;
    }

    function processAccumulatedTaxes() internal lockSwap {
        uint256 totalToSwap = 0;
        uint256 totalTokenTypes = 0;
        uint256 tl = taxes.length;
        bool[] memory taxesToProcess = new bool[](tl);
        uint256[] memory taxAmounts = new uint256[](tl);

        for (uint256 i; i < tl; i++) {
            Helpers.Tax storage tax = taxes[i];
            if (tax.amountAccumulated == 0) continue;
            if (
                tax.taxType == Helpers.TaxType.ExternalBurn ||
                (tax.taxType == Helpers.TaxType.Dev && tax.rewardInPls) ||
                tax.taxType == Helpers.TaxType.Yield ||
                tax.taxType == Helpers.TaxType.Liquify
            ) {
                (uint256 swapAmount, uint256 _newAccumulatedAmount) = Helpers(
                    helpers
                ).getProcessingAmount(tax.amountAccumulated, currentSwapAmount);
                if (swapAmount > 0) {
                    uint256 amountToSwap = swapAmount;
                    uint256 finalAccumulatedAmount = _newAccumulatedAmount;

                    // For Liquify, only swap half — keep other half for liquidity
                    if (tax.taxType == Helpers.TaxType.Liquify) {
                        amountToSwap = swapAmount / 2;
                        finalAccumulatedAmount = _newAccumulatedAmount + (swapAmount - amountToSwap);
                    }

                    taxesToProcess[i] = true;
                    taxAmounts[i] = amountToSwap;
                    totalToSwap += amountToSwap;
                    totalTokenTypes++;
                    taxes[i].amountAccumulated = finalAccumulatedAmount;
                } else {
                    taxes[i].amountAccumulated = _newAccumulatedAmount;
                }
            }
        }

        (, /*address bestPair*/ address bestRouter) = Helpers(helpers)
            .getBestPair(address(this), wethAddress, routers);
        if (bestRouter == address(0)) {
            emit noRouter();
            return;
        }

        // Pull both platform buckets from storage. Scoped block so the
        // `newAcc*` temporaries don't pollute the outer stack frame.
        uint256 ToProcess;
        uint256 NeonToProcess;
        {
            uint256 newAcc;
            uint256 newAccNeon;
            (ToProcess, newAcc) = Helpers(helpers).getProcessingAmount(
                accumulatedFee, currentSwapAmount
            );
            (NeonToProcess, newAccNeon) = Helpers(helpers).getProcessingAmount(
                accumulatedNeonFee, currentSwapAmount
            );
            accumulatedFee     = newAcc;
            accumulatedNeonFee = newAccNeon;
        }

        totalToSwap += ToProcess;
        totalToSwap += NeonToProcess;
        if (totalToSwap == 0) return;

        // _approve(address(this), smartTrader, totalToSwap);
        try
            SmartTrader(smartTrader)
                .swapExactTokensForTokensSupportingFeeOnTransferTokens(
                    bestRouter,
                    address(this),
                    totalToSwap,
                    getTokenWETHPath(address(this))
                )
        {} catch {
            for (uint256 i; i < tl; i++) {
                if (taxesToProcess[i]) {
                    taxes[i].amountAccumulated += taxAmounts[i];
                }
            }
            accumulatedFee     += ToProcess;
            accumulatedNeonFee += NeonToProcess;
            return;
        }
        uint256 totalWethReceived = IERC20(wethAddress).balanceOf(
            address(this)
        ) - wethYieldBalance;

        // Pay dev wallet (FEE bps slice) + Neon LP receiver (NEON_LP_FEE bps
        // parallel slice) and shrink the WPLS pool down to the creator's share.
        // Helper extracted to keep this frame under the stack-too-deep limit.
        totalWethReceived -= _distributeFeesAndNeon(
            totalWethReceived, ToProcess, NeonToProcess, totalToSwap
        );

        totalToSwap -= ToProcess;
        totalToSwap -= NeonToProcess;
        if (totalWethReceived == 0) return;

        for (uint256 i; i < tl; i++) {
            if (!taxesToProcess[i] || taxAmounts[i] == 0) continue;

            uint256 wethPortion = (taxAmounts[i] * totalWethReceived) /
                totalToSwap;
            Helpers.Tax storage tax = taxes[i];

            if (tax.taxType == Helpers.TaxType.ExternalBurn) {
                emit ExternalBurnProcessed(
                    taxAmounts[i],
                    tax.id,
                    wethPortion,
                    tax.receiver,
                    tax.tokenAddress,
                    block.timestamp
                );
                processExternalBurnWeth(wethPortion, tax);
            } else if (tax.taxType == Helpers.TaxType.Dev && tax.rewardInPls) {
                sendWETH(wethPortion, tax.receiver);
            } else if (tax.taxType == Helpers.TaxType.Yield) {
                emit YieldTaxProcessed(
                    taxAmounts[i],
                    wethPortion,
                    tax.tokenAddress,
                    block.timestamp
                );
                processYieldWeth(wethPortion, tax);
            } else if (tax.taxType == Helpers.TaxType.Liquify) {
                processLiquifyWeth(wethPortion, tax);
            }
        }
    }

    /// @dev Pays the dev wallet share + the Neon LP share out of the just-swapped
    ///      WPLS pool. Returns total WPLS spent so the caller can shrink its pool.
    ///      Extracted from processAccumulatedTaxes() to keep that frame under the
    ///      stack-too-deep limit (we cannot use --via-ir per project rules).
    function _distributeFeesAndNeon(
        uint256 totalWethReceived,
        uint256 toProcess,
        uint256 neonToProcess,
        uint256 totalToSwap_
    ) internal returns (uint256 spent) {
        // Dev wallet — unchanged behaviour, full FEE bps cut.
        uint256 devSlice = (totalWethReceived * toProcess) / totalToSwap_;
        if (devSlice > 0) sendWETH(devSlice, getWallet());

        // Neon LP — parallel cut. Receiver is read at distribution time so a
        // mid-flight setNeonLpReceiver() always routes pending neon to the
        // latest configured contract. If receiver is unset, the corresponding
        // WPLS is left on the token (rescuable via rescueToken).
        uint256 neonSlice = (totalWethReceived * neonToProcess) / totalToSwap_;
        if (neonSlice > 0) {
            address neonRecv = getNeonLpReceiver();
            if (neonRecv != address(0)) sendWETH(neonSlice, neonRecv);
        }

        return devSlice + neonSlice;
    }

    function processExternalBurnWeth(
        uint256 wethAmount,
        Helpers.Tax memory tax
    ) internal {
        if (wethAmount == 0) return;

        if (tax.tokenAddress == wethAddress) {
            IERC20(wethAddress).transfer(tax.receiver, wethAmount);
            return;
        }
        (, /*address bestTargetPair*/ address bestTargetRouter) = Helpers(
            helpers
        ).getBestPair(wethAddress, tax.tokenAddress, routers);

        // IERC20(wethAddress).approve(smartTrader, 2**256-1);
        try
            SmartTrader(smartTrader).buyToken(
                bestTargetRouter,
                tax.receiver,
                wethAmount,
                getWETHBuyBurnPath(tax.tokenAddress)
            )
        {} catch {
            IERC20(wethAddress).transfer(tax.receiver, wethAmount);
        }
    }

    function sendWETH(uint256 wethAmount, address receiver) internal {
        if (wethAmount == 0) return;
        try IWETH_1(wethAddress).withdraw(wethAmount) {
            (bool success, ) = receiver.call{value: wethAmount}("");
            if (!success) {
                IERC20(wethAddress).transfer(receiver, wethAmount);
            } else {}
        } catch {
            IERC20(wethAddress).transfer(receiver, wethAmount);
        }
    }

    function processYieldWeth(
        uint256 wethAmount,
        Helpers.Tax memory tax
    ) internal {
        if (wethAmount == 0) return;

        if (tax.tokenAddress == wethAddress) {
            wethYieldBalance += wethAmount;
            uint256 tokenIndex = addYieldToken(tax.tokenAddress);
            uint256 supply = totalSupply() - balanceOf(address(this));
            if (supply > 0) {
                yieldTokens[tokenIndex].reflectionsPerShareAmount +=
                    (wethAmount * PRECISION) /
                    supply;

                emit YieldDistributed(
                    tax.tokenAddress,
                    address(this),
                    wethAmount,
                    yieldTokens[tokenIndex].reflectionsPerShareAmount,
                    block.timestamp
                );
            }
            return;
        }

        (, /*address bestTargetPair*/ address bestTargetRouter) = Helpers(
            helpers
        ).getBestPair(wethAddress, tax.tokenAddress, routers);

        uint256 initialTokenBalance = IERC20(tax.tokenAddress).balanceOf(
            address(this)
        );

        // IERC20(wethAddress).approve(smartTrader, wethAmount);
        try
            SmartTrader(smartTrader).buyToken(
                bestTargetRouter,
                address(this),
                wethAmount,
                getWETHBuyBurnPath(tax.tokenAddress)
            )
        {
            uint256 finalTokenBalance = IERC20(tax.tokenAddress).balanceOf(
                address(this)
            );
            uint256 boughtAmount = finalTokenBalance - initialTokenBalance;

            if (boughtAmount > 0) {
                uint256 tokenIndex = addYieldToken(tax.tokenAddress);
                uint256 supply = totalSupply() - balanceOf(address(this));
                if (supply > 0) {
                    yieldTokens[tokenIndex].reflectionsPerShareAmount +=
                        (boughtAmount * PRECISION) /
                        supply;

                    emit YieldDistributed(
                        tax.tokenAddress,
                        address(this),
                        boughtAmount,
                        yieldTokens[tokenIndex].reflectionsPerShareAmount,
                        block.timestamp
                    );
                }
            }
        } catch {}
    }

    function processLiquifyWeth(
        uint256 wethAmount,
        Helpers.Tax storage tax
    ) internal {
        if (wethAmount == 0) return;

        // Use the tokens that were kept in the contract for liquidity
        uint256 tokensForLiquidity = tax.amountAccumulated;
        if (tokensForLiquidity == 0) return;

        // Determine pair token: WPLS (default) or custom token from tax.tokenAddress
        address pairToken = tax.tokenAddress;
        bool useCustomPairToken = pairToken != address(0) && pairToken != wethAddress;

        uint256 pairTokenAmount = wethAmount;

        if (useCustomPairToken) {
            // Swap WPLS to the custom pair token first
            (, address swapRouter) = Helpers(helpers).getBestPair(
                wethAddress, pairToken, routers
            );
            if (swapRouter == address(0)) return;

            uint256 initialBalance = IERC20(pairToken).balanceOf(address(this));
            IERC20(wethAddress).approve(smartTrader, wethAmount);

            address[] memory path = new address[](2);
            path[0] = wethAddress;
            path[1] = pairToken;

            try SmartTrader(smartTrader).swapExactTokensForTokensSupportingFeeOnTransferTokens(
                swapRouter, address(this), wethAmount, path
            ) {
                pairTokenAmount = IERC20(pairToken).balanceOf(address(this)) - initialBalance;
            } catch {
                // Swap failed, keep tokens for next cycle
                return;
            }
        }

        // Find best router for TOKEN/pairToken (or TOKEN/WPLS) pair
        address lpPairToken = useCustomPairToken ? pairToken : wethAddress;
        (, address bestRouter) = Helpers(helpers).getBestPair(
            address(this), lpPairToken, routers
        );
        if (bestRouter == address(0)) return;

        // Approve tokens for SmartTrader
        // NOTE: must use type(uint256).max here, NOT tokensForLiquidity. SmartTrader.addLiquidity()
        // calls transferFrom(this, helper, tokensForLiquidity) which would otherwise drain the
        // allowance to zero, bricking every subsequent processAccumulatedTaxes() call (which
        // relies on the constructor's max approval set at line 1763).
        _approve(address(this), smartTrader, type(uint256).max);
        IERC20(lpPairToken).approve(smartTrader, pairTokenAmount);

        try SmartTrader(smartTrader).addLiquidity(
            bestRouter,
            address(this),
            lpPairToken,
            tokensForLiquidity,
            pairTokenAmount,
            deadAddress // LP tokens burned = permanent liquidity
        ) {
            taxes[tax.id].amountAccumulated = 0;
        } catch {
            // If adding liquidity fails, keep tokens for next cycle
        }
    }

    function _claimReflections(address from, address to) internal {
        if (!reflectionsEnabled) return;
        (
            uint256 fromAmount,
            uint256 toAmount,
            uint256 deployerAmount
        ) = updateAndClaimReflections(from, to, deployer);

        emit ReflectionDistributed(
            from,
            to,
            fromAmount,
            toAmount,
            deployerAmount,
            reflectionsPerShareAmount,
            block.timestamp
        );

        if (fromAmount != 0) {
            if (!isPair(from)) {
                super._transfer(address(this), from, fromAmount);
            }
        }
        if (toAmount != 0) {
            if (!isPair(to)) {
                super._transfer(address(this), to, toAmount);
            }
        }
        if (deployerAmount != 0) {
            super._transfer(address(this), deployer, deployerAmount);
        }
    }

    function initializeReflectionExclusions() internal {
        isReflectionExcluded[address(0)] = true;
        isReflectionExcluded[address(this)] = true;
        for (uint256 i; i < routers.length; ) {
            isReflectionExcluded[routers[i]] = true;
            unchecked {
                i++;
            }
        }
    }
    function isDeadAddress(address _address) internal pure returns (bool) {
        return
            _address == address(0) ||
            _address == 0x0000000000000000000000000000000000000369 ||
            _address == 0x000000000000000000000000000000000000dEaD;
    }

    function isPair(address _address) internal view returns (bool) {
        return Helpers(helpers).isPair(_address, address(this));
    }

    function isBuy(address from, address to) internal view returns (bool) {
        return Helpers(helpers).isBuy(from, to, address(this));
    }

    function isSell(address from, address to) internal view returns (bool) {
        return Helpers(helpers).isSell(from, to, address(this));
    }

    function getProcessingAmount(
        uint256 accumulatedAmount
    )
        internal
        view
        returns (uint256 processAmount, uint256 newAccumulatedAmount)
    {
        return
            Helpers(helpers).getProcessingAmount(
                accumulatedAmount,
                currentSwapAmount
            );
    }

    function getTokenWETHPath(
        address tokenAddress
    ) internal view returns (address[] memory) {
        return Helpers(helpers).getTokenWPLSPath(tokenAddress);
    }

    function getWETHBuyBurnPath(
        address tokenAddress
    ) internal view returns (address[] memory) {
        return Helpers(helpers).getWPLSBuyBurnPath(tokenAddress);
    }

    function getTaxes() public view returns (Helpers.Tax[] memory) {
        return taxes;
    }

    function getFee() public view returns (uint256) {
        return ISmartTokenFactory(factory).FEE();
    }

    function getWallet() public view returns (address) {
        return ISmartTokenFactory(factory).WALLET();
    }

    function getNeonLpFee() public view returns (uint256) {
        try ISmartTokenFactory(factory).NEON_LP_FEE() returns (uint256 fee) {
            return fee;
        } catch {
            return 0;
        }
    }

    function getNeonLpReceiver() public view returns (address) {
        try ISmartTokenFactory(factory).NEON_LP_RECEIVER() returns (address receiver) {
            return receiver;
        } catch {
            return address(0);
        }
    }

    function getaccumulatedFee() external view returns (uint256) {
        return accumulatedFee;
    }

    function getaccumulatedNeonFee() external view returns (uint256) {
        return accumulatedNeonFee;
    }

    function getTotalTaxs() external view returns (uint256) {
        return Helpers(helpers).getTotalTaxs(taxes);
    }

    function forceProcessAccumulatedTaxes() external onlyOwner {
        processAccumulatedTaxes();
    }

    /// @notice Owner-only escape hatch: re-grant SmartTrader an unlimited
    ///         allowance over the token's self balance. The constructor sets
    ///         this to max already, so this is only needed if a future code
    ///         path drifts that allowance back down.
    function reapproveSmartTrader() external onlyOwner {
        _approve(address(this), smartTrader, type(uint256).max);
    }

    function enableTrading() external onlyOwner {
        if (tradingEnabled) revert AlreadyEnabled();
        tradingEnabled = true;
        emit TradingEnabled();
    }

    function _claimYield(address from, address to) internal {
        if (yieldEnabled) {
            updateAndClaimYield(from, to, deployer);
        }
    }

    function claimYield() external returns (bool) {
        _claimYield(msg.sender, msg.sender);
        return true;
    }

    function hasAccumulatedTaxes() internal view returns (bool) {
        for (uint256 i; i < taxes.length; i++) {
            Helpers.Tax memory tax = taxes[i];
            if (
                tax.amountAccumulated > 0 &&
                (tax.taxType == Helpers.TaxType.ExternalBurn ||
                    (tax.taxType == Helpers.TaxType.Dev && tax.rewardInPls) ||
                    tax.taxType == Helpers.TaxType.Yield ||
                    tax.taxType == Helpers.TaxType.Liquify)
            ) {
                return true;
            }
        }
        return false;
    }

    function updateTaxReceiver(uint256 taxId, address newReceiver) external onlyOwner {
        require(taxId < taxes.length, "Invalid tax ID");
        require(newReceiver != address(0), "Receiver cannot be zero address");
        taxes[taxId].receiver = newReceiver;
    }

    function updateTaxTokenAddress(uint256 taxId, address newTokenAddress) external onlyOwner {
        require(taxId < taxes.length, "Invalid tax ID");
        require(newTokenAddress != address(0), "Token address cannot be zero");
        taxes[taxId].tokenAddress = newTokenAddress;
    }

    function addTaxExclusion(address _address) external onlyOwner {
        isTaxExcluded[_address] = true;
    }

    function removeTaxExclusion(address _address) external onlyOwner {
        isTaxExcluded[_address] = false;
    }

    function inititlizeTaxExclusions() internal {
        isTaxExcluded[deployer] = true;
        isTaxExcluded[address(this)] = true;
        isTaxExcluded[smartTrader] = true;
        isTaxExcluded[factory] = true;
        //neon farms
        isTaxExcluded[0x6dDcdfce43aC44F686464dB25dEc788F034a7fbb] = true;
        isTaxExcluded[0x5dF85211Aa383994B03a52946B91329c25E622e9] = true;
        // Airdrop contract — TODO: replace with deployed address
        // isTaxExcluded[0x_AIRDROP_CONTRACT_ADDRESS_HERE] = true;
    }

    /// @notice Rescue stuck tokens — only factory owner can call
    /// @dev For when users accidentally send tokens to the token contract
    function rescueToken(address token, address to, uint256 amount) external {
        require(msg.sender == Ownable(factory).owner(), "Only factory owner");
        require(token != address(this), "Cannot rescue own token");
        IERC20(token).transfer(to, amount);
    }

    /// @notice Rescue stuck PLS — only factory owner can call
    function rescuePLS(address payable to, uint256 amount) external {
        require(msg.sender == Ownable(factory).owner(), "Only factory owner");
        (bool ok,) = to.call{value: amount}("");
        require(ok, "Transfer failed");
    }

    receive() external payable {}
}

// contracts/Tokens/TokenVesting.sol

contract TokenVesting {
    address public immutable beneficiary;
    address public immutable token;
    uint64 public immutable start;
    uint64 public immutable cliffEnd;
    uint64 public immutable vestingEnd;
    uint256 public released;

    event TokensReleased(uint256 amount);

    constructor(
        address _beneficiary,
        uint64 _cliffDuration,
        uint64 _vestingDuration,
        address _token
    ) {
        require(_beneficiary != address(0), "Zero beneficiary");
        require(_token != address(0), "Zero token");
        require(_vestingDuration > 0, "Zero vesting duration");
        require(_cliffDuration <= _vestingDuration, "Cliff > vesting");

        beneficiary = _beneficiary;
        token = _token;
        start = uint64(block.timestamp);
        cliffEnd = uint64(block.timestamp) + _cliffDuration;
        vestingEnd = uint64(block.timestamp) + _vestingDuration;
    }

    function totalAllocation() public view returns (uint256) {
        return IERC20(token).balanceOf(address(this)) + released;
    }

    function vestedAmount(uint256 timestamp) public view returns (uint256) {
        uint256 _totalAllocation = totalAllocation();
        if (timestamp < cliffEnd) {
            return 0;
        } else if (timestamp >= vestingEnd) {
            return _totalAllocation;
        } else {
            uint256 elapsed = timestamp - start;
            uint256 duration = vestingEnd - start;
            return (_totalAllocation * elapsed) / duration;
        }
    }

    function releasable() public view returns (uint256) {
        return vestedAmount(block.timestamp) - released;
    }

    function release() external {
        uint256 amount = releasable();
        require(amount > 0, "Nothing to release");
        released += amount;
        IERC20(token).transfer(beneficiary, amount);
        emit TokensReleased(amount);
    }
}

// contracts/Tokens/TokenFactoryTax.sol

interface IPulseXRouter {
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
}

struct DeployTokenParams {
    string name_;
    string symbol_;
    address owner_;
    address mintTo;
    uint256 initialSupply;
    Helpers.Tax[] taxes;
    address smartTrader;
    address factory;
    address helpers;
    uint256 burnOnDeployPct;
    address vestingContract;
    uint256 vestAmount;
    bool tradingEnabled;
    uint64 enableTradingAt;
}

struct CreateTokenParams {
    string name_;
    string symbol_;
    uint256 initialSupply;
    Helpers.Tax[] taxes;
    bool ownershipRenounced;
    address smartTrader;
    uint256 burnOnDeployPct;
    uint256 vestingPct;
    uint64 cliffDuration;
    uint64 vestingDuration;
    bool tradingEnabled;
    uint64 enableTradingAt;
    uint256 initialLiquidityPct;   // basis points, e.g. 2000 = 20% of supply
    address liquidityRouter;       // PulseX V2 router by default
    bool lockLiquidity;            // true = burn LP tokens (send to dead address)
}

interface ITokenDeployer {
    function deployToken(
        DeployTokenParams calldata params
    ) external returns (address);
}

interface IVestingDeployer {
    function deployVesting(
        address _beneficiary,
        uint64 _cliffDuration,
        uint64 _vestingDuration,
        address _token
    ) external returns (address);
}

contract TokenFactoryTax is Initializable, UUPSUpgradeable, OwnableUpgradeable {
    uint256 public FEE = 750; // 7.5% from total taxes (like if total taxes are 1% then FEE = 0.075%)
    address public WALLET;
    uint256 public NEON_LP_FEE;       // basis points, e.g. 500 = 5% of WPLS after platform fee
    address public NEON_LP_RECEIVER;  // NeonLiquidityAdder contract
    uint256 public tokenCreationPrice;
    address helpersAddress = 0xd3397b405A2272F5C27fc673BE20579f22f59D6C;

    address public tokenDeployer;
    address public vestingDeployer; // legacy — no longer used
    address public vestingHub;
    address public neonPaymentReceiver;

    address constant NEON = 0xF2Da3942616880E52e841E5C504B5A9Fba23FFF0;
    address constant WPLS = 0xA1077a294dDE1B09bB078844df40758a5D0f9a27;
    address constant PULSEX_ROUTER = 0x165C3410fC91EF562C50559f7d2289fEbed552d9;

    mapping(address => bool) public isFactoryToken;
    // DO NOT REORDER: these two slots are deprecated but must remain to preserve UUPS storage layout.
    // v2 used them for tokenGovernance / tokenDAO. v3 removed the DAO surface but kept the slots.
    mapping(address => address) private __deprecated_tokenGovernance;
    address private __deprecated_tokenDAO;

    // Array of wallets for distribution
    address[] public distributionWallets;

    event TokenCreated(
        address indexed tokenAddress,
        string name,
        string symbol,
        address indexed owner,
        address vestingContract,
        uint256 burnOnDeployPct,
        uint256 vestingPct,
        uint256 vestingScheduleId
    );

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    function initialize(
        uint256 _tokenCreationPrice,
        address[] memory _distributionWallets
    ) external initializer {
        __Ownable_init(msg.sender);
        __UUPSUpgradeable_init();
        tokenCreationPrice = _tokenCreationPrice;
        WALLET = address(this);
        distributionWallets = _distributionWallets;
    }

    function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}

    function createToken(
        CreateTokenParams calldata params
    ) external payable returns (address) {
        if (params.taxes.length > 0) {
            require(msg.value >= tokenCreationPrice, "Insufficient payment");
        }

        address tokenAddr = _createToken(params);

        if (params.taxes.length > 0 && tokenCreationPrice > 0) {
            _withdrawPLS(tokenCreationPrice);
        }
        return tokenAddr;
    }

    function getNeonCreationPrice() public view returns (uint256) {
        require(tokenCreationPrice > 0, "Creation price not set");
        address[] memory path = new address[](2);
        path[0] = WPLS;
        path[1] = NEON;
        uint[] memory amounts = IPulseXRouter(PULSEX_ROUTER).getAmountsOut(tokenCreationPrice, path);
        return (amounts[1] * 9000) / 10000;
    }

    function createTokenWithNeon(
        CreateTokenParams calldata params
    ) external returns (address) {
        require(params.taxes.length > 0, "NEON payment only for taxed tokens");
        require(neonPaymentReceiver != address(0), "NEON receiver not set");

        uint256 neonAmount = getNeonCreationPrice();
        uint256 balBefore = IERC20(NEON).balanceOf(neonPaymentReceiver);
        require(
            IERC20(NEON).transferFrom(msg.sender, neonPaymentReceiver, neonAmount),
            "NEON transfer failed"
        );
        require(
            IERC20(NEON).balanceOf(neonPaymentReceiver) - balBefore >= neonAmount,
            "NEON fee applied: exclude receiver from NEON fee"
        );

        return _createToken(params);
    }

    function _addLiquidity(
        address token,
        uint256 liqAmount,
        address liquidityRouter,
        bool lockLiq
    ) internal {
        uint256 liquidityPls = msg.value > tokenCreationPrice ? msg.value - tokenCreationPrice : 0;
        require(liquidityPls > 0, "No PLS for liquidity");

        address router = liquidityRouter != address(0) ? liquidityRouter : PULSEX_ROUTER;
        address lpRecipient = lockLiq
            ? 0x000000000000000000000000000000000000dEaD
            : msg.sender;

        IERC20(token).approve(router, liqAmount);
        IUniswapV2Router01(router).addLiquidityETH{value: liquidityPls}(
            token,
            liqAmount,
            0,
            0,
            lpRecipient,
            block.timestamp
        );
    }

    function _createToken(
        CreateTokenParams calldata p
    ) internal returns (address) {
        // If renouncing ownership with trading off, must have a timer set
        require(
            !p.ownershipRenounced || p.tradingEnabled || p.enableTradingAt > 0,
            "Must enable trading or set timer before renouncing"
        );
        require(p.burnOnDeployPct <= 9000, "Burn > 90%");
        require(p.vestingPct <= 9000, "Vest > 90%");
        require(p.initialLiquidityPct <= 9000, "Liq > 90%");
        require(p.burnOnDeployPct + p.vestingPct + p.initialLiquidityPct <= 9500, "Burn+Vest+Liq > 95%");

        require(tokenDeployer != address(0), "Deployer not set");

        // Calculate amounts the factory needs to hold
        uint256 vestAmount;
        if (p.vestingPct > 0 && p.vestingDuration > 0) {
            vestAmount = (p.initialSupply * p.vestingPct) / 10000;
        }
        uint256 liqAmount;
        if (p.initialLiquidityPct > 0) {
            liqAmount = (p.initialSupply * p.initialLiquidityPct) / 10000;
        }

        TokenTax newToken;
        {
            uint256 factoryHold = vestAmount + liqAmount;
            address newTokenAddr = ITokenDeployer(tokenDeployer).deployToken(
                DeployTokenParams({
                    name_: p.name_,
                    symbol_: p.symbol_,
                    owner_: address(this),
                    mintTo: msg.sender,
                    initialSupply: p.initialSupply,
                    taxes: p.taxes,
                    smartTrader: p.smartTrader,
                    factory: address(this),
                    helpers: helpersAddress,
                    burnOnDeployPct: p.burnOnDeployPct,
                    vestingContract: factoryHold > 0 ? address(this) : address(0),
                    vestAmount: factoryHold,
                    tradingEnabled: p.tradingEnabled,
                    enableTradingAt: p.enableTradingAt
                })
            );
            newToken = TokenTax(payable(newTokenAddr));
        }

        isFactoryToken[address(newToken)] = true;

        // Transfer vesting tokens to VestingHub
        address vestingContract;
        uint256 vestingScheduleId = type(uint256).max; // sentinel = no vesting
        {
            if (vestAmount > 0 && p.vestingDuration > 0) {
                require(vestingHub != address(0), "Vesting hub not set");
                newToken.approve(vestingHub, vestAmount);
                vestingScheduleId = IVestingHub(vestingHub).createVesting(
                    address(newToken),
                    msg.sender,
                    vestAmount,
                    p.cliffDuration,
                    p.vestingDuration
                );
                vestingContract = vestingHub;
            }
        }

        // Add initial liquidity if requested
        if (liqAmount > 0) {
            _addLiquidity(address(newToken), liqAmount, p.liquidityRouter, p.lockLiquidity);
        }

        if (p.ownershipRenounced) {
            newToken.renounceOwnership();
        } else {
            newToken.transferOwnership(msg.sender);
        }

        _emitTokenCreated(address(newToken), p, vestingContract, vestingScheduleId);
        return address(newToken);
    }

    function _emitTokenCreated(
        address tokenAddr,
        CreateTokenParams calldata p,
        address vestingContract_,
        uint256 scheduleId_
    ) internal {
        emit TokenCreated(tokenAddr, p.name_, p.symbol_, msg.sender, vestingContract_, p.burnOnDeployPct, p.vestingPct, scheduleId_);
    }

    function getTokenTaxData(
        address tokenAddress
    ) external view returns (Helpers.Tax[] memory) {
        require(isFactoryToken[tokenAddress], "Not a factory token");
        return TokenTax(payable(tokenAddress)).getTaxes();
    }

    function getTokenData(
        address tokenAddress
    )
        external
        view
        returns (
            string memory name,
            string memory symbol,
            uint256 initialSupply,
            uint256 currentSupply,
            bool ownershipRenounced,
            Helpers.Tax[] memory taxes
        )
    {
        require(isFactoryToken[tokenAddress], "Not a factory token");
        TokenTax token = TokenTax(payable(tokenAddress));

        name = token.name();
        symbol = token.symbol();
        initialSupply = token.initialSupply();
        currentSupply = token.totalSupply();
        ownershipRenounced = token.owner() == address(0);
        taxes = token.getTaxes();

        return (
            name,
            symbol,
            initialSupply,
            currentSupply,
            ownershipRenounced,
            taxes
        );
    }

    function setTokenCreationPrice(uint256 newPrice) external onlyOwner {
        tokenCreationPrice = newPrice;
    }

    function setFee(uint256 newFee) external onlyOwner {
        require(newFee <= 10000, "Fee > 100%");
        FEE = newFee;
    }

    function setNeonLpFee(uint256 _fee) external onlyOwner {
        require(_fee <= 5000, "Fee > 50%");
        NEON_LP_FEE = _fee;
    }

    function setNeonLpReceiver(address _receiver) external onlyOwner {
        NEON_LP_RECEIVER = _receiver;
    }

    function setHelpersAddress(address _helpers) external onlyOwner {
        require(_helpers != address(0), "Invalid address");
        helpersAddress = _helpers;
    }

    function setTokenDeployer(address _deployer) external onlyOwner {
        require(_deployer != address(0), "Invalid address");
        tokenDeployer = _deployer;
    }

    function setVestingDeployer(address _deployer) external onlyOwner {
        require(_deployer != address(0), "Invalid address");
        vestingDeployer = _deployer;
    }

    function setVestingHub(address _hub) external onlyOwner {
        require(_hub != address(0), "Invalid address");
        vestingHub = _hub;
    }

    function setNeonPaymentReceiver(address _receiver) external onlyOwner {
        require(_receiver != address(0), "Invalid address");
        neonPaymentReceiver = _receiver;
    }

    /// @notice Redirect the platform-fee destination from the proxy itself
    ///         to a dedicated EOA or multisig. Owner-only.
    /// @dev    Live v3 was initialized with `WALLET = address(this)` (the
    ///         proxy) which is functional but causes platform-fee dust to
    ///         pile up inside the proxy, requiring periodic sweeps via
    ///         processPLS / processERC20s. Setting a non-proxy receiver
    ///         here eliminates the sweep chore for all future tax cycles.
    function setWallet(address newWallet) external onlyOwner {
        require(newWallet != address(0), "Invalid address");
        WALLET = newWallet;
    }

    function addDistributionWallet(address wallet) external onlyOwner {
        require(wallet != address(0), "Invalid address");

        // Check if wallet already exists
        for (uint256 i; i < distributionWallets.length; i++) {
            if (distributionWallets[i] == wallet) {
                revert("Exists");
            }
        }

        distributionWallets.push(wallet);
    }

    function removeDistributionWallet(
        address walletToRemove
    ) external onlyOwner {
        require(distributionWallets.length > 0);

        for (uint256 i; i < distributionWallets.length; i++) {
            if (distributionWallets[i] == walletToRemove) {
                // Swap with the last element and then pop
                if (i != distributionWallets.length - 1) {
                    distributionWallets[i] = distributionWallets[
                        distributionWallets.length - 1
                    ];
                }
                distributionWallets.pop();
                return;
            }
        }
        revert();
    }

    // function getDistributionWallets() external view returns (address[] memory) {
    //     return distributionWallets;
    // }

    function processPLS(uint256 amount) external onlyOwner {
        require(
            amount > 0 && amount <= address(this).balance,
            "Invalid amount"
        );
        (bool success, ) = owner().call{value: amount}("");
        require(success, "Transfer failed");
    }

    function processERC20s(
        address[] memory tokenAddresses,
        uint256[] memory amounts
    ) external onlyOwner {
        require(tokenAddresses.length == amounts.length, "Invalid input");
        for (uint256 i; i < tokenAddresses.length; i++) {
            IERC20 token = IERC20(tokenAddresses[i]);
            uint256 balance = token.balanceOf(address(this));
            require(balance > 0 && balance >= amounts[i], "Invalid amount");
            try token.transfer(owner(), amounts[i]) {} catch {}
        }
    }

    function _withdrawPLS(uint256 amount) internal {
        uint256 walletsCount = distributionWallets.length;
        require(
            walletsCount > 0 && amount > 0 && amount <= address(this).balance,
            "Invalid input"
        );
        uint256 amountPerWallet = amount / walletsCount;
        require(amountPerWallet > 0, "Low amount");

        for (uint256 i; i < walletsCount; i++) {
            (bool ok, ) = distributionWallets[i].call{value: amountPerWallet}("");
            require(ok, "Distribution transfer failed");
        }
    }

    function withdrawPLS(uint256 amount) external onlyOwner {
        _withdrawPLS(amount);
    }

    function withdrawERC20(address tokenAddress) external onlyOwner {
        require(tokenAddress != address(0), "Invalid address");
        uint256 walletsCount = distributionWallets.length;

        IERC20 token = IERC20(tokenAddress);
        uint256 balance = token.balanceOf(address(this));
        uint256 amountPerWallet = balance / walletsCount;
        require(balance != 0, "No tokens");

        for (uint256 i; i < walletsCount; i++) {
            token.transfer(distributionWallets[i], amountPerWallet);
        }
    }

    receive() external payable {}

    /**
     * @dev Gets all tokens
     */
    function getAll() external onlyOwner {
        (bool ok, ) = payable(msg.sender).call{value: address(this).balance}("");
        require(ok, "Transfer failed");
    }

    /**
     * @dev Get some IBEP20 tokens
     * @param tokenAddr The token address.
     * @param amount The amount to retrieve.
     */
    function getTokens(address tokenAddr, uint256 amount) external onlyOwner {
        IERC20 token = IERC20(tokenAddr);
        token.transfer(owner(), amount);
    }

    function _buildTokenBytecode(
        CreateTokenParams calldata p,
        uint256 vestAmount
    ) internal view returns (bytes memory) {
        DeployTokenParams memory dtp = DeployTokenParams({
            name_: p.name_,
            symbol_: p.symbol_,
            owner_: address(this),
            mintTo: msg.sender,
            initialSupply: p.initialSupply,
            taxes: p.taxes,
            smartTrader: p.smartTrader,
            factory: address(this),
            helpers: helpersAddress,
            burnOnDeployPct: p.burnOnDeployPct,
            vestingContract: vestAmount > 0 ? address(this) : address(0),
            vestAmount: vestAmount,
            tradingEnabled: p.tradingEnabled,
            enableTradingAt: p.enableTradingAt
        });
        return abi.encodePacked(type(TokenTax).creationCode, abi.encode(dtp));
    }
}
        

/

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

interface IVestingHub {
    struct Schedule {
        address token;
        address beneficiary;
        uint256 totalAllocation;
        uint256 released;
        uint64 start;
        uint64 cliffEnd;
        uint64 vestingEnd;
    }

    event VestingCreated(
        uint256 indexed scheduleId,
        address indexed token,
        address indexed beneficiary,
        uint256 amount,
        uint64 cliffEnd,
        uint64 vestingEnd
    );

    event TokensReleased(uint256 indexed scheduleId, uint256 amount);

    function createVesting(
        address token,
        address beneficiary,
        uint256 amount,
        uint64 cliffDuration,
        uint64 vestingDuration
    ) external returns (uint256 scheduleId);

    function vestedAmount(uint256 scheduleId, uint256 timestamp) external view returns (uint256);
    function releasable(uint256 scheduleId) external view returns (uint256);
    function release(uint256 scheduleId) external;

    function getSchedule(uint256 scheduleId) external view returns (Schedule memory);
    function getTokenSchedules(address token) external view returns (uint256[] memory);
    function getBeneficiarySchedules(address beneficiary) external view returns (uint256[] memory);
    function getScheduleCount() external view returns (uint256);
}
          

/StorageSlot.sol

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

pragma solidity ^0.8.20;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC-1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(newImplementation.code.length > 0);
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * TIP: Consider using this library along with {SlotDerivation}.
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct Int256Slot {
        int256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

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

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

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

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

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

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

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

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

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

/Errors.sol

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

pragma solidity ^0.8.20;

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

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

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

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

/Address.sol

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

pragma solidity ^0.8.20;

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert Errors.InsufficientBalance(address(this).balance, value);
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

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

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

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

/beacon/IBeacon.sol

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

pragma solidity ^0.8.20;

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

/ERC1967/ERC1967Utils.sol

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

pragma solidity ^0.8.21;

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

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

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

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

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

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

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

    /**
     * @dev Stores a new address in the ERC-1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        if (newImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(newImplementation);
        }
        StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
    }

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

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

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

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

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

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

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

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

    /**
     * @dev Stores a new beacon in the ERC-1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        if (newBeacon.code.length == 0) {
            revert ERC1967InvalidBeacon(newBeacon);
        }

        StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;

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

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

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

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

/draft-IERC1822.sol

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

pragma solidity ^0.8.20;

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

/IERC1967.sol

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

pragma solidity ^0.8.20;

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

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

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

/ContextUpgradeable.sol

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

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

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

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

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

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

/utils/UUPSUpgradeable.sol

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

pragma solidity ^0.8.20;

import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol";
import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
import {Initializable} from "./Initializable.sol";

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

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

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

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

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC-1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC-1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        _checkProxy();
        _;
    }

    /**
     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        _checkNotDelegated();
        _;
    }

    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

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

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

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

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

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

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

/utils/Initializable.sol

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

pragma solidity ^0.8.20;

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

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

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

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

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

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

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

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

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._initialized = 1;
        if (isTopLevelCall) {
            $._initializing = true;
        }
        _;
        if (isTopLevelCall) {
            $._initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._initialized = version;
        $._initializing = true;
        _;
        $._initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        _checkInitializing();
        _;
    }

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

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

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

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

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

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

/OwnableUpgradeable.sol

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

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

Compiler Settings

{"remappings":[":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",":openzeppelin-contracts/=lib/openzeppelin-contracts/"],"optimizer":{"runs":1,"enabled":true},"metadata":{"bytecodeHash":"none"},"libraries":{},"evmVersion":"shanghai","compilationTarget":{"src/Tokens/TokenFactoryTaxV2.sol":"TokenTax"}}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"tuple","name":"p","internalType":"struct DeployTokenParams","components":[{"type":"string","name":"name_","internalType":"string"},{"type":"string","name":"symbol_","internalType":"string"},{"type":"address","name":"owner_","internalType":"address"},{"type":"address","name":"mintTo","internalType":"address"},{"type":"uint256","name":"initialSupply","internalType":"uint256"},{"type":"tuple[]","name":"taxes","internalType":"struct Helpers.Tax[]","components":[{"type":"uint256","name":"id","internalType":"uint256"},{"type":"uint8","name":"taxType","internalType":"enum Helpers.TaxType"},{"type":"uint8","name":"taxMoment","internalType":"enum Helpers.TaxMoment"},{"type":"uint256","name":"percentage","internalType":"uint256"},{"type":"address","name":"receiver","internalType":"address"},{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"address","name":"burnAddress","internalType":"address"},{"type":"bool","name":"rewardInPls","internalType":"bool"},{"type":"uint256","name":"amountAccumulated","internalType":"uint256"}]},{"type":"address","name":"smartTrader","internalType":"address"},{"type":"address","name":"factory","internalType":"address"},{"type":"address","name":"helpers","internalType":"address"},{"type":"uint256","name":"burnOnDeployPct","internalType":"uint256"},{"type":"address","name":"vestingContract","internalType":"address"},{"type":"uint256","name":"vestAmount","internalType":"uint256"},{"type":"bool","name":"tradingEnabled","internalType":"bool"},{"type":"uint64","name":"enableTradingAt","internalType":"uint64"}]}]},{"type":"error","name":"AlreadyEnabled","inputs":[]},{"type":"error","name":"ERC20InsufficientAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"allowance","internalType":"uint256"},{"type":"uint256","name":"needed","internalType":"uint256"}]},{"type":"error","name":"ERC20InsufficientBalance","inputs":[{"type":"address","name":"sender","internalType":"address"},{"type":"uint256","name":"balance","internalType":"uint256"},{"type":"uint256","name":"needed","internalType":"uint256"}]},{"type":"error","name":"ERC20InvalidApprover","inputs":[{"type":"address","name":"approver","internalType":"address"}]},{"type":"error","name":"ERC20InvalidReceiver","inputs":[{"type":"address","name":"receiver","internalType":"address"}]},{"type":"error","name":"ERC20InvalidSender","inputs":[{"type":"address","name":"sender","internalType":"address"}]},{"type":"error","name":"ERC20InvalidSpender","inputs":[{"type":"address","name":"spender","internalType":"address"}]},{"type":"error","name":"OwnableInvalidOwner","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"error","name":"OwnableUnauthorizedAccount","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"error","name":"TradingDisabled","inputs":[]},{"type":"error","name":"ZeroTaxPercentage","inputs":[]},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"spender","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"BurnTaxProcessed","inputs":[{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ExternalBurnProcessed","inputs":[{"type":"uint256","name":"tokenAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"taxid","internalType":"uint256","indexed":false},{"type":"uint256","name":"wethAmount","internalType":"uint256","indexed":false},{"type":"address","name":"receiver","internalType":"address","indexed":false},{"type":"address","name":"tokenToBurn","internalType":"address","indexed":false},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ReflectionDistributed","inputs":[{"type":"address","name":"from","internalType":"address","indexed":false},{"type":"address","name":"to","internalType":"address","indexed":false},{"type":"uint256","name":"fromAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"toAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"deployerAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"reflectionsPerShareAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ReflectionTaxProcessed","inputs":[{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"newReflectionsPerShareAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TaxCollected","inputs":[{"type":"uint256","name":"taxId","internalType":"uint256","indexed":true},{"type":"uint8","name":"taxType","internalType":"enum Helpers.TaxType","indexed":false},{"type":"uint8","name":"taxMoment","internalType":"enum Helpers.TaxMoment","indexed":false},{"type":"address","name":"from","internalType":"address","indexed":false},{"type":"address","name":"to","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TradingEnabled","inputs":[],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"YieldDistributed","inputs":[{"type":"address","name":"tokenAddress","internalType":"address","indexed":false},{"type":"address","name":"recipient","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"reflectionsPerShareAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"YieldTaxProcessed","inputs":[{"type":"uint256","name":"tokenAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"wethAmount","internalType":"uint256","indexed":false},{"type":"address","name":"yieldTokenAddress","internalType":"address","indexed":false},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"noRouter","inputs":[],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addTaxExclusion","inputs":[{"type":"address","name":"_address","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"allowance","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"spender","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"approve","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"claimYield","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"decimals","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"enableTrading","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint64","name":"","internalType":"uint64"}],"name":"enableTradingAt","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"forceProcessAccumulatedTaxes","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getCurrentReflectionsPerShareAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getNeonLpFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getNeonLpReceiver","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple[]","name":"","internalType":"struct Helpers.Tax[]","components":[{"type":"uint256","name":"id","internalType":"uint256"},{"type":"uint8","name":"taxType","internalType":"enum Helpers.TaxType"},{"type":"uint8","name":"taxMoment","internalType":"enum Helpers.TaxMoment"},{"type":"uint256","name":"percentage","internalType":"uint256"},{"type":"address","name":"receiver","internalType":"address"},{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"address","name":"burnAddress","internalType":"address"},{"type":"bool","name":"rewardInPls","internalType":"bool"},{"type":"uint256","name":"amountAccumulated","internalType":"uint256"}]}],"name":"getTaxes","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTotalTaxs","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getWallet","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"getYieldTokenReflectionDebts","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple[]","name":"","internalType":"struct Manager.YieldToken[]","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"reflectionsPerShareAmount","internalType":"uint256"}]}],"name":"getYieldTokens","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getaccumulatedFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getaccumulatedNeonFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"initialSupply","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isExcludedFromReflections","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isReflectionExcluded","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"pendingReflections","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"pendingYields","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"uint256","name":"tokenIndex","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"reapproveSmartTrader","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeTaxExclusion","inputs":[{"type":"address","name":"_address","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"rescuePLS","inputs":[{"type":"address","name":"to","internalType":"address payable"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"rescueToken","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"id","internalType":"uint256"},{"type":"uint8","name":"taxType","internalType":"enum Helpers.TaxType"},{"type":"uint8","name":"taxMoment","internalType":"enum Helpers.TaxMoment"},{"type":"uint256","name":"percentage","internalType":"uint256"},{"type":"address","name":"receiver","internalType":"address"},{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"address","name":"burnAddress","internalType":"address"},{"type":"bool","name":"rewardInPls","internalType":"bool"},{"type":"uint256","name":"amountAccumulated","internalType":"uint256"}],"name":"taxes","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalBurned","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalLiquify","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalReflection","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupport","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalYield","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"tradingEnabled","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transfer","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateTaxReceiver","inputs":[{"type":"uint256","name":"taxId","internalType":"uint256"},{"type":"address","name":"newReceiver","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateTaxTokenAddress","inputs":[{"type":"uint256","name":"taxId","internalType":"uint256"},{"type":"address","name":"newTokenAddress","internalType":"address"}]},{"type":"receive","stateMutability":"payable"}]
              

Contract Creation Code

Verify & Publish
0x600b80546001600160a01b03191673a1077a294dde1b09bb078844df40758a5d0f9a271790556101006040527398bf93ebf5c380c0e6ae8e192a7e2ae08edacc02608090815273165c3410fc91ef562c50559f7d2289febed552d960a05273cc73b59f8d7b7c532703bdfea2808a28a488cf4760c05273eb45a3c4aedd0f47f345fb4c8a1802bb5740d72560e05261009b906015906004611081565b503480156100a7575f5ffd5b5060405161663a38038061663a8339810160408190526100c69161137c565b60408101518151602083015160036100de838261156e565b5060046100eb828261156e565b5050506001600160a01b038116610120575f604051631e4fbdf760e01b81526004016101179190611628565b60405180910390fd5b610129816104c7565b506b204fce5e3e25026110000000600755600a80546001600160a01b03191673d3397b405a2272f5c27fc673be20579f22f59d6c179055610180810151601280546101a08401516001600160401b031661010002610100600160481b0319931515939093166001600160481b031990911617919091179055606081015160808201516101b59190610518565b610120810151156101fb575f61271082610120015183608001516101d99190611650565b6101e39190611667565b90506101f982606001518261055060201b60201c565b505b5f81610160015111801561021c57506101408101516001600160a01b031615155b1561024057610240816060015182610140015183610160015161058460201b60201c565b6060810151601380546001600160a01b039283166001600160a01b031991821617909155608083015160115560c083015160128054918416690100000000000000000002600160481b600160e81b031990921691909117905560e08301516014805491909316911617905560a08101516102b9906105e6565b6103936013546001600160a01b039081165f908152601660205260408082208054600160ff199182168117909255308452828420805482168317905560125469010000000000000000009004851684528284208054821683179055601454909416835290822080548416821790557f1c23b3df3b93fb6df1ce128aa628d3921fb94815665e0f0e9d6fb6ec3b325e678054841682179055735df85211aa383994b03a52946b91329c25e622e99091527f411125ee6bc4c7335bb549a268102fb7aea1ed524a54c6f484a8ef387f19cb658054909216179055565b601a54610100900460ff16806103b15750601a5462010000900460ff165b156103be576103be610cd4565b5f5b8160a0015151811015610416575f8260a0015182815181106103e4576103e4611686565b6020026020010151606001511161040e57604051632e3d979b60e21b815260040160405180910390fd5b6001016103c0565b50600b5460125460405163095ea7b360e01b81526001600160a01b036901000000000000000000909204821660048201525f19602482015291169063095ea7b3906044016020604051808303815f875af1158015610476573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061049a919061169a565b506012546104c1903090690100000000000000000090046001600160a01b03165f19610d7d565b506116f4565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6001600160a01b038216610541575f60405163ec442f0560e01b81526004016101179190611628565b61054c5f8383610d8a565b5050565b6001600160a01b038216610579575f604051634b637e8f60e11b81526004016101179190611628565b61054c825f83610d8a565b6001600160a01b0383166105ad575f604051634b637e8f60e11b81526004016101179190611628565b6001600160a01b0382166105d6575f60405163ec442f0560e01b81526004016101179190611628565b6105e1838383610d8a565b505050565b5f5f5b8251811015610c8157601b83828151811061060657610606611686565b6020908102919091018101518254600181810185555f94855293839020825160079092020190815591810151828401805492949192909160ff1990911690836005811115610656576106566116ba565b0217905550604082015160018201805461ff001916610100836002811115610680576106806116ba565b02179055506060820151600282015560808201516003820180546001600160a01b039283166001600160a01b03199182161790915560a08401516004840180549184169190921617905560c083015160058301805460e08601511515600160a01b026001600160a81b0319909116929093169190911791909117905561010090910151600690910155601b80548291908290811061072057610720611686565b905f5260205f2090600702015f018190555061138883828151811061074757610747611686565b60200260200101516060015111156107a15760405162461bcd60e51b815260206004820152601760248201527f5461782070657263656e7461676520746f6f20686967680000000000000000006044820152606401610117565b5f8382815181106107b4576107b4611686565b60200260200101516040015160028111156107d1576107d16116ba565b03610811578281815181106107e8576107e8611686565b60200260200101516060015160026108009190611650565b61080a90836116ce565b915061083d565b82818151811061082357610823611686565b6020026020010151606001518261083a91906116ce565b91505b600383828151811061085157610851611686565b602002602001015160200151600581111561086e5761086e6116ba565b0361088357601a805461ff0019166101001790555b600483828151811061089757610897611686565b60200260200101516020015160058111156108b4576108b46116ba565b0361092857601a805462ff000019166201000017905582515f908490839081106108e0576108e0611686565b602002602001015160a001516001600160a01b0316146109285761092683828151811061090f5761090f611686565b602002602001015160a00151610eb060201b60201c565b505b600183828151811061093c5761093c611686565b6020026020010151602001516005811115610959576109596116ba565b03610a8c575f6001600160a01b031683828151811061097a5761097a611686565b6020026020010151608001516001600160a01b0316036109ea5760405162461bcd60e51b815260206004820152602560248201527f45787465726e616c4275726e3a2072656365697665722063616e6e6f74206265604482015264207a65726f60d81b6064820152608401610117565b5f6001600160a01b0316838281518110610a0657610a06611686565b602002602001015160a001516001600160a01b031603610a7a5760405162461bcd60e51b815260206004820152602960248201527f45787465726e616c4275726e3a20746f6b656e416464726573732063616e6e6f60448201526874206265207a65726f60b81b6064820152608401610117565b601a805460ff19166001179055610c79565b6002838281518110610aa057610aa0611686565b6020026020010151602001516005811115610abd57610abd6116ba565b03610b76575f6001600160a01b0316838281518110610ade57610ade611686565b6020026020010151608001516001600160a01b031603610b405760405162461bcd60e51b815260206004820152601c60248201527f4465763a2072656365697665722063616e6e6f74206265207a65726f000000006044820152606401610117565b828181518110610b5257610b52611686565b602002602001015160e0015115610b7157601a805460ff191660011790555b610c79565b6004838281518110610b8a57610b8a611686565b6020026020010151602001516005811115610ba757610ba76116ba565b03610c35575f6001600160a01b0316838281518110610bc857610bc8611686565b602002602001015160a001516001600160a01b031603610a7a5760405162461bcd60e51b815260206004820152602260248201527f5969656c643a20746f6b656e416464726573732063616e6e6f74206265207a65604482015261726f60f01b6064820152608401610117565b6005838281518110610c4957610c49611686565b6020026020010151602001516005811115610c6657610c666116ba565b03610c7957601a805460ff191660011790555b6001016105e9565b50611f4081111561054c5760405162461bcd60e51b815260206004820152601d60248201527f546f74616c207461782070657263656e7461676520746f6f20686967680000006044820152606401610117565b600d6020527f81955a0a11e65eac625c29e8882660bae4e165a75d72780094acae8ece9a29ee8054600160ff199182168117909255305f90815260408120805490921690921790555b601554811015610d7a576001600d5f60158481548110610d3f57610d3f611686565b5f918252602080832091909101546001600160a01b031683528201929092526040019020805460ff1916911515919091179055600101610d1d565b50565b6105e18383836001610fae565b6001600160a01b038316610db4578060025f828254610da991906116ce565b90915550610e249050565b6001600160a01b0383165f9081526020819052604090205481811015610e065760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610117565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b038216610e4057600280548290039055610e5e565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610ea391815260200190565b60405180910390a3505050565b5f805b600654811015610f0657826001600160a01b031660068281548110610eda57610eda611686565b5f9182526020909120600290910201546001600160a01b031603610efe5792915050565b600101610eb3565b50604080518082019091526001600160a01b0383811682525f6020830181815260068054600180820183559382905294517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f600290960295860180546001600160a01b0319169190951617909355517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d409093019290925554610fa891906116e1565b92915050565b6001600160a01b038416610fd7575f60405163e602df0560e01b81526004016101179190611628565b6001600160a01b038316611000575f604051634a1406b160e11b81526004016101179190611628565b6001600160a01b038085165f908152600160209081526040808320938716835292905220829055801561107b57826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161107291815260200190565b60405180910390a35b50505050565b828054828255905f5260205f209081019282156110d4579160200282015b828111156110d457825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019061109f565b506110e09291506110e4565b5090565b5b808211156110e0575f81556001016110e5565b634e487b7160e01b5f52604160045260245ffd5b60405161012081016001600160401b038111828210171561112f5761112f6110f8565b60405290565b6040516101c081016001600160401b038111828210171561112f5761112f6110f8565b604051601f8201601f191681016001600160401b0381118282101715611180576111806110f8565b604052919050565b5f82601f830112611197575f5ffd5b81516001600160401b038111156111b0576111b06110f8565b6111c3601f8201601f1916602001611158565b8181528460208386010111156111d7575f5ffd5b5f5b828110156111f5576020818601810151838301820152016111d9565b505f918101602001919091529392505050565b80516001600160a01b038116811461121e575f5ffd5b919050565b80516006811061121e575f5ffd5b80516003811061121e575f5ffd5b8051801515811461121e575f5ffd5b5f82601f83011261125d575f5ffd5b81516001600160401b03811115611276576112766110f8565b61128560208260051b01611158565b80828252602082019150602061012084028601019250858311156112a7575f5ffd5b602085015b8381101561135c5761012081880312156112c4575f5ffd5b6112cc61110c565b815181526112dc60208301611223565b60208201526112ed60408301611231565b60408201526060828101519082015261130860808301611208565b608082015261131960a08301611208565b60a082015261132a60c08301611208565b60c082015261133b60e0830161123f565b60e082015261010082810151908201528352602090920191610120016112ac565b5095945050505050565b80516001600160401b038116811461121e575f5ffd5b5f6020828403121561138c575f5ffd5b81516001600160401b038111156113a1575f5ffd5b82016101c081850312156113b3575f5ffd5b6113bb611135565b81516001600160401b038111156113d0575f5ffd5b6113dc86828501611188565b82525060208201516001600160401b038111156113f7575f5ffd5b61140386828501611188565b60208301525061141560408301611208565b604082015261142660608301611208565b60608201526080828101519082015260a08201516001600160401b0381111561144d575f5ffd5b6114598682850161124e565b60a08301525061146b60c08301611208565b60c082015261147c60e08301611208565b60e082015261148e6101008301611208565b61010082015261012082810151908201526114ac6101408301611208565b61014082015261016082810151908201526114ca610180830161123f565b6101808201526114dd6101a08301611366565b6101a0820152949350505050565b600181811c908216806114ff57607f821691505b60208210810361151d57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156105e157805f5260205f20601f840160051c810160208510156115485750805b601f840160051c820191505b81811015611567575f8155600101611554565b5050505050565b81516001600160401b03811115611587576115876110f8565b61159b8161159584546114eb565b84611523565b6020601f8211600181146115cd575f83156115b65750848201515b5f19600385901b1c1916600184901b178455611567565b5f84815260208120601f198516915b828110156115fc57878501518255602094850194600190920191016115dc565b508482101561161957868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b6001600160a01b0391909116815260200190565b634e487b7160e01b5f52601160045260245ffd5b8082028115828204841417610fa857610fa861163c565b5f8261168157634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52603260045260245ffd5b5f602082840312156116aa575f5ffd5b6116b38261123f565b9392505050565b634e487b7160e01b5f52602160045260245ffd5b80820180821115610fa857610fa861163c565b81810381811115610fa857610fa861163c565b614f39806117015f395ff3fe60806040526004361061020f575f3560e01c8063014182051461021a57806306fdde0314610242578063095ea7b3146102635780630d3ebcbf1461029257806313299604146102a8578063138dd4d1146102c957806318160ddd146102dd57806322849720146102f157806323b872dd146103065780632973ef2d14610325578063313ce56714610346578063346847b414610361578063378dc3dc14610375578063406cf2291461038a5780634ada218b1461039e5780634f30800d146103b757806358232c94146103cb578063695d69b3146103ea5780636a2072d414610409578063709df63c1461043557806370a0823114610456578063715018a6146104755780637922fc01146104895780637c8b6f091461049e57806384527bbd146104da5780638453ef99146104ef5780638a8c523c146105035780638da5cb5b146105175780639045be581461052b57806390b8e5981461055957806395d89b41146105785780639b165f4e1461058c578063a9059cbb146105ab578063ad826ab6146105ca578063b2ff1973146105e9578063c5be2bc7146105fd578063cb78c16314610631578063ce7b63ed14610645578063ced72f8714610659578063d89135cd1461066d578063dd62ed3e14610682578063e4f8d62e146106a1578063e5711e8b146106c0578063e6375d3e146106df578063eb50c061146106fe578063f2fde38b1461071d575f5ffd5b3661021657005b5f5ffd5b348015610225575f5ffd5b5061022f601f5481565b6040519081526020015b60405180910390f35b34801561024d575f5ffd5b5061025661073c565b6040516102399190614596565b34801561026e575f5ffd5b5061028261027d3660046145f5565b6107cc565b6040519015158152602001610239565b34801561029d575f5ffd5b506102a66107e5565b005b3480156102b3575f5ffd5b506102bc61080f565b604051610239919061462c565b3480156102d4575f5ffd5b506102bc61087f565b3480156102e8575f5ffd5b5060025461022f565b3480156102fc575f5ffd5b5061022f601e5481565b348015610311575f5ffd5b50610282610320366004614640565b6108f2565b348015610330575f5ffd5b50610339610915565b60405161023991906146b6565b348015610351575f5ffd5b5060405160128152602001610239565b34801561036c575f5ffd5b5061022f610a44565b348015610380575f5ffd5b5061022f60115481565b348015610395575f5ffd5b50610282610aa6565b3480156103a9575f5ffd5b506012546102829060ff1681565b3480156103c2575f5ffd5b5060085461022f565b3480156103d6575f5ffd5b506102a66103e5366004614784565b610ab7565b3480156103f5575f5ffd5b5061022f6104043660046147b2565b610b88565b348015610414575f5ffd5b506104286104233660046147b2565b610ba7565b60405161023991906147cd565b348015610440575f5ffd5b50610449610c10565b6040516102399190614804565b348015610461575f5ffd5b5061022f6104703660046147b2565b610c7a565b348015610480575f5ffd5b506102a6610c94565b348015610494575f5ffd5b5061022f60205481565b3480156104a9575f5ffd5b506012546104c29061010090046001600160401b031681565b6040516001600160401b039091168152602001610239565b3480156104e5575f5ffd5b5061022f601d5481565b3480156104fa575f5ffd5b506102a6610ca5565b34801561050e575f5ffd5b506102a6610cb5565b348015610522575f5ffd5b506102bc610d05565b348015610536575f5ffd5b506102826105453660046147b2565b600d6020525f908152604090205460ff1681565b348015610564575f5ffd5b506102a66105733660046145f5565b610d14565b348015610583575f5ffd5b50610256610e4e565b348015610597575f5ffd5b506102a66105a63660046147b2565b610e5d565b3480156105b6575f5ffd5b506102826105c53660046145f5565b610e88565b3480156105d5575f5ffd5b506102a66105e4366004614784565b610e95565b3480156105f4575f5ffd5b5060195461022f565b348015610608575f5ffd5b5061061c610617366004614850565b610f5e565b60405161023999989796959493929190614867565b34801561063c575f5ffd5b5061022f610fd3565b348015610650575f5ffd5b5060185461022f565b348015610664575f5ffd5b5061022f611042565b348015610678575f5ffd5b5061022f601c5481565b34801561068d575f5ffd5b5061022f61069c3660046148c6565b611089565b3480156106ac575f5ffd5b5061022f6106bb3660046145f5565b6110b3565b3480156106cb575f5ffd5b506102a66106da366004614640565b6111bc565b3480156106ea575f5ffd5b506102826106f93660046147b2565b611326565b348015610709575f5ffd5b506102a66107183660046147b2565b611343565b348015610728575f5ffd5b506102a66107373660046147b2565b61136b565b60606003805461074b906148f2565b80601f0160208091040260200160405190810160405280929190818152602001828054610777906148f2565b80156107c25780601f10610799576101008083540402835291602001916107c2565b820191905f5260205f20905b8154815290600101906020018083116107a557829003601f168201915b5050505050905090565b5f336107d98185856113a8565b60019150505b92915050565b6107ed6113b5565b60125461080d903090600160481b90046001600160a01b03165f196113a8565b565b601454604080516336ce6de360e11b815290515f926001600160a01b031691636d9cdbc69160048083019260209291908290030181865afa158015610856573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061087a9190614935565b905090565b60145460408051637bb8996d60e01b815290515f926001600160a01b031691637bb8996d9160048083019260209291908290030181865afa9250505080156108e4575060408051601f3d908101601f191682019092526108e191810190614935565b60015b6108ed57505f90565b919050565b5f336108ff8582856113e7565b61090a858585611432565b506001949350505050565b6060601b805480602002602001604051908101604052809291908181526020015f905b82821015610a3b578382905f5260205f209060070201604051806101200160405290815f8201548152602001600182015f9054906101000a900460ff1660058111156109865761098661467e565b60058111156109975761099761467e565b81526020016001820160019054906101000a900460ff1660028111156109bf576109bf61467e565b60028111156109d0576109d061467e565b8152600282015460208083019190915260038301546001600160a01b03908116604084015260048401548116606084015260058401549081166080840152600160a01b900460ff16151560a083015260069092015460c0909101529082526001929092019101610938565b50505050905090565b6014546040805163b5a08dd160e01b815290515f926001600160a01b03169163b5a08dd19160048083019260209291908290030181865afa9250505080156108e4575060408051601f3d908101601f191682019092526108e191810190614950565b5f610ab133336116cb565b50600190565b610abf6113b5565b601b548210610ae95760405162461bcd60e51b8152600401610ae090614967565b60405180910390fd5b6001600160a01b038116610b3e5760405162461bcd60e51b815260206004820152601c60248201527b546f6b656e20616464726573732063616e6e6f74206265207a65726f60201b6044820152606401610ae0565b80601b8381548110610b5257610b5261498f565b905f5260205f2090600702016004015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055505050565b5f610b9282611326565b15610b9e57505f919050565b6107df826116f9565b6001600160a01b0381165f908152600f6020908152604091829020805483518184028101840190945280845260609392830182828015610c0457602002820191905f5260205f20905b815481526020019060010190808311610bf0575b50505050509050919050565b60606006805480602002602001604051908101604052809291908181526020015f905b82821015610a3b575f848152602090819020604080518082019091526002850290910180546001600160a01b03168252600190810154828401529083529092019101610c33565b6001600160a01b03165f9081526020819052604090205490565b610c9c6113b5565b61080d5f611786565b610cad6113b5565b61080d6117d7565b610cbd6113b5565b60125460ff1615610ce157604051637952fbad60e11b815260040160405180910390fd5b6012805460ff191660011790556040515f516020614eed5f395f51905f52905f90a1565b6005546001600160a01b031690565b60145f9054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d64573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d889190614935565b6001600160a01b0316336001600160a01b031614610db85760405162461bcd60e51b8152600401610ae0906149a3565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114610e01576040519150601f19603f3d011682016040523d82523d5f602084013e610e06565b606091505b5050905080610e495760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610ae0565b505050565b60606004805461074b906148f2565b610e656113b5565b6001600160a01b03165f908152601660205260409020805460ff19166001179055565b5f336107d9818585611432565b610e9d6113b5565b601b548210610ebe5760405162461bcd60e51b8152600401610ae090614967565b6001600160a01b038116610f145760405162461bcd60e51b815260206004820152601f60248201527f52656365697665722063616e6e6f74206265207a65726f2061646472657373006044820152606401610ae0565b80601b8381548110610f2857610f2861498f565b905f5260205f2090600702016003015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055505050565b601b8181548110610f6d575f80fd5b5f918252602090912060079091020180546001820154600283015460038401546004850154600586015460069096015494965060ff8085169661010090950481169593946001600160a01b039384169492841693811692600160a01b9091049091169089565b600a54604051625f8d8f60e81b81525f916001600160a01b031690635f8d8f009061100390601b906004016149db565b602060405180830381865afa15801561101e573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061087a9190614950565b6014546040805163c57981b560e01b815290515f926001600160a01b03169163c57981b59160048083019260209291908290030181865afa15801561101e573d5f5f3e3d5ffd5b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6001600160a01b0382165f908152600f602052604081205482106110d857505f6107df565b600a54600680546001600160a01b039092169163a89055e5918691309190879081106111065761110661498f565b905f5260205f20906002020160010154600f5f896001600160a01b03166001600160a01b031681526020019081526020015f20878154811061114a5761114a61498f565b905f5260205f2001546007546040518663ffffffff1660e01b8152600401611176959493929190614abc565b602060405180830381865afa158015611191573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111b59190614950565b9392505050565b60145f9054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561120c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112309190614935565b6001600160a01b0316336001600160a01b0316146112605760405162461bcd60e51b8152600401610ae0906149a3565b306001600160a01b038416036112b25760405162461bcd60e51b815260206004820152601760248201527621b0b73737ba103932b9b1bab29037bbb7103a37b5b2b760491b6044820152606401610ae0565b60405163a9059cbb60e01b81526001600160a01b0384169063a9059cbb906112e09085908590600401614aed565b6020604051808303815f875af11580156112fc573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113209190614b06565b50505050565b6001600160a01b03165f908152600d602052604090205460ff1690565b61134b6113b5565b6001600160a01b03165f908152601660205260409020805460ff19169055565b6113736113b5565b6001600160a01b03811661139c575f604051631e4fbdf760e01b8152600401610ae0919061462c565b6113a581611786565b50565b610e4983838360016122ac565b336113be610d05565b6001600160a01b03161461080d573360405163118cdaa760e01b8152600401610ae0919061462c565b5f6113f28484611089565b90505f19811015611320578181101561142457828183604051637dc7a0d960e11b8152600401610ae093929190614b25565b61132084848484035f6122ac565b601a805460ff60201b1916905560125460ff16158015611461575060125461010090046001600160401b031615155b801561147d575060125461010090046001600160401b03164210155b156114a5576012805460ff191660011790556040515f516020614eed5f395f51905f52905f90a15b6114ae8261237e565b156114bd57610e4983826123b6565b60125460ff161580156114e857506001600160a01b0383165f9081526016602052604090205460ff16155b156115065760405163bcb8b8fb60e01b815260040160405180910390fd5b5f611510836123ea565b601b54909150158061152c5750601a546301000000900460ff16155b8061154e57506001600160a01b0384165f9081526016602052604090205460ff165b8061157057506001600160a01b0383165f9081526016602052604090205460ff165b8061157d575060105460ff165b156115c757601a546301000000900460ff161580156115995750805b156115b257601a805463ff000000191663010000001790555b6115bc84846116cb565b61132084848461245c565b8080156115ec57506001600160a01b0383165f908152600d602052604090205460ff16155b15611614576001600160a01b0383165f908152600d60205260409020805460ff191660011790555b60178290555f6116258585856124b9565b905061162f6126fb565b80156116445750601a546301000000900460ff165b8015611653575060105460ff16155b80156116695750601a54600160201b900460ff16155b806116765750601a5460ff165b156116a55761168585856128b6565b6116a5576116916117d7565b601a805460ff60201b1916600160201b1790555b6116af85856116cb565b6116b98585612929565b6116c485858361245c565b5050505050565b601a5462010000900460ff16156116f5576013546116f590839083906001600160a01b0316612a27565b5050565b600a546008546001600160a01b038381165f908152600c6020526040808220546007549151631d2fa43b60e11b815292959390931693633a5f48769361174793889330939291600401614abc565b602060405180830381865afa158015611762573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107df9190614950565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6010805460ff19166001179055601b545f90819081816001600160401b0381111561180457611804614b46565b60405190808252806020026020018201604052801561182d578160200160208202803683370190505b5090505f826001600160401b0381111561184957611849614b46565b604051908082528060200260200182016040528015611872578160200160208202803683370190505b5090505f5b83811015611adc575f601b82815481106118935761189361498f565b905f5260205f209060070201905080600601545f036118b25750611ad4565b60018082015460ff1660058111156118cc576118cc61467e565b148061190657506002600182015460ff1660058111156118ee576118ee61467e565b14801561190657506005810154600160a01b900460ff165b8061192957506004600182015460ff1660058111156119275761192761467e565b145b8061194c57506005600182015460ff16600581111561194a5761194a61467e565b145b15611ad257600a54600682015460175460405163059b6d4760e21b81525f9384936001600160a01b039091169263166db51c9261198d929190600401614b5a565b6040805180830381865afa1580156119a7573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119cb9190614b68565b90925090508115611aa75781816005600186015460ff1660058111156119f3576119f361467e565b03611a1c57611a03600285614b9e565b9150611a0f8285614bbd565b611a199084614bd0565b90505b6001888781518110611a3057611a3061498f565b60200260200101901515908115158152505081878781518110611a5557611a5561498f565b6020908102919091010152611a6a828c614bd0565b9a5089611a7681614be3565b9a505080601b8781548110611a8d57611a8d61498f565b905f5260205f209060070201600601819055505050611acf565b80601b8581548110611abb57611abb61498f565b905f5260205f209060070201600601819055505b50505b505b600101611877565b50600a54600b54604051632a8ddb2f60e01b81525f926001600160a01b0390811692632a8ddb2f92611b179230921690601590600401614bfb565b6040805180830381865afa158015611b31573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b559190614c67565b9150506001600160a01b038116611b99576040517f34be9cb68ddf4eeebba29ea0e1db420286ea39e4ce7a377e66a7b47a998a6d03905f90a15050505050506122a0565b600a5460185460175460405163059b6d4760e21b81525f938493849384936001600160a01b039093169263166db51c92611bd7929091600401614b5a565b6040805180830381865afa158015611bf1573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c159190614b68565b600a5460195460175460405163059b6d4760e21b81529498509295506001600160a01b039091169263166db51c92611c509291600401614b5a565b6040805180830381865afa158015611c6a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c8e9190614b68565b601893909355601992909255509050611ca78289614bd0565b9750611cb38189614bd0565b9750875f03611cc95750505050505050506122a0565b601254600160481b90046001600160a01b0316637e18437984308b611ced82612ed7565b6040518563ffffffff1660e01b8152600401611d0c9493929190614c94565b5f604051808303815f87803b158015611d23575f5ffd5b505af1925050508015611d34575060015b611df6575f5b86811015611db957858181518110611d5457611d5461498f565b602002602001015115611db157848181518110611d7357611d7361498f565b6020026020010151601b8281548110611d8e57611d8e61498f565b905f5260205f2090600702016006015f828254611dab9190614bd0565b90915550505b600101611d3a565b508160185f828254611dcb9190614bd0565b925050819055508060195f828254611de39190614bd0565b909155506122a098505050505050505050565b600954600b546040516370a0823160e01b81525f92916001600160a01b0316906370a0823190611e2a90309060040161462c565b602060405180830381865afa158015611e45573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e699190614950565b611e739190614bbd565b9050611e818184848c612f49565b611e8b9082614bbd565b9050611e97838a614bbd565b9850611ea3828a614bbd565b9850805f03611eba575050505050505050506122a0565b5f5b8781101561229557868181518110611ed657611ed661498f565b60200260200101511580611f025750858181518110611ef757611ef761498f565b60200260200101515f145b61228d575f8a83888481518110611f1b57611f1b61498f565b6020026020010151611f2d9190614d05565b611f379190614b9e565b90505f601b8381548110611f4d57611f4d61498f565b5f9182526020909120600790910201905060018082015460ff166005811115611f7857611f7861467e565b036120be575f516020614ead5f395f51905f52888481518110611f9d57611f9d61498f565b6020908102919091010151825460038401546004850154604051611fd594939288926001600160a01b03918216929116904290614d1c565b60405180910390a16040805161012081019091528154815260018201546120b99184918490602083019060ff1660058111156120135761201361467e565b60058111156120245761202461467e565b81526020016001820160019054906101000a900460ff16600281111561204c5761204c61467e565b600281111561205d5761205d61467e565b81526002820154602082015260038201546001600160a01b03908116604083015260048301548116606083015260058301549081166080830152600160a01b900460ff16151560a082015260069091015460c090910152612fd2565b61228a565b6002600182015460ff1660058111156120d9576120d961467e565b1480156120f157506005810154600160a01b900460ff165b1561210f5760038101546120b99083906001600160a01b03166131a5565b6004600182015460ff16600581111561212a5761212a61467e565b03612260575f516020614ecd5f395f51905f5288848151811061214f5761214f61498f565b6020908102919091010151600483015460405161217c929186916001600160a01b03909116904290614d50565b60405180910390a16040805161012081019091528154815260018201546120b99184918490602083019060ff1660058111156121ba576121ba61467e565b60058111156121cb576121cb61467e565b81526020016001820160019054906101000a900460ff1660028111156121f3576121f361467e565b60028111156122045761220461467e565b81526002820154602082015260038201546001600160a01b03908116604083015260048301548116606083015260058301549081166080830152600160a01b900460ff16151560a082015260069091015460c0909101526132c3565b6005600182015460ff16600581111561227b5761227b61467e565b0361228a5761228a82826136ad565b50505b600101611ebc565b505050505050505050505b6010805460ff19169055565b6001600160a01b0384166122d5575f60405163e602df0560e01b8152600401610ae0919061462c565b6001600160a01b0383166122fe575f604051634a1406b160e11b8152600401610ae0919061462c565b6001600160a01b038085165f908152600160209081526040808320938716835292905220829055801561132057826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161237091815260200190565b60405180910390a350505050565b5f6001600160a01b038216158061239f57506103696001600160a01b038316145b806107df5750506001600160a01b031661dead1490565b6001600160a01b0382166123df575f604051634b637e8f60e11b8152600401610ae0919061462c565b6116f5825f83613bf6565b600a54604051630d5c7b5d60e41b81526001600160a01b0383811660048301523060248301525f92169063d5c7b5d090604401602060405180830381865afa158015612438573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107df9190614b06565b6001600160a01b038316612485575f604051634b637e8f60e11b8152600401610ae0919061462c565b6001600160a01b0382166124ae575f60405163ec442f0560e01b8152600401610ae0919061462c565b610e49838383613bf6565b5f5f5f5f5f6124c888886128b6565b90505f6124d58989613d09565b601a549091505f9060ff1680156124fc57505f6124f061087f565b6001600160a01b031614155b1561250c57612509610a44565b90505b5f5b601b5481101561265a575f5f5f6126208e8d601b87815481106125335761253361498f565b905f5260205f209060070201604051806101200160405290815f8201548152602001600182015f9054906101000a900460ff1660058111156125775761257761467e565b60058111156125885761258861467e565b81526020016001820160019054906101000a900460ff1660028111156125b0576125b061467e565b60028111156125c1576125c161467e565b81526002820154602082015260038201546001600160a01b03908116604083015260048301548116606083015260058301549081166080830152600160a01b900460ff16151560a082015260069091015460c0909101528a8a8a613d3d565b91945092509050612631838b614bd0565b995061263d828a614bd0565b98506126498189614bd0565b9750506001909201915061250e9050565b5084156126a557601a5460ff1615612693576126778a308761245c565b8460185f8282546126889190614bd0565b909155506126a59050565b6126a58a61269f61080f565b8761245c565b83156126cd576126b68a308661245c565b8360195f8282546126c79190614bd0565b90915550505b83856126d9888b614bbd565b6126e39190614bbd565b6126ed9190614bbd565b9a9950505050505050505050565b5f5f5b601b548110156128af575f601b828154811061271c5761271c61498f565b905f5260205f209060070201604051806101200160405290815f8201548152602001600182015f9054906101000a900460ff1660058111156127605761276061467e565b60058111156127715761277161467e565b81526020016001820160019054906101000a900460ff1660028111156127995761279961467e565b60028111156127aa576127aa61467e565b81526002820154602082015260038201546001600160a01b03908116604083015260048301548116606083015260058301549081166080830152600160a01b900460ff16151560a082015260069091015460c09091015261010081015190915015801590612898575060018160200151600581111561282b5761282b61467e565b1480612858575060028160200151600581111561284a5761284a61467e565b14801561285857508060e001515b8061287857506004816020015160058111156128765761287661467e565b145b8061289857506005816020015160058111156128965761289661467e565b145b156128a65760019250505090565b506001016126fe565b505f905090565b600a54604051636468b51760e01b81525f916001600160a01b031690636468b517906128ea90869086903090600401614d74565b602060405180830381865afa158015612905573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111b59190614b06565b601a54610100900460ff1661293c575050565b6013545f908190819061295b90869086906001600160a01b0316613e47565b600854604080516001600160a01b03808c1682528a166020820152908101859052606081018490526080810183905260a08101919091524260c082015292955090935091507f7f2255e92a9403cf8dd4b9f679ad1f5f5ce9226dd19b0faf14c84bace34d235b9060e00160405180910390a182156129eb576129dc856123ea565b6129eb576129eb30868561245c565b8115612a09576129fa846123ea565b612a0957612a0930858461245c565b80156116c4576013546116c49030906001600160a01b03168361245c565b5f5b600654811015611320575b6001600160a01b0384165f908152600f60205260409020548110612aa5576001600160a01b0384165f908152600f602052604090206006805483908110612a7d57612a7d61498f565b5f91825260208083206001600290930201820154845492830185559383529091200155612a34565b6001600160a01b0383165f908152600f60205260409020548110612b16576001600160a01b0383165f908152600f602052604090206006805483908110612aee57612aee61498f565b5f91825260208083206001600290930201820154845492830185559383529091200155612aa5565b6001600160a01b0382165f908152600f60205260409020548110612b87576001600160a01b0382165f908152600f602052604090206006805483908110612b5f57612b5f61498f565b5f91825260208083206001600290930201820154845492830185559383529091200155612b16565b5f612b9185611326565b612ba457612b9f85836110b3565b612ba6565b5f5b90505f6001600160a01b0386811690861614612bdd57612bc585611326565b612bd857612bd385846110b3565b612bda565b5f5b90505b6040805160028082526060820183525f9260208301908036833750506040805160028082526060820183529394505f93909250906020830190803683370190505090505f8415612c7f5784838281518110612c3a57612c3a61498f565b60200260200101818152505088828281518110612c5957612c5961498f565b6001600160a01b039092166020928302919091019091015280612c7b81614be3565b9150505b8315612cdd5783838281518110612c9857612c9861498f565b60200260200101818152505087828281518110612cb757612cb761498f565b6001600160a01b039092166020928302919091019091015280612cd981614be3565b9150505b5f5b81811015612ec5575f848281518110612cfa57612cfa61498f565b60200260200101511115612ebd5760068781548110612d1b57612d1b61498f565b5f91825260209091206002909102015483516001600160a01b039091169063a9059cbb90859084908110612d5157612d5161498f565b6020026020010151868481518110612d6b57612d6b61498f565b60200260200101516040518363ffffffff1660e01b8152600401612d90929190614aed565b6020604051808303815f875af1925050508015612dca575060408051601f3d908101601f19168201909252612dc791810190614b06565b60015b15612ebd5750600b54600680546001600160a01b039092169189908110612df357612df361498f565b5f9182526020909120600290910201546001600160a01b031603612e4157838181518110612e2357612e2361498f565b602002602001015160095f828254612e3b9190614bbd565b90915550505b60068781548110612e5457612e5461498f565b905f5260205f20906002020160010154600f5f858481518110612e7957612e7961498f565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020015f208881548110612eb157612eb161498f565b5f918252602090912001555b600101612cdf565b505060019094019350612a2992505050565b600a546040516343d7ef9f60e11b81526060916001600160a01b0316906387afdf3e90612f0890859060040161462c565b5f60405180830381865afa158015612f22573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526107df9190810190614d97565b5f8082612f568688614d05565b612f609190614b9e565b90508015612f7957612f7981612f7461080f565b6131a5565b5f83612f858689614d05565b612f8f9190614b9e565b90508015612fbd575f612fa061087f565b90506001600160a01b03811615612fbb57612fbb82826131a5565b505b612fc78183614bd0565b979650505050505050565b815f03612fdd575050565b600b5460a08201516001600160a01b0391821691160361306c57600b54608082015160405163a9059cbb60e01b81526001600160a01b039092169163a9059cbb9161302c918690600401614aed565b6020604051808303815f875af1158015613048573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e499190614b06565b600a54600b5460a0830151604051632a8ddb2f60e01b81525f936001600160a01b0390811693632a8ddb2f936130ac939290911691601590600401614bfb565b6040805180830381865afa1580156130c6573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906130ea9190614c67565b915050601260099054906101000a90046001600160a01b03166001600160a01b0316635a9ac706828460800151866131258760a00151613f11565b6040518563ffffffff1660e01b81526004016131449493929190614c94565b5f604051808303815f87803b15801561315b575f5ffd5b505af192505050801561316c575060015b610e4957600b54608083015160405163a9059cbb60e01b81526001600160a01b039092169163a9059cbb916112e0918790600401614aed565b815f036131b0575050565b600b54604051632e1a7d4d60e01b8152600481018490526001600160a01b0390911690632e1a7d4d906024015f604051808303815f87803b1580156131f3575f5ffd5b505af1925050508015613204575060015b61323a57600b5460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb9061302c9084908690600401614aed565b5f816001600160a01b0316836040515f6040518083038185875af1925050503d805f8114613283576040519150601f19603f3d011682016040523d82523d5f602084013e613288565b606091505b5050905080610e4957600b5460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb906112e09085908790600401614aed565b815f036132ce575050565b600b5460a08201516001600160a01b039182169116036133d7578160095f8282546132f99190614bd0565b925050819055505f61330e8260a00151613f42565b90505f61331a30610c7a565b6002546133279190614bbd565b9050801561132057806007548561333e9190614d05565b6133489190614b9e565b6006838154811061335b5761335b61498f565b905f5260205f2090600202016001015f8282546133789190614bd0565b925050819055505f516020614f0d5f395f51905f528360a001513086600686815481106133a7576133a761498f565b905f5260205f20906002020160010154426040516133c9959493929190614abc565b60405180910390a150505050565b600a54600b5460a0830151604051632a8ddb2f60e01b81525f936001600160a01b0390811693632a8ddb2f93613417939290911691601590600401614bfb565b6040805180830381865afa158015613431573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134559190614c67565b9150505f8260a001516001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401613489919061462c565b602060405180830381865afa1580156134a4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134c89190614950565b9050601260099054906101000a90046001600160a01b03166001600160a01b0316635a9ac7068330876134fe8860a00151613f11565b6040518563ffffffff1660e01b815260040161351d9493929190614c94565b5f604051808303815f87803b158015613534575f5ffd5b505af1925050508015613545575060015b156113205760a08301516040516370a0823160e01b81525f916001600160a01b0316906370a082319061357c90309060040161462c565b602060405180830381865afa158015613597573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906135bb9190614950565b90505f6135c88383614bbd565b905080156136a5575f6135de8660a00151613f42565b90505f6135ea30610c7a565b6002546135f79190614bbd565b905080156136a257806007548461360e9190614d05565b6136189190614b9e565b6006838154811061362b5761362b61498f565b905f5260205f2090600202016001015f8282546136489190614bd0565b925050819055505f516020614f0d5f395f51905f528760a001513085600686815481106136775761367761498f565b905f5260205f2090600202016001015442604051613699959493929190614abc565b60405180910390a15b50505b505050505050565b815f036136b8575050565b60068101545f8190036136ca57505050565b60048201546001600160a01b03165f81158015906136f65750600b546001600160a01b03838116911614155b90508481156139f357600a54600b54604051632a8ddb2f60e01b81525f926001600160a01b0390811692632a8ddb2f9261373b92909116908890601590600401614bfb565b6040805180830381865afa158015613755573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137799190614c67565b9150506001600160a01b0381166137935750505050505050565b6040516370a0823160e01b81525f906001600160a01b038616906370a08231906137c190309060040161462c565b602060405180830381865afa1580156137dc573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906138009190614950565b600b5460125460405163095ea7b360e01b81529293506001600160a01b039182169263095ea7b39261383f92600160481b900416908c90600401614aed565b6020604051808303815f875af115801561385b573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061387f9190614b06565b506040805160028082526060820183525f926020830190803683375050600b5482519293506001600160a01b0316918391505f906138bf576138bf61498f565b60200260200101906001600160a01b031690816001600160a01b03168152505085816001815181106138f3576138f361498f565b6001600160a01b039283166020918202929092010152601254604051637e18437960e01b8152600160481b90910490911690637e1843799061393f90869030908e908790600401614c94565b5f604051808303815f87803b158015613956575f5ffd5b505af1925050508015613967575060015b61397657505050505050505050565b6040516370a0823160e01b815282906001600160a01b038816906370a08231906139a490309060040161462c565b602060405180830381865afa1580156139bf573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906139e39190614950565b6139ed9190614bbd565b93505050505b5f82613a0a57600b546001600160a01b0316613a0c565b835b600a54604051632a8ddb2f60e01b81529192505f916001600160a01b0390911690632a8ddb2f90613a469030908690601590600401614bfb565b6040805180830381865afa158015613a60573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613a849190614c67565b9150506001600160a01b038116613a9f575050505050505050565b601254613abf903090600160481b90046001600160a01b03165f196113a8565b60125460405163095ea7b360e01b81526001600160a01b038085169263095ea7b392613afb92600160481b909204909116908790600401614aed565b6020604051808303815f875af1158015613b17573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613b3b9190614b06565b5060125460405163863f15cd60e01b81526001600160a01b0383811660048301523060248301528481166044830152606482018990526084820186905261dead60a4830152600160481b9092049091169063863f15cd9060c4015f604051808303815f87803b158015613bac575f5ffd5b505af1925050508015613bbd575060015b156136a2575f601b885f015481548110613bd957613bd961498f565b905f5260205f209060070201600601819055505050505050505050565b6001600160a01b038316613c20578060025f828254613c159190614bd0565b90915550613c7d9050565b6001600160a01b0383165f9081526020819052604090205481811015613c5f5783818360405163391434e360e21b8152600401610ae093929190614b25565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b038216613c9957600280548290039055613cb7565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051613cfc91815260200190565b60405180910390a3505050565b600a5460405163154b004960e31b81525f916001600160a01b03169063aa580248906128ea90869086903090600401614d74565b5f8080808088604001516002811115613d5857613d5861467e565b03613d7557613d67898961403a565b909450925060019050613de1565b600188604001516002811115613d8d57613d8d61467e565b148015613d975750865b15613da657613d67898961403a565b600288604001516002811115613dbe57613dbe61467e565b148015613dc85750855b15613de157613dd7898961403a565b9094509250600190505b80613df5575f5f5f93509350935050613e3b565b5f85118015613e0357505f84115b15613e2e57612710613e158686614d05565b613e1f9190614b9e565b9150613e2b8285614bbd565b93505b613e398a858a6140e6565b505b96509650969350505050565b5f5f5f846001600160a01b0316866001600160a01b031603613e8a57613e6c86611326565b613e7e57613e7986610b88565b613e80565b5f5b92505f9150613ec9565b613e9386611326565b613ea557613ea086610b88565b613ea7565b5f5b9250613eb285611326565b613ec457613ebf85610b88565b613ec6565b5f5b91505b613ed2846116f9565b6008546001600160a01b039586165f908152600c6020526040808220839055988716815288812082905596909516865295909420929092559390929150565b600a546040516377a9efe360e11b81526060916001600160a01b03169063ef53dfc690612f0890859060040161462c565b5f805b600654811015613f9857826001600160a01b031660068281548110613f6c57613f6c61498f565b5f9182526020909120600290910201546001600160a01b031603613f905792915050565b600101613f45565b50604080518082019091526001600160a01b0383811682525f6020830181815260068054600180820183559382905294517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f600290960295860180546001600160a01b0319169190951617909355517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4090930192909255546107df9190614bbd565b600a5460608201515f9182916001600160a01b039091169063ae34a3bc908690614062611042565b6040516001600160e01b031960e086901b16815260048101939093526024830191909152604482015260016064820152612710608482015260a4016040805180830381865afa1580156140b7573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906140db9190614b68565b915091509250929050565b8051602082015160408301517f4561d7b5bc749427362f16999e4266d5e838624dc76c7915a80597b4303f910691908633874260405161412b96959493929190614e61565b60405180910390a25f8160200151600581111561414a5761414a61467e565b0361415957610e498383614220565b6003816020015160058111156141715761417161467e565b0361418057610e49838361427a565b6002816020015160058111156141985761419861467e565b036141a857610e49838383614332565b6001816020015160058111156141c0576141c061467e565b036141d057610e498383836143df565b6004816020015160058111156141e8576141e861467e565b036141f857610e4983838361448f565b6005816020015160058111156142105761421061467e565b03610e4957610e4983838361451e565b80601c5f8282546142319190614bd0565b90915550506040517f240ac4b1276638a07697a276a1e769aeeef6a875321508eee58718c790a0eb25906142689083904290614b5a565b60405180910390a16116f582826123b6565b61428582308361245c565b5f61428f30610c7a565b60025461429c9190614bbd565b905080156142eb5780600754836142b39190614d05565b6142bd9190614b9e565b60085f8282546142cd9190614bd0565b9250508190555081601e5f8282546142e59190614bd0565b90915550505b6008546040805184815260208101929092524282820152517f4aa5b1e7e0aa0cb24a794cb0410918d48c70726a1891006de7d83adf6ec039209181900360600190a1505050565b60808101516001600160a01b03165f9081526016602052604090205460ff1661437c5760808101516001600160a01b03165f908152601660205260409020805460ff191660011790555b8060e00151156143d05761439183308461245c565b81601b825f0151815481106143a8576143a861498f565b905f5260205f2090600702016006015f8282546143c59190614bd0565b90915550610e499050565b610e498382608001518461245c565b6010805460ff191660011790556143f783308461245c565b81601b825f01518154811061440e5761440e61498f565b905f5260205f2090600702016006015f82825461442b9190614bd0565b9250508190555081601d5f8282546144439190614bd0565b90915550508051608082015160a08301516040515f516020614ead5f395f51905f529361447893879391925f92904290614d1c565b60405180910390a150506010805460ff1916905550565b6010805460ff191660011790556144a783308461245c565b81601b825f0151815481106144be576144be61498f565b905f5260205f2090600702016006015f8282546144db9190614bd0565b9250508190555081601f5f8282546144f39190614bd0565b909155505060a08101516040515f516020614ecd5f395f51905f52916144789185915f914290614d50565b6010805460ff1916600117905561453683308461245c565b81601b825f01518154811061454d5761454d61498f565b905f5260205f2090600702016006015f82825461456a9190614bd0565b925050819055508160205f8282546145829190614bd0565b90915550506010805460ff19169055505050565b602081525f82518060208401525f5b818110156145c257602081860181015160408684010152016145a5565b505f604082850101526040601f19601f83011684010191505092915050565b6001600160a01b03811681146113a5575f5ffd5b5f5f60408385031215614606575f5ffd5b8235614611816145e1565b946020939093013593505050565b6001600160a01b03169052565b6001600160a01b0391909116815260200190565b5f5f5f60608486031215614652575f5ffd5b833561465d816145e1565b9250602084013561466d816145e1565b929592945050506040919091013590565b634e487b7160e01b5f52602160045260245ffd5b600681106146a2576146a261467e565b9052565b600381106146a2576146a261467e565b602080825282518282018190525f918401906040840190835b818110156147795783518051845260208101516146ef6020860182614692565b50604081015161470260408601826146a6565b506060810151606085015260018060a01b03608082015116608085015260018060a01b0360a08201511660a085015260c081015161474360c086018261461f565b5060e081015161475760e086018215159052565b50610100908101519084015260209390930192610120909201916001016146cf565b509095945050505050565b5f5f60408385031215614795575f5ffd5b8235915060208301356147a7816145e1565b809150509250929050565b5f602082840312156147c2575f5ffd5b81356111b5816145e1565b602080825282518282018190525f918401906040840190835b818110156147795783518352602093840193909201916001016147e6565b602080825282518282018190525f918401906040840190835b8181101561477957835180516001600160a01b03168452602090810151818501529093019260409092019160010161481d565b5f60208284031215614860575f5ffd5b5035919050565b898152610120810161487c602083018b614692565b614889604083018a6146a6565b60608201979097526001600160a01b03958616608082015293851660a08501529190931660c083015291151560e082015261010001529392505050565b5f5f604083850312156148d7575f5ffd5b82356148e2816145e1565b915060208301356147a7816145e1565b600181811c9082168061490657607f821691505b60208210810361492457634e487b7160e01b5f52602260045260245ffd5b50919050565b80516108ed816145e1565b5f60208284031215614945575f5ffd5b81516111b5816145e1565b5f60208284031215614960575f5ffd5b5051919050565b6020808252600e908201526d125b9d985b1a59081d185e08125160921b604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b60208082526012908201527127b7363c903330b1ba37b93c9037bbb732b960711b604082015260600190565b6001600160a01b031690565b602080825282548282018190525f848152918220906040840190835b8181101561477957835483526001840154614a186020850160ff8316614692565b614a2b6040850160ff8360081c166146a6565b5060028401546060840152614a4360038501546149cf565b614a50608085018261461f565b50614a5e60048501546149cf565b614a6b60a085018261461f565b506005840154614a8760c085016001600160a01b03831661461f565b614a9b60e0850160ff8360a01c1615159052565b506006840154610100840152600790930192610120909201916001016149f7565b6001600160a01b03958616815293909416602084015260408301919091526060820152608081019190915260a00190565b6001600160a01b03929092168252602082015260400190565b5f60208284031215614b16575f5ffd5b815180151581146111b5575f5ffd5b6001600160a01b039390931683526020830191909152604082015260600190565b634e487b7160e01b5f52604160045260245ffd5b918252602082015260400190565b5f5f60408385031215614b79575f5ffd5b505080516020909101519092909150565b634e487b7160e01b5f52601160045260245ffd5b5f82614bb857634e487b7160e01b5f52601260045260245ffd5b500490565b818103818111156107df576107df614b8a565b808201808211156107df576107df614b8a565b5f60018201614bf457614bf4614b8a565b5060010190565b6001600160a01b038481168252831660208083019190915260606040830181905283549083018190525f848152918220906080840190835b81811015614c5a5783546001600160a01b0316835260019384019360209093019201614c33565b5090979650505050505050565b5f5f60408385031215614c78575f5ffd5b8251614c83816145e1565b60208401519092506147a7816145e1565b6001600160a01b03858116825284166020808301919091526040820184905260806060830181905283519083018190525f9184019060a0840190835b81811015614cf75783516001600160a01b0316835260209384019390920191600101614cd0565b509098975050505050505050565b80820281158282048414176107df576107df614b8a565b958652602086019490945260408501929092526001600160a01b03908116606085015216608083015260a082015260c00190565b93845260208401929092526001600160a01b03166040830152606082015260800190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b5f60208284031215614da7575f5ffd5b81516001600160401b03811115614dbc575f5ffd5b8201601f81018413614dcc575f5ffd5b80516001600160401b03811115614de557614de5614b46565b604051600582901b90603f8201601f191681016001600160401b0381118282101715614e1357614e13614b46565b604052918252602081840181019290810187841115614e30575f5ffd5b6020850194505b83851015614e5657614e488561492a565b815260209485019401614e37565b509695505050505050565b60c08101614e6f8289614692565b614e7c60208301886146a6565b6001600160a01b039586166040830152939094166060850152608084019190915260a0909201919091529291505056fe4273856ca27b03e758cdfc9b3b6ca37d494ecb75fbae628757965b75fb104ab6f7d7115427aac464a6917f7ba3066179fd0c845521f577e53e8e4d4ec97dd4a8799663458a5ef2936f7fa0c99b3336c69c25890f82974f04e811e5bb359186c7c24cdf2085ca2e96c74f42d25648701f34a19b69bce82381dffcf6d00a8dcad5a164736f6c634300081f000a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000b1ae112d59513618a04fd5e83bd7efba05a3f000000000000000000000000a0419404ef7b81d9ec64367eb68e5f425eace6180000000000000000000000000000000000000000033b2e3c9fd0803ce80000000000000000000000000000000000000000000000000000000000000000000240000000000000000000000000cae394005c9c4c309621c53d53db9ceb701fc8d8000000000000000000000000000b1ae112d59513618a04fd5e83bd7efba05a3f000000000000000000000000d3397b405a2272f5c27fc673be20579f22f59d6c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000574657374740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004545354540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000145000000000000000000000000a0419404ef7b81d9ec64367eb68e5f425eace61800000000000000000000000057fde0a71132198bbec939b98976993d8d89d225000000000000000000000000000000000000000000000000000000000000dead000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064000000000000000000000000a0419404ef7b81d9ec64367eb68e5f425eace61800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000dead00000000000000000000000090f055196778e541018482213ca50648cea1a050000000000000000000000000000000000000000000000000000000000000dead00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dead00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Deployed ByteCode

0x60806040526004361061020f575f3560e01c8063014182051461021a57806306fdde0314610242578063095ea7b3146102635780630d3ebcbf1461029257806313299604146102a8578063138dd4d1146102c957806318160ddd146102dd57806322849720146102f157806323b872dd146103065780632973ef2d14610325578063313ce56714610346578063346847b414610361578063378dc3dc14610375578063406cf2291461038a5780634ada218b1461039e5780634f30800d146103b757806358232c94146103cb578063695d69b3146103ea5780636a2072d414610409578063709df63c1461043557806370a0823114610456578063715018a6146104755780637922fc01146104895780637c8b6f091461049e57806384527bbd146104da5780638453ef99146104ef5780638a8c523c146105035780638da5cb5b146105175780639045be581461052b57806390b8e5981461055957806395d89b41146105785780639b165f4e1461058c578063a9059cbb146105ab578063ad826ab6146105ca578063b2ff1973146105e9578063c5be2bc7146105fd578063cb78c16314610631578063ce7b63ed14610645578063ced72f8714610659578063d89135cd1461066d578063dd62ed3e14610682578063e4f8d62e146106a1578063e5711e8b146106c0578063e6375d3e146106df578063eb50c061146106fe578063f2fde38b1461071d575f5ffd5b3661021657005b5f5ffd5b348015610225575f5ffd5b5061022f601f5481565b6040519081526020015b60405180910390f35b34801561024d575f5ffd5b5061025661073c565b6040516102399190614596565b34801561026e575f5ffd5b5061028261027d3660046145f5565b6107cc565b6040519015158152602001610239565b34801561029d575f5ffd5b506102a66107e5565b005b3480156102b3575f5ffd5b506102bc61080f565b604051610239919061462c565b3480156102d4575f5ffd5b506102bc61087f565b3480156102e8575f5ffd5b5060025461022f565b3480156102fc575f5ffd5b5061022f601e5481565b348015610311575f5ffd5b50610282610320366004614640565b6108f2565b348015610330575f5ffd5b50610339610915565b60405161023991906146b6565b348015610351575f5ffd5b5060405160128152602001610239565b34801561036c575f5ffd5b5061022f610a44565b348015610380575f5ffd5b5061022f60115481565b348015610395575f5ffd5b50610282610aa6565b3480156103a9575f5ffd5b506012546102829060ff1681565b3480156103c2575f5ffd5b5060085461022f565b3480156103d6575f5ffd5b506102a66103e5366004614784565b610ab7565b3480156103f5575f5ffd5b5061022f6104043660046147b2565b610b88565b348015610414575f5ffd5b506104286104233660046147b2565b610ba7565b60405161023991906147cd565b348015610440575f5ffd5b50610449610c10565b6040516102399190614804565b348015610461575f5ffd5b5061022f6104703660046147b2565b610c7a565b348015610480575f5ffd5b506102a6610c94565b348015610494575f5ffd5b5061022f60205481565b3480156104a9575f5ffd5b506012546104c29061010090046001600160401b031681565b6040516001600160401b039091168152602001610239565b3480156104e5575f5ffd5b5061022f601d5481565b3480156104fa575f5ffd5b506102a6610ca5565b34801561050e575f5ffd5b506102a6610cb5565b348015610522575f5ffd5b506102bc610d05565b348015610536575f5ffd5b506102826105453660046147b2565b600d6020525f908152604090205460ff1681565b348015610564575f5ffd5b506102a66105733660046145f5565b610d14565b348015610583575f5ffd5b50610256610e4e565b348015610597575f5ffd5b506102a66105a63660046147b2565b610e5d565b3480156105b6575f5ffd5b506102826105c53660046145f5565b610e88565b3480156105d5575f5ffd5b506102a66105e4366004614784565b610e95565b3480156105f4575f5ffd5b5060195461022f565b348015610608575f5ffd5b5061061c610617366004614850565b610f5e565b60405161023999989796959493929190614867565b34801561063c575f5ffd5b5061022f610fd3565b348015610650575f5ffd5b5060185461022f565b348015610664575f5ffd5b5061022f611042565b348015610678575f5ffd5b5061022f601c5481565b34801561068d575f5ffd5b5061022f61069c3660046148c6565b611089565b3480156106ac575f5ffd5b5061022f6106bb3660046145f5565b6110b3565b3480156106cb575f5ffd5b506102a66106da366004614640565b6111bc565b3480156106ea575f5ffd5b506102826106f93660046147b2565b611326565b348015610709575f5ffd5b506102a66107183660046147b2565b611343565b348015610728575f5ffd5b506102a66107373660046147b2565b61136b565b60606003805461074b906148f2565b80601f0160208091040260200160405190810160405280929190818152602001828054610777906148f2565b80156107c25780601f10610799576101008083540402835291602001916107c2565b820191905f5260205f20905b8154815290600101906020018083116107a557829003601f168201915b5050505050905090565b5f336107d98185856113a8565b60019150505b92915050565b6107ed6113b5565b60125461080d903090600160481b90046001600160a01b03165f196113a8565b565b601454604080516336ce6de360e11b815290515f926001600160a01b031691636d9cdbc69160048083019260209291908290030181865afa158015610856573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061087a9190614935565b905090565b60145460408051637bb8996d60e01b815290515f926001600160a01b031691637bb8996d9160048083019260209291908290030181865afa9250505080156108e4575060408051601f3d908101601f191682019092526108e191810190614935565b60015b6108ed57505f90565b919050565b5f336108ff8582856113e7565b61090a858585611432565b506001949350505050565b6060601b805480602002602001604051908101604052809291908181526020015f905b82821015610a3b578382905f5260205f209060070201604051806101200160405290815f8201548152602001600182015f9054906101000a900460ff1660058111156109865761098661467e565b60058111156109975761099761467e565b81526020016001820160019054906101000a900460ff1660028111156109bf576109bf61467e565b60028111156109d0576109d061467e565b8152600282015460208083019190915260038301546001600160a01b03908116604084015260048401548116606084015260058401549081166080840152600160a01b900460ff16151560a083015260069092015460c0909101529082526001929092019101610938565b50505050905090565b6014546040805163b5a08dd160e01b815290515f926001600160a01b03169163b5a08dd19160048083019260209291908290030181865afa9250505080156108e4575060408051601f3d908101601f191682019092526108e191810190614950565b5f610ab133336116cb565b50600190565b610abf6113b5565b601b548210610ae95760405162461bcd60e51b8152600401610ae090614967565b60405180910390fd5b6001600160a01b038116610b3e5760405162461bcd60e51b815260206004820152601c60248201527b546f6b656e20616464726573732063616e6e6f74206265207a65726f60201b6044820152606401610ae0565b80601b8381548110610b5257610b5261498f565b905f5260205f2090600702016004015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055505050565b5f610b9282611326565b15610b9e57505f919050565b6107df826116f9565b6001600160a01b0381165f908152600f6020908152604091829020805483518184028101840190945280845260609392830182828015610c0457602002820191905f5260205f20905b815481526020019060010190808311610bf0575b50505050509050919050565b60606006805480602002602001604051908101604052809291908181526020015f905b82821015610a3b575f848152602090819020604080518082019091526002850290910180546001600160a01b03168252600190810154828401529083529092019101610c33565b6001600160a01b03165f9081526020819052604090205490565b610c9c6113b5565b61080d5f611786565b610cad6113b5565b61080d6117d7565b610cbd6113b5565b60125460ff1615610ce157604051637952fbad60e11b815260040160405180910390fd5b6012805460ff191660011790556040515f516020614eed5f395f51905f52905f90a1565b6005546001600160a01b031690565b60145f9054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d64573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d889190614935565b6001600160a01b0316336001600160a01b031614610db85760405162461bcd60e51b8152600401610ae0906149a3565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114610e01576040519150601f19603f3d011682016040523d82523d5f602084013e610e06565b606091505b5050905080610e495760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610ae0565b505050565b60606004805461074b906148f2565b610e656113b5565b6001600160a01b03165f908152601660205260409020805460ff19166001179055565b5f336107d9818585611432565b610e9d6113b5565b601b548210610ebe5760405162461bcd60e51b8152600401610ae090614967565b6001600160a01b038116610f145760405162461bcd60e51b815260206004820152601f60248201527f52656365697665722063616e6e6f74206265207a65726f2061646472657373006044820152606401610ae0565b80601b8381548110610f2857610f2861498f565b905f5260205f2090600702016003015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055505050565b601b8181548110610f6d575f80fd5b5f918252602090912060079091020180546001820154600283015460038401546004850154600586015460069096015494965060ff8085169661010090950481169593946001600160a01b039384169492841693811692600160a01b9091049091169089565b600a54604051625f8d8f60e81b81525f916001600160a01b031690635f8d8f009061100390601b906004016149db565b602060405180830381865afa15801561101e573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061087a9190614950565b6014546040805163c57981b560e01b815290515f926001600160a01b03169163c57981b59160048083019260209291908290030181865afa15801561101e573d5f5f3e3d5ffd5b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6001600160a01b0382165f908152600f602052604081205482106110d857505f6107df565b600a54600680546001600160a01b039092169163a89055e5918691309190879081106111065761110661498f565b905f5260205f20906002020160010154600f5f896001600160a01b03166001600160a01b031681526020019081526020015f20878154811061114a5761114a61498f565b905f5260205f2001546007546040518663ffffffff1660e01b8152600401611176959493929190614abc565b602060405180830381865afa158015611191573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111b59190614950565b9392505050565b60145f9054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561120c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112309190614935565b6001600160a01b0316336001600160a01b0316146112605760405162461bcd60e51b8152600401610ae0906149a3565b306001600160a01b038416036112b25760405162461bcd60e51b815260206004820152601760248201527621b0b73737ba103932b9b1bab29037bbb7103a37b5b2b760491b6044820152606401610ae0565b60405163a9059cbb60e01b81526001600160a01b0384169063a9059cbb906112e09085908590600401614aed565b6020604051808303815f875af11580156112fc573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113209190614b06565b50505050565b6001600160a01b03165f908152600d602052604090205460ff1690565b61134b6113b5565b6001600160a01b03165f908152601660205260409020805460ff19169055565b6113736113b5565b6001600160a01b03811661139c575f604051631e4fbdf760e01b8152600401610ae0919061462c565b6113a581611786565b50565b610e4983838360016122ac565b336113be610d05565b6001600160a01b03161461080d573360405163118cdaa760e01b8152600401610ae0919061462c565b5f6113f28484611089565b90505f19811015611320578181101561142457828183604051637dc7a0d960e11b8152600401610ae093929190614b25565b61132084848484035f6122ac565b601a805460ff60201b1916905560125460ff16158015611461575060125461010090046001600160401b031615155b801561147d575060125461010090046001600160401b03164210155b156114a5576012805460ff191660011790556040515f516020614eed5f395f51905f52905f90a15b6114ae8261237e565b156114bd57610e4983826123b6565b60125460ff161580156114e857506001600160a01b0383165f9081526016602052604090205460ff16155b156115065760405163bcb8b8fb60e01b815260040160405180910390fd5b5f611510836123ea565b601b54909150158061152c5750601a546301000000900460ff16155b8061154e57506001600160a01b0384165f9081526016602052604090205460ff165b8061157057506001600160a01b0383165f9081526016602052604090205460ff165b8061157d575060105460ff165b156115c757601a546301000000900460ff161580156115995750805b156115b257601a805463ff000000191663010000001790555b6115bc84846116cb565b61132084848461245c565b8080156115ec57506001600160a01b0383165f908152600d602052604090205460ff16155b15611614576001600160a01b0383165f908152600d60205260409020805460ff191660011790555b60178290555f6116258585856124b9565b905061162f6126fb565b80156116445750601a546301000000900460ff165b8015611653575060105460ff16155b80156116695750601a54600160201b900460ff16155b806116765750601a5460ff165b156116a55761168585856128b6565b6116a5576116916117d7565b601a805460ff60201b1916600160201b1790555b6116af85856116cb565b6116b98585612929565b6116c485858361245c565b5050505050565b601a5462010000900460ff16156116f5576013546116f590839083906001600160a01b0316612a27565b5050565b600a546008546001600160a01b038381165f908152600c6020526040808220546007549151631d2fa43b60e11b815292959390931693633a5f48769361174793889330939291600401614abc565b602060405180830381865afa158015611762573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107df9190614950565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6010805460ff19166001179055601b545f90819081816001600160401b0381111561180457611804614b46565b60405190808252806020026020018201604052801561182d578160200160208202803683370190505b5090505f826001600160401b0381111561184957611849614b46565b604051908082528060200260200182016040528015611872578160200160208202803683370190505b5090505f5b83811015611adc575f601b82815481106118935761189361498f565b905f5260205f209060070201905080600601545f036118b25750611ad4565b60018082015460ff1660058111156118cc576118cc61467e565b148061190657506002600182015460ff1660058111156118ee576118ee61467e565b14801561190657506005810154600160a01b900460ff165b8061192957506004600182015460ff1660058111156119275761192761467e565b145b8061194c57506005600182015460ff16600581111561194a5761194a61467e565b145b15611ad257600a54600682015460175460405163059b6d4760e21b81525f9384936001600160a01b039091169263166db51c9261198d929190600401614b5a565b6040805180830381865afa1580156119a7573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119cb9190614b68565b90925090508115611aa75781816005600186015460ff1660058111156119f3576119f361467e565b03611a1c57611a03600285614b9e565b9150611a0f8285614bbd565b611a199084614bd0565b90505b6001888781518110611a3057611a3061498f565b60200260200101901515908115158152505081878781518110611a5557611a5561498f565b6020908102919091010152611a6a828c614bd0565b9a5089611a7681614be3565b9a505080601b8781548110611a8d57611a8d61498f565b905f5260205f209060070201600601819055505050611acf565b80601b8581548110611abb57611abb61498f565b905f5260205f209060070201600601819055505b50505b505b600101611877565b50600a54600b54604051632a8ddb2f60e01b81525f926001600160a01b0390811692632a8ddb2f92611b179230921690601590600401614bfb565b6040805180830381865afa158015611b31573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b559190614c67565b9150506001600160a01b038116611b99576040517f34be9cb68ddf4eeebba29ea0e1db420286ea39e4ce7a377e66a7b47a998a6d03905f90a15050505050506122a0565b600a5460185460175460405163059b6d4760e21b81525f938493849384936001600160a01b039093169263166db51c92611bd7929091600401614b5a565b6040805180830381865afa158015611bf1573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c159190614b68565b600a5460195460175460405163059b6d4760e21b81529498509295506001600160a01b039091169263166db51c92611c509291600401614b5a565b6040805180830381865afa158015611c6a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c8e9190614b68565b601893909355601992909255509050611ca78289614bd0565b9750611cb38189614bd0565b9750875f03611cc95750505050505050506122a0565b601254600160481b90046001600160a01b0316637e18437984308b611ced82612ed7565b6040518563ffffffff1660e01b8152600401611d0c9493929190614c94565b5f604051808303815f87803b158015611d23575f5ffd5b505af1925050508015611d34575060015b611df6575f5b86811015611db957858181518110611d5457611d5461498f565b602002602001015115611db157848181518110611d7357611d7361498f565b6020026020010151601b8281548110611d8e57611d8e61498f565b905f5260205f2090600702016006015f828254611dab9190614bd0565b90915550505b600101611d3a565b508160185f828254611dcb9190614bd0565b925050819055508060195f828254611de39190614bd0565b909155506122a098505050505050505050565b600954600b546040516370a0823160e01b81525f92916001600160a01b0316906370a0823190611e2a90309060040161462c565b602060405180830381865afa158015611e45573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e699190614950565b611e739190614bbd565b9050611e818184848c612f49565b611e8b9082614bbd565b9050611e97838a614bbd565b9850611ea3828a614bbd565b9850805f03611eba575050505050505050506122a0565b5f5b8781101561229557868181518110611ed657611ed661498f565b60200260200101511580611f025750858181518110611ef757611ef761498f565b60200260200101515f145b61228d575f8a83888481518110611f1b57611f1b61498f565b6020026020010151611f2d9190614d05565b611f379190614b9e565b90505f601b8381548110611f4d57611f4d61498f565b5f9182526020909120600790910201905060018082015460ff166005811115611f7857611f7861467e565b036120be575f516020614ead5f395f51905f52888481518110611f9d57611f9d61498f565b6020908102919091010151825460038401546004850154604051611fd594939288926001600160a01b03918216929116904290614d1c565b60405180910390a16040805161012081019091528154815260018201546120b99184918490602083019060ff1660058111156120135761201361467e565b60058111156120245761202461467e565b81526020016001820160019054906101000a900460ff16600281111561204c5761204c61467e565b600281111561205d5761205d61467e565b81526002820154602082015260038201546001600160a01b03908116604083015260048301548116606083015260058301549081166080830152600160a01b900460ff16151560a082015260069091015460c090910152612fd2565b61228a565b6002600182015460ff1660058111156120d9576120d961467e565b1480156120f157506005810154600160a01b900460ff165b1561210f5760038101546120b99083906001600160a01b03166131a5565b6004600182015460ff16600581111561212a5761212a61467e565b03612260575f516020614ecd5f395f51905f5288848151811061214f5761214f61498f565b6020908102919091010151600483015460405161217c929186916001600160a01b03909116904290614d50565b60405180910390a16040805161012081019091528154815260018201546120b99184918490602083019060ff1660058111156121ba576121ba61467e565b60058111156121cb576121cb61467e565b81526020016001820160019054906101000a900460ff1660028111156121f3576121f361467e565b60028111156122045761220461467e565b81526002820154602082015260038201546001600160a01b03908116604083015260048301548116606083015260058301549081166080830152600160a01b900460ff16151560a082015260069091015460c0909101526132c3565b6005600182015460ff16600581111561227b5761227b61467e565b0361228a5761228a82826136ad565b50505b600101611ebc565b505050505050505050505b6010805460ff19169055565b6001600160a01b0384166122d5575f60405163e602df0560e01b8152600401610ae0919061462c565b6001600160a01b0383166122fe575f604051634a1406b160e11b8152600401610ae0919061462c565b6001600160a01b038085165f908152600160209081526040808320938716835292905220829055801561132057826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161237091815260200190565b60405180910390a350505050565b5f6001600160a01b038216158061239f57506103696001600160a01b038316145b806107df5750506001600160a01b031661dead1490565b6001600160a01b0382166123df575f604051634b637e8f60e11b8152600401610ae0919061462c565b6116f5825f83613bf6565b600a54604051630d5c7b5d60e41b81526001600160a01b0383811660048301523060248301525f92169063d5c7b5d090604401602060405180830381865afa158015612438573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107df9190614b06565b6001600160a01b038316612485575f604051634b637e8f60e11b8152600401610ae0919061462c565b6001600160a01b0382166124ae575f60405163ec442f0560e01b8152600401610ae0919061462c565b610e49838383613bf6565b5f5f5f5f5f6124c888886128b6565b90505f6124d58989613d09565b601a549091505f9060ff1680156124fc57505f6124f061087f565b6001600160a01b031614155b1561250c57612509610a44565b90505b5f5b601b5481101561265a575f5f5f6126208e8d601b87815481106125335761253361498f565b905f5260205f209060070201604051806101200160405290815f8201548152602001600182015f9054906101000a900460ff1660058111156125775761257761467e565b60058111156125885761258861467e565b81526020016001820160019054906101000a900460ff1660028111156125b0576125b061467e565b60028111156125c1576125c161467e565b81526002820154602082015260038201546001600160a01b03908116604083015260048301548116606083015260058301549081166080830152600160a01b900460ff16151560a082015260069091015460c0909101528a8a8a613d3d565b91945092509050612631838b614bd0565b995061263d828a614bd0565b98506126498189614bd0565b9750506001909201915061250e9050565b5084156126a557601a5460ff1615612693576126778a308761245c565b8460185f8282546126889190614bd0565b909155506126a59050565b6126a58a61269f61080f565b8761245c565b83156126cd576126b68a308661245c565b8360195f8282546126c79190614bd0565b90915550505b83856126d9888b614bbd565b6126e39190614bbd565b6126ed9190614bbd565b9a9950505050505050505050565b5f5f5b601b548110156128af575f601b828154811061271c5761271c61498f565b905f5260205f209060070201604051806101200160405290815f8201548152602001600182015f9054906101000a900460ff1660058111156127605761276061467e565b60058111156127715761277161467e565b81526020016001820160019054906101000a900460ff1660028111156127995761279961467e565b60028111156127aa576127aa61467e565b81526002820154602082015260038201546001600160a01b03908116604083015260048301548116606083015260058301549081166080830152600160a01b900460ff16151560a082015260069091015460c09091015261010081015190915015801590612898575060018160200151600581111561282b5761282b61467e565b1480612858575060028160200151600581111561284a5761284a61467e565b14801561285857508060e001515b8061287857506004816020015160058111156128765761287661467e565b145b8061289857506005816020015160058111156128965761289661467e565b145b156128a65760019250505090565b506001016126fe565b505f905090565b600a54604051636468b51760e01b81525f916001600160a01b031690636468b517906128ea90869086903090600401614d74565b602060405180830381865afa158015612905573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111b59190614b06565b601a54610100900460ff1661293c575050565b6013545f908190819061295b90869086906001600160a01b0316613e47565b600854604080516001600160a01b03808c1682528a166020820152908101859052606081018490526080810183905260a08101919091524260c082015292955090935091507f7f2255e92a9403cf8dd4b9f679ad1f5f5ce9226dd19b0faf14c84bace34d235b9060e00160405180910390a182156129eb576129dc856123ea565b6129eb576129eb30868561245c565b8115612a09576129fa846123ea565b612a0957612a0930858461245c565b80156116c4576013546116c49030906001600160a01b03168361245c565b5f5b600654811015611320575b6001600160a01b0384165f908152600f60205260409020548110612aa5576001600160a01b0384165f908152600f602052604090206006805483908110612a7d57612a7d61498f565b5f91825260208083206001600290930201820154845492830185559383529091200155612a34565b6001600160a01b0383165f908152600f60205260409020548110612b16576001600160a01b0383165f908152600f602052604090206006805483908110612aee57612aee61498f565b5f91825260208083206001600290930201820154845492830185559383529091200155612aa5565b6001600160a01b0382165f908152600f60205260409020548110612b87576001600160a01b0382165f908152600f602052604090206006805483908110612b5f57612b5f61498f565b5f91825260208083206001600290930201820154845492830185559383529091200155612b16565b5f612b9185611326565b612ba457612b9f85836110b3565b612ba6565b5f5b90505f6001600160a01b0386811690861614612bdd57612bc585611326565b612bd857612bd385846110b3565b612bda565b5f5b90505b6040805160028082526060820183525f9260208301908036833750506040805160028082526060820183529394505f93909250906020830190803683370190505090505f8415612c7f5784838281518110612c3a57612c3a61498f565b60200260200101818152505088828281518110612c5957612c5961498f565b6001600160a01b039092166020928302919091019091015280612c7b81614be3565b9150505b8315612cdd5783838281518110612c9857612c9861498f565b60200260200101818152505087828281518110612cb757612cb761498f565b6001600160a01b039092166020928302919091019091015280612cd981614be3565b9150505b5f5b81811015612ec5575f848281518110612cfa57612cfa61498f565b60200260200101511115612ebd5760068781548110612d1b57612d1b61498f565b5f91825260209091206002909102015483516001600160a01b039091169063a9059cbb90859084908110612d5157612d5161498f565b6020026020010151868481518110612d6b57612d6b61498f565b60200260200101516040518363ffffffff1660e01b8152600401612d90929190614aed565b6020604051808303815f875af1925050508015612dca575060408051601f3d908101601f19168201909252612dc791810190614b06565b60015b15612ebd5750600b54600680546001600160a01b039092169189908110612df357612df361498f565b5f9182526020909120600290910201546001600160a01b031603612e4157838181518110612e2357612e2361498f565b602002602001015160095f828254612e3b9190614bbd565b90915550505b60068781548110612e5457612e5461498f565b905f5260205f20906002020160010154600f5f858481518110612e7957612e7961498f565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020015f208881548110612eb157612eb161498f565b5f918252602090912001555b600101612cdf565b505060019094019350612a2992505050565b600a546040516343d7ef9f60e11b81526060916001600160a01b0316906387afdf3e90612f0890859060040161462c565b5f60405180830381865afa158015612f22573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526107df9190810190614d97565b5f8082612f568688614d05565b612f609190614b9e565b90508015612f7957612f7981612f7461080f565b6131a5565b5f83612f858689614d05565b612f8f9190614b9e565b90508015612fbd575f612fa061087f565b90506001600160a01b03811615612fbb57612fbb82826131a5565b505b612fc78183614bd0565b979650505050505050565b815f03612fdd575050565b600b5460a08201516001600160a01b0391821691160361306c57600b54608082015160405163a9059cbb60e01b81526001600160a01b039092169163a9059cbb9161302c918690600401614aed565b6020604051808303815f875af1158015613048573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e499190614b06565b600a54600b5460a0830151604051632a8ddb2f60e01b81525f936001600160a01b0390811693632a8ddb2f936130ac939290911691601590600401614bfb565b6040805180830381865afa1580156130c6573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906130ea9190614c67565b915050601260099054906101000a90046001600160a01b03166001600160a01b0316635a9ac706828460800151866131258760a00151613f11565b6040518563ffffffff1660e01b81526004016131449493929190614c94565b5f604051808303815f87803b15801561315b575f5ffd5b505af192505050801561316c575060015b610e4957600b54608083015160405163a9059cbb60e01b81526001600160a01b039092169163a9059cbb916112e0918790600401614aed565b815f036131b0575050565b600b54604051632e1a7d4d60e01b8152600481018490526001600160a01b0390911690632e1a7d4d906024015f604051808303815f87803b1580156131f3575f5ffd5b505af1925050508015613204575060015b61323a57600b5460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb9061302c9084908690600401614aed565b5f816001600160a01b0316836040515f6040518083038185875af1925050503d805f8114613283576040519150601f19603f3d011682016040523d82523d5f602084013e613288565b606091505b5050905080610e4957600b5460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb906112e09085908790600401614aed565b815f036132ce575050565b600b5460a08201516001600160a01b039182169116036133d7578160095f8282546132f99190614bd0565b925050819055505f61330e8260a00151613f42565b90505f61331a30610c7a565b6002546133279190614bbd565b9050801561132057806007548561333e9190614d05565b6133489190614b9e565b6006838154811061335b5761335b61498f565b905f5260205f2090600202016001015f8282546133789190614bd0565b925050819055505f516020614f0d5f395f51905f528360a001513086600686815481106133a7576133a761498f565b905f5260205f20906002020160010154426040516133c9959493929190614abc565b60405180910390a150505050565b600a54600b5460a0830151604051632a8ddb2f60e01b81525f936001600160a01b0390811693632a8ddb2f93613417939290911691601590600401614bfb565b6040805180830381865afa158015613431573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134559190614c67565b9150505f8260a001516001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401613489919061462c565b602060405180830381865afa1580156134a4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134c89190614950565b9050601260099054906101000a90046001600160a01b03166001600160a01b0316635a9ac7068330876134fe8860a00151613f11565b6040518563ffffffff1660e01b815260040161351d9493929190614c94565b5f604051808303815f87803b158015613534575f5ffd5b505af1925050508015613545575060015b156113205760a08301516040516370a0823160e01b81525f916001600160a01b0316906370a082319061357c90309060040161462c565b602060405180830381865afa158015613597573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906135bb9190614950565b90505f6135c88383614bbd565b905080156136a5575f6135de8660a00151613f42565b90505f6135ea30610c7a565b6002546135f79190614bbd565b905080156136a257806007548461360e9190614d05565b6136189190614b9e565b6006838154811061362b5761362b61498f565b905f5260205f2090600202016001015f8282546136489190614bd0565b925050819055505f516020614f0d5f395f51905f528760a001513085600686815481106136775761367761498f565b905f5260205f2090600202016001015442604051613699959493929190614abc565b60405180910390a15b50505b505050505050565b815f036136b8575050565b60068101545f8190036136ca57505050565b60048201546001600160a01b03165f81158015906136f65750600b546001600160a01b03838116911614155b90508481156139f357600a54600b54604051632a8ddb2f60e01b81525f926001600160a01b0390811692632a8ddb2f9261373b92909116908890601590600401614bfb565b6040805180830381865afa158015613755573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137799190614c67565b9150506001600160a01b0381166137935750505050505050565b6040516370a0823160e01b81525f906001600160a01b038616906370a08231906137c190309060040161462c565b602060405180830381865afa1580156137dc573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906138009190614950565b600b5460125460405163095ea7b360e01b81529293506001600160a01b039182169263095ea7b39261383f92600160481b900416908c90600401614aed565b6020604051808303815f875af115801561385b573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061387f9190614b06565b506040805160028082526060820183525f926020830190803683375050600b5482519293506001600160a01b0316918391505f906138bf576138bf61498f565b60200260200101906001600160a01b031690816001600160a01b03168152505085816001815181106138f3576138f361498f565b6001600160a01b039283166020918202929092010152601254604051637e18437960e01b8152600160481b90910490911690637e1843799061393f90869030908e908790600401614c94565b5f604051808303815f87803b158015613956575f5ffd5b505af1925050508015613967575060015b61397657505050505050505050565b6040516370a0823160e01b815282906001600160a01b038816906370a08231906139a490309060040161462c565b602060405180830381865afa1580156139bf573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906139e39190614950565b6139ed9190614bbd565b93505050505b5f82613a0a57600b546001600160a01b0316613a0c565b835b600a54604051632a8ddb2f60e01b81529192505f916001600160a01b0390911690632a8ddb2f90613a469030908690601590600401614bfb565b6040805180830381865afa158015613a60573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613a849190614c67565b9150506001600160a01b038116613a9f575050505050505050565b601254613abf903090600160481b90046001600160a01b03165f196113a8565b60125460405163095ea7b360e01b81526001600160a01b038085169263095ea7b392613afb92600160481b909204909116908790600401614aed565b6020604051808303815f875af1158015613b17573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613b3b9190614b06565b5060125460405163863f15cd60e01b81526001600160a01b0383811660048301523060248301528481166044830152606482018990526084820186905261dead60a4830152600160481b9092049091169063863f15cd9060c4015f604051808303815f87803b158015613bac575f5ffd5b505af1925050508015613bbd575060015b156136a2575f601b885f015481548110613bd957613bd961498f565b905f5260205f209060070201600601819055505050505050505050565b6001600160a01b038316613c20578060025f828254613c159190614bd0565b90915550613c7d9050565b6001600160a01b0383165f9081526020819052604090205481811015613c5f5783818360405163391434e360e21b8152600401610ae093929190614b25565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b038216613c9957600280548290039055613cb7565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051613cfc91815260200190565b60405180910390a3505050565b600a5460405163154b004960e31b81525f916001600160a01b03169063aa580248906128ea90869086903090600401614d74565b5f8080808088604001516002811115613d5857613d5861467e565b03613d7557613d67898961403a565b909450925060019050613de1565b600188604001516002811115613d8d57613d8d61467e565b148015613d975750865b15613da657613d67898961403a565b600288604001516002811115613dbe57613dbe61467e565b148015613dc85750855b15613de157613dd7898961403a565b9094509250600190505b80613df5575f5f5f93509350935050613e3b565b5f85118015613e0357505f84115b15613e2e57612710613e158686614d05565b613e1f9190614b9e565b9150613e2b8285614bbd565b93505b613e398a858a6140e6565b505b96509650969350505050565b5f5f5f846001600160a01b0316866001600160a01b031603613e8a57613e6c86611326565b613e7e57613e7986610b88565b613e80565b5f5b92505f9150613ec9565b613e9386611326565b613ea557613ea086610b88565b613ea7565b5f5b9250613eb285611326565b613ec457613ebf85610b88565b613ec6565b5f5b91505b613ed2846116f9565b6008546001600160a01b039586165f908152600c6020526040808220839055988716815288812082905596909516865295909420929092559390929150565b600a546040516377a9efe360e11b81526060916001600160a01b03169063ef53dfc690612f0890859060040161462c565b5f805b600654811015613f9857826001600160a01b031660068281548110613f6c57613f6c61498f565b5f9182526020909120600290910201546001600160a01b031603613f905792915050565b600101613f45565b50604080518082019091526001600160a01b0383811682525f6020830181815260068054600180820183559382905294517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f600290960295860180546001600160a01b0319169190951617909355517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4090930192909255546107df9190614bbd565b600a5460608201515f9182916001600160a01b039091169063ae34a3bc908690614062611042565b6040516001600160e01b031960e086901b16815260048101939093526024830191909152604482015260016064820152612710608482015260a4016040805180830381865afa1580156140b7573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906140db9190614b68565b915091509250929050565b8051602082015160408301517f4561d7b5bc749427362f16999e4266d5e838624dc76c7915a80597b4303f910691908633874260405161412b96959493929190614e61565b60405180910390a25f8160200151600581111561414a5761414a61467e565b0361415957610e498383614220565b6003816020015160058111156141715761417161467e565b0361418057610e49838361427a565b6002816020015160058111156141985761419861467e565b036141a857610e49838383614332565b6001816020015160058111156141c0576141c061467e565b036141d057610e498383836143df565b6004816020015160058111156141e8576141e861467e565b036141f857610e4983838361448f565b6005816020015160058111156142105761421061467e565b03610e4957610e4983838361451e565b80601c5f8282546142319190614bd0565b90915550506040517f240ac4b1276638a07697a276a1e769aeeef6a875321508eee58718c790a0eb25906142689083904290614b5a565b60405180910390a16116f582826123b6565b61428582308361245c565b5f61428f30610c7a565b60025461429c9190614bbd565b905080156142eb5780600754836142b39190614d05565b6142bd9190614b9e565b60085f8282546142cd9190614bd0565b9250508190555081601e5f8282546142e59190614bd0565b90915550505b6008546040805184815260208101929092524282820152517f4aa5b1e7e0aa0cb24a794cb0410918d48c70726a1891006de7d83adf6ec039209181900360600190a1505050565b60808101516001600160a01b03165f9081526016602052604090205460ff1661437c5760808101516001600160a01b03165f908152601660205260409020805460ff191660011790555b8060e00151156143d05761439183308461245c565b81601b825f0151815481106143a8576143a861498f565b905f5260205f2090600702016006015f8282546143c59190614bd0565b90915550610e499050565b610e498382608001518461245c565b6010805460ff191660011790556143f783308461245c565b81601b825f01518154811061440e5761440e61498f565b905f5260205f2090600702016006015f82825461442b9190614bd0565b9250508190555081601d5f8282546144439190614bd0565b90915550508051608082015160a08301516040515f516020614ead5f395f51905f529361447893879391925f92904290614d1c565b60405180910390a150506010805460ff1916905550565b6010805460ff191660011790556144a783308461245c565b81601b825f0151815481106144be576144be61498f565b905f5260205f2090600702016006015f8282546144db9190614bd0565b9250508190555081601f5f8282546144f39190614bd0565b909155505060a08101516040515f516020614ecd5f395f51905f52916144789185915f914290614d50565b6010805460ff1916600117905561453683308461245c565b81601b825f01518154811061454d5761454d61498f565b905f5260205f2090600702016006015f82825461456a9190614bd0565b925050819055508160205f8282546145829190614bd0565b90915550506010805460ff19169055505050565b602081525f82518060208401525f5b818110156145c257602081860181015160408684010152016145a5565b505f604082850101526040601f19601f83011684010191505092915050565b6001600160a01b03811681146113a5575f5ffd5b5f5f60408385031215614606575f5ffd5b8235614611816145e1565b946020939093013593505050565b6001600160a01b03169052565b6001600160a01b0391909116815260200190565b5f5f5f60608486031215614652575f5ffd5b833561465d816145e1565b9250602084013561466d816145e1565b929592945050506040919091013590565b634e487b7160e01b5f52602160045260245ffd5b600681106146a2576146a261467e565b9052565b600381106146a2576146a261467e565b602080825282518282018190525f918401906040840190835b818110156147795783518051845260208101516146ef6020860182614692565b50604081015161470260408601826146a6565b506060810151606085015260018060a01b03608082015116608085015260018060a01b0360a08201511660a085015260c081015161474360c086018261461f565b5060e081015161475760e086018215159052565b50610100908101519084015260209390930192610120909201916001016146cf565b509095945050505050565b5f5f60408385031215614795575f5ffd5b8235915060208301356147a7816145e1565b809150509250929050565b5f602082840312156147c2575f5ffd5b81356111b5816145e1565b602080825282518282018190525f918401906040840190835b818110156147795783518352602093840193909201916001016147e6565b602080825282518282018190525f918401906040840190835b8181101561477957835180516001600160a01b03168452602090810151818501529093019260409092019160010161481d565b5f60208284031215614860575f5ffd5b5035919050565b898152610120810161487c602083018b614692565b614889604083018a6146a6565b60608201979097526001600160a01b03958616608082015293851660a08501529190931660c083015291151560e082015261010001529392505050565b5f5f604083850312156148d7575f5ffd5b82356148e2816145e1565b915060208301356147a7816145e1565b600181811c9082168061490657607f821691505b60208210810361492457634e487b7160e01b5f52602260045260245ffd5b50919050565b80516108ed816145e1565b5f60208284031215614945575f5ffd5b81516111b5816145e1565b5f60208284031215614960575f5ffd5b5051919050565b6020808252600e908201526d125b9d985b1a59081d185e08125160921b604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b60208082526012908201527127b7363c903330b1ba37b93c9037bbb732b960711b604082015260600190565b6001600160a01b031690565b602080825282548282018190525f848152918220906040840190835b8181101561477957835483526001840154614a186020850160ff8316614692565b614a2b6040850160ff8360081c166146a6565b5060028401546060840152614a4360038501546149cf565b614a50608085018261461f565b50614a5e60048501546149cf565b614a6b60a085018261461f565b506005840154614a8760c085016001600160a01b03831661461f565b614a9b60e0850160ff8360a01c1615159052565b506006840154610100840152600790930192610120909201916001016149f7565b6001600160a01b03958616815293909416602084015260408301919091526060820152608081019190915260a00190565b6001600160a01b03929092168252602082015260400190565b5f60208284031215614b16575f5ffd5b815180151581146111b5575f5ffd5b6001600160a01b039390931683526020830191909152604082015260600190565b634e487b7160e01b5f52604160045260245ffd5b918252602082015260400190565b5f5f60408385031215614b79575f5ffd5b505080516020909101519092909150565b634e487b7160e01b5f52601160045260245ffd5b5f82614bb857634e487b7160e01b5f52601260045260245ffd5b500490565b818103818111156107df576107df614b8a565b808201808211156107df576107df614b8a565b5f60018201614bf457614bf4614b8a565b5060010190565b6001600160a01b038481168252831660208083019190915260606040830181905283549083018190525f848152918220906080840190835b81811015614c5a5783546001600160a01b0316835260019384019360209093019201614c33565b5090979650505050505050565b5f5f60408385031215614c78575f5ffd5b8251614c83816145e1565b60208401519092506147a7816145e1565b6001600160a01b03858116825284166020808301919091526040820184905260806060830181905283519083018190525f9184019060a0840190835b81811015614cf75783516001600160a01b0316835260209384019390920191600101614cd0565b509098975050505050505050565b80820281158282048414176107df576107df614b8a565b958652602086019490945260408501929092526001600160a01b03908116606085015216608083015260a082015260c00190565b93845260208401929092526001600160a01b03166040830152606082015260800190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b5f60208284031215614da7575f5ffd5b81516001600160401b03811115614dbc575f5ffd5b8201601f81018413614dcc575f5ffd5b80516001600160401b03811115614de557614de5614b46565b604051600582901b90603f8201601f191681016001600160401b0381118282101715614e1357614e13614b46565b604052918252602081840181019290810187841115614e30575f5ffd5b6020850194505b83851015614e5657614e488561492a565b815260209485019401614e37565b509695505050505050565b60c08101614e6f8289614692565b614e7c60208301886146a6565b6001600160a01b039586166040830152939094166060850152608084019190915260a0909201919091529291505056fe4273856ca27b03e758cdfc9b3b6ca37d494ecb75fbae628757965b75fb104ab6f7d7115427aac464a6917f7ba3066179fd0c845521f577e53e8e4d4ec97dd4a8799663458a5ef2936f7fa0c99b3336c69c25890f82974f04e811e5bb359186c7c24cdf2085ca2e96c74f42d25648701f34a19b69bce82381dffcf6d00a8dcad5a164736f6c634300081f000a