S Price: $0.070753 (-0.57%)
Gas: 55 Gwei

Contract

0x244267da9e741ed00304Ddf533dBe6842eef026A

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Execute Sink Buy610526182026-01-24 12:11:001 hr ago1769256660IN
0x244267da...42eef026A
0 S0.0180730550
Distribute Rewar...610526042026-01-24 12:10:351 hr ago1769256635IN
0x244267da...42eef026A
0 S0.0190020550
Execute Sink Buy605119842026-01-16 12:38:428 days ago1768567122IN
0x244267da...42eef026A
0 S0.0175487550
Distribute Rewar...605119672026-01-16 12:38:188 days ago1768567098IN
0x244267da...42eef026A
0 S0.0190020550
Execute Sink Buy599139982026-01-08 12:16:0316 days ago1767874563IN
0x244267da...42eef026A
0 S0.0175487850.0001
Distribute Rewar...599139822026-01-08 12:15:3916 days ago1767874539IN
0x244267da...42eef026A
0 S0.0190024350.001
Execute Sink Buy597898542026-01-07 0:50:4317 days ago1767747043IN
0x244267da...42eef026A
0 S0.0175487550
Execute Sink Buy596978842026-01-06 0:15:3718 days ago1767658537IN
0x244267da...42eef026A
0 S0.0195472755
Execute Sink Buy596107642026-01-04 21:50:4719 days ago1767563447IN
0x244267da...42eef026A
0 S0.0195472755
Execute Sink Buy595179172026-01-03 18:30:0620 days ago1767465006IN
0x244267da...42eef026A
0 S0.0177702550
Execute Sink Buy594523712026-01-02 18:23:2121 days ago1767378201IN
0x244267da...42eef026A
0 S0.0195472755
Distribute Rewar...594041232026-01-02 2:28:0422 days ago1767320884IN
0x244267da...42eef026A
0 S0.0240635455
Execute Sink Buy593643632026-01-01 12:00:3723 days ago1767268837IN
0x244267da...42eef026A
0 S0.0206327550
Execute Sink Buy592960562025-12-31 10:25:3124 days ago1767176731IN
0x244267da...42eef026A
0 S0.0214405550
Execute Sink Buy592298412025-12-30 9:08:3325 days ago1767085713IN
0x244267da...42eef026A
0 S0.0248273550
Execute Sink Buy591620162025-12-29 8:43:5026 days ago1766997830IN
0x244267da...42eef026A
0 S0.0248273950.0001
Execute Sink Buy590990262025-12-28 8:36:5127 days ago1766911011IN
0x244267da...42eef026A
0 S0.0214405550
Execute Sink Buy590290832025-12-27 8:18:3728 days ago1766823517IN
0x244267da...42eef026A
0 S0.0248273550
Execute Sink Buy589600842025-12-26 8:14:2929 days ago1766736869IN
0x244267da...42eef026A
0 S0.0248273550
Execute Sink Buy588518082025-12-25 6:26:4630 days ago1766644006IN
0x244267da...42eef026A
0 S0.0206327550
Execute Sink Buy587561312025-12-24 6:26:2131 days ago1766557581IN
0x244267da...42eef026A
0 S0.0082549650.0001
Execute Sink Buy587561292025-12-24 6:26:1831 days ago1766557578IN
0x244267da...42eef026A
0 S0.0248273550
Distribute Rewar...587285402025-12-23 22:38:4531 days ago1766529525IN
0x244267da...42eef026A
0 S0.0175143550
Execute Sink Buy586611062025-12-23 6:03:3232 days ago1766469812IN
0x244267da...42eef026A
0 S0.0248273550
Execute Sink Buy585521812025-12-22 1:25:1533 days ago1766366715IN
0x244267da...42eef026A
0 S0.0206327550
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
610526182026-01-24 12:11:001 hr ago1769256660
0x244267da...42eef026A
1.98167489 S
610526042026-01-24 12:10:351 hr ago1769256635
0x244267da...42eef026A
1.98167489 S
610525902026-01-24 12:10:081 hr ago1769256608
0x244267da...42eef026A
3.96334978 S
605119842026-01-16 12:38:428 days ago1768567122
0x244267da...42eef026A
2.2303621 S
605119672026-01-16 12:38:188 days ago1768567098
0x244267da...42eef026A
2.2303621 S
605119502026-01-16 12:37:578 days ago1768567077
0x244267da...42eef026A
4.46072421 S
599139982026-01-08 12:16:0316 days ago1767874563
0x244267da...42eef026A
3.43377152 S
599139822026-01-08 12:15:3916 days ago1767874539
0x244267da...42eef026A
3.43377152 S
599139332026-01-08 12:14:4416 days ago1767874484
0x244267da...42eef026A
6.86754305 S
597898542026-01-07 0:50:4317 days ago1767747043
0x244267da...42eef026A
13.45492969 S
596978842026-01-06 0:15:3718 days ago1767658537
0x244267da...42eef026A
20 S
596107642026-01-04 21:50:4719 days ago1767563447
0x244267da...42eef026A
20 S
595179172026-01-03 18:30:0620 days ago1767465006
0x244267da...42eef026A
20 S
594523712026-01-02 18:23:2121 days ago1767378201
0x244267da...42eef026A
20 S
594041232026-01-02 2:28:0422 days ago1767320884
0x244267da...42eef026A
4.06106388 S
593643832026-01-01 12:01:0723 days ago1767268867
0x244267da...42eef026A
8.12212776 S
593643632026-01-01 12:00:3723 days ago1767268837
0x244267da...42eef026A
20 S
592960562025-12-31 10:25:3124 days ago1767176731
0x244267da...42eef026A
20 S
592298412025-12-30 9:08:3325 days ago1767085713
0x244267da...42eef026A
20 S
591620162025-12-29 8:43:5026 days ago1766997830
0x244267da...42eef026A
20 S
590990262025-12-28 8:36:5127 days ago1766911011
0x244267da...42eef026A
20 S
590290832025-12-27 8:18:3728 days ago1766823517
0x244267da...42eef026A
20 S
589600842025-12-26 8:14:2929 days ago1766736869
0x244267da...42eef026A
20 S
588518082025-12-25 6:26:4630 days ago1766644006
0x244267da...42eef026A
20 S
587561292025-12-24 6:26:1831 days ago1766557578
0x244267da...42eef026A
20 S
View All Internal Transactions
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SinkBuyAndBurn

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "../interfaces/IShadowV2Router.sol";
import "../interfaces/IShadowFactory.sol";
import "../interfaces/IMiningProtocol.sol";
import "../interfaces/IWETH.sol";
import "../interfaces/ISink.sol";

/**
 * @title SinkBuyAndBurn
 * @dev 处理SINK生态系统中S奖励的回购销毁逻辑
 * - 50% 回购MLH并发送到Sink合约永久质押
 * - 50% 回购SINK并销毁
 * 注:8%的生态基金份额已在Sink合约中处理
 */
