false
true
0

Contract Address Details

0x1cAAeB97152B2D895588a45840434B9Ca8Ca55d6

Token
HEXCAVATOR (HEXCAVATOR)
Creator
0x697275–1ed143 at 0x93c6cd–3fd50e
Balance
0 PLS ( )
Tokens
Fetching tokens...
Transactions
280 Transactions
Transfers
0 Transfers
Gas Used
0
Last Balance Update
26174184
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
HEXCAVATOR




Optimization enabled
true
Compiler version
v0.8.20+commit.a1b79de6




Optimization runs
200
EVM Version
paris




Verified at
2025-09-02T16:50:40.222268Z

Constructor Arguments

0x0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb39000000000000000000000000234c847e16253779c3ca04a5bda4d6baadc354ae000000000000000000000000165c3410fc91ef562c50559f7d2289febed552d9000000000000000000000000a1077a294dde1b09bb078844df40758a5d0f9a27

Arg [0] (address) : 0x2b591e99afe9f32eaa6214f7b7629768c40eeb39
Arg [1] (address) : 0x234c847e16253779c3ca04a5bda4d6baadc354ae
Arg [2] (address) : 0x165c3410fc91ef562c50559f7d2289febed552d9
Arg [3] (address) : 0xa1077a294dde1b09bb078844df40758a5d0f9a27

              

contracts/HEXCAVATOR.sol

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

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IUniswapV2Router02.sol";

// Minimal interface into your staking system to award HEXANIUM points
interface IStakingCycle {
    function rewardActivityPoints(address user, uint256 points) external;
}

/**
 * HEXCAVATOR (v2.1)
 * - Buy/Sell tax -> swap HEXCAVATOR->WPLS->HEX -> send HEX to Treasury.
 * - Internal swap triggers ONLY on non-AMM<->non-AMM transfers (avoids router collisions).
 * - Launch gate: LP can be added while trading is closed; whitelist controls who can touch AMM before open.
 * - NEW: permissionless flushTreasury() with cooldown; optional reward to caller via StakingCycle.
 */
contract HEXCAVATOR is ERC20, ERC20Burnable, Ownable {
    // ---- Fees (bps; 10_000 = 100%) ----
    uint256 public constant BUY_TAX_BPS  = 369; // 3.69%
    uint256 public constant SELL_TAX_BPS = 963; // 9.63%

    // ---- External wiring ----
    IERC20 public immutable hexToken;
    IUniswapV2Router02 public router;
    address public treasury;
    address public wpls;

    // ---- AMM & fee controls ----
    mapping(address => bool) public isAMMPair;
    mapping(address => bool) public isFeeExempt;

    // ---- Swap control ----
    uint256 public swapThreshold;
    bool private inSwap;

    // ---- Launch control ----
    bool public tradingOpen;
    mapping(address => bool) public launchWhitelist;

    // ---- Stored swap route: [HEXCAVATOR -> WPLS -> HEX] ----
    address[] private _swapRoute;

    // ---- Public flush (permissionless) ----
    uint256 public flushCooldown = 30 minutes;
    uint256 public lastFlush;
    uint256 public flushRewardPoints; // 0 = disabled
    IStakingCycle public staking;     // optional reward sink

    // ---- Events ----
    event TreasuryUpdated(address indexed treasury);
    event RouterUpdated(address indexed router);
    event WPLSUpdated(address indexed wpls);
    event AMMPairSet(address indexed pair, bool value);
    event FeeExempt(address indexed account, bool value);
    event SwapThresholdUpdated(uint256 amount);
    event LaunchWhitelistUpdated(address indexed account, bool allowed);
    event TradingOpened();

    event TreasuryFlushed(uint256 HEXCAVATORSold, address indexed caller);
    event FlushCooldownUpdated(uint256 seconds_);
    event FlushRewardPointsUpdated(uint256 points);
    event StakingSet(address indexed staking_);

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

    constructor(
        address _hexToken,
        address _treasury,
        address _router,
        address _wpls
    ) ERC20("HEXCAVATOR", "HEXCAVATOR") Ownable(msg.sender) {
        require(_hexToken != address(0) && _treasury != address(0) && _router != address(0) && _wpls != address(0), "zero");
        hexToken = IERC20(_hexToken);
        treasury = _treasury;
        router   = IUniswapV2Router02(_router);
        wpls     = _wpls;

        emit RouterUpdated(_router);
        emit WPLSUpdated(_wpls);

        // Route in storage (cheaper at runtime)
        _swapRoute.push(address(this));
        _swapRoute.push(wpls);
        _swapRoute.push(address(hexToken));

        // Exemptions
        isFeeExempt[msg.sender]    = true;      // deployer
        isFeeExempt[address(this)] = true;      // token
        isFeeExempt[_treasury]     = true;      // treasury

        // Launch whitelist so LP can be added before open
        launchWhitelist[msg.sender] = true;     // deployer
        launchWhitelist[_router]    = true;     // router
        emit LaunchWhitelistUpdated(msg.sender, true);
        emit LaunchWhitelistUpdated(_router, true);

        swapThreshold = 10_000 * 10 ** decimals();  // tune later
        _mint(msg.sender, 10_000_000 * 10 ** decimals());
    }

    // ---------- Admin ----------
    function setRouter(address _router) external onlyOwner {
        require(_router != address(0), "router=0");
        router = IUniswapV2Router02(_router);
        emit RouterUpdated(_router);
    }

    function setWPLS(address _wpls) external onlyOwner {
        require(_wpls != address(0), "wpls=0");
        wpls = _wpls;
        _swapRoute[1] = _wpls;
        emit WPLSUpdated(_wpls);
    }

    function setTreasury(address _treasury) external onlyOwner {
        require(_treasury != address(0), "treasury=0");
        treasury = _treasury;
        emit TreasuryUpdated(_treasury);
    }

    function setAMMPair(address pair, bool value) external onlyOwner {
        isAMMPair[pair] = value;
        emit AMMPairSet(pair, value);
    }

    function setFeeExempt(address account, bool value) external onlyOwner {
        isFeeExempt[account] = value;
        emit FeeExempt(account, value);
    }

    function setSwapThreshold(uint256 amount) external onlyOwner {
        swapThreshold = amount;
        emit SwapThresholdUpdated(amount);
    }

    function setLaunchWhitelist(address account, bool allowed) external onlyOwner {
        launchWhitelist[account] = allowed;
        emit LaunchWhitelistUpdated(account, allowed);
    }

    function openTrading() external onlyOwner {
        tradingOpen = true;
        emit TradingOpened();
    }

    function setFlushCooldown(uint256 seconds_) external onlyOwner {
        flushCooldown = seconds_;
        emit FlushCooldownUpdated(seconds_);
    }

    function setFlushRewardPoints(uint256 points) external onlyOwner {
        flushRewardPoints = points;
        emit FlushRewardPointsUpdated(points);
    }

    function setStaking(address staking_) external onlyOwner {
        staking = IStakingCycle(staking_);
        emit StakingSet(staking_);
    }

    function getSwapRoute() external view returns (address[] memory r) { r = _swapRoute; }

    // View helper for UI
    function canFlush() external view returns (bool ok, uint256 timeRemaining, uint256 buffer, uint256 threshold) {
        buffer = balanceOf(address(this));
        threshold = swapThreshold;
        uint256 t = block.timestamp;
        uint256 next = lastFlush + flushCooldown;
        timeRemaining = t >= next ? 0 : (next - t);
        ok = (timeRemaining == 0 && buffer >= threshold && treasury != address(0));
    }

    // ---------- Transfers with tax + launch gate ----------
    function _update(address from, address to, uint256 amount) internal override {
        if (inSwap) {
            super._update(from, to, amount);
            return;
        }

        // Gate AMM transfers until trading is opened
        if (!tradingOpen && (isAMMPair[from] || isAMMPair[to])) {
            require(launchWhitelist[from] || launchWhitelist[to], "Trading not open");
        }

        uint256 fee;
        bool takeFee = !(isFeeExempt[from] || isFeeExempt[to]);

        if (takeFee) {
            if (isAMMPair[from]) {
                // Buy
                fee = (amount * BUY_TAX_BPS) / 10_000;
            } else if (isAMMPair[to]) {
                // Sell
                fee = (amount * SELL_TAX_BPS) / 10_000;
            }
        }

        if (fee > 0) {
            super._update(from, address(this), fee);
            amount -= fee;
        }

        super._update(from, to, amount);

        // Swap only on NON-AMM <-> NON-AMM transfers to avoid router collisions
        uint256 bal = balanceOf(address(this));
        if (!inSwap && bal >= swapThreshold && !isAMMPair[from] && !isAMMPair[to] && treasury != address(0)) {
            _swapHEXCAVATORForHEX(bal);
        }
    }

    // ---------- Public, permissionless flush with cooldown ----------
    function flushTreasury() external {
        require(block.timestamp >= lastFlush + flushCooldown, "Cooldown");
        uint256 bal = balanceOf(address(this));
        require(bal >= swapThreshold, "BelowThreshold");
        require(treasury != address(0), "NoTreasury");

        lastFlush = block.timestamp;
        _swapHEXCAVATORForHEX(bal);

        // Optional points reward (no-op if not configured)
        if (address(staking) != address(0) && flushRewardPoints > 0) {
            // do not let a staking revert block the flush
            try staking.rewardActivityPoints(msg.sender, flushRewardPoints) {} catch {}
        }

        emit TreasuryFlushed(bal, msg.sender);
    }

    // ---------- Internal: swap HEXCAVATOR -> WPLS -> HEX ----------
    function _swapHEXCAVATORForHEX(uint256 amountIn) internal swapping {
        _approve(address(this), address(router), amountIn);
        router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
            amountIn,
            0,
            _swapRoute,
            treasury,
            block.timestamp
        );
    }
}
        