contract SinkBuyAndBurn is ReentrancyGuard, Ownable {
    using SafeERC20 for IERC20;
    using Address for address payable;

    // ======== 常量 ========

    /// @dev 回购MLH并永久质押的比例
    uint256 public constant BUY_MLH_PERCENT = 50;

    /// @dev 回购SINK并销毁的比例
    uint256 public constant BUY_SINK_PERCENT = 50;

    /// @dev 百分比基数
    uint256 public constant PERCENT_DENOMINATOR = 100;

    /// @dev 滑点容差(0.5%)
    uint256 public constant SLIPPAGE_TOLERANCE = 50;

    /// @dev 滑点基数
    uint256 public constant SLIPPAGE_DENOMINATOR = 10000;

    /// @dev 辅助计算参数
    uint256 public constant PERCENT_BPS = 100_00;

    // ======== 状态变量 ========

    /// @dev SINK合约地址 (Sink.sol既是代币也是功能合约)
    address public sinkContract;

    /// @dev MLH代币地址
    address public mlhToken;

    /// @dev WETH代币地址(Sonic链上的原生代币包装)
    address public weth;

    /// @dev MLH挖矿合约地址
    address public miningProtocolAddress;

    /// @dev Shadow V2 Router地址
    IShadowV2Router public shadowRouter;

    /// @dev 上次操作时间戳
    uint256 public lastOperationTime;

    /// @dev 操作冷却时间(默认15分钟)
    uint256 public cooldownPeriod = 900;

    /// @dev 上次回购SINK的时间戳
    uint256 public lastSinkBuyTime;

    /// @dev SINK回购间隔时间(默认15分钟)
    uint256 public sinkBuyInterval = 900;

    /// @dev 单次SINK回购金额上限(默认15 S)
    uint256 public maxSinkBuyAmount = 20 ether;

    /// @dev 待回购SINK的S数量
    uint256 public pendingSinkBuyAmount;

    /// @dev 总共回购并发送到Sink合约的MLH数量
    uint256 public totalMlhBought;

    /// @dev 总共回购并销毁的SINK数量
    uint256 public totalSinkBoughtAndBurned;

    /// @dev 回购MLH路径(ETH -> MLH)稳定对标志
    bool public mlhStableRoute = false;

    /// @dev 回购SINK路径(ETH -> SINK)稳定对标志
    bool public sinkStableRoute = false;

    /// @dev 回购暂停标志
    bool public isPaused = false;

    // ======== 事件 ========

    /// @dev S奖励分配事件
    event RewardsDistributed(
        uint256 indexed totalAmount,
        uint256 mlhBuyAmount,
        uint256 sinkBuyAmount
    );

    /// @dev MLH回购并发送到Sink合约事件
    event MlhBoughtAndSent(uint256 indexed ethSpent, uint256 mlhAmount);

    /// @dev SINK回购并销毁事件
    event SinkBoughtAndBurned(uint256 indexed ethSpent, uint256 sinkAmount);

    /// @dev 冷却时间更新事件
    event CooldownPeriodUpdated(uint256 indexed newPeriod);

    /// @dev 稳定路由设置事件
    event StableRouteUpdated(address indexed token, bool indexed isStable);

    /// @dev wS解包事件
    event WethUnwrapped(uint256 indexed amount);

    modifier onlyEOA() {
        require(tx.origin == msg.sender, "Only EOA can call this function");
        _;
    }

    /**
     * @dev 构造函数
     * @param _sinkContract SINK合约地址 (Sink.sol)
     * @param _mlhToken MLH代币地址
     * @param _miningProtocolAddress MLH挖矿协议地址
     * @param _shadowRouter Shadow V2 Router地址
     */
    constructor(
        address _sinkContract,
        address _mlhToken,
        address _miningProtocolAddress,
        address _shadowRouter
    ) Ownable() {
        require(
            _sinkContract != address(0),
            "SINK contract address cannot be zero"
        );
        require(_mlhToken != address(0), "MLH token address cannot be zero");
        require(
            _miningProtocolAddress != address(0),
            "Mining protocol address cannot be zero"
        );
        require(
            _shadowRouter != address(0),
            "Shadow router address cannot be zero"
        );

        sinkContract = _sinkContract;
        mlhToken = _mlhToken;
        miningProtocolAddress = _miningProtocolAddress;
        shadowRouter = IShadowV2Router(_shadowRouter);

        // 获取WETH地址
        weth = shadowRouter.WETH();

        // 初始化最后操作时间为部署时间
        lastOperationTime = block.timestamp;
    }

    /**
     * @dev 执行S奖励分配,回购MLH并发送到Sink合约,累计用于回购SINK的金额
     * @notice 任何人都可以调用,但有冷却时间限制
     */
    function distributeRewards() external nonReentrant onlyEOA {
        // 检查冷却时间
        require(
            block.timestamp >= lastOperationTime + cooldownPeriod,
            "Cooldown period not passed"
        );

        // 更新最后操作时间
        lastOperationTime = block.timestamp;

        // 处理可能的wS (包装的S)
        uint256 wethBalance = IERC20(weth).balanceOf(address(this));
        if (wethBalance > 0) {
            _unwrapWETH(wethBalance);
        }

        // 获取新增的S奖励 (排除掉已经分配给SINK回购的部分)
        uint256 totalBalance = address(this).balance;
        require(
            totalBalance > pendingSinkBuyAmount,
            "No new rewards to distribute"
        );

        uint256 newRewardsAmount = totalBalance - pendingSinkBuyAmount;
        require(newRewardsAmount > 0, "No new rewards to distribute");

        // 计算分配金额
        uint256 mlhBuyAmount = (newRewardsAmount * BUY_MLH_PERCENT) /
            PERCENT_DENOMINATOR;
        uint256 sinkBuyAmount = newRewardsAmount - mlhBuyAmount;

        // 执行MLH回购并发送到Sink合约
        if (mlhBuyAmount > 0) {
            _buyAndSendMlhToSink(mlhBuyAmount);
        }

        // 累加到待回购SINK的金额
        if (sinkBuyAmount > 0) {
            pendingSinkBuyAmount += sinkBuyAmount;
        }

        emit RewardsDistributed(newRewardsAmount, mlhBuyAmount, sinkBuyAmount);
    }

    /**
     * @dev 执行SINK回购
     * @notice 任何人都可以调用,但有时间间隔限制
     */
    function executeSinkBuy() external nonReentrant onlyEOA {
        require(!isPaused, "Buyback is paused");
        // 检查回购间隔
        require(
            block.timestamp >= lastSinkBuyTime + sinkBuyInterval,
            "SINK buy interval not passed"
        );

        // 检查是否有待回购金额
        require(pendingSinkBuyAmount > 0, "No pending SINK buy amount");

        // 计算本次回购金额
        uint256 buyAmount = pendingSinkBuyAmount;
        if (buyAmount > maxSinkBuyAmount) {
            buyAmount = maxSinkBuyAmount;
        }

        // 更新待回购金额和上次回购时间
        pendingSinkBuyAmount -= buyAmount;
        lastSinkBuyTime = block.timestamp;

        // 执行SINK回购
        _buyAndBurnSink(buyAmount);
    }

    /**
     * @dev 设置SINK回购参数
     * @param _interval 新的回购间隔时间(秒)
     * @param _maxAmount 新的单次回购金额上限
     * @notice 只有管理员可调用
     */
    function setSinkBuyParams(
        uint256 _interval,
        uint256 _maxAmount
    ) external onlyOwner {
        require(_interval >= 60, "Interval too short");
        require(_interval <= 1 days, "Interval too long");
        require(_maxAmount > 0, "Max amount must be greater than 0");

        sinkBuyInterval = _interval;
        maxSinkBuyAmount = _maxAmount;
    }

    /**
     * @dev 解包WETH为ETH
     * @param amount 要解包的WETH数量
     */
    function _unwrapWETH(uint256 amount) internal {
        IERC20(weth).approve(weth, amount);
        IWETH(weth).withdraw(amount);
        emit WethUnwrapped(amount);
    }

    /**
     * @dev 获取S到MLH的交易路径
     * @return 交易路径
     */
    function getPathForETHtoMLH()
        internal
        view
        returns (IUniswapV2Router01.route[] memory)
    {
        // S直接到MLH的路径
        IUniswapV2Router01.route[] memory path = new IUniswapV2Router01.route[](
            1
        );
        path[0] = IUniswapV2Router01.route({
            from: weth, // S(ETH)
            to: mlhToken,
            stable: mlhStableRoute
        });
        return path;
    }

    /**
     * @dev 获取S到SINK的交易路径
     * @return 交易路径
     */
    function getPathForETHtoSINK()
        internal
        view
        returns (IUniswapV2Router01.route[] memory)
    {
        // S到SINK需要经过MLH:S -> MLH -> SINK
        IUniswapV2Router01.route[] memory path = new IUniswapV2Router01.route[](
            2
        );

        // 第一步:S -> MLH
        path[0] = IUniswapV2Router01.route({
            from: weth,
            to: mlhToken,
            stable: mlhStableRoute
        });

        // 第二步:MLH -> SINK
        path[1] = IUniswapV2Router01.route({
            from: mlhToken,
            to: sinkContract,
            stable: sinkStableRoute
        });

        return path;
    }

    /**
     * @dev 使用S回购MLH并发送到Sink合约
     * @param amount S数量
     */
    function _buyAndSendMlhToSink(uint256 amount) internal {
        // 创建交易路径
        IUniswapV2Router01.route[] memory path = getPathForETHtoMLH();

        // // 计算预期输出量
        // uint256[] memory amountsOut = shadowRouter.getAmountsOut(amount, path);
        // uint256 expectedMlhAmount = amountsOut[amountsOut.length - 1];

        // 执行交换
        uint256[] memory receivedAmounts = shadowRouter.swapExactETHForTokens{
            value: amount
        }(
            0, // 不设置最小数量
            path,
            address(this),
            block.timestamp + 600 // deadline: 当前时间+10分钟
        );

        uint256 mlhReceived = receivedAmounts[receivedAmounts.length - 1];

        // 发送MLH到Sink合约用于永久质押
        IERC20(mlhToken).transfer(sinkContract, mlhReceived);
        ISink(sinkContract).stakeAllMlh();

        // 更新统计
        totalMlhBought += mlhReceived;

        emit MlhBoughtAndSent(amount, mlhReceived);
    }

    /**
     * @dev 使用S回购SINK并销毁
     * @param amount S数量
     */
    function _buyAndBurnSink(uint256 amount) internal {
        // 创建交易路径
        IUniswapV2Router01.route[] memory path = getPathForETHtoSINK();
        // 执行交换
        uint256[] memory receivedAmounts = shadowRouter.swapExactETHForTokens{
            value: amount
        }(
            0, // 不设置最小数量
            path,
            address(this),
            block.timestamp + 600 // deadline: 当前时间+10分钟
        );

        uint256 sinkReceived = receivedAmounts[receivedAmounts.length - 1];

        // 销毁SINK
        IERC20(sinkContract).transfer(address(0xdead), sinkReceived);

        // 更新统计
        totalSinkBoughtAndBurned += sinkReceived;

        emit SinkBoughtAndBurned(amount, sinkReceived);
    }

    /**
     * @dev 设置冷却时间
     * @param newPeriod 新的冷却时间(秒)
     * @notice 只有管理员可调用
     */
    function setCooldownPeriod(uint256 newPeriod) external onlyOwner {
        require(newPeriod <= 1 days, "Cooldown period too long");
        cooldownPeriod = newPeriod;
        emit CooldownPeriodUpdated(newPeriod);
    }

    /**
     * @dev 设置MLH的稳定路由标志
     * @param isStable 是否为稳定路由
     */
    function setMlhStableRoute(bool isStable) external onlyOwner {
        mlhStableRoute = isStable;
        emit StableRouteUpdated(mlhToken, isStable);
    }

    /**
     * @dev 设置SINK的稳定路由标志
     * @param isStable 是否为稳定路由
     */
    function setSinkStableRoute(bool isStable) external onlyOwner {
        sinkStableRoute = isStable;
        emit StableRouteUpdated(sinkContract, isStable);
    }

    /**
     * @dev 更新Sink合约地址
     * @param newSinkContract 新的Sink合约地址
     */
    function setSinkContract(address newSinkContract) external onlyOwner {
        require(newSinkContract != address(0), "New address cannot be zero");
        sinkContract = newSinkContract;
    }

    /**
     * @dev 更新MLH挖矿合约地址
     * @param newAddress 新的MLH挖矿合约地址
     */
    function setMiningProtocolAddress(address newAddress) external onlyOwner {
        require(newAddress != address(0), "New address cannot be zero");
        miningProtocolAddress = newAddress;
    }

    /**
     * @dev 暂停回购
     */
    function pauseBuyback(bool _isPaused) external onlyOwner {
        isPaused = _isPaused;
    }

    /**
     * @dev 手动将WETH转换为ETH
     * @notice 任何人都可以调用此函数将合约中的WETH转换为ETH
     */
    function unwrapAllWETH() external nonReentrant onlyOwner {
        uint256 wethBalance = IERC20(weth).balanceOf(address(this));
        require(wethBalance > 0, "No WETH to unwrap");

        _unwrapWETH(wethBalance);
    }

    /// @dev Register my contract on Sonic FeeM
    function registerMe() external {
        (bool _success, ) = address(0xDC2B0D2Dd2b7759D97D50db4eabDC36973110830)
            .call(abi.encodeWithSignature("selfRegister(uint256)", 164));
        require(_success, "FeeM registration failed");
    }

    /**
     * @dev 接收原生代币的回调函数
     */
    receive() external payable {}
}

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