@openzeppelin/contracts/access/Ownable.sol

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

@openzeppelin/contracts/interfaces/IERC1363.sol

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

pragma solidity >=0.6.2;

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

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

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

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

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

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

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

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

@openzeppelin/contracts/interfaces/IERC165.sol

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

pragma solidity >=0.4.16;

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

@openzeppelin/contracts/interfaces/IERC20.sol

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

pragma solidity >=0.4.16;

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/draft-IERC6093.sol)
pragma solidity >=0.8.4;

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

@openzeppelin/contracts/token/ERC20/ERC20.sol

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

pragma solidity ^0.8.20;

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

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * Both 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;
    }

    /// @inheritdoc IERC20
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupply;
    }

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

    /// @inheritdoc IERC20
    function allowance(address owner, address spender) public view virtual returns (uint256) {
        return _allowances[owner][spender];
    }

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

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

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

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

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

        emit Transfer(from, to, value);
    }

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

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

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

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

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

@openzeppelin/contracts/token/ERC20/IERC20.sol

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

pragma solidity >=0.4.16;

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

@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol

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

pragma solidity ^0.8.20;

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

/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20Burnable is Context, ERC20 {
    /**
     * @dev Destroys a `value` amount of tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 value) public virtual {
        _burn(_msgSender(), value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, deducting from
     * the caller's allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `value`.
     */
    function burnFrom(address account, uint256 value) public virtual {
        _spendAllowance(account, _msgSender(), value);
        _burn(account, value);
    }
}
          

@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol

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

pragma solidity >=0.6.2;

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

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

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

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

@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol

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

pragma solidity ^0.8.20;

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

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

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

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

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

    /**
     * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

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

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

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

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

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

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

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

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

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

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

@openzeppelin/contracts/utils/Context.sol

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

pragma solidity ^0.8.20;

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

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

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

@openzeppelin/contracts/utils/introspection/IERC165.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)

pragma solidity >=0.4.16;

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

contracts/StakingCycle.sol

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

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

/* ---------- External interfaces (top-level) ---------- */
interface ITreasury {
 function sendHEX(address to, uint256 amount) external;
 function payoutHEX(address to, uint256 amount) external;
 function distributeHEX(address to, uint256 amount) external;
}

/**
 * StakingCycle
 *
 * - Users stake HEXCAVATOR for fixed durations and earn HEXANIUM (points).
 * - Points persist across cycles. Every 120h, snapshot the top-3 point holders.
 * - Those 3 have a 24h claim window to burn ALL their points and claim HEX from Treasury:
 * #1 => 25%, #2 => 15%, #3 => 5% of the snapshotted HEX balance.
 * - If they don't claim in time, their points are burned anyway; others keep points into next cycle.
 * - Permissionless cycle advancement & claims.
 * - HEXCAVATOR can grant "activity" points (e.g., for permissionless fee flush) via rewardActivityPoints().
 */
contract StakingCycle is Ownable {
 using SafeERC20 for IERC20;

 /* ---------- Constants / External wiring ---------- */
 // PulseChain HEX (as per your setup)
 address public constant HEX_TOKEN = 0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39;

 IERC20 public immutable HEX = IERC20(HEX_TOKEN);
 IERC20 public HEXCAVATOR_TOKEN; // set via constructor/setHEXCAVATOR (HEXCAVATOR)
 address public HEXCAVATOR; // raw address for onlyHEXCAVATOR modifier
 address public treasury; // Treasury holding HEX (set in constructor)

 /* ---------- Staking config ---------- */
 // Index: 0..4 => 24h,48h,72h,96h,120h
 uint32[5] public DURATIONS = [24 hours, 48 hours, 72 hours, 96 hours, 120 hours];
 // Percentage of HEXCAVATOR returned on successful unstake (BPS: 10000 = 100%)
 uint16[5] public RETURN_BPS = [9800, 9600, 9400, 9200, 9000];
 // HEXANIUM point multipliers applied at stake time
 uint16[5] public MULTIPLIER = [1, 3, 7, 13, 21];

 /* ---------- Cycle config ---------- */
 uint256 public constant CYCLE_LENGTH = 120 hours;
 uint256 public constant CLAIM_WINDOW = 24 hours;

 /* ---------- State: staking ---------- */
 struct StakeInfo {
 uint256 amount;
 uint64 unlockTime;
 uint8 durationIndex;
 bool active;
 }

 mapping(address => StakeInfo[]) public stakesByUser;
 mapping(address => uint256) public points; // HEXANIUM points
 address[] public participants; // addresses that ever gained points
 mapping(address => bool) internal seen; // helper to add to participants once

 /* ---------- State: cycles / claims ---------- */
 uint64 public cycleStart; // start time of current cycle
 bool public claimActive; // whether we are in a claim window
 uint64 public claimStart; // start time of current claim window (if active)

 // Snapshot for the cycle that just ended
 address[3] public snapTop; // rank 1..3 at snapshot
 uint256[3] public snapScores;
 bool[3] public snapClaimed;
 uint256 public snapHexBalance; // HEX balance in treasury at snapshot

 /* ---------- Events ---------- */
 event Staked(address indexed user, uint256 indexed id, uint256 amount, uint8 durationIdx, uint64 unlockTime, uint256 pointsGained);
 event Unstaked(address indexed user, uint256 indexed id, uint256 returnedAmount, uint256 burnedAmount);
 event PointsRewarded(address indexed user, uint256 points);
 event CycleSnap(uint64 indexed atTime, address[3] top, uint256[3] scores, uint256 hexBalance);
 event Claim(address indexed user, uint8 rank, uint256 amountHex);
 event BurnedForNoClaim(address indexed user, uint8 rank, uint256 burnedPoints);
 event AdvancedToNewCycle(uint64 indexed newStart);
 event HEXCAVATORSet(address indexed HEXCAVATOR);
 event TreasurySet(address indexed treasury);

 /* ---------- Modifiers ---------- */
 modifier onlyHEXCAVATOR() {
 require(msg.sender == HEXCAVATOR, "not HEXCAVATOR");
 _;
 }

 constructor(address _HEXCAVATOR, address _treasury) Ownable(msg.sender) {
 require(_HEXCAVATOR != address(0) && _treasury != address(0), "zero addr");
 HEXCAVATOR = _HEXCAVATOR;
 HEXCAVATOR_TOKEN = IERC20(_HEXCAVATOR);
 treasury = _treasury;

 cycleStart = uint64(block.timestamp);
 emit HEXCAVATORSet(_HEXCAVATOR);
 emit TreasurySet(_treasury);
 }

 /* ---------- Admin wiring ---------- */
 function setHEXCAVATOR(address _HEXCAVATOR) external onlyOwner {
 require(_HEXCAVATOR != address(0), "HEXCAVATOR=0");
 HEXCAVATOR = _HEXCAVATOR;
 HEXCAVATOR_TOKEN = IERC20(_HEXCAVATOR);
 emit HEXCAVATORSet(_HEXCAVATOR);
 }

 function setTreasury(address _treasury) external onlyOwner {
 require(_treasury != address(0), "treasury=0");
 treasury = _treasury;
 emit TreasurySet(_treasury);
 }

 /* ---------- User actions ---------- */
 function stake(uint256 amount, uint8 durationIdx) external {
 require(amount > 0, "amount=0");
 require(durationIdx < DURATIONS.length, "bad index");

 // Pull HEXCAVATOR to this contract
 HEXCAVATOR_TOKEN.safeTransferFrom(msg.sender, address(this), amount);

 // Create stake
 uint64 unlock = uint64(block.timestamp + DURATIONS[durationIdx]);
 StakeInfo memory s = StakeInfo({
 amount: amount,
 unlockTime: unlock,
 durationIndex: durationIdx,
 active: true
 });
 stakesByUser[msg.sender].push(s);
 uint256 stakeId = stakesByUser[msg.sender].length - 1;

 // Award HEXANIUM points immediately based on multiplier
 uint256 p = amount * MULTIPLIER[durationIdx];
 points[msg.sender] += p;
 if (!seen[msg.sender]) { seen[msg.sender] = true; participants.push(msg.sender); }

 emit Staked(msg.sender, stakeId, amount, durationIdx, unlock, p);
 emit PointsRewarded(msg.sender, p);
 }

 function unstake(uint256 stakeId) external {
 require(stakeId < stakesByUser[msg.sender].length, "bad id");
 StakeInfo storage s = stakesByUser[msg.sender][stakeId];
 require(s.active, "inactive");
 require(block.timestamp >= s.unlockTime, "still locked");

 s.active = false;

 uint256 bps = RETURN_BPS[s.durationIndex];
 uint256 returned = (s.amount * bps) / 10_000;
 uint256 burned = s.amount - returned;

 // Return HEXCAVATOR to the user
 HEXCAVATOR_TOKEN.safeTransfer(msg.sender, returned);

 // Burn penalty from this contract's balance if token supports it, else send to treasury
 if (burned > 0) {
 (bool ok, ) = address(HEXCAVATOR_TOKEN).call(abi.encodeWithSignature("burn(uint256)", burned));
 if (!ok) {
 // If HEXCAVATOR doesn't expose burn(), redirect penalty to treasury
 HEXCAVATOR_TOKEN.safeTransfer(treasury, burned);
 }
 }

 emit Unstaked(msg.sender, stakeId, returned, burned);
 }

 // Called by HEXCAVATOR to reward a caller (e.g., flushTreasury())
 function rewardActivityPoints(address user, uint256 pts) external onlyHEXCAVATOR {
 require(user != address(0) && pts > 0, "bad args");
 points[user] += pts;
 if (!seen[user]) { seen[user] = true; participants.push(user); }
 emit PointsRewarded(user, pts);
 }

 /* ---------- Cycle management ---------- */

 /**
 * Anyone can advance the machine:
 * - If 120h passed since cycleStart AND we are NOT in claim window: snapshot leaders & treasury HEX, start 24h claim window
 * - Else if claim window is running and expired: burn unclaimed leaders’ points and start the next cycle
 */
 function advanceCycle() public {
 if (!claimActive) {
 // Start claim window if cycle elapsed
 if (block.timestamp >= (cycleStart + CYCLE_LENGTH)) {
 _snapshotLeadersAndOpenClaims();
 } else {
 revert("cycle not finished");
 }
 } else {
 // Close claim window if expired
 if (block.timestamp >= (claimStart + CLAIM_WINDOW)) {
 _closeClaimsAndStartNewCycle();
 } else {
 revert("claim window not finished");
 }
 }
 }

 function _snapshotLeadersAndOpenClaims() internal {
 // Compute live top-3 by scanning participants
 (address[3] memory addrs, uint256[3] memory scores) = _computeTop3();

 snapTop = addrs;
 snapScores = scores;
 snapClaimed = [false, false, false];
 snapHexBalance = HEX.balanceOf(treasury);

 claimActive = true;
 claimStart = uint64(block.timestamp);

 emit CycleSnap(uint64(block.timestamp), addrs, scores, snapHexBalance);
 }

 function _closeClaimsAndStartNewCycle() internal {
 // Burn points of any unclaimed leaders
 for (uint8 i = 0; i < 3; i++) {
 address u = snapTop[i];
 if (u != address(0) && !snapClaimed[i]) {
 uint256 burned = points[u];
 if (burned > 0) {
 points[u] = 0;
 emit BurnedForNoClaim(u, i + 1, burned);
 }
 }
 }

 // Reset claim window and start next cycle
 claimActive = false;
 cycleStart = uint64(block.timestamp);
 emit AdvancedToNewCycle(cycleStart);
 }

 // Claim for rank = 1,2,3
 function claim(uint8 rank) external {
 require(claimActive, "no claim window");
 require(rank >= 1 && rank <= 3, "bad rank");
 uint8 i = rank - 1;

 require(block.timestamp <= (claimStart + CLAIM_WINDOW), "claim ended");
 require(!snapClaimed[i], "already claimed");
 require(snapTop[i] == msg.sender, "not your rank");

 // Burn ALL points of claimer
 points[msg.sender] = 0;
 snapClaimed[i] = true;

 // Calculate share using the snapshotted HEX balance
 uint256 shareBps = (i == 0 ? 2500 : (i == 1 ? 1500 : 500)); // 25%, 15%, 5%
 uint256 amount = (snapHexBalance * shareBps) / 10_000;

 // Payout from Treasury
 _payoutHEX(msg.sender, amount);

 emit Claim(msg.sender, rank, amount);
 }

 /* ---------- Helpers ---------- */

 function _computeTop3() internal view returns (address[3] memory a, uint256[3] memory s) {
 a = [address(0), address(0), address(0)];
 s = [uint256(0), uint256(0), uint256(0)];

 uint256 len = participants.length;
 for (uint256 k = 0; k < len; k++) {
 address u = participants[k];
 uint256 p = points[u];
 if (p == 0) continue;

 // insert-sort into top3
 if (p > s[0]) {
 s[2] = s[1]; a[2] = a[1];
 s[1] = s[0]; a[1] = a[0];
 s[0] = p; a[0] = u;
 } else if (p > s[1]) {
 s[2] = s[1]; a[2] = a[1];
 s[1] = p; a[1] = u;
 } else if (p > s[2]) {
 s[2] = p; a[2] = u;
 }
 }
 }

 // Public view for the dApp to display the *live* leaderboard
 function currentTop3() external view returns (address[3] memory a, uint256[3] memory s) {
 return _computeTop3();
 }

 // Try common treasury methods; fallback to transferFrom if Treasury approved us
 function _payoutHEX(address to, uint256 amount) internal {
 if (amount == 0) return;

 // Try: sendHEX(address,uint256)
 try ITreasury(treasury).sendHEX(to, amount) {
 return;
 } catch {}

 // Try: payoutHEX(address,uint256)
 try ITreasury(treasury).payoutHEX(to, amount) {
 return;
 } catch {}

 // Try: distributeHEX(address,uint256)
 try ITreasury(treasury).distributeHEX(to, amount) {
 return;
 } catch {}

 // Fallback: pull directly if Treasury approved us
 HEX.safeTransferFrom(treasury, to, amount);
 }

 /* ---------- Views for frontend convenience ---------- */

 function getUserStakes(address user) external view returns (StakeInfo[] memory) {
 return stakesByUser[user];
 }

 function claimWindow() external view returns (bool active, uint256 secondsRemaining) {
 if (!claimActive) return (false, 0);
 uint256 end = claimStart + CLAIM_WINDOW;
 secondsRemaining = block.timestamp >= end ? 0 : (end - block.timestamp);
 return (true, secondsRemaining);
 }

 function cycleInfo() external view returns (uint256 start, uint256 secondsToSnapshot) {
 start = cycleStart;
 uint256 end = cycleStart + CYCLE_LENGTH;
 secondsToSnapshot = block.timestamp >= end ? 0 : (end - block.timestamp);
 }
}
          