pragma solidity ^0.8.0;

import "../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.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

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

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

    /**
     * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` 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 amount) external returns (bool);
}

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

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

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

    /**
     * @dev 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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
     * 0 before setting it to a non-zero value.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

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

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

// /** @notice Burn stake and creates Proof-Of-Burn record to be used by connected DeFi and fee is paid to specified address
//  * @param user user address
//  * @param id stake id
//  * @param userRebatePercentage percentage for user rebate in liquid titan (0 - 8)
//  * @param rewardPaybackPercentage percentage for builder fee in liquid titan (0 - 8)
//  * @param rewardPaybackAddress builder can opt to receive fee in another address
//  */
interface IMiningProtocol {
    /**
     * @dev 质押MLH到挖矿合约
     * @param amount MLH数量
     */
    function stake(uint256 amount) external;

    /**
     * @dev 提取质押的MLH
     * @param amount MLH数量
     */
    function unstake(uint256 amount) external;

    /**
     * @dev 提取S奖励
     */
    function claimFees() external;

    /**
     * @dev 获取当前轮次
     */
    function getCurrentCycle() external view returns (uint256);

    /**
     * @dev 获取当前轮次质押的MLH数量
     */
    function accStakeCycle(
        address account,
        uint256 cycle
    ) external view returns (uint256);

    /**
     * @dev 获取当前轮次燃烧的MLH数量
     */
    function accBurnedBatches(
        address account,
        uint256 cycle
    ) external view returns (uint256);