contracts/Treasury.sol

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

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/**
 * TreasuryV2
 * - Holds HEX
 * - Owner can approve StakingCycle to pull HEX (keeps StakingCycle unchanged)
 * - Optional cycleManager + payout for future-proofing
 */
contract TreasuryV2 is Ownable {
    address public immutable HEX_TOKEN;
    address public cycleManager;

    event CycleManagerUpdated(address indexed manager);
    event Approved(address indexed spender, uint256 amount);
    event Payout(address indexed to, uint256 amount);
    event Swept(address indexed token, address indexed to, uint256 amount);

    modifier onlyCycleManager() {
        require(msg.sender == cycleManager, "not manager");
        _;
    }

    constructor(address _hex) Ownable(msg.sender) {
        require(_hex != address(0), "hex=0");
        HEX_TOKEN = _hex;
    }

    // Required for current StakingCycle pull model
    function approveHEX(address spender, uint256 amount) external onlyOwner {
        require(spender != address(0), "spender=0");
        IERC20(HEX_TOKEN).approve(spender, amount);
        emit Approved(spender, amount);
    }

    // Optional
    function setCycleManager(address m) external onlyOwner {
        cycleManager = m;
        emit CycleManagerUpdated(m);
    }

    function payout(address to, uint256 amount) external onlyCycleManager {
        require(to != address(0), "to=0");
        IERC20(HEX_TOKEN).transfer(to, amount);
        emit Payout(to, amount);
    }

    // Safety
    function sweep(address token, address to, uint256 amount) external onlyOwner {
        require(to != address(0), "to=0");
        IERC20(token).transfer(to, amount);
        emit Swept(token, to, amount);
    }
}
          

contracts/interfaces/IUniswapV2Router02.sol

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

interface IUniswapV2Router02 {
    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}
          

Compiler Settings

{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"],"":["ast"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{},"evmVersion":"paris"}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_hexToken","internalType":"address"},{"type":"address","name":"_treasury","internalType":"address"},{"type":"address","name":"_router","internalType":"address"},{"type":"address","name":"_wpls","internalType":"address"}]},{"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":"event","name":"AMMPairSet","inputs":[{"type":"address","name":"pair","internalType":"address","indexed":true},{"type":"bool","name":"value","internalType":"bool","indexed":false}],"anonymous":false},{"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":"FeeExempt","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"bool","name":"value","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"FlushCooldownUpdated","inputs":[{"type":"uint256","name":"seconds_","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"FlushRewardPointsUpdated","inputs":[{"type":"uint256","name":"points","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"LaunchWhitelistUpdated","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"bool","name":"allowed","internalType":"bool","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":"RouterUpdated","inputs":[{"type":"address","name":"router","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"StakingSet","inputs":[{"type":"address","name":"staking_","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"SwapThresholdUpdated","inputs":[{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TradingOpened","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":"TreasuryFlushed","inputs":[{"type":"uint256","name":"HEXCAVATORSold","internalType":"uint256","indexed":false},{"type":"address","name":"caller","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"TreasuryUpdated","inputs":[{"type":"address","name":"treasury","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"WPLSUpdated","inputs":[{"type":"address","name":"wpls","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"BUY_TAX_BPS","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"SELL_TAX_BPS","inputs":[]},{"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":[],"name":"burn","inputs":[{"type":"uint256","name":"value","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"burnFrom","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"ok","internalType":"bool"},{"type":"uint256","name":"timeRemaining","internalType":"uint256"},{"type":"uint256","name":"buffer","internalType":"uint256"},{"type":"uint256","name":"threshold","internalType":"uint256"}],"name":"canFlush","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"decimals","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"flushCooldown","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"flushRewardPoints","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"flushTreasury","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[]","name":"r","internalType":"address[]"}],"name":"getSwapRoute","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"hexToken","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isAMMPair","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isFeeExempt","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastFlush","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"launchWhitelist","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"openTrading","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IUniswapV2Router02"}],"name":"router","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAMMPair","inputs":[{"type":"address","name":"pair","internalType":"address"},{"type":"bool","name":"value","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFeeExempt","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"bool","name":"value","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFlushCooldown","inputs":[{"type":"uint256","name":"seconds_","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFlushRewardPoints","inputs":[{"type":"uint256","name":"points","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setLaunchWhitelist","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"bool","name":"allowed","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRouter","inputs":[{"type":"address","name":"_router","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setStaking","inputs":[{"type":"address","name":"staking_","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setSwapThreshold","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTreasury","inputs":[{"type":"address","name":"_treasury","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setWPLS","inputs":[{"type":"address","name":"_wpls","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IStakingCycle"}],"name":"staking","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"swapThreshold","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"tradingOpen","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":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"treasury","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"wpls","inputs":[]}]
              

Contract Creation Code

0x60a0604052610708600f553480156200001757600080fd5b50604051620025d5380380620025d58339810160408190526200003a916200097d565b604080518082018252600a808252692422ac21a0ab20aa27a960b11b6020808401829052845180860190955291845290830152339160036200007d838262000a76565b5060046200008c828262000a76565b5050506001600160a01b038116620000bf57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b620000ca8162000370565b506001600160a01b03841615801590620000ec57506001600160a01b03831615155b80156200010157506001600160a01b03821615155b80156200011657506001600160a01b03811615155b6200014d5760405162461bcd60e51b8152600401620000b6906020808252600490820152637a65726f60e01b604082015260600190565b6001600160a01b03848116608052600780546001600160a01b031990811686841617909155600680548216858416908117909155600880549092169284169290921790556040517f7aed1d3e8155a07ccf395e44ea3109a0e2d6c9b29bbbe9f142d9790596f4dc8090600090a26040516001600160a01b038216907f4f970d0a54fa0a0026fa0aa086eda911d313e7f461087603cedf97ef6bf7290e90600090a2600e8054600180820183557fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd9182018054306001600160a01b0319918216811790925560085485548085018755850180546001600160a01b03928316908416179055608051865480860190975595909401805490911694841694909417909355336000818152600a60209081526040808320805460ff199081168717909155968352808320805488168617905589861683528083208054881686179055838352600d825280832080548816861790559488168252908490208054909516831790945591519081529091600080516020620025b5833981519152910160405180910390a2604051600181526001600160a01b03831690600080516020620025b58339815191529060200160405180910390a26200032d6012600a62000c57565b6200033b9061271062000c6f565b600b556200036633620003516012600a62000c57565b62000360906298968062000c6f565b620003c2565b5050505062000d50565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216620003ee5760405163ec442f0560e01b815260006004820152602401620000b6565b620003fc6000838362000400565b5050565b600c5460ff16156200041e5762000419838383620006a0565b505050565b600c54610100900460ff161580156200047257506001600160a01b03831660009081526009602052604090205460ff16806200047257506001600160a01b03821660009081526009602052604090205460ff165b15620004f9576001600160a01b0383166000908152600d602052604090205460ff1680620004b857506001600160a01b0382166000908152600d602052604090205460ff165b620004f95760405162461bcd60e51b815260206004820152601060248201526f2a3930b234b733903737ba1037b832b760811b6044820152606401620000b6565b6001600160a01b0383166000908152600a6020526040812054819060ff16806200053b57506001600160a01b0384166000908152600a602052604090205460ff165b1590508015620005ce576001600160a01b03851660009081526009602052604090205460ff16156200058c57612710620005786101718562000c6f565b62000584919062000c89565b9150620005ce565b6001600160a01b03841660009081526009602052604090205460ff1615620005ce57612710620005bf6103c38562000c6f565b620005cb919062000c89565b91505b8115620005f157620005e2853084620006a0565b620005ee828462000cac565b92505b620005fe858585620006a0565b30600090815260208190526040902054600c5460ff16158015620006245750600b548110155b80156200064a57506001600160a01b03861660009081526009602052604090205460ff16155b80156200067057506001600160a01b03851660009081526009602052604090205460ff16155b80156200068757506007546001600160a01b031615155b1562000698576200069881620007d3565b505050505050565b6001600160a01b038316620006cf578060026000828254620006c3919062000cc2565b90915550620007439050565b6001600160a01b03831660009081526020819052604090205481811015620007245760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401620000b6565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216620007615760028054829003905562000780565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051620007c691815260200190565b60405180910390a3505050565b600c805460ff19166001179055600654620007fa9030906001600160a01b0316836200087b565b600654600754604051635c11d79560e01b81526001600160a01b0392831692635c11d795926200083a928692600092600e92911690429060040162000cd8565b600060405180830381600087803b1580156200085557600080fd5b505af11580156200086a573d6000803e3d6000fd5b5050600c805460ff19169055505050565b6200041983838360016001600160a01b038416620008b05760405163e602df0560e01b815260006004820152602401620000b6565b6001600160a01b038316620008dc57604051634a1406b160e11b815260006004820152602401620000b6565b6001600160a01b03808516600090815260016020908152604080832093871683529290522082905580156200095a57826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516200095191815260200190565b60405180910390a35b50505050565b80516001600160a01b03811681146200097857600080fd5b919050565b600080600080608085870312156200099457600080fd5b6200099f8562000960565b9350620009af6020860162000960565b9250620009bf6040860162000960565b9150620009cf6060860162000960565b905092959194509250565b634e487b7160e01b600052604160045260246000fd5b600181811c9082168062000a0557607f821691505b60208210810362000a2657634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200041957600081815260208120601f850160051c8101602086101562000a555750805b601f850160051c820191505b81811015620006985782815560010162000a61565b81516001600160401b0381111562000a925762000a92620009da565b62000aaa8162000aa38454620009f0565b8462000a2c565b602080601f83116001811462000ae2576000841562000ac95750858301515b600019600386901b1c1916600185901b17855562000698565b600085815260208120601f198616915b8281101562000b135788860151825594840194600190910190840162000af2565b508582101562000b325787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111562000b9957816000190482111562000b7d5762000b7d62000b42565b8085161562000b8b57918102915b93841c939080029062000b5d565b509250929050565b60008262000bb25750600162000c51565b8162000bc15750600062000c51565b816001811462000bda576002811462000be55762000c05565b600191505062000c51565b60ff84111562000bf95762000bf962000b42565b50506001821b62000c51565b5060208310610133831016604e8410600b841016171562000c2a575081810a62000c51565b62000c36838362000b58565b806000190482111562000c4d5762000c4d62000b42565b0290505b92915050565b600062000c6860ff84168362000ba1565b9392505050565b808202811582820484141762000c515762000c5162000b42565b60008262000ca757634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111562000c515762000c5162000b42565b8082018082111562000c515762000c5162000b42565b600060a082018783526020878185015260a0604085015281875480845260c0860191508860005282600020935060005b8181101562000d2f5784546001600160a01b03168352600194850194928401920162000d08565b50506001600160a01b03969096166060850152505050608001529392505050565b60805161184962000d6c600039600061037b01526118496000f3fe608060405234801561001057600080fd5b50600436106102695760003560e01c80638c2ce6e711610151578063c0d78655116100c3578063f0f4426011610087578063f0f44260146105a1578063f2fde38b146105b4578063f887ea40146105c7578063fd657856146105da578063feb7c94d146105e3578063ffb54a99146105eb57600080fd5b8063c0d786551461052f578063c9567bf914610542578063d18202891461054a578063dd62ed3e14610553578063ef1a8ec11461058c57600080fd5b8063927ef7fa11610115578063927ef7fa146104b857806395d89b41146104cb5780639b363e67146104d35780639d0014b1146104e6578063a9059cbb146104f9578063b0249cc61461050c57600080fd5b80638c2ce6e7146104655780638da5cb5b146104785780638ebfc796146104895780638ff390991461049c5780639099bd3f146104af57600080fd5b80633f4218e0116101ea57806361d027b3116101ae57806361d027b3146103db57806370a08231146103ee578063715018a61461041757806379cc67901461041f5780637ad3851d14610432578063802ee8351461045c57600080fd5b80633f4218e01461034057806342966c681461036357806349ce0a11146103765780634cf088d9146103b55780635669c3e6146103c857600080fd5b8063259490b911610231578063259490b9146102dd57806325e79739146102e65780632cc5868d146102fb5780632d99d32e1461031e578063313ce5671461033157600080fd5b80630445b6671461026e57806306fdde031461028a578063095ea7b31461029f57806318160ddd146102c257806323b872dd146102ca575b600080fd5b610277600b5481565b6040519081526020015b60405180910390f35b6102926105fd565b6040516102819190611511565b6102b26102ad36600461157b565b61068f565b6040519015158152602001610281565b600254610277565b6102b26102d83660046115a5565b6106a9565b61027760115481565b6102f96102f43660046115e1565b6106cd565b005b6102b261030936600461161d565b600d6020526000908152604090205460ff1681565b6102f961032c3660046115e1565b610735565b60405160128152602001610281565b6102b261034e36600461161d565b600a6020526000908152604090205460ff1681565b6102f961037136600461163f565b610795565b61039d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610281565b60125461039d906001600160a01b031681565b6102f96103d636600461161d565b6107a2565b60075461039d906001600160a01b031681565b6102776103fc36600461161d565b6001600160a01b031660009081526020819052604090205490565b6102f9610873565b6102f961042d36600461157b565b610887565b61043a6108a0565b6040805194151585526020850193909352918301526060820152608001610281565b61027760105481565b6102f961047336600461163f565b610916565b6005546001600160a01b031661039d565b6102f96104973660046115e1565b61095a565b6102f96104aa36600461161d565b6109ba565b61027761017181565b60085461039d906001600160a01b031681565b610292610a0c565b6102f96104e136600461163f565b610a1b565b6102f96104f436600461163f565b610a58565b6102b261050736600461157b565b610a95565b6102b261051a36600461161d565b60096020526000908152604090205460ff1681565b6102f961053d36600461161d565b610aa3565b6102f9610b36565b610277600f5481565b610277610561366004611658565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610594610b78565b604051610281919061168b565b6102f96105af36600461161d565b610bd9565b6102f96105c236600461161d565b610c6e565b60065461039d906001600160a01b031681565b6102776103c381565b6102f9610ca9565b600c546102b290610100900460ff1681565b60606003805461060c906116d8565b80601f0160208091040260200160405190810160405280929190818152602001828054610638906116d8565b80156106855780601f1061065a57610100808354040283529160200191610685565b820191906000526020600020905b81548152906001019060200180831161066857829003601f168201915b5050505050905090565b60003361069d818585610e54565b60019150505b92915050565b6000336106b7858285610e66565b6106c2858585610ee5565b506001949350505050565b6106d5610f44565b6001600160a01b0382166000818152600d6020908152604091829020805460ff191685151590811790915591519182527fa78c56560de061737f73a0e71ef7683cb3ebb04a79a96719393627e03185e12091015b60405180910390a25050565b61073d610f44565b6001600160a01b038216600081815260096020908152604091829020805460ff191685151590811790915591519182527ff9f3066792ece7dadd967a9482836e4b52c2f9d93bb1a3db2e245bbee91db8329101610729565b61079f3382610f71565b50565b6107aa610f44565b6001600160a01b0381166107ee5760405162461bcd60e51b8152602060048201526006602482015265077706c733d360d41b60448201526064015b60405180910390fd5b600880546001600160a01b0319166001600160a01b038316179055600e8054829190600190811061082157610821611712565b6000918252602082200180546001600160a01b0319166001600160a01b03938416179055604051918316917f4f970d0a54fa0a0026fa0aa086eda911d313e7f461087603cedf97ef6bf7290e9190a250565b61087b610f44565b6108856000610fa7565b565b610892823383610e66565b61089c8282610f71565b5050565b30600090815260208190526040812054600b54600f5460105484939291429185916108ca9161173e565b9050808210156108e3576108de8282611751565b6108e6565b60005b9450841580156108f65750828410155b801561090c57506007546001600160a01b031615155b9550505090919293565b61091e610f44565b600f8190556040518181527f51c1960f50f6a263163f8b6746f2421d795181dd74e4466e4be64e308a1ddaf9906020015b60405180910390a150565b610962610f44565b6001600160a01b0382166000818152600a6020908152604091829020805460ff191685151590811790915591519182527f3c2ffbcbb112b509bd5950ceeacf73a964be7e4386c19a4325729127d884052f9101610729565b6109c2610f44565b601280546001600160a01b0319166001600160a01b0383169081179091556040517ff520447191196b125f76f7110397fdf32b1b9cefb7dec323bd3b998022ac233890600090a250565b60606004805461060c906116d8565b610a23610f44565b60118190556040518181527f3c107f9104db6fcf05b1728a0c489c67c922f2c05f984706dfba694a1ab759a29060200161094f565b610a60610f44565b600b8190556040518181527f18ff2fc8464635e4f668567019152095047e34d7a2ab4b97661ba4dc7fd064769060200161094f565b60003361069d818585610ee5565b610aab610f44565b6001600160a01b038116610aec5760405162461bcd60e51b81526020600482015260086024820152670726f757465723d360c41b60448201526064016107e5565b600680546001600160a01b0319166001600160a01b0383169081179091556040517f7aed1d3e8155a07ccf395e44ea3109a0e2d6c9b29bbbe9f142d9790596f4dc8090600090a250565b610b3e610f44565b600c805461ff0019166101001790556040517fea4359d5c4b8f0945a64ab9c37fe830b3407d45e0e6e6f84275977a570457d6f90600090a1565b6060600e80548060200260200160405190810160405280929190818152602001828054801561068557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610bb2575050505050905090565b610be1610f44565b6001600160a01b038116610c245760405162461bcd60e51b815260206004820152600a602482015269074726561737572793d360b41b60448201526064016107e5565b600780546001600160a01b0319166001600160a01b0383169081179091556040517f7dae230f18360d76a040c81f050aa14eb9d6dc7901b20fc5d855e2a20fe814d190600090a250565b610c76610f44565b6001600160a01b038116610ca057604051631e4fbdf760e01b8152600060048201526024016107e5565b61079f81610fa7565b600f54601054610cb9919061173e565b421015610cf35760405162461bcd60e51b815260206004820152600860248201526721b7b7b63237bbb760c11b60448201526064016107e5565b30600090815260208190526040902054600b54811015610d465760405162461bcd60e51b815260206004820152600e60248201526d10995b1bddd51a1c995cda1bdb1960921b60448201526064016107e5565b6007546001600160a01b0316610d8b5760405162461bcd60e51b815260206004820152600a6024820152694e6f547265617375727960b01b60448201526064016107e5565b42601055610d9881610ff9565b6012546001600160a01b031615801590610db457506000601154115b15610e1c57601254601154604051632ede053b60e21b815233600482015260248101919091526001600160a01b039091169063bb7814ec90604401600060405180830381600087803b158015610e0957600080fd5b505af1925050508015610e1a575060015b505b60405181815233907ff59e9ce22c060d8d0e691e98e64543135bb3fcd9bb3359cb604707b329044f169060200160405180910390a250565b610e61838383600161109b565b505050565b6001600160a01b03838116600090815260016020908152604080832093861683529290522054600019811015610edf5781811015610ed057604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064016107e5565b610edf8484848403600061109b565b50505050565b6001600160a01b038316610f0f57604051634b637e8f60e11b8152600060048201526024016107e5565b6001600160a01b038216610f395760405163ec442f0560e01b8152600060048201526024016107e5565b610e61838383611170565b6005546001600160a01b031633146108855760405163118cdaa760e01b81523360048201526024016107e5565b6001600160a01b038216610f9b57604051634b637e8f60e11b8152600060048201526024016107e5565b61089c82600083611170565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600c805460ff1916600117905560065461101e9030906001600160a01b031683610e54565b600654600754604051635c11d79560e01b81526001600160a01b0392831692635c11d7959261105c928692600092600e929116904290600401611764565b600060405180830381600087803b15801561107657600080fd5b505af115801561108a573d6000803e3d6000fd5b5050600c805460ff19169055505050565b6001600160a01b0384166110c55760405163e602df0560e01b8152600060048201526024016107e5565b6001600160a01b0383166110ef57604051634a1406b160e11b8152600060048201526024016107e5565b6001600160a01b0380851660009081526001602090815260408083209387168352929052208290558015610edf57826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161116291815260200190565b60405180910390a350505050565b600c5460ff161561118657610e618383836113e7565b600c54610100900460ff161580156111d857506001600160a01b03831660009081526009602052604090205460ff16806111d857506001600160a01b03821660009081526009602052604090205460ff165b1561125b576001600160a01b0383166000908152600d602052604090205460ff168061121c57506001600160a01b0382166000908152600d602052604090205460ff165b61125b5760405162461bcd60e51b815260206004820152601060248201526f2a3930b234b733903737ba1037b832b760811b60448201526064016107e5565b6001600160a01b0383166000908152600a6020526040812054819060ff168061129c57506001600160a01b0384166000908152600a602052604090205460ff165b1590508015611323576001600160a01b03851660009081526009602052604090205460ff16156112e6576127106112d5610171856117da565b6112df91906117f1565b9150611323565b6001600160a01b03841660009081526009602052604090205460ff1615611323576127106113166103c3856117da565b61132091906117f1565b91505b8115611341576113348530846113e7565b61133e8284611751565b92505b61134c8585856113e7565b30600090815260208190526040902054600c5460ff161580156113715750600b548110155b801561139657506001600160a01b03861660009081526009602052604090205460ff16155b80156113bb57506001600160a01b03851660009081526009602052604090205460ff16155b80156113d157506007546001600160a01b031615155b156113df576113df81610ff9565b505050505050565b6001600160a01b038316611412578060026000828254611407919061173e565b909155506114849050565b6001600160a01b038316600090815260208190526040902054818110156114655760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016107e5565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b0382166114a0576002805482900390556114bf565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161150491815260200190565b60405180910390a3505050565b600060208083528351808285015260005b8181101561153e57858101830151858201604001528201611522565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461157657600080fd5b919050565b6000806040838503121561158e57600080fd5b6115978361155f565b946020939093013593505050565b6000806000606084860312156115ba57600080fd5b6115c38461155f565b92506115d16020850161155f565b9150604084013590509250925092565b600080604083850312156115f457600080fd5b6115fd8361155f565b91506020830135801515811461161257600080fd5b809150509250929050565b60006020828403121561162f57600080fd5b6116388261155f565b9392505050565b60006020828403121561165157600080fd5b5035919050565b6000806040838503121561166b57600080fd5b6116748361155f565b91506116826020840161155f565b90509250929050565b6020808252825182820181905260009190848201906040850190845b818110156116cc5783516001600160a01b0316835292840192918401916001016116a7565b50909695505050505050565b600181811c908216806116ec57607f821691505b60208210810361170c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156106a3576106a3611728565b818103818111156106a3576106a3611728565b600060a082018783526020878185015260a0604085015281875480845260c0860191508860005282600020935060005b818110156117b95784546001600160a01b031683526001948501949284019201611794565b50506001600160a01b03969096166060850152505050608001529392505050565b80820281158282048414176106a3576106a3611728565b60008261180e57634e487b7160e01b600052601260045260246000fd5b50049056fea2646970667358221220994895ffddf8cdb3226335757673e40c4c257f361b13c49ee2622fa78e95ac9664736f6c63430008140033a78c56560de061737f73a0e71ef7683cb3ebb04a79a96719393627e03185e1200000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb39000000000000000000000000234c847e16253779c3ca04a5bda4d6baadc354ae000000000000000000000000165c3410fc91ef562c50559f7d2289febed552d9000000000000000000000000a1077a294dde1b09bb078844df40758a5d0f9a27

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106102695760003560e01c80638c2ce6e711610151578063c0d78655116100c3578063f0f4426011610087578063f0f44260146105a1578063f2fde38b146105b4578063f887ea40146105c7578063fd657856146105da578063feb7c94d146105e3578063ffb54a99146105eb57600080fd5b8063c0d786551461052f578063c9567bf914610542578063d18202891461054a578063dd62ed3e14610553578063ef1a8ec11461058c57600080fd5b8063927ef7fa11610115578063927ef7fa146104b857806395d89b41146104cb5780639b363e67146104d35780639d0014b1146104e6578063a9059cbb146104f9578063b0249cc61461050c57600080fd5b80638c2ce6e7146104655780638da5cb5b146104785780638ebfc796146104895780638ff390991461049c5780639099bd3f146104af57600080fd5b80633f4218e0116101ea57806361d027b3116101ae57806361d027b3146103db57806370a08231146103ee578063715018a61461041757806379cc67901461041f5780637ad3851d14610432578063802ee8351461045c57600080fd5b80633f4218e01461034057806342966c681461036357806349ce0a11146103765780634cf088d9146103b55780635669c3e6146103c857600080fd5b8063259490b911610231578063259490b9146102dd57806325e79739146102e65780632cc5868d146102fb5780632d99d32e1461031e578063313ce5671461033157600080fd5b80630445b6671461026e57806306fdde031461028a578063095ea7b31461029f57806318160ddd146102c257806323b872dd146102ca575b600080fd5b610277600b5481565b6040519081526020015b60405180910390f35b6102926105fd565b6040516102819190611511565b6102b26102ad36600461157b565b61068f565b6040519015158152602001610281565b600254610277565b6102b26102d83660046115a5565b6106a9565b61027760115481565b6102f96102f43660046115e1565b6106cd565b005b6102b261030936600461161d565b600d6020526000908152604090205460ff1681565b6102f961032c3660046115e1565b610735565b60405160128152602001610281565b6102b261034e36600461161d565b600a6020526000908152604090205460ff1681565b6102f961037136600461163f565b610795565b61039d7f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3981565b6040516001600160a01b039091168152602001610281565b60125461039d906001600160a01b031681565b6102f96103d636600461161d565b6107a2565b60075461039d906001600160a01b031681565b6102776103fc36600461161d565b6001600160a01b031660009081526020819052604090205490565b6102f9610873565b6102f961042d36600461157b565b610887565b61043a6108a0565b6040805194151585526020850193909352918301526060820152608001610281565b61027760105481565b6102f961047336600461163f565b610916565b6005546001600160a01b031661039d565b6102f96104973660046115e1565b61095a565b6102f96104aa36600461161d565b6109ba565b61027761017181565b60085461039d906001600160a01b031681565b610292610a0c565b6102f96104e136600461163f565b610a1b565b6102f96104f436600461163f565b610a58565b6102b261050736600461157b565b610a95565b6102b261051a36600461161d565b60096020526000908152604090205460ff1681565b6102f961053d36600461161d565b610aa3565b6102f9610b36565b610277600f5481565b610277610561366004611658565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610594610b78565b604051610281919061168b565b6102f96105af36600461161d565b610bd9565b6102f96105c236600461161d565b610c6e565b60065461039d906001600160a01b031681565b6102776103c381565b6102f9610ca9565b600c546102b290610100900460ff1681565b60606003805461060c906116d8565b80601f0160208091040260200160405190810160405280929190818152602001828054610638906116d8565b80156106855780601f1061065a57610100808354040283529160200191610685565b820191906000526020600020905b81548152906001019060200180831161066857829003601f168201915b5050505050905090565b60003361069d818585610e54565b60019150505b92915050565b6000336106b7858285610e66565b6106c2858585610ee5565b506001949350505050565b6106d5610f44565b6001600160a01b0382166000818152600d6020908152604091829020805460ff191685151590811790915591519182527fa78c56560de061737f73a0e71ef7683cb3ebb04a79a96719393627e03185e12091015b60405180910390a25050565b61073d610f44565b6001600160a01b038216600081815260096020908152604091829020805460ff191685151590811790915591519182527ff9f3066792ece7dadd967a9482836e4b52c2f9d93bb1a3db2e245bbee91db8329101610729565b61079f3382610f71565b50565b6107aa610f44565b6001600160a01b0381166107ee5760405162461bcd60e51b8152602060048201526006602482015265077706c733d360d41b60448201526064015b60405180910390fd5b600880546001600160a01b0319166001600160a01b038316179055600e8054829190600190811061082157610821611712565b6000918252602082200180546001600160a01b0319166001600160a01b03938416179055604051918316917f4f970d0a54fa0a0026fa0aa086eda911d313e7f461087603cedf97ef6bf7290e9190a250565b61087b610f44565b6108856000610fa7565b565b610892823383610e66565b61089c8282610f71565b5050565b30600090815260208190526040812054600b54600f5460105484939291429185916108ca9161173e565b9050808210156108e3576108de8282611751565b6108e6565b60005b9450841580156108f65750828410155b801561090c57506007546001600160a01b031615155b9550505090919293565b61091e610f44565b600f8190556040518181527f51c1960f50f6a263163f8b6746f2421d795181dd74e4466e4be64e308a1ddaf9906020015b60405180910390a150565b610962610f44565b6001600160a01b0382166000818152600a6020908152604091829020805460ff191685151590811790915591519182527f3c2ffbcbb112b509bd5950ceeacf73a964be7e4386c19a4325729127d884052f9101610729565b6109c2610f44565b601280546001600160a01b0319166001600160a01b0383169081179091556040517ff520447191196b125f76f7110397fdf32b1b9cefb7dec323bd3b998022ac233890600090a250565b60606004805461060c906116d8565b610a23610f44565b60118190556040518181527f3c107f9104db6fcf05b1728a0c489c67c922f2c05f984706dfba694a1ab759a29060200161094f565b610a60610f44565b600b8190556040518181527f18ff2fc8464635e4f668567019152095047e34d7a2ab4b97661ba4dc7fd064769060200161094f565b60003361069d818585610ee5565b610aab610f44565b6001600160a01b038116610aec5760405162461bcd60e51b81526020600482015260086024820152670726f757465723d360c41b60448201526064016107e5565b600680546001600160a01b0319166001600160a01b0383169081179091556040517f7aed1d3e8155a07ccf395e44ea3109a0e2d6c9b29bbbe9f142d9790596f4dc8090600090a250565b610b3e610f44565b600c805461ff0019166101001790556040517fea4359d5c4b8f0945a64ab9c37fe830b3407d45e0e6e6f84275977a570457d6f90600090a1565b6060600e80548060200260200160405190810160405280929190818152602001828054801561068557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610bb2575050505050905090565b610be1610f44565b6001600160a01b038116610c245760405162461bcd60e51b815260206004820152600a602482015269074726561737572793d360b41b60448201526064016107e5565b600780546001600160a01b0319166001600160a01b0383169081179091556040517f7dae230f18360d76a040c81f050aa14eb9d6dc7901b20fc5d855e2a20fe814d190600090a250565b610c76610f44565b6001600160a01b038116610ca057604051631e4fbdf760e01b8152600060048201526024016107e5565b61079f81610fa7565b600f54601054610cb9919061173e565b421015610cf35760405162461bcd60e51b815260206004820152600860248201526721b7b7b63237bbb760c11b60448201526064016107e5565b30600090815260208190526040902054600b54811015610d465760405162461bcd60e51b815260206004820152600e60248201526d10995b1bddd51a1c995cda1bdb1960921b60448201526064016107e5565b6007546001600160a01b0316610d8b5760405162461bcd60e51b815260206004820152600a6024820152694e6f547265617375727960b01b60448201526064016107e5565b42601055610d9881610ff9565b6012546001600160a01b031615801590610db457506000601154115b15610e1c57601254601154604051632ede053b60e21b815233600482015260248101919091526001600160a01b039091169063bb7814ec90604401600060405180830381600087803b158015610e0957600080fd5b505af1925050508015610e1a575060015b505b60405181815233907ff59e9ce22c060d8d0e691e98e64543135bb3fcd9bb3359cb604707b329044f169060200160405180910390a250565b610e61838383600161109b565b505050565b6001600160a01b03838116600090815260016020908152604080832093861683529290522054600019811015610edf5781811015610ed057604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064016107e5565b610edf8484848403600061109b565b50505050565b6001600160a01b038316610f0f57604051634b637e8f60e11b8152600060048201526024016107e5565b6001600160a01b038216610f395760405163ec442f0560e01b8152600060048201526024016107e5565b610e61838383611170565b6005546001600160a01b031633146108855760405163118cdaa760e01b81523360048201526024016107e5565b6001600160a01b038216610f9b57604051634b637e8f60e11b8152600060048201526024016107e5565b61089c82600083611170565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600c805460ff1916600117905560065461101e9030906001600160a01b031683610e54565b600654600754604051635c11d79560e01b81526001600160a01b0392831692635c11d7959261105c928692600092600e929116904290600401611764565b600060405180830381600087803b15801561107657600080fd5b505af115801561108a573d6000803e3d6000fd5b5050600c805460ff19169055505050565b6001600160a01b0384166110c55760405163e602df0560e01b8152600060048201526024016107e5565b6001600160a01b0383166110ef57604051634a1406b160e11b8152600060048201526024016107e5565b6001600160a01b0380851660009081526001602090815260408083209387168352929052208290558015610edf57826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161116291815260200190565b60405180910390a350505050565b600c5460ff161561118657610e618383836113e7565b600c54610100900460ff161580156111d857506001600160a01b03831660009081526009602052604090205460ff16806111d857506001600160a01b03821660009081526009602052604090205460ff165b1561125b576001600160a01b0383166000908152600d602052604090205460ff168061121c57506001600160a01b0382166000908152600d602052604090205460ff165b61125b5760405162461bcd60e51b815260206004820152601060248201526f2a3930b234b733903737ba1037b832b760811b60448201526064016107e5565b6001600160a01b0383166000908152600a6020526040812054819060ff168061129c57506001600160a01b0384166000908152600a602052604090205460ff165b1590508015611323576001600160a01b03851660009081526009602052604090205460ff16156112e6576127106112d5610171856117da565b6112df91906117f1565b9150611323565b6001600160a01b03841660009081526009602052604090205460ff1615611323576127106113166103c3856117da565b61132091906117f1565b91505b8115611341576113348530846113e7565b61133e8284611751565b92505b61134c8585856113e7565b30600090815260208190526040902054600c5460ff161580156113715750600b548110155b801561139657506001600160a01b03861660009081526009602052604090205460ff16155b80156113bb57506001600160a01b03851660009081526009602052604090205460ff16155b80156113d157506007546001600160a01b031615155b156113df576113df81610ff9565b505050505050565b6001600160a01b038316611412578060026000828254611407919061173e565b909155506114849050565b6001600160a01b038316600090815260208190526040902054818110156114655760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016107e5565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b0382166114a0576002805482900390556114bf565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161150491815260200190565b60405180910390a3505050565b600060208083528351808285015260005b8181101561153e57858101830151858201604001528201611522565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461157657600080fd5b919050565b6000806040838503121561158e57600080fd5b6115978361155f565b946020939093013593505050565b6000806000606084860312156115ba57600080fd5b6115c38461155f565b92506115d16020850161155f565b9150604084013590509250925092565b600080604083850312156115f457600080fd5b6115fd8361155f565b91506020830135801515811461161257600080fd5b809150509250929050565b60006020828403121561162f57600080fd5b6116388261155f565b9392505050565b60006020828403121561165157600080fd5b5035919050565b6000806040838503121561166b57600080fd5b6116748361155f565b91506116826020840161155f565b90509250929050565b6020808252825182820181905260009190848201906040850190845b818110156116cc5783516001600160a01b0316835292840192918401916001016116a7565b50909695505050505050565b600181811c908216806116ec57607f821691505b60208210810361170c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156106a3576106a3611728565b818103818111156106a3576106a3611728565b600060a082018783526020878185015260a0604085015281875480845260c0860191508860005282600020935060005b818110156117b95784546001600160a01b031683526001948501949284019201611794565b50506001600160a01b03969096166060850152505050608001529392505050565b80820281158282048414176106a3576106a3611728565b60008261180e57634e487b7160e01b600052601260045260246000fd5b50049056fea2646970667358221220994895ffddf8cdb3226335757673e40c4c257f361b13c49ee2622fa78e95ac9664736f6c63430008140033