    /**
     * @dev 获取当前轮次奖励
     */
    function currentCycleReward() external view returns (uint256);

    /**
     * @dev 获取当前轮次总质押量
     */
    function summedCycleStakes(uint256 cycle) external view returns (uint256);

    /**
     * @dev 获取当前轮次总燃烧量
     */
    function summedCycleBurnedBatches(
        uint256 cycle
    ) external view returns (uint256);

    /**
     * @dev 获取8天池奖励
     */
    function getEightDayPoolRewards() external view returns (uint256);

    /**
     * @dev 获取当前轮次所有账户燃烧的批次总数
     */
    function cycleTotalBatchesBurned(
        uint256 cycle
    ) external view returns (uint256);

    /**
     * @dev 获取MLH代币地址
     */
    function mlh() external view returns (address);
}

//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

interface IShadowFactory {
    event PairCreated(
        address indexed token0,
        address indexed token1,
        address pair,
        uint256
    );

    function feeTo() external view returns (address);

    function feeToSetter() external view returns (address);

    function getPair(
        address tokenA,
        address tokenB,
        bool stable
    ) external view returns (address pair);

    function allPairs(uint256) external view returns (address pair);

    function allPairsLength() external view returns (uint256);

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

    function setFeeTo(address) external;

    function setFeeToSetter(address) external;
}

File 11 of 13 : IShadowV2Router.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

interface IUniswapV2Router01 {
    struct route {
        /// @dev token from
        address from;
        /// @dev token to
        address to;
        /// @dev is stable route
        bool stable;
    }
    function factory() external pure returns (address);

    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        bool stable,
        uint256 amountADesired,
        uint256 amountBDesired,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline
    ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);

    function addLiquidityETH(
        address token,
        bool stable,
        uint256 amountTokenDesired,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    )
        external
        payable
        returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);

    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint256 liquidity,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline
    ) external returns (uint256 amountA, uint256 amountB);

    function removeLiquidityETH(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    ) external returns (uint256 amountToken, uint256 amountETH);

    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint256 liquidity,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline,
        bool approveMax,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external returns (uint256 amountA, uint256 amountB);

    function removeLiquidityETHWithPermit(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline,
        bool approveMax,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external returns (uint256 amountToken, uint256 amountETH);

    function swapExactTokensForTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);

    function swapTokensForExactTokens(
        uint256 amountOut,
        uint256 amountInMax,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);

    function swapExactETHForTokens(
        uint256 amountOutMin,
        route[] calldata path,
        address to,
        uint256 deadline
    ) external payable returns (uint256[] memory amounts);

    function swapTokensForExactETH(
        uint256 amountOut,
        uint256 amountInMax,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);

    function swapExactTokensForETH(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);

    function swapETHForExactTokens(
        uint256 amountOut,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external payable returns (uint256[] memory amounts);

    function quote(
        uint256 amountA,
        uint256 reserveA,
        uint256 reserveB
    ) external pure returns (uint256 amountB);

    function getAmountOut(
        uint256 amountIn,
        uint256 reserveIn,
        uint256 reserveOut
    ) external pure returns (uint256 amountOut);

    function getAmountIn(
        uint256 amountOut,
        uint256 reserveIn,
        uint256 reserveOut
    ) external pure returns (uint256 amountIn);

    function getAmountsOut(
        uint256 amountIn,
        route[] calldata path
    ) external view returns (uint256[] memory amounts);

    function getAmountsIn(
        uint256 amountOut,
        route[] calldata path
    ) external view returns (uint256[] memory amounts);
}

interface IShadowV2Router is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    ) external returns (uint256 amountETH);

    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline,
        bool approveMax,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external returns (uint256 amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        route[] calldata path,
        address to,
        uint256 deadline
    ) external;

    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint256 amountOutMin,
        route[] calldata path,
        address to,
        uint256 deadline
    ) external payable;

    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        route[] calldata path,
        address to,
        uint256 deadline
    ) external;
}

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

    function name() external pure returns (string memory);

    function symbol() external pure returns (string memory);

    function decimals() external pure returns (uint8);

    function totalSupply() external view returns (uint256);

    function balanceOf(address owner) external view returns (uint256);

    function allowance(
        address owner,
        address spender
    ) external view returns (uint256);

    function approve(address spender, uint256 value) external returns (bool);

    function transfer(address to, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);

    function PERMIT_TYPEHASH() external pure returns (bytes32);

    function nonces(address owner) external view returns (uint256);

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

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

    function MINIMUM_LIQUIDITY() external pure returns (uint256);

    function factory() external view returns (address);

    function token0() external view returns (address);

    function token1() external view returns (address);

    function getReserves()
        external
        view
        returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);

    function price0CumulativeLast() external view returns (uint256);

    function price1CumulativeLast() external view returns (uint256);

    function kLast() external view returns (uint256);

    function mint(address to) external returns (uint256 liquidity);

    function burn(
        address to
    ) external returns (uint256 amount0, uint256 amount1);

    function swap(
        uint256 amount0Out,
        uint256 amount1Out,
        address to,
        bytes calldata data
    ) external;

    function skim(address to) external;

    function sync() external;

    function initialize(address, address) external;
}

interface IUniswapV3Pair {
    function fee() external view returns (uint24);

    function token0() external view returns (address);

    function token1() external view returns (address);
}

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

interface ISink {
    // 将所有MLH质押到挖矿协议
    function stakeAllMlh() external;

    // 获取当前的MLH兑换SINK比率,如果为0表示不在启动期
    function getCurrentExchangeRate() external view returns (uint256);

    // 使用MLH兑换SINK
    function exchangeMlhForSink(uint256 amount) external returns (uint256);

    // 转账
    function transfer(address to, uint256 amount) external returns (bool);
}

//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

// /** @notice Burn stake and creates Proof-Of-Burn record to be used by connected DeFi and fee is paid to specified address
//  * @param user user address
//  * @param id stake id
//  * @param userRebatePercentage percentage for user rebate in liquid titan (0 - 8)
//  * @param rewardPaybackPercentage percentage for builder fee in liquid titan (0 - 8)
//  * @param rewardPaybackAddress builder can opt to receive fee in another address
//  */
interface IWETH {
    function deposit() external payable;
    function withdraw(uint256 amount) external;
    function balanceOf(address account) external view returns (uint256);
    function transfer(address to, uint256 amount) external returns (bool);
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_sinkContract","type":"address"},{"internalType":"address","name":"_mlhToken","type":"address"},{"internalType":"address","name":"_miningProtocolAddress","type":"address"},{"internalType":"address","name":"_shadowRouter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"newPeriod","type":"uint256"}],"name":"CooldownPeriodUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"ethSpent","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mlhAmount","type":"uint256"}],"name":"MlhBoughtAndSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"totalAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mlhBuyAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sinkBuyAmount","type":"uint256"}],"name":"RewardsDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"ethSpent","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sinkAmount","type":"uint256"}],"name":"SinkBoughtAndBurned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"bool","name":"isStable","type":"bool"}],"name":"StableRouteUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WethUnwrapped","type":"event"},{"inputs":[],"name":"BUY_MLH_PERCENT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BUY_SINK_PERCENT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERCENT_BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERCENT_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SLIPPAGE_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SLIPPAGE_TOLERANCE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cooldownPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributeRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"executeSinkBuy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastOperationTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastSinkBuyTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSinkBuyAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"miningProtocolAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mlhStableRoute","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mlhToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_isPaused","type":"bool"}],"name":"pauseBuyback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pendingSinkBuyAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registerMe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPeriod","type":"uint256"}],"name":"setCooldownPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAddress","type":"address"}],"name":"setMiningProtocolAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"isStable","type":"bool"}],"name":"setMlhStableRoute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_interval","type":"uint256"},{"internalType":"uint256","name":"_maxAmount","type":"uint256"}],"name":"setSinkBuyParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newSinkContract","type":"address"}],"name":"setSinkContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"isStable","type":"bool"}],"name":"setSinkStableRoute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shadowRouter","outputs":[{"internalType":"contract IShadowV2Router","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sinkBuyInterval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sinkContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sinkStableRoute","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalMlhBought","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSinkBoughtAndBurned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unwrapAllWETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040526103846008819055600a556801158e460913d00000600b55600f805462ffffff191690553480156200003557600080fd5b5060405162001da438038062001da483398101604081905262000058916200033b565b60016000556200006833620002cc565b6001600160a01b038416620000d05760405162461bcd60e51b8152602060048201526024808201527f53494e4b20636f6e747261637420616464726573732063616e6e6f74206265206044820152637a65726f60e01b60648201526084015b60405180910390fd5b6001600160a01b038316620001285760405162461bcd60e51b815260206004820181905260248201527f4d4c4820746f6b656e20616464726573732063616e6e6f74206265207a65726f6044820152606401620000c7565b6001600160a01b0382166200018f5760405162461bcd60e51b815260206004820152602660248201527f4d696e696e672070726f746f636f6c20616464726573732063616e6e6f74206260448201526565207a65726f60d01b6064820152608401620000c7565b6001600160a01b038116620001f35760405162461bcd60e51b8152602060048201526024808201527f536861646f7720726f7574657220616464726573732063616e6e6f74206265206044820152637a65726f60e01b6064820152608401620000c7565b600280546001600160a01b038087166001600160a01b0319928316179092556003805486841690831617905560058054858416908316179055600680549284169290911682179055604080516315ab88c960e31b8152905163ad5c4648916004808201926020929091908290030181865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d919062000398565b600480546001600160a01b0319166001600160a01b039290921691909117905550504260075550620003bd9050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146200033657600080fd5b919050565b600080600080608085870312156200035257600080fd5b6200035d856200031e565b93506200036d602086016200031e565b92506200037d604086016200031e565b91506200038d606086016200031e565b905092959194509250565b600060208284031215620003ab57600080fd5b620003b6826200031e565b9392505050565b6119d780620003cd6000396000f3fe6080604052600436106102135760003560e01c806362b35aab116101185780639a198d61116100a0578063b187bd261161006f578063b187bd2614610541578063d4161d8b14610561578063dc2a0e6c14610577578063e2c1a62514610597578063f2fde38b146105ac57600080fd5b80639a198d61146104f75780639e2195061461050c5780639e6c29591461052c578063ac9051141461029657600080fd5b806379541174116100e7578063795411741461046457806380ea3de1146104835780638da5cb5b146104a35780639334e97b146104c1578063981556be146104d757600080fd5b806362b35aab1461033a5780636f4a2cd014610410578063715018a61461042557806377610ced1461043a57600080fd5b8063393528dd1161019b5780634c2037861161016a5780634c2037861461033a5780634c60c8b6146103a55780634d022134146103bb5780635c8f4b37146103d05780635e06fa4d146103f057600080fd5b8063393528dd1461033a5780633fc8cef31461034f5780634387d2d31461036f5780634b8c8f781461038f57600080fd5b80631a4fa5b0116101e25780631a4fa5b014610296578063265fa411146102ac57806328532d62146102e45780632c2ec19d146103045780633273f2581461031a57600080fd5b806304646a491461021f57806304e32ec51461024857806307d856a81461025e57806316d43a971461028057600080fd5b3661021a57005b600080fd5b34801561022b57600080fd5b5061023560085481565b6040519081526020015b60405180910390f35b34801561025457600080fd5b50610235600d5481565b34801561026a57600080fd5b5061027e6102793660046116c0565b6105cc565b005b34801561028c57600080fd5b5061023560075481565b3480156102a257600080fd5b5061023561271081565b3480156102b857600080fd5b506003546102cc906001600160a01b031681565b6040516001600160a01b03909116815260200161023f565b3480156102f057600080fd5b506006546102cc906001600160a01b031681565b34801561031057600080fd5b5061023560095481565b34801561032657600080fd5b5061027e6103353660046116c0565b610628565b34801561034657600080fd5b50610235603281565b34801561035b57600080fd5b506004546102cc906001600160a01b031681565b34801561037b57600080fd5b5061027e61038a3660046116e4565b61064c565b34801561039b57600080fd5b50610235600b5481565b3480156103b157600080fd5b50610235600c5481565b3480156103c757600080fd5b5061027e6106d1565b3480156103dc57600080fd5b506002546102cc906001600160a01b031681565b3480156103fc57600080fd5b5061027e61040b36600461170d565b610869565b34801561041c57600080fd5b5061027e610963565b34801561043157600080fd5b5061027e610bf5565b34801561044657600080fd5b50600f546104549060ff1681565b604051901515815260200161023f565b34801561047057600080fd5b50600f5461045490610100900460ff1681565b34801561048f57600080fd5b5061027e61049e36600461172f565b610c07565b3480156104af57600080fd5b506001546001600160a01b03166102cc565b3480156104cd57600080fd5b50610235600a5481565b3480156104e357600080fd5b506005546102cc906001600160a01b031681565b34801561050357600080fd5b5061027e610c95565b34801561051857600080fd5b5061027e6105273660046116e4565b610d86565b34801561053857600080fd5b50610235606481565b34801561054d57600080fd5b50600f546104549062010000900460ff1681565b34801561056d57600080fd5b50610235600e5481565b34801561058357600080fd5b5061027e6105923660046116c0565b610e06565b3480156105a357600080fd5b5061027e610e5a565b3480156105b857600080fd5b5061027e6105c73660046116e4565b610f2b565b6105d4610fa1565b600f805461ff001916610100831515908102919091179091556002546040516001600160a01b03909116907fa1ef12dbbb9036c89a55a058fbdc1a1cd5eb92f59f58e13bd92340a97a1aabc690600090a350565b610630610fa1565b600f8054911515620100000262ff000019909216919091179055565b610654610fa1565b6001600160a01b0381166106af5760405162461bcd60e51b815260206004820152601a60248201527f4e657720616464726573732063616e6e6f74206265207a65726f00000000000060448201526064015b60405180910390fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6106d9610ffb565b3233146107285760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920454f412063616e2063616c6c20746869732066756e6374696f6e0060448201526064016106a6565b600f5462010000900460ff16156107755760405162461bcd60e51b8152602060048201526011602482015270109d5e589858dac81a5cc81c185d5cd959607a1b60448201526064016106a6565b600a54600954610785919061175e565b4210156107d45760405162461bcd60e51b815260206004820152601c60248201527f53494e4b2062757920696e74657276616c206e6f74207061737365640000000060448201526064016106a6565b6000600c54116108265760405162461bcd60e51b815260206004820152601a60248201527f4e6f2070656e64696e672053494e4b2062757920616d6f756e7400000000000060448201526064016106a6565b600c54600b548111156108385750600b545b80600c600082825461084a9190611777565b90915550504260095561085c81611054565b506108676001600055565b565b610871610fa1565b603c8210156108b75760405162461bcd60e51b8152602060048201526012602482015271125b9d195c9d985b081d1bdbc81cda1bdc9d60721b60448201526064016106a6565b620151808211156108fe5760405162461bcd60e51b8152602060048201526011602482015270496e74657276616c20746f6f206c6f6e6760781b60448201526064016106a6565b600081116109585760405162461bcd60e51b815260206004820152602160248201527f4d617820616d6f756e74206d7573742062652067726561746572207468616e206044820152600360fc1b60648201526084016106a6565b600a91909155600b55565b61096b610ffb565b3233146109ba5760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920454f412063616e2063616c6c20746869732066756e6374696f6e0060448201526064016106a6565b6008546007546109ca919061175e565b421015610a195760405162461bcd60e51b815260206004820152601a60248201527f436f6f6c646f776e20706572696f64206e6f742070617373656400000000000060448201526064016106a6565b42600755600480546040516370a0823160e01b815230928101929092526000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015610a6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8f919061178a565b90508015610aa057610aa0816111e5565b600c5447908111610af35760405162461bcd60e51b815260206004820152601c60248201527f4e6f206e6577207265776172647320746f20646973747269627574650000000060448201526064016106a6565b6000600c5482610b039190611777565b905060008111610b555760405162461bcd60e51b815260206004820152601c60248201527f4e6f206e6577207265776172647320746f20646973747269627574650000000060448201526064016106a6565b60006064610b646032846117a3565b610b6e91906117ba565b90506000610b7c8284611777565b90508115610b8d57610b8d826112e5565b8015610bab5780600c6000828254610ba5919061175e565b90915550505b604080518381526020810183905284917f6ae8ee960d83517f7fa993ad7a0e16e33d9655a23ff41eefc62bdb289c7a8e5f910160405180910390a250505050506108676001600055565b610bfd610fa1565b61086760006114d7565b610c0f610fa1565b62015180811115610c625760405162461bcd60e51b815260206004820152601860248201527f436f6f6c646f776e20706572696f6420746f6f206c6f6e67000000000000000060448201526064016106a6565b600881905560405181907f3b897fd6944545fcb6a5d5b058781d763169157f8559ca1a7f3276b981d0997190600090a250565b60405160a4602482015260009073dc2b0d2dd2b7759d97d50db4eabdc369731108309060440160408051601f198184030181529181526020820180516001600160e01b03166307983f4560e21b17905251610cf091906117dc565b6000604051808303816000865af19150503d8060008114610d2d576040519150601f19603f3d011682016040523d82523d6000602084013e610d32565b606091505b5050905080610d835760405162461bcd60e51b815260206004820152601860248201527f4665654d20726567697374726174696f6e206661696c6564000000000000000060448201526064016106a6565b50565b610d8e610fa1565b6001600160a01b038116610de45760405162461bcd60e51b815260206004820152601a60248201527f4e657720616464726573732063616e6e6f74206265207a65726f00000000000060448201526064016106a6565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b610e0e610fa1565b600f805460ff19168215159081179091556003546040516001600160a01b03909116907fa1ef12dbbb9036c89a55a058fbdc1a1cd5eb92f59f58e13bd92340a97a1aabc690600090a350565b610e62610ffb565b610e6a610fa1565b600480546040516370a0823160e01b815230928101929092526000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015610eb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edc919061178a565b905060008111610f225760405162461bcd60e51b815260206004820152601160248201527004e6f205745544820746f20756e7772617607c1b60448201526064016106a6565b61085c816111e5565b610f33610fa1565b6001600160a01b038116610f985760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106a6565b610d83816114d7565b6001546001600160a01b031633146108675760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106a6565b60026000540361104d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106a6565b6002600055565b600061105e611529565b6006549091506000906001600160a01b03166367ffb66a848385306110854261025861175e565b6040518663ffffffff1660e01b81526004016110a4949392919061180b565b60006040518083038185885af11580156110c2573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f191682016040526110eb91908101906118b0565b9050600081600183516110fe9190611777565b8151811061110e5761110e61196e565b602090810291909101015160025460405163a9059cbb60e01b815261dead6004820152602481018390529192506001600160a01b03169063a9059cbb906044016020604051808303816000875af115801561116d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111919190611984565b5080600e60008282546111a4919061175e565b909155505060405181815284907f25840271b4795b6ffe593775f398548e649182d98f6caf613138201d3d06d74a906020015b60405180910390a250505050565b6004805460405163095ea7b360e01b81526001600160a01b039091169181018290526024810183905263095ea7b3906044016020604051808303816000875af1158015611236573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125a9190611984565b5060048054604051632e1a7d4d60e01b81529182018390526001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561129f57600080fd5b505af11580156112b3573d6000803e3d6000fd5b50506040518392507f672d0a596c1acf168b3a858a9062ff388c7d7e314b94293409d4ae697685b6969150600090a250565b60006112ef611622565b6006549091506000906001600160a01b03166367ffb66a848385306113164261025861175e565b6040518663ffffffff1660e01b8152600401611335949392919061180b565b60006040518083038185885af1158015611353573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f1916820160405261137c91908101906118b0565b90506000816001835161138f9190611777565b8151811061139f5761139f61196e565b602090810291909101015160035460025460405163a9059cbb60e01b81526001600160a01b03918216600482015260248101849052929350169063a9059cbb906044016020604051808303816000875af1158015611401573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114259190611984565b50600260009054906101000a90046001600160a01b03166001600160a01b0316635449e4896040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561147657600080fd5b505af115801561148a573d6000803e3d6000fd5b5050505080600d60008282546114a0919061175e565b909155505060405181815284907ff852af430ab27d2df135fc00e42e7cbb8fe4791172681d23a3fe7f1eb1f9d1a3906020016111d7565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516002808252606082810190935260009190816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181611543575050604080516060810182526004546001600160a01b039081168252600354166020820152600f5460ff1615159181019190915281519192509082906000906115b8576115b861196e565b602090810291909101810191909152604080516060810182526003546001600160a01b0390811682526002541692810192909252600f54610100900460ff161515908201528151829060019081106116125761161261196e565b6020908102919091010152919050565b60408051600180825281830190925260609160009190816020015b604080516060810182526000808252602080830182905292820152825260001990920191018161163d575050604080516060810182526004546001600160a01b039081168252600354166020820152600f5460ff1615159181019190915281519192509082906000906116125761161261196e565b8015158114610d8357600080fd5b6000602082840312156116d257600080fd5b81356116dd816116b2565b9392505050565b6000602082840312156116f657600080fd5b81356001600160a01b03811681146116dd57600080fd5b6000806040838503121561172057600080fd5b50508035926020909101359150565b60006020828403121561174157600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561177157611771611748565b92915050565b8181038181111561177157611771611748565b60006020828403121561179c57600080fd5b5051919050565b808202811582820484141761177157611771611748565b6000826117d757634e487b7160e01b600052601260045260246000fd5b500490565b6000825160005b818110156117fd57602081860181015185830152016117e3565b506000920191825250919050565b600060808201868352602060808185015281875180845260a086019150828901935060005b8181101561187057845180516001600160a01b03908116855285820151168585015260409081015115159084015293830193606090920191600101611830565b50506001600160a01b0387166040860152925061188b915050565b82606083015295945050505050565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156118c357600080fd5b825167ffffffffffffffff808211156118db57600080fd5b818501915085601f8301126118ef57600080fd5b8151818111156119015761190161189a565b8060051b604051601f19603f830116810181811085821117156119265761192661189a565b60405291825284820192508381018501918883111561194457600080fd5b938501935b8285101561196257845184529385019392850192611949565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561199657600080fd5b81516116dd816116b256fea2646970667358221220677d18dc061d9aa61c244e92388001c91de1d06a9fede0bc03cdf7b1231bf7c764736f6c63430008110033000000000000000000000000a20d7892a4b42a517e5a127ff775f1aa77dfce350000000000000000000000003b2ce558eec07099e668e4cf1c5b47aad29687850000000000000000000000004b17642adbfcac421e5191af98d0b589ec087e250000000000000000000000001d368773735ee1e678950b7a97bca2cafb330cdc

Deployed Bytecode

0x6080604052600436106102135760003560e01c806362b35aab116101185780639a198d61116100a0578063b187bd261161006f578063b187bd2614610541578063d4161d8b14610561578063dc2a0e6c14610577578063e2c1a62514610597578063f2fde38b146105ac57600080fd5b80639a198d61146104f75780639e2195061461050c5780639e6c29591461052c578063ac9051141461029657600080fd5b806379541174116100e7578063795411741461046457806380ea3de1146104835780638da5cb5b146104a35780639334e97b146104c1578063981556be146104d757600080fd5b806362b35aab1461033a5780636f4a2cd014610410578063715018a61461042557806377610ced1461043a57600080fd5b8063393528dd1161019b5780634c2037861161016a5780634c2037861461033a5780634c60c8b6146103a55780634d022134146103bb5780635c8f4b37146103d05780635e06fa4d146103f057600080fd5b8063393528dd1461033a5780633fc8cef31461034f5780634387d2d31461036f5780634b8c8f781461038f57600080fd5b80631a4fa5b0116101e25780631a4fa5b014610296578063265fa411146102ac57806328532d62146102e45780632c2ec19d146103045780633273f2581461031a57600080fd5b806304646a491461021f57806304e32ec51461024857806307d856a81461025e57806316d43a971461028057600080fd5b3661021a57005b600080fd5b34801561022b57600080fd5b5061023560085481565b6040519081526020015b60405180910390f35b34801561025457600080fd5b50610235600d5481565b34801561026a57600080fd5b5061027e6102793660046116c0565b6105cc565b005b34801561028c57600080fd5b5061023560075481565b3480156102a257600080fd5b5061023561271081565b3480156102b857600080fd5b506003546102cc906001600160a01b031681565b6040516001600160a01b03909116815260200161023f565b3480156102f057600080fd5b506006546102cc906001600160a01b031681565b34801561031057600080fd5b5061023560095481565b34801561032657600080fd5b5061027e6103353660046116c0565b610628565b34801561034657600080fd5b50610235603281565b34801561035b57600080fd5b506004546102cc906001600160a01b031681565b34801561037b57600080fd5b5061027e61038a3660046116e4565b61064c565b34801561039b57600080fd5b50610235600b5481565b3480156103b157600080fd5b50610235600c5481565b3480156103c757600080fd5b5061027e6106d1565b3480156103dc57600080fd5b506002546102cc906001600160a01b031681565b3480156103fc57600080fd5b5061027e61040b36600461170d565b610869565b34801561041c57600080fd5b5061027e610963565b34801561043157600080fd5b5061027e610bf5565b34801561044657600080fd5b50600f546104549060ff1681565b604051901515815260200161023f565b34801561047057600080fd5b50600f5461045490610100900460ff1681565b34801561048f57600080fd5b5061027e61049e36600461172f565b610c07565b3480156104af57600080fd5b506001546001600160a01b03166102cc565b3480156104cd57600080fd5b50610235600a5481565b3480156104e357600080fd5b506005546102cc906001600160a01b031681565b34801561050357600080fd5b5061027e610c95565b34801561051857600080fd5b5061027e6105273660046116e4565b610d86565b34801561053857600080fd5b50610235606481565b34801561054d57600080fd5b50600f546104549062010000900460ff1681565b34801561056d57600080fd5b50610235600e5481565b34801561058357600080fd5b5061027e6105923660046116c0565b610e06565b3480156105a357600080fd5b5061027e610e5a565b3480156105b857600080fd5b5061027e6105c73660046116e4565b610f2b565b6105d4610fa1565b600f805461ff001916610100831515908102919091179091556002546040516001600160a01b03909116907fa1ef12dbbb9036c89a55a058fbdc1a1cd5eb92f59f58e13bd92340a97a1aabc690600090a350565b610630610fa1565b600f8054911515620100000262ff000019909216919091179055565b610654610fa1565b6001600160a01b0381166106af5760405162461bcd60e51b815260206004820152601a60248201527f4e657720616464726573732063616e6e6f74206265207a65726f00000000000060448201526064015b60405180910390fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6106d9610ffb565b3233146107285760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920454f412063616e2063616c6c20746869732066756e6374696f6e0060448201526064016106a6565b600f5462010000900460ff16156107755760405162461bcd60e51b8152602060048201526011602482015270109d5e589858dac81a5cc81c185d5cd959607a1b60448201526064016106a6565b600a54600954610785919061175e565b4210156107d45760405162461bcd60e51b815260206004820152601c60248201527f53494e4b2062757920696e74657276616c206e6f74207061737365640000000060448201526064016106a6565b6000600c54116108265760405162461bcd60e51b815260206004820152601a60248201527f4e6f2070656e64696e672053494e4b2062757920616d6f756e7400000000000060448201526064016106a6565b600c54600b548111156108385750600b545b80600c600082825461084a9190611777565b90915550504260095561085c81611054565b506108676001600055565b565b610871610fa1565b603c8210156108b75760405162461bcd60e51b8152602060048201526012602482015271125b9d195c9d985b081d1bdbc81cda1bdc9d60721b60448201526064016106a6565b620151808211156108fe5760405162461bcd60e51b8152602060048201526011602482015270496e74657276616c20746f6f206c6f6e6760781b60448201526064016106a6565b600081116109585760405162461bcd60e51b815260206004820152602160248201527f4d617820616d6f756e74206d7573742062652067726561746572207468616e206044820152600360fc1b60648201526084016106a6565b600a91909155600b55565b61096b610ffb565b3233146109ba5760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920454f412063616e2063616c6c20746869732066756e6374696f6e0060448201526064016106a6565b6008546007546109ca919061175e565b421015610a195760405162461bcd60e51b815260206004820152601a60248201527f436f6f6c646f776e20706572696f64206e6f742070617373656400000000000060448201526064016106a6565b42600755600480546040516370a0823160e01b815230928101929092526000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015610a6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8f919061178a565b90508015610aa057610aa0816111e5565b600c5447908111610af35760405162461bcd60e51b815260206004820152601c60248201527f4e6f206e6577207265776172647320746f20646973747269627574650000000060448201526064016106a6565b6000600c5482610b039190611777565b905060008111610b555760405162461bcd60e51b815260206004820152601c60248201527f4e6f206e6577207265776172647320746f20646973747269627574650000000060448201526064016106a6565b60006064610b646032846117a3565b610b6e91906117ba565b90506000610b7c8284611777565b90508115610b8d57610b8d826112e5565b8015610bab5780600c6000828254610ba5919061175e565b90915550505b604080518381526020810183905284917f6ae8ee960d83517f7fa993ad7a0e16e33d9655a23ff41eefc62bdb289c7a8e5f910160405180910390a250505050506108676001600055565b610bfd610fa1565b61086760006114d7565b610c0f610fa1565b62015180811115610c625760405162461bcd60e51b815260206004820152601860248201527f436f6f6c646f776e20706572696f6420746f6f206c6f6e67000000000000000060448201526064016106a6565b600881905560405181907f3b897fd6944545fcb6a5d5b058781d763169157f8559ca1a7f3276b981d0997190600090a250565b60405160a4602482015260009073dc2b0d2dd2b7759d97d50db4eabdc369731108309060440160408051601f198184030181529181526020820180516001600160e01b03166307983f4560e21b17905251610cf091906117dc565b6000604051808303816000865af19150503d8060008114610d2d576040519150601f19603f3d011682016040523d82523d6000602084013e610d32565b606091505b5050905080610d835760405162461bcd60e51b815260206004820152601860248201527f4665654d20726567697374726174696f6e206661696c6564000000000000000060448201526064016106a6565b50565b610d8e610fa1565b6001600160a01b038116610de45760405162461bcd60e51b815260206004820152601a60248201527f4e657720616464726573732063616e6e6f74206265207a65726f00000000000060448201526064016106a6565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b610e0e610fa1565b600f805460ff19168215159081179091556003546040516001600160a01b03909116907fa1ef12dbbb9036c89a55a058fbdc1a1cd5eb92f59f58e13bd92340a97a1aabc690600090a350565b610e62610ffb565b610e6a610fa1565b600480546040516370a0823160e01b815230928101929092526000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015610eb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edc919061178a565b905060008111610f225760405162461bcd60e51b815260206004820152601160248201527004e6f205745544820746f20756e7772617607c1b60448201526064016106a6565b61085c816111e5565b610f33610fa1565b6001600160a01b038116610f985760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106a6565b610d83816114d7565b6001546001600160a01b031633146108675760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106a6565b60026000540361104d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106a6565b6002600055565b600061105e611529565b6006549091506000906001600160a01b03166367ffb66a848385306110854261025861175e565b6040518663ffffffff1660e01b81526004016110a4949392919061180b565b60006040518083038185885af11580156110c2573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f191682016040526110eb91908101906118b0565b9050600081600183516110fe9190611777565b8151811061110e5761110e61196e565b602090810291909101015160025460405163a9059cbb60e01b815261dead6004820152602481018390529192506001600160a01b03169063a9059cbb906044016020604051808303816000875af115801561116d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111919190611984565b5080600e60008282546111a4919061175e565b909155505060405181815284907f25840271b4795b6ffe593775f398548e649182d98f6caf613138201d3d06d74a906020015b60405180910390a250505050565b6004805460405163095ea7b360e01b81526001600160a01b039091169181018290526024810183905263095ea7b3906044016020604051808303816000875af1158015611236573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125a9190611984565b5060048054604051632e1a7d4d60e01b81529182018390526001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561129f57600080fd5b505af11580156112b3573d6000803e3d6000fd5b50506040518392507f672d0a596c1acf168b3a858a9062ff388c7d7e314b94293409d4ae697685b6969150600090a250565b60006112ef611622565b6006549091506000906001600160a01b03166367ffb66a848385306113164261025861175e565b6040518663ffffffff1660e01b8152600401611335949392919061180b565b60006040518083038185885af1158015611353573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f1916820160405261137c91908101906118b0565b90506000816001835161138f9190611777565b8151811061139f5761139f61196e565b602090810291909101015160035460025460405163a9059cbb60e01b81526001600160a01b03918216600482015260248101849052929350169063a9059cbb906044016020604051808303816000875af1158015611401573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114259190611984565b50600260009054906101000a90046001600160a01b03166001600160a01b0316635449e4896040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561147657600080fd5b505af115801561148a573d6000803e3d6000fd5b5050505080600d60008282546114a0919061175e565b909155505060405181815284907ff852af430ab27d2df135fc00e42e7cbb8fe4791172681d23a3fe7f1eb1f9d1a3906020016111d7565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516002808252606082810190935260009190816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181611543575050604080516060810182526004546001600160a01b039081168252600354166020820152600f5460ff1615159181019190915281519192509082906000906115b8576115b861196e565b602090810291909101810191909152604080516060810182526003546001600160a01b0390811682526002541692810192909252600f54610100900460ff161515908201528151829060019081106116125761161261196e565b6020908102919091010152919050565b60408051600180825281830190925260609160009190816020015b604080516060810182526000808252602080830182905292820152825260001990920191018161163d575050604080516060810182526004546001600160a01b039081168252600354166020820152600f5460ff1615159181019190915281519192509082906000906116125761161261196e565b8015158114610d8357600080fd5b6000602082840312156116d257600080fd5b81356116dd816116b2565b9392505050565b6000602082840312156116f657600080fd5b81356001600160a01b03811681146116dd57600080fd5b6000806040838503121561172057600080fd5b50508035926020909101359150565b60006020828403121561174157600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561177157611771611748565b92915050565b8181038181111561177157611771611748565b60006020828403121561179c57600080fd5b5051919050565b808202811582820484141761177157611771611748565b6000826117d757634e487b7160e01b600052601260045260246000fd5b500490565b6000825160005b818110156117fd57602081860181015185830152016117e3565b506000920191825250919050565b600060808201868352602060808185015281875180845260a086019150828901935060005b8181101561187057845180516001600160a01b03908116855285820151168585015260409081015115159084015293830193606090920191600101611830565b50506001600160a01b0387166040860152925061188b915050565b82606083015295945050505050565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156118c357600080fd5b825167ffffffffffffffff808211156118db57600080fd5b818501915085601f8301126118ef57600080fd5b8151818111156119015761190161189a565b8060051b604051601f19603f830116810181811085821117156119265761192661189a565b60405291825284820192508381018501918883111561194457600080fd5b938501935b8285101561196257845184529385019392850192611949565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561199657600080fd5b81516116dd816116b256fea2646970667358221220677d18dc061d9aa61c244e92388001c91de1d06a9fede0bc03cdf7b1231bf7c764736f6c63430008110033

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

000000000000000000000000a20d7892a4b42a517e5a127ff775f1aa77dfce350000000000000000000000003b2ce558eec07099e668e4cf1c5b47aad29687850000000000000000000000004b17642adbfcac421e5191af98d0b589ec087e250000000000000000000000001d368773735ee1e678950b7a97bca2cafb330cdc

-----Decoded View---------------
Arg [0] : _sinkContract (address): 0xa20d7892A4B42a517e5A127fF775f1AA77dfCe35
Arg [1] : _mlhToken (address): 0x3B2CE558Eec07099e668e4cF1C5B47aAd2968785
Arg [2] : _miningProtocolAddress (address): 0x4B17642ADbfCac421E5191AF98d0b589ec087e25
Arg [3] : _shadowRouter (address): 0x1D368773735ee1E678950B7A97bcA2CafB330CDc

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000a20d7892a4b42a517e5a127ff775f1aa77dfce35
Arg [1] : 0000000000000000000000003b2ce558eec07099e668e4cf1c5b47aad2968785
Arg [2] : 0000000000000000000000004b17642adbfcac421e5191af98d0b589ec087e25
Arg [3] : 0000000000000000000000001d368773735ee1e678950b7a97bca2cafb330cdc


Block Transaction Gas Used Reward
view all blocks ##produced##

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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