ETH Price: $2,430.69 (-9.58%)

Contract

0xbB214233C570b8e9b732212974E7baeFFE63F0de

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Create Decrease ...1450590222023-10-29 8:12:26825 days ago1698567146IN
0xbB214233...FFE63F0de
0.00015 ETH0.000088970.1
Create Decrease ...1450562242023-10-29 7:59:31825 days ago1698566371IN
0xbB214233...FFE63F0de
0.00015 ETH0.00008830.1
Create Decrease ...1450547662023-10-29 7:52:50825 days ago1698565970IN
0xbB214233...FFE63F0de
0.00015 ETH0.000095920.1
Create Decrease ...1450530062023-10-29 7:44:43825 days ago1698565483IN
0xbB214233...FFE63F0de
0.00015 ETH0.000090290.1
Create Decrease ...1221891072023-08-17 6:53:11898 days ago1692255191IN
0xbB214233...FFE63F0de
0.00015 ETH0.000106470.1
Create Increase ...1143288422023-07-24 3:04:44923 days ago1690167884IN
0xbB214233...FFE63F0de
0.00015 ETH0.000112780.1
Create Decrease ...1143266692023-07-24 2:55:26923 days ago1690167326IN
0xbB214233...FFE63F0de
0.00015 ETH0.000106710.1
Create Increase ...1143206912023-07-24 2:29:57923 days ago1690165797IN
0xbB214233...FFE63F0de
0.00015 ETH0.000098660.1
Create Increase ...1143203692023-07-24 2:28:38923 days ago1690165718IN
0xbB214233...FFE63F0de
0.00815 ETH0.000093120.1
Create Increase ...1143201422023-07-24 2:27:40923 days ago1690165660IN
0xbB214233...FFE63F0de
0.01015 ETH0.000094060.1
Create Increase ...1143198992023-07-24 2:26:39923 days ago1690165599IN
0xbB214233...FFE63F0de
0.01015 ETH0.00009390.1
Create Decrease ...1143185402023-07-24 2:20:51923 days ago1690165251IN
0xbB214233...FFE63F0de
0.00015 ETH0.000097620.1
Create Increase ...1130871952023-07-20 9:07:12926 days ago1689844032IN
0xbB214233...FFE63F0de
0.00015 ETH0.000111010.1
Create Increase ...1130832072023-07-20 8:50:39926 days ago1689843039IN
0xbB214233...FFE63F0de
0.01015 ETH0.000108840.1
Create Increase ...1130780542023-07-20 8:29:11926 days ago1689841751IN
0xbB214233...FFE63F0de
0.00615 ETH0.000109830.1
Create Decrease ...1117110862023-07-16 6:39:51930 days ago1689489591IN
0xbB214233...FFE63F0de
0.00015 ETH0.000099950.1
Create Decrease ...1111125322023-07-14 11:48:06932 days ago1689335286IN
0xbB214233...FFE63F0de
0.00015 ETH0.000101620.1
Create Increase ...1109250852023-07-13 22:31:14933 days ago1689287474IN
0xbB214233...FFE63F0de
0.00015 ETH0.000147670.1
Create Decrease ...1109225222023-07-13 22:19:57933 days ago1689286797IN
0xbB214233...FFE63F0de
0.00015 ETH0.000156220.1
Create Increase ...1108869952023-07-13 19:44:55933 days ago1689277495IN
0xbB214233...FFE63F0de
0.00015 ETH0.000232960.1
Create Decrease ...1108426952023-07-13 16:37:40933 days ago1689266260IN
0xbB214233...FFE63F0de
0.00015 ETH0.000422120.1
Create Increase ...1105028312023-07-12 16:17:57934 days ago1689178677IN
0xbB214233...FFE63F0de
0.01015 ETH0.000241580.1
Create Increase ...1105024812023-07-12 16:16:27934 days ago1689178587IN
0xbB214233...FFE63F0de
0.05015 ETH0.000234890.1
Create Increase ...1105017372023-07-12 16:13:20934 days ago1689178400IN
0xbB214233...FFE63F0de
0.07015 ETH0.000224620.1
Create Increase ...1105016152023-07-12 16:12:50934 days ago1689178370IN
0xbB214233...FFE63F0de
0.08015 ETH0.000232150.1
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
1450590222023-10-29 8:12:26825 days ago1698567146
0xbB214233...FFE63F0de
0.00015 ETH
1450562242023-10-29 7:59:31825 days ago1698566371
0xbB214233...FFE63F0de
0.00015 ETH
1450547662023-10-29 7:52:50825 days ago1698565970
0xbB214233...FFE63F0de
0.00015 ETH
1450530062023-10-29 7:44:43825 days ago1698565483
0xbB214233...FFE63F0de
0.00015 ETH
1221891102023-08-17 6:53:12898 days ago1692255192
0xbB214233...FFE63F0de
0.00015 ETH
1221891102023-08-17 6:53:12898 days ago1692255192
0xbB214233...FFE63F0de
0.00015 ETH
1221891072023-08-17 6:53:11898 days ago1692255191
0xbB214233...FFE63F0de
0.00015 ETH
1143288442023-07-24 3:04:45923 days ago1690167885
0xbB214233...FFE63F0de
0.00015 ETH
1143288442023-07-24 3:04:45923 days ago1690167885
0xbB214233...FFE63F0de
0.00015 ETH
1143288422023-07-24 3:04:44923 days ago1690167884
0xbB214233...FFE63F0de
0.00015 ETH
1143266722023-07-24 2:55:27923 days ago1690167327
0xbB214233...FFE63F0de
0.00015 ETH
1143266722023-07-24 2:55:27923 days ago1690167327
0xbB214233...FFE63F0de
0.00015 ETH
1143266692023-07-24 2:55:26923 days ago1690167326
0xbB214233...FFE63F0de
0.00015 ETH
1143206932023-07-24 2:29:58923 days ago1690165798
0xbB214233...FFE63F0de
0.00015 ETH
1143206932023-07-24 2:29:58923 days ago1690165798
0xbB214233...FFE63F0de
0.00015 ETH
1143206912023-07-24 2:29:57923 days ago1690165797
0xbB214233...FFE63F0de
0.00015 ETH
1143203712023-07-24 2:28:38923 days ago1690165718
0xbB214233...FFE63F0de
0.00015 ETH
1143203712023-07-24 2:28:38923 days ago1690165718
0xbB214233...FFE63F0de
0.00015 ETH
1143203712023-07-24 2:28:38923 days ago1690165718
0xbB214233...FFE63F0de
0.008 ETH
1143203712023-07-24 2:28:38923 days ago1690165718
0xbB214233...FFE63F0de
0.008 ETH
1143203692023-07-24 2:28:38923 days ago1690165718
0xbB214233...FFE63F0de
0.00815 ETH
1143201452023-07-24 2:27:41923 days ago1690165661
0xbB214233...FFE63F0de
0.00015 ETH
1143201452023-07-24 2:27:41923 days ago1690165661
0xbB214233...FFE63F0de
0.00015 ETH
1143201452023-07-24 2:27:41923 days ago1690165661
0xbB214233...FFE63F0de
0.01 ETH
1143201452023-07-24 2:27:41923 days ago1690165661
0xbB214233...FFE63F0de
0.01 ETH
View All Internal Transactions

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PositionRouter

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "./interfaces/IRouter.sol";
import "./interfaces/IVault.sol";
import "./interfaces/IPositionRouter.sol";

import "../peripherals/interfaces/ITimelock.sol";
import "./BasePositionManager.sol";

contract PositionRouter is BasePositionManager, IPositionRouter {
    struct IncreasePositionRequest {
        address account;
        address[] path;
        address indexToken;
        uint256 amountIn;
        uint256 minOut;
        uint256 sizeDelta;
        bool isLong;
        uint256 acceptablePrice;
        uint256 executionFee;
        uint256 blockNumber;
        uint256 blockTime;
        bool hasCollateralInETH;
    }

    struct DecreasePositionRequest {
        address account;
        address[] path;
        address indexToken;
        uint256 collateralDelta;
        uint256 sizeDelta;
        bool isLong;
        address receiver;
        uint256 acceptablePrice;
        uint256 minOut;
        uint256 executionFee;
        uint256 blockNumber;
        uint256 blockTime;
        bool withdrawETH;
    }

    uint256 public minExecutionFee;

    uint256 public minBlockDelayKeeper;
    uint256 public minTimeDelayPublic;
    uint256 public maxTimeDelay;
    address public positionCreator;

    bool public isLeverageEnabled = true;

    bytes32[] public increasePositionRequestKeys;
    bytes32[] public decreasePositionRequestKeys;

    uint256 public override increasePositionRequestKeysStart;
    uint256 public override decreasePositionRequestKeysStart;

    mapping(address => bool) public isPositionKeeper;

    mapping(address => uint256) public increasePositionsIndex;
    mapping(bytes32 => IncreasePositionRequest) public increasePositionRequests;

    mapping(address => uint256) public decreasePositionsIndex;
    mapping(bytes32 => DecreasePositionRequest) public decreasePositionRequests;

    event CreateIncreasePosition(
        address indexed account,
        address[] path,
        address indexToken,
        uint256 amountIn,
        uint256 minOut,
        uint256 sizeDelta,
        bool isLong,
        uint256 acceptablePrice,
        uint256 executionFee,
        uint256 index,
        uint256 blockNumber,
        uint256 blockTime,
        uint256 gasPrice
    );

    event ExecuteIncreasePosition(
        address indexed account,
        address[] path,
        address indexToken,
        uint256 amountIn,
        uint256 minOut,
        uint256 sizeDelta,
        bool isLong,
        uint256 acceptablePrice,
        uint256 executionFee,
        uint256 blockGap,
        uint256 timeGap
    );

    event CancelIncreasePosition(
        address indexed account,
        address[] path,
        address indexToken,
        uint256 amountIn,
        uint256 minOut,
        uint256 sizeDelta,
        bool isLong,
        uint256 acceptablePrice,
        uint256 executionFee,
        uint256 blockGap,
        uint256 timeGap
    );

    event CreateDecreasePosition(
        address indexed account,
        address[] path,
        address indexToken,
        uint256 collateralDelta,
        uint256 sizeDelta,
        bool isLong,
        address receiver,
        uint256 acceptablePrice,
        uint256 minOut,
        uint256 executionFee,
        uint256 index,
        uint256 blockNumber,
        uint256 blockTime
    );

    event ExecuteDecreasePosition(
        address indexed account,
        address[] path,
        address indexToken,
        uint256 collateralDelta,
        uint256 sizeDelta,
        bool isLong,
        address receiver,
        uint256 acceptablePrice,
        uint256 minOut,
        uint256 executionFee,
        uint256 blockGap,
        uint256 timeGap
    );

    event CancelDecreasePosition(
        address indexed account,
        address[] path,
        address indexToken,
        uint256 collateralDelta,
        uint256 sizeDelta,
        bool isLong,
        address receiver,
        uint256 acceptablePrice,
        uint256 minOut,
        uint256 executionFee,
        uint256 blockGap,
        uint256 timeGap
    );

    event SetPositionKeeper(address indexed account, bool isActive);
    event SetMinExecutionFee(uint256 minExecutionFee);
    event SetIsLeverageEnabled(bool isLeverageEnabled);
    event SetDelayValues(uint256 minBlockDelayKeeper, uint256 minTimeDelayPublic, uint256 maxTimeDelay);
    event SetRequestKeysStartValues(uint256 increasePositionRequestKeysStart, uint256 decreasePositionRequestKeysStart);

    modifier onlyPositionKeeper() {
        require(isPositionKeeper[msg.sender], "PositionRouter: forbidden");
        _;
    }

    modifier onlyPositionCreator() {
        require(msg.sender == positionCreator, "PositionRouter: forbidden");
        _;
    }

    constructor(
        address _vault,
        address _router,
        address _weth,
        uint256 _depositFee,
        uint256 _minExecutionFee
    ) public BasePositionManager(_vault, _router, _weth, _depositFee) {
        minExecutionFee = _minExecutionFee;
    }

    function setPositionKeeper(address _account, bool _isActive) external onlyAdmin {
        isPositionKeeper[_account] = _isActive;
        emit SetPositionKeeper(_account, _isActive);
    }

    function setMinExecutionFee(uint256 _minExecutionFee) external onlyAdmin {
        minExecutionFee = _minExecutionFee;
        emit SetMinExecutionFee(_minExecutionFee);
    }

    function setIsLeverageEnabled(bool _isLeverageEnabled) external onlyAdmin {
        isLeverageEnabled = _isLeverageEnabled;
        emit SetIsLeverageEnabled(_isLeverageEnabled);
    }

    function setDelayValues(
        uint256 _minBlockDelayKeeper,
        uint256 _minTimeDelayPublic,
        uint256 _maxTimeDelay
    ) external onlyAdmin {
        minBlockDelayKeeper = _minBlockDelayKeeper;
        minTimeDelayPublic = _minTimeDelayPublic;
        maxTimeDelay = _maxTimeDelay;
        emit SetDelayValues(_minBlockDelayKeeper, _minTimeDelayPublic, _maxTimeDelay);
    }

    function setRequestKeysStartValues(
        uint256 _increasePositionRequestKeysStart,
        uint256 _decreasePositionRequestKeysStart
    ) external onlyAdmin {
        increasePositionRequestKeysStart = _increasePositionRequestKeysStart;
        decreasePositionRequestKeysStart = _decreasePositionRequestKeysStart;

        emit SetRequestKeysStartValues(_increasePositionRequestKeysStart, _decreasePositionRequestKeysStart);
    }

    function setPositionCreator(address _positionCreator) external onlyAdmin {
        positionCreator = _positionCreator;
    }

    function executeIncreasePositions(
        uint256 _endIndex,
        address payable _executionFeeReceiver
    ) external override onlyPositionKeeper {
        uint256 index = increasePositionRequestKeysStart;
        uint256 length = increasePositionRequestKeys.length;

        if (index >= length) {
            return;
        }

        if (_endIndex > length) {
            _endIndex = length;
        }

        while (index < _endIndex) {
            bytes32 key = increasePositionRequestKeys[index];

            // if the request was executed then delete the key from the array
            // if the request was not executed then break from the loop, this can happen if the
            // minimum number of blocks has not yet passed
            // an error could be thrown if the request is too old or if the slippage is
            // higher than what the user specified, or if there is insufficient liquidity for the position
            // in case an error was thrown, cancel the request
            try this.executeIncreasePosition(key, _executionFeeReceiver) returns (bool _wasExecuted) {
                if (!_wasExecuted) {
                    break;
                }
            } catch {
                // wrap this call in a try catch to prevent invalid cancels from blocking the loop
                try this.cancelIncreasePosition(key, _executionFeeReceiver) returns (bool _wasCancelled) {
                    if (!_wasCancelled) {
                        break;
                    }
                } catch {}
            }

            delete increasePositionRequestKeys[index];
            index++;
        }

        increasePositionRequestKeysStart = index;
    }

    function executeDecreasePositions(
        uint256 _endIndex,
        address payable _executionFeeReceiver
    ) external override onlyPositionKeeper {
        uint256 index = decreasePositionRequestKeysStart;
        uint256 length = decreasePositionRequestKeys.length;

        if (index >= length) {
            return;
        }

        if (_endIndex > length) {
            _endIndex = length;
        }

        while (index < _endIndex) {
            bytes32 key = decreasePositionRequestKeys[index];

            // if the request was executed then delete the key from the array
            // if the request was not executed then break from the loop, this can happen if the
            // minimum number of blocks has not yet passed
            // an error could be thrown if the request is too old
            // in case an error was thrown, cancel the request
            try this.executeDecreasePosition(key, _executionFeeReceiver) returns (bool _wasExecuted) {
                if (!_wasExecuted) {
                    break;
                }
            } catch {
                // wrap this call in a try catch to prevent invalid cancels from blocking the loop
                try this.cancelDecreasePosition(key, _executionFeeReceiver) returns (bool _wasCancelled) {
                    if (!_wasCancelled) {
                        break;
                    }
                } catch {}
            }

            delete decreasePositionRequestKeys[index];
            index++;
        }

        decreasePositionRequestKeysStart = index;
    }

    function createIncreasePosition(
        address[] memory _path,
        address _indexToken,
        uint256 _amountIn,
        uint256 _minOut,
        uint256 _sizeDelta,
        bool _isLong,
        uint256 _acceptablePrice,
        uint256 _executionFee,
        bytes32 _referralCode
    ) external payable nonReentrant {
        require(_executionFee >= minExecutionFee, "PositionRouter: invalid executionFee");
        require(msg.value == _executionFee, "PositionRouter: invalid msg.value");
        require(_path.length == 1 || _path.length == 2, "PositionRouter: invalid _path length");

        _transferInETH();
        _setTraderReferralCode(_referralCode);

        if (_amountIn > 0) {
            IRouter(router).pluginTransfer(_path[0], msg.sender, address(this), _amountIn);
        }

        _createIncreasePosition(
            msg.sender,
            _path,
            _indexToken,
            _amountIn,
            _minOut,
            _sizeDelta,
            _isLong,
            _acceptablePrice,
            _executionFee,
            false
        );
    }

    function createIncreasePositionForUser(
        address _account,
        address[] memory _path,
        address _indexToken,
        uint256 _amountIn,
        uint256 _minOut,
        uint256 _sizeDelta,
        bool _isLong,
        uint256 _acceptablePrice,
        uint256 _executionFee,
        bytes32 _referralCode,
        bool _wrap
    ) external payable override onlyPositionCreator {
        require(_executionFee >= minExecutionFee, "PositionRouter: invalid executionFee");
        require(_path.length == 1 || _path.length == 2, "PositionRouter: invalid _path length");

        _transferInETH();
        _setTraderReferralCode(_referralCode);

        if (_wrap) {
            require(_amountIn.add(_executionFee) == msg.value, "PositionRouter: invalid msg.value");
        } else {
            require(_executionFee == msg.value, "PositionRouter: invalid msg.value");
            IRouter(router).pluginTransfer(_path[0], _account, address(this), _amountIn);
        }

        _createIncreasePosition(
            _account,
            _path,
            _indexToken,
            _amountIn,
            _minOut,
            _sizeDelta,
            _isLong,
            _acceptablePrice,
            _executionFee,
            _wrap
        );
    }

    function createIncreasePositionETH(
        address[] memory _path,
        address _indexToken,
        uint256 _minOut,
        uint256 _sizeDelta,
        bool _isLong,
        uint256 _acceptablePrice,
        uint256 _executionFee,
        bytes32 _referralCode
    ) external payable nonReentrant {
        require(_executionFee >= minExecutionFee, "PositionRouter: invalid executionFee");
        require(msg.value >= _executionFee, "PositionRouter: invalid msg.value");
        require(_path.length == 1 || _path.length == 2, "PositionRouter: invalid _path length");
        require(_path[0] == weth, "PositionRouter: invalid _path");

        _transferInETH();
        _setTraderReferralCode(_referralCode);

        uint256 amountIn = msg.value.sub(_executionFee);

        _createIncreasePosition(
            msg.sender,
            _path,
            _indexToken,
            amountIn,
            _minOut,
            _sizeDelta,
            _isLong,
            _acceptablePrice,
            _executionFee,
            true
        );
    }

    function createDecreasePosition(
        address[] memory _path,
        address _indexToken,
        uint256 _collateralDelta,
        uint256 _sizeDelta,
        bool _isLong,
        address _receiver,
        uint256 _acceptablePrice,
        uint256 _minOut,
        uint256 _executionFee,
        bool _withdrawETH
    ) external payable nonReentrant {
        require(_executionFee >= minExecutionFee, "PositionRouter: invalid executionFee");
        require(msg.value == _executionFee, "PositionRouter: invalid msg.value");
        require(_path.length == 1 || _path.length == 2, "PositionRouter: invalid _path length");

        if (_withdrawETH) {
            require(_path[_path.length - 1] == weth, "PositionRouter: invalid _path");
        }

        _transferInETH();

        _createDecreasePosition(
            msg.sender,
            _path,
            _indexToken,
            _collateralDelta,
            _sizeDelta,
            _isLong,
            _receiver,
            _acceptablePrice,
            _minOut,
            _executionFee,
            _withdrawETH
        );
    }

    function getRequestQueueLengths() external view returns (uint256, uint256, uint256, uint256) {
        return (
            increasePositionRequestKeysStart,
            increasePositionRequestKeys.length,
            decreasePositionRequestKeysStart,
            decreasePositionRequestKeys.length
        );
    }

    function executeIncreasePosition(
        bytes32 _key,
        address payable _executionFeeReceiver
    ) public nonReentrant returns (bool) {
        IncreasePositionRequest memory request = increasePositionRequests[_key];
        // if the request was already executed or cancelled, return true so that the executeIncreasePositions loop will continue executing the next request
        if (request.account == address(0)) {
            return true;
        }

        bool shouldExecute = _validateExecution(request.blockNumber, request.blockTime, request.account);
        if (!shouldExecute) {
            return false;
        }

        delete increasePositionRequests[_key];

        if (request.amountIn > 0) {
            uint256 amountIn = request.amountIn;

            if (request.path.length > 1) {
                IERC20(request.path[0]).safeTransfer(vault, request.amountIn);
                amountIn = _swap(request.path, request.minOut, address(this));
            }

            uint256 afterFeeAmount = _collectFees(
                msg.sender,
                request.path,
                amountIn,
                request.indexToken,
                request.isLong,
                request.sizeDelta
            );
            IERC20(request.path[request.path.length - 1]).safeTransfer(vault, afterFeeAmount);
        }

        _increasePosition(
            request.account,
            request.path[request.path.length - 1],
            request.indexToken,
            request.sizeDelta,
            request.isLong,
            request.acceptablePrice
        );

        _transferOutETH(request.executionFee, _executionFeeReceiver);

        emit ExecuteIncreasePosition(
            request.account,
            request.path,
            request.indexToken,
            request.amountIn,
            request.minOut,
            request.sizeDelta,
            request.isLong,
            request.acceptablePrice,
            request.executionFee,
            block.number.sub(request.blockNumber),
            block.timestamp.sub(request.blockTime)
        );

        return true;
    }

    function cancelIncreasePosition(
        bytes32 _key,
        address payable _executionFeeReceiver
    ) public nonReentrant returns (bool) {
        IncreasePositionRequest memory request = increasePositionRequests[_key];
        // if the request was already executed or cancelled, return true so that the executeIncreasePositions loop will continue executing the next request
        if (request.account == address(0)) {
            return true;
        }

        bool shouldCancel = _validateCancellation(request.blockNumber, request.blockTime, request.account);
        if (!shouldCancel) {
            return false;
        }

        delete increasePositionRequests[_key];

        if (request.hasCollateralInETH) {
            _transferOutETHWithGasLimit(request.amountIn, payable(request.account));
        } else {
            IERC20(request.path[0]).safeTransfer(request.account, request.amountIn);
        }

        _transferOutETH(request.executionFee, _executionFeeReceiver);

        emit CancelIncreasePosition(
            request.account,
            request.path,
            request.indexToken,
            request.amountIn,
            request.minOut,
            request.sizeDelta,
            request.isLong,
            request.acceptablePrice,
            request.executionFee,
            block.number.sub(request.blockNumber),
            block.timestamp.sub(request.blockTime)
        );

        return true;
    }

    function executeDecreasePosition(
        bytes32 _key,
        address payable _executionFeeReceiver
    ) public nonReentrant returns (bool) {
        DecreasePositionRequest memory request = decreasePositionRequests[_key];
        // if the request was already executed or cancelled, return true so that the executeDecreasePositions loop will continue executing the next request
        if (request.account == address(0)) {
            return true;
        }

        bool shouldExecute = _validateExecution(request.blockNumber, request.blockTime, request.account);
        if (!shouldExecute) {
            return false;
        }

        delete decreasePositionRequests[_key];

        uint256 amountOut = _decreasePosition(
            request.account,
            request.path[0],
            request.indexToken,
            request.collateralDelta,
            request.sizeDelta,
            request.isLong,
            address(this),
            request.acceptablePrice
        );

        if (request.path.length > 1) {
            IERC20(request.path[0]).safeTransfer(vault, amountOut);
            amountOut = _swap(request.path, request.minOut, address(this));
        }

        if (request.withdrawETH) {
            _transferOutETHWithGasLimit(amountOut, payable(request.receiver));
        } else {
            IERC20(request.path[request.path.length - 1]).safeTransfer(request.receiver, amountOut);
        }

        _transferOutETH(request.executionFee, _executionFeeReceiver);

        emit ExecuteDecreasePosition(
            request.account,
            request.path,
            request.indexToken,
            request.collateralDelta,
            request.sizeDelta,
            request.isLong,
            request.receiver,
            request.acceptablePrice,
            request.minOut,
            request.executionFee,
            block.number.sub(request.blockNumber),
            block.timestamp.sub(request.blockTime)
        );

        return true;
    }

    function cancelDecreasePosition(
        bytes32 _key,
        address payable _executionFeeReceiver
    ) public nonReentrant returns (bool) {
        DecreasePositionRequest memory request = decreasePositionRequests[_key];
        // if the request was already executed or cancelled, return true so that the executeDecreasePositions loop will continue executing the next request
        if (request.account == address(0)) {
            return true;
        }

        bool shouldCancel = _validateCancellation(request.blockNumber, request.blockTime, request.account);
        if (!shouldCancel) {
            return false;
        }

        delete decreasePositionRequests[_key];

        _transferOutETH(request.executionFee, _executionFeeReceiver);

        emit CancelDecreasePosition(
            request.account,
            request.path,
            request.indexToken,
            request.collateralDelta,
            request.sizeDelta,
            request.isLong,
            request.receiver,
            request.acceptablePrice,
            request.minOut,
            request.executionFee,
            block.number.sub(request.blockNumber),
            block.timestamp.sub(request.blockTime)
        );

        return true;
    }

    function getRequestKey(address _account, uint256 _index) public pure returns (bytes32) {
        return keccak256(abi.encodePacked(_account, _index));
    }

    function getIncreasePositionRequestPath(bytes32 _key) public view returns (address[] memory) {
        IncreasePositionRequest memory request = increasePositionRequests[_key];
        return request.path;
    }

    function getDecreasePositionRequestPath(bytes32 _key) public view returns (address[] memory) {
        DecreasePositionRequest memory request = decreasePositionRequests[_key];
        return request.path;
    }

    function _setTraderReferralCode(bytes32 _referralCode) internal {
        if (_referralCode != bytes32(0) && referralStorage != address(0)) {
            IReferralStorage(referralStorage).setTraderReferralCode(msg.sender, _referralCode);
        }
    }

    function _validateExecution(
        uint256 _positionBlockNumber,
        uint256 _positionBlockTime,
        address _account
    ) internal view returns (bool) {
        if (_positionBlockTime.add(maxTimeDelay) <= block.timestamp) {
            revert("PositionRouter: request has expired");
        }

        bool isKeeperCall = msg.sender == address(this) || isPositionKeeper[msg.sender];

        if (!isLeverageEnabled && !isKeeperCall) {
            revert("PositionRouter: forbidden");
        }

        if (isKeeperCall) {
            return _positionBlockNumber.add(minBlockDelayKeeper) <= block.number;
        }

        require(msg.sender == _account, "PositionRouter: forbidden");

        require(
            _positionBlockTime.add(minTimeDelayPublic) <= block.timestamp,
            "PositionRouter: min delay not yet passed"
        );

        return true;
    }

    function _validateCancellation(
        uint256 _positionBlockNumber,
        uint256 _positionBlockTime,
        address _account
    ) internal view returns (bool) {
        bool isKeeperCall = msg.sender == address(this) || isPositionKeeper[msg.sender];

        if (!isLeverageEnabled && !isKeeperCall) {
            revert("PositionRouter: forbidden");
        }

        if (isKeeperCall) {
            return _positionBlockNumber.add(minBlockDelayKeeper) <= block.number;
        }

        require(msg.sender == _account, "PositionRouter: forbidden");

        require(
            _positionBlockTime.add(minTimeDelayPublic) <= block.timestamp,
            "PositionRouter: min delay not yet passed"
        );

        return true;
    }

    function _createIncreasePosition(
        address _account,
        address[] memory _path,
        address _indexToken,
        uint256 _amountIn,
        uint256 _minOut,
        uint256 _sizeDelta,
        bool _isLong,
        uint256 _acceptablePrice,
        uint256 _executionFee,
        bool _hasCollateralInETH
    ) internal {
        uint256 index = increasePositionsIndex[_account].add(1);
        increasePositionsIndex[_account] = index;

        IncreasePositionRequest memory request = IncreasePositionRequest(
            _account,
            _path,
            _indexToken,
            _amountIn,
            _minOut,
            _sizeDelta,
            _isLong,
            _acceptablePrice,
            _executionFee,
            block.number,
            block.timestamp,
            _hasCollateralInETH
        );

        bytes32 key = getRequestKey(_account, index);
        increasePositionRequests[key] = request;

        increasePositionRequestKeys.push(key);

        emit CreateIncreasePosition(
            _account,
            _path,
            _indexToken,
            _amountIn,
            _minOut,
            _sizeDelta,
            _isLong,
            _acceptablePrice,
            _executionFee,
            index,
            block.number,
            block.timestamp,
            tx.gasprice
        );
    }

    function _createDecreasePosition(
        address _account,
        address[] memory _path,
        address _indexToken,
        uint256 _collateralDelta,
        uint256 _sizeDelta,
        bool _isLong,
        address _receiver,
        uint256 _acceptablePrice,
        uint256 _minOut,
        uint256 _executionFee,
        bool _withdrawETH
    ) internal {
        uint256 index = decreasePositionsIndex[_account].add(1);
        decreasePositionsIndex[_account] = index;

        DecreasePositionRequest memory request = DecreasePositionRequest(
            _account,
            _path,
            _indexToken,
            _collateralDelta,
            _sizeDelta,
            _isLong,
            _receiver,
            _acceptablePrice,
            _minOut,
            _executionFee,
            block.number,
            block.timestamp,
            _withdrawETH
        );

        bytes32 key = getRequestKey(_account, index);
        decreasePositionRequests[key] = request;

        decreasePositionRequestKeys.push(key);

        emit CreateDecreasePosition(
            _account,
            _path,
            _indexToken,
            _collateralDelta,
            _sizeDelta,
            _isLong,
            _receiver,
            _acceptablePrice,
            _minOut,
            _executionFee,
            index,
            block.number,
            block.timestamp
        );
    }
}

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

contract Governable {
    address public gov;

    constructor() public {
        gov = msg.sender;
    }

    modifier onlyGov() {
        require(msg.sender == gov, "Governable: forbidden");
        _;
    }

    function setGov(address _gov) external onlyGov {
        gov = _gov;
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../libraries/math/SafeMath.sol";
import "../libraries/token/IERC20.sol";
import "../tokens/interfaces/IWETH.sol";
import "../libraries/token/SafeERC20.sol";
import "../libraries/utils/Address.sol";
import "../libraries/utils/ReentrancyGuard.sol";

import "./interfaces/IRouter.sol";
import "./interfaces/IVault.sol";
import "./interfaces/IOrderBook.sol";
import "./interfaces/IBasePositionManager.sol";

import "../access/Governable.sol";
import "../peripherals/interfaces/ITimelock.sol";

import "../referrals/interfaces/IReferralStorage.sol";

contract BasePositionManager is IBasePositionManager, ReentrancyGuard, Governable {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    using Address for address payable;

    uint256 public constant BASIS_POINTS_DIVISOR = 10000;

    address public admin;

    address public vault;
    address public router;
    address public weth;

    // to prevent using the deposit and withdrawal of collateral as a zero fee swap,
    // there is a small depositFee charged if a collateral deposit results in the decrease
    // of leverage for an existing position
    // increasePositionBufferBps allows for a small amount of decrease of leverage
    uint256 public depositFee;
    uint256 public increasePositionBufferBps = 100;

    address public referralStorage;

    mapping(address => uint256) public feeReserves;

    mapping(address => uint256) public override maxGlobalLongSizes;
    mapping(address => uint256) public override maxGlobalShortSizes;

    event SetDepositFee(uint256 depositFee);
    event SetIncreasePositionBufferBps(uint256 increasePositionBufferBps);
    event SetReferralStorage(address referralStorage);
    event SetAdmin(address admin);
    event WithdrawFees(address token, address receiver, uint256 amount);

    event SetMaxGlobalSizes(address[] tokens, uint256[] longSizes, uint256[] shortSizes);

    event IncreasePositionReferral(
        address account,
        uint256 sizeDelta,
        uint256 marginFeeBasisPoints,
        bytes32 referralCode,
        address referrer
    );

    event DecreasePositionReferral(
        address account,
        uint256 sizeDelta,
        uint256 marginFeeBasisPoints,
        bytes32 referralCode,
        address referrer
    );

    modifier onlyAdmin() {
        require(msg.sender == admin, "BasePositionManager: forbidden");
        _;
    }

    constructor(address _vault, address _router, address _weth, uint256 _depositFee) public {
        vault = _vault;
        router = _router;
        weth = _weth;
        depositFee = _depositFee;

        admin = msg.sender;
    }

    receive() external payable {
        require(msg.sender == weth, "BasePositionManager: invalid sender");
    }

    function setAdmin(address _admin) external onlyGov {
        admin = _admin;
        emit SetAdmin(_admin);
    }

    function setDepositFee(uint256 _depositFee) external onlyAdmin {
        depositFee = _depositFee;
        emit SetDepositFee(_depositFee);
    }

    function setIncreasePositionBufferBps(uint256 _increasePositionBufferBps) external onlyAdmin {
        increasePositionBufferBps = _increasePositionBufferBps;
        emit SetIncreasePositionBufferBps(_increasePositionBufferBps);
    }

    function setReferralStorage(address _referralStorage) external onlyAdmin {
        referralStorage = _referralStorage;
        emit SetReferralStorage(_referralStorage);
    }

    function setMaxGlobalSizes(
        address[] memory _tokens,
        uint256[] memory _longSizes,
        uint256[] memory _shortSizes
    ) external onlyAdmin {
        for (uint256 i = 0; i < _tokens.length; i++) {
            address token = _tokens[i];
            maxGlobalLongSizes[token] = _longSizes[i];
            maxGlobalShortSizes[token] = _shortSizes[i];
        }

        emit SetMaxGlobalSizes(_tokens, _longSizes, _shortSizes);
    }

    function withdrawFees(address _token, address _receiver) external onlyAdmin {
        uint256 amount = feeReserves[_token];
        if (amount == 0) {
            return;
        }

        feeReserves[_token] = 0;
        IERC20(_token).safeTransfer(_receiver, amount);

        emit WithdrawFees(_token, _receiver, amount);
    }

    function approve(address _token, address _spender, uint256 _amount) external onlyGov {
        IERC20(_token).approve(_spender, _amount);
    }

    function sendValue(address payable _receiver, uint256 _amount) external onlyGov {
        _receiver.sendValue(_amount);
    }

    function _increasePosition(
        address _account,
        address _collateralToken,
        address _indexToken,
        uint256 _sizeDelta,
        bool _isLong,
        uint256 _price
    ) internal {
        address _vault = vault;

        if (_isLong) {
            require(
                IVault(_vault).getMaxPrice(_indexToken) <= _price,
                "BasePositionManager: mark price higher than limit"
            );
        } else {
            require(
                IVault(_vault).getMinPrice(_indexToken) >= _price,
                "BasePositionManager: mark price lower than limit"
            );
        }

        if (_isLong) {
            uint256 maxGlobalLongSize = maxGlobalLongSizes[_indexToken];
            if (
                maxGlobalLongSize > 0 && IVault(_vault).guaranteedUsd(_indexToken).add(_sizeDelta) > maxGlobalLongSize
            ) {
                revert("BasePositionManager: max global longs exceeded");
            }
        } else {
            uint256 maxGlobalShortSize = maxGlobalShortSizes[_indexToken];
            if (
                maxGlobalShortSize > 0 &&
                IVault(_vault).globalShortSizes(_indexToken).add(_sizeDelta) > maxGlobalShortSize
            ) {
                revert("BasePositionManager: max global shorts exceeded");
            }
        }

        address timelock = IVault(_vault).gov();

        ITimelock(timelock).enableLeverage(_vault);
        IRouter(router).pluginIncreasePosition(_account, _collateralToken, _indexToken, _sizeDelta, _isLong);
        ITimelock(timelock).disableLeverage(_vault);

        _emitIncreasePositionReferral(_account, _sizeDelta);
    }

    function _decreasePosition(
        address _account,
        address _collateralToken,
        address _indexToken,
        uint256 _collateralDelta,
        uint256 _sizeDelta,
        bool _isLong,
        address _receiver,
        uint256 _price
    ) internal returns (uint256) {
        address _vault = vault;

        if (_isLong) {
            require(
                IVault(_vault).getMinPrice(_indexToken) >= _price,
                "BasePositionManager: mark price lower than limit"
            );
        } else {
            require(
                IVault(_vault).getMaxPrice(_indexToken) <= _price,
                "BasePositionManager: mark price higher than limit"
            );
        }

        address timelock = IVault(_vault).gov();

        ITimelock(timelock).enableLeverage(_vault);
        uint256 amountOut = IRouter(router).pluginDecreasePosition(
            _account,
            _collateralToken,
            _indexToken,
            _collateralDelta,
            _sizeDelta,
            _isLong,
            _receiver
        );
        ITimelock(timelock).disableLeverage(_vault);

        _emitDecreasePositionReferral(_account, _sizeDelta);

        return amountOut;
    }

    function _emitIncreasePositionReferral(address _account, uint256 _sizeDelta) internal {
        address _referralStorage = referralStorage;
        if (_referralStorage == address(0)) {
            return;
        }

        (bytes32 referralCode, address referrer) = IReferralStorage(_referralStorage).getTraderReferralInfo(_account);
        emit IncreasePositionReferral(
            _account,
            _sizeDelta,
            IVault(vault).marginFeeBasisPoints(),
            referralCode,
            referrer
        );
    }

    function _emitDecreasePositionReferral(address _account, uint256 _sizeDelta) internal {
        address _referralStorage = referralStorage;
        if (_referralStorage == address(0)) {
            return;
        }

        (bytes32 referralCode, address referrer) = IReferralStorage(_referralStorage).getTraderReferralInfo(_account);

        if (referralCode == bytes32(0)) {
            return;
        }

        emit DecreasePositionReferral(
            _account,
            _sizeDelta,
            IVault(vault).marginFeeBasisPoints(),
            referralCode,
            referrer
        );
    }

    function _swap(address[] memory _path, uint256 _minOut, address _receiver) internal returns (uint256) {
        if (_path.length == 2) {
            return _vaultSwap(_path[0], _path[1], _minOut, _receiver);
        }
        revert("BasePositionManager: invalid _path.length");
    }

    function _vaultSwap(
        address _tokenIn,
        address _tokenOut,
        uint256 _minOut,
        address _receiver
    ) internal returns (uint256) {
        uint256 amountOut = IVault(vault).swap(_tokenIn, _tokenOut, _receiver);
        require(amountOut >= _minOut, "BasePositionManager: insufficient amountOut");
        return amountOut;
    }

    function _transferInETH() internal {
        if (msg.value != 0) {
            IWETH(weth).deposit{value: msg.value}();
        }
    }

    function _transferOutETH(uint256 _amountOut, address payable _receiver) internal {
        IWETH(weth).withdraw(_amountOut);
        _receiver.sendValue(_amountOut);
    }

    function _transferOutETHWithGasLimit(uint256 _amountOut, address payable _receiver) internal {
        IWETH(weth).withdraw(_amountOut);
        _receiver.transfer(_amountOut);
    }

    function _collectFees(
        address _account,
        address[] memory _path,
        uint256 _amountIn,
        address _indexToken,
        bool _isLong,
        uint256 _sizeDelta
    ) internal returns (uint256) {
        bool shouldDeductFee = _shouldDeductFee(_account, _path, _amountIn, _indexToken, _isLong, _sizeDelta);

        if (shouldDeductFee) {
            uint256 afterFeeAmount = _amountIn.mul(BASIS_POINTS_DIVISOR.sub(depositFee)).div(BASIS_POINTS_DIVISOR);
            uint256 feeAmount = _amountIn.sub(afterFeeAmount);
            address feeToken = _path[_path.length - 1];
            feeReserves[feeToken] = feeReserves[feeToken].add(feeAmount);
            return afterFeeAmount;
        }

        return _amountIn;
    }

    function _shouldDeductFee(
        address _account,
        address[] memory _path,
        uint256 _amountIn,
        address _indexToken,
        bool _isLong,
        uint256 _sizeDelta
    ) internal view returns (bool) {
        // if the position is a short, do not charge a fee
        if (!_isLong) {
            return false;
        }

        // if the position size is not increasing, this is a collateral deposit
        if (_sizeDelta == 0) {
            return true;
        }

        address collateralToken = _path[_path.length - 1];

        IVault _vault = IVault(vault);
        (uint256 size, uint256 collateral, , , , , , ) = _vault.getPosition(
            _account,
            collateralToken,
            _indexToken,
            _isLong
        );

        // if there is no existing position, do not charge a fee
        if (size == 0) {
            return false;
        }

        uint256 nextSize = size.add(_sizeDelta);
        uint256 collateralDelta = _vault.tokenToUsdMin(collateralToken, _amountIn);
        uint256 nextCollateral = collateral.add(collateralDelta);

        uint256 prevLeverage = size.mul(BASIS_POINTS_DIVISOR).div(collateral);
        // allow for a maximum of a increasePositionBufferBps decrease since there might be some swap fees taken from the collateral
        uint256 nextLeverage = nextSize.mul(BASIS_POINTS_DIVISOR + increasePositionBufferBps).div(nextCollateral);

        // deduct a fee if the leverage is decreased
        return nextLeverage < prevLeverage;
    }
}

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface IBasePositionManager {
    function maxGlobalLongSizes(address _token) external view returns (uint256);

    function maxGlobalShortSizes(address _token) external view returns (uint256);
}

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface IOrderBook {
    function getSwapOrder(
        address _account,
        uint256 _orderIndex
    )
        external
        view
        returns (
            address path0,
            address path1,
            address path2,
            uint256 amountIn,
            uint256 minOut,
            uint256 triggerRatio,
            bool triggerAboveThreshold,
            bool shouldUnwrap,
            uint256 executionFee
        );

    function getIncreaseOrder(
        address _account,
        uint256 _orderIndex
    )
        external
        view
        returns (
            address purchaseToken,
            uint256 purchaseTokenAmount,
            address collateralToken,
            address indexToken,
            uint256 sizeDelta,
            bool isLong,
            uint256 triggerPrice,
            bool triggerAboveThreshold,
            uint256 executionFee
        );

    function getDecreaseOrder(
        address _account,
        uint256 _orderIndex
    )
        external
        view
        returns (
            address collateralToken,
            uint256 collateralDelta,
            address indexToken,
            uint256 sizeDelta,
            bool isLong,
            uint256 triggerPrice,
            bool triggerAboveThreshold,
            uint256 executionFee
        );

    function executeSwapOrder(address, uint256, address payable) external;

    function executeDecreaseOrder(address, uint256, address payable) external;

    function executeIncreaseOrder(address, uint256, address payable) external;

    function createDecreaseOrderForUser(
        address _account,
        address _indexToken,
        uint256 _sizeDelta,
        address _collateralToken,
        uint256 _collateralDelta,
        bool _isLong,
        uint256 _triggerPrice,
        bool _triggerAboveThreshold
    ) external payable;

    function createIncreaseOrderForUser(
        address _account,
        address[] memory _path,
        uint256 _amountIn,
        address _indexToken,
        uint256 _minOut,
        uint256 _sizeDelta,
        address _collateralToken,
        bool _isLong,
        uint256 _triggerPrice,
        bool _triggerAboveThreshold,
        uint256 _executionFee,
        bool _shouldWrap
    ) external payable;
}

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface IPositionRouter {
    function increasePositionRequestKeysStart() external returns (uint256);

    function decreasePositionRequestKeysStart() external returns (uint256);

    function executeIncreasePositions(uint256 _count, address payable _executionFeeReceiver) external;

    function executeDecreasePositions(uint256 _count, address payable _executionFeeReceiver) external;

    function createIncreasePositionForUser(
        address _account,
        address[] memory _path,
        address _indexToken,
        uint256 _amountIn,
        uint256 _minOut,
        uint256 _sizeDelta,
        bool _isLong,
        uint256 _acceptablePrice,
        uint256 _executionFee,
        bytes32 _referralCode,
        bool _wrap
    ) external payable;
}

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface IRouter {
    function addPlugin(address _plugin) external;

    function pluginTransfer(address _token, address _account, address _receiver, uint256 _amount) external;

    function pluginIncreasePosition(
        address _account,
        address _collateralToken,
        address _indexToken,
        uint256 _sizeDelta,
        bool _isLong
    ) external;

    function pluginDecreasePosition(
        address _account,
        address _collateralToken,
        address _indexToken,
        uint256 _collateralDelta,
        uint256 _sizeDelta,
        bool _isLong,
        address _receiver
    ) external returns (uint256);

    function swap(address[] memory _path, uint256 _amountIn, uint256 _minOut, address _receiver) external;
}

File 8 of 17 : IVault.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

import "./IVaultUtils.sol";

interface IVault {
    function isInitialized() external view returns (bool);

    function isSwapEnabled() external view returns (bool);

    function isLeverageEnabled() external view returns (bool);

    function setVaultUtils(IVaultUtils _vaultUtils) external;

    function setError(uint256 _errorCode, string calldata _error) external;

    function router() external view returns (address);

    function usdg() external view returns (address);

    function gov() external view returns (address);

    function whitelistedTokenCount() external view returns (uint256);

    function maxLeverage() external view returns (uint256);

    function minProfitTime() external view returns (uint256);

    function hasDynamicFees() external view returns (bool);

    function fundingInterval() external view returns (uint256);

    function totalTokenWeights() external view returns (uint256);

    function getTargetUsdgAmount(address _token) external view returns (uint256);

    function inManagerMode() external view returns (bool);

    function inPrivateLiquidationMode() external view returns (bool);

    function maxGasPrice() external view returns (uint256);

    function approvedRouters(address _account, address _router) external view returns (bool);

    function isLiquidator(address _account) external view returns (bool);

    function isManager(address _account) external view returns (bool);

    function minProfitBasisPoints(address _token) external view returns (uint256);

    function tokenBalances(address _token) external view returns (uint256);

    function lastFundingTimes(address _token) external view returns (uint256);

    function setMaxLeverage(uint256 _maxLeverage) external;

    function setInManagerMode(bool _inManagerMode) external;

    function setManager(address _manager, bool _isManager) external;

    function setIsSwapEnabled(bool _isSwapEnabled) external;

    function setIsLeverageEnabled(bool _isLeverageEnabled) external;

    function setMaxGasPrice(uint256 _maxGasPrice) external;

    function setUsdgAmount(address _token, uint256 _amount) external;

    function setBufferAmount(address _token, uint256 _amount) external;

    function setMaxGlobalShortSize(address _token, uint256 _amount) external;

    function setInPrivateLiquidationMode(bool _inPrivateLiquidationMode) external;

    function setLiquidator(address _liquidator, bool _isActive) external;

    function setFundingRate(
        uint256 _fundingInterval,
        uint256 _fundingRateFactor,
        uint256 _stableFundingRateFactor
    ) external;

    function setFees(
        uint256 _taxBasisPoints,
        uint256 _stableTaxBasisPoints,
        uint256 _mintBurnFeeBasisPoints,
        uint256 _swapFeeBasisPoints,
        uint256 _stableSwapFeeBasisPoints,
        uint256 _marginFeeBasisPoints,
        uint256 _liquidationFeeUsd,
        uint256 _minProfitTime,
        bool _hasDynamicFees
    ) external;

    function setTokenConfig(
        address _token,
        uint256 _tokenDecimals,
        uint256 _redemptionBps,
        uint256 _minProfitBps,
        uint256 _maxUsdgAmount,
        bool _isStable,
        bool _isShortable
    ) external;

    function setPriceFeed(address _priceFeed) external;

    function withdrawFees(address _token, address _receiver) external returns (uint256);

    function directPoolDeposit(address _token) external;

    function buyUSDG(address _token, address _receiver) external returns (uint256);

    function sellUSDG(address _token, address _receiver) external returns (uint256);

    function swap(address _tokenIn, address _tokenOut, address _receiver) external returns (uint256);

    function increasePosition(
        address _account,
        address _collateralToken,
        address _indexToken,
        uint256 _sizeDelta,
        bool _isLong
    ) external;

    function decreasePosition(
        address _account,
        address _collateralToken,
        address _indexToken,
        uint256 _collateralDelta,
        uint256 _sizeDelta,
        bool _isLong,
        address _receiver
    ) external returns (uint256);

    function liquidatePosition(
        address _account,
        address _collateralToken,
        address _indexToken,
        bool _isLong,
        address _feeReceiver
    ) external;

    function tokenToUsdMin(address _token, uint256 _tokenAmount) external view returns (uint256);

    function priceFeed() external view returns (address);

    function fundingRateFactor() external view returns (uint256);

    function stableFundingRateFactor() external view returns (uint256);

    function cumulativeFundingRates(address _token) external view returns (uint256);

    function getNextFundingRate(address _token) external view returns (uint256);

    function getFeeBasisPoints(
        address _token,
        uint256 _usdgDelta,
        uint256 _feeBasisPoints,
        uint256 _taxBasisPoints,
        bool _increment
    ) external view returns (uint256);

    function liquidationFeeUsd() external view returns (uint256);

    function taxBasisPoints() external view returns (uint256);

    function stableTaxBasisPoints() external view returns (uint256);

    function mintBurnFeeBasisPoints() external view returns (uint256);

    function swapFeeBasisPoints() external view returns (uint256);

    function stableSwapFeeBasisPoints() external view returns (uint256);

    function marginFeeBasisPoints() external view returns (uint256);

    function allWhitelistedTokensLength() external view returns (uint256);

    function allWhitelistedTokens(uint256) external view returns (address);

    function whitelistedTokens(address _token) external view returns (bool);

    function stableTokens(address _token) external view returns (bool);

    function shortableTokens(address _token) external view returns (bool);

    function feeReserves(address _token) external view returns (uint256);

    function globalShortSizes(address _token) external view returns (uint256);

    function globalShortAveragePrices(address _token) external view returns (uint256);

    function maxGlobalShortSizes(address _token) external view returns (uint256);

    function tokenDecimals(address _token) external view returns (uint256);

    function tokenWeights(address _token) external view returns (uint256);

    function guaranteedUsd(address _token) external view returns (uint256);

    function poolAmounts(address _token) external view returns (uint256);

    function bufferAmounts(address _token) external view returns (uint256);

    function reservedAmounts(address _token) external view returns (uint256);

    function usdgAmounts(address _token) external view returns (uint256);

    function maxUsdgAmounts(address _token) external view returns (uint256);

    function getRedemptionAmount(address _token, uint256 _usdgAmount) external view returns (uint256);

    function getMaxPrice(address _token) external view returns (uint256);

    function getMinPrice(address _token) external view returns (uint256);

    function getDelta(
        address _indexToken,
        uint256 _size,
        uint256 _averagePrice,
        bool _isLong,
        uint256 _lastIncreasedTime
    ) external view returns (bool, uint256);

    function getPosition(
        address _account,
        address _collateralToken,
        address _indexToken,
        bool _isLong
    ) external view returns (uint256, uint256, uint256, uint256, uint256, uint256, bool, uint256);
}

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface IVaultUtils {
    function updateCumulativeFundingRate(address _collateralToken, address _indexToken) external returns (bool);

    function validateIncreasePosition(
        address _account,
        address _collateralToken,
        address _indexToken,
        uint256 _sizeDelta,
        bool _isLong
    ) external view;

    function validateDecreasePosition(
        address _account,
        address _collateralToken,
        address _indexToken,
        uint256 _collateralDelta,
        uint256 _sizeDelta,
        bool _isLong,
        address _receiver
    ) external view;

    function validateLiquidation(
        address _account,
        address _collateralToken,
        address _indexToken,
        bool _isLong,
        bool _raise
    ) external view returns (uint256, uint256);

    function getEntryFundingRate(
        address _collateralToken,
        address _indexToken,
        bool _isLong
    ) external view returns (uint256);

    function getPositionFee(
        address _account,
        address _collateralToken,
        address _indexToken,
        bool _isLong,
        uint256 _sizeDelta
    ) external view returns (uint256);

    function getFundingFee(
        address _account,
        address _collateralToken,
        address _indexToken,
        bool _isLong,
        uint256 _size,
        uint256 _entryFundingRate
    ) external view returns (uint256);

    function getBuyUsdgFeeBasisPoints(address _token, uint256 _usdgAmount) external view returns (uint256);

    function getSellUsdgFeeBasisPoints(address _token, uint256 _usdgAmount) external view returns (uint256);

    function getSwapFeeBasisPoints(
        address _tokenIn,
        address _tokenOut,
        uint256 _usdgAmount
    ) external view returns (uint256);

    function getFeeBasisPoints(
        address _token,
        uint256 _usdgDelta,
        uint256 _feeBasisPoints,
        uint256 _taxBasisPoints,
        bool _increment
    ) external view returns (uint256);
}

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool);

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

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

import "./IERC20.sol";
import "../math/SafeMath.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 SafeMath for uint256;
    using Address for address;

    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    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'
        // solhint-disable-next-line max-line-length
        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));
    }

    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(
            value,
            "SafeERC20: decreased allowance below zero"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    /**
     * @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");
        if (returndata.length > 0) {
            // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.6.2;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            size := extcodesize(account)
        }
        return size > 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://diligence.consensys.net/posts/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.5.11/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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return _verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.3._
     */
    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.3._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) private pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 14 of 17 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

/**
 * @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].
 */
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() internal {
        _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 make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface ITimelock {
    function setAdmin(address _admin) external;

    function enableLeverage(address _vault) external;

    function disableLeverage(address _vault) external;

    function setIsLeverageEnabled(address _vault, bool _isLeverageEnabled) external;

    function signalSetGov(address _target, address _gov) external;

    function managedSetHandler(address _target, address _handler, bool _isActive) external;

    function managedSetMinter(address _target, address _minter, bool _isActive) external;
}

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface IReferralStorage {
    function codeOwners(bytes32 _code) external view returns (address);

    function getTraderReferralInfo(address _account) external view returns (bytes32, address);

    function setTraderReferralCode(address _account, bytes32 _code) external;
}

//SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface IWETH {
    function deposit() external payable;

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

    function withdraw(uint256) external;
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_vault","type":"address"},{"internalType":"address","name":"_router","type":"address"},{"internalType":"address","name":"_weth","type":"address"},{"internalType":"uint256","name":"_depositFee","type":"uint256"},{"internalType":"uint256","name":"_minExecutionFee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address[]","name":"path","type":"address[]"},{"indexed":false,"internalType":"address","name":"indexToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"collateralDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sizeDelta","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isLong","type":"bool"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"acceptablePrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"executionFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockGap","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeGap","type":"uint256"}],"name":"CancelDecreasePosition","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address[]","name":"path","type":"address[]"},{"indexed":false,"internalType":"address","name":"indexToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sizeDelta","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isLong","type":"bool"},{"indexed":false,"internalType":"uint256","name":"acceptablePrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"executionFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockGap","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeGap","type":"uint256"}],"name":"CancelIncreasePosition","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address[]","name":"path","type":"address[]"},{"indexed":false,"internalType":"address","name":"indexToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"collateralDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sizeDelta","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isLong","type":"bool"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"acceptablePrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"executionFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockTime","type":"uint256"}],"name":"CreateDecreasePosition","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address[]","name":"path","type":"address[]"},{"indexed":false,"internalType":"address","name":"indexToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sizeDelta","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isLong","type":"bool"},{"indexed":false,"internalType":"uint256","name":"acceptablePrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"executionFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasPrice","type":"uint256"}],"name":"CreateIncreasePosition","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"sizeDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"marginFeeBasisPoints","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"referralCode","type":"bytes32"},{"indexed":false,"internalType":"address","name":"referrer","type":"address"}],"name":"DecreasePositionReferral","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address[]","name":"path","type":"address[]"},{"indexed":false,"internalType":"address","name":"indexToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"collateralDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sizeDelta","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isLong","type":"bool"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"acceptablePrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"executionFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockGap","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeGap","type":"uint256"}],"name":"ExecuteDecreasePosition","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address[]","name":"path","type":"address[]"},{"indexed":false,"internalType":"address","name":"indexToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sizeDelta","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isLong","type":"bool"},{"indexed":false,"internalType":"uint256","name":"acceptablePrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"executionFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockGap","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeGap","type":"uint256"}],"name":"ExecuteIncreasePosition","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"sizeDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"marginFeeBasisPoints","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"referralCode","type":"bytes32"},{"indexed":false,"internalType":"address","name":"referrer","type":"address"}],"name":"IncreasePositionReferral","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"SetAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minBlockDelayKeeper","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minTimeDelayPublic","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxTimeDelay","type":"uint256"}],"name":"SetDelayValues","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"depositFee","type":"uint256"}],"name":"SetDepositFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"increasePositionBufferBps","type":"uint256"}],"name":"SetIncreasePositionBufferBps","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isLeverageEnabled","type":"bool"}],"name":"SetIsLeverageEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"longSizes","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"shortSizes","type":"uint256[]"}],"name":"SetMaxGlobalSizes","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minExecutionFee","type":"uint256"}],"name":"SetMinExecutionFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"isActive","type":"bool"}],"name":"SetPositionKeeper","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"referralStorage","type":"address"}],"name":"SetReferralStorage","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"increasePositionRequestKeysStart","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"decreasePositionRequestKeysStart","type":"uint256"}],"name":"SetRequestKeysStartValues","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawFees","type":"event"},{"inputs":[],"name":"BASIS_POINTS_DIVISOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"},{"internalType":"address payable","name":"_executionFeeReceiver","type":"address"}],"name":"cancelDecreasePosition","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"},{"internalType":"address payable","name":"_executionFeeReceiver","type":"address"}],"name":"cancelIncreasePosition","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"address","name":"_indexToken","type":"address"},{"internalType":"uint256","name":"_collateralDelta","type":"uint256"},{"internalType":"uint256","name":"_sizeDelta","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_acceptablePrice","type":"uint256"},{"internalType":"uint256","name":"_minOut","type":"uint256"},{"internalType":"uint256","name":"_executionFee","type":"uint256"},{"internalType":"bool","name":"_withdrawETH","type":"bool"}],"name":"createDecreasePosition","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"address","name":"_indexToken","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_minOut","type":"uint256"},{"internalType":"uint256","name":"_sizeDelta","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"uint256","name":"_acceptablePrice","type":"uint256"},{"internalType":"uint256","name":"_executionFee","type":"uint256"},{"internalType":"bytes32","name":"_referralCode","type":"bytes32"}],"name":"createIncreasePosition","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"address","name":"_indexToken","type":"address"},{"internalType":"uint256","name":"_minOut","type":"uint256"},{"internalType":"uint256","name":"_sizeDelta","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"uint256","name":"_acceptablePrice","type":"uint256"},{"internalType":"uint256","name":"_executionFee","type":"uint256"},{"internalType":"bytes32","name":"_referralCode","type":"bytes32"}],"name":"createIncreasePositionETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"address","name":"_indexToken","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_minOut","type":"uint256"},{"internalType":"uint256","name":"_sizeDelta","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"uint256","name":"_acceptablePrice","type":"uint256"},{"internalType":"uint256","name":"_executionFee","type":"uint256"},{"internalType":"bytes32","name":"_referralCode","type":"bytes32"},{"internalType":"bool","name":"_wrap","type":"bool"}],"name":"createIncreasePositionForUser","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"decreasePositionRequestKeys","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decreasePositionRequestKeysStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"decreasePositionRequests","outputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"indexToken","type":"address"},{"internalType":"uint256","name":"collateralDelta","type":"uint256"},{"internalType":"uint256","name":"sizeDelta","type":"uint256"},{"internalType":"bool","name":"isLong","type":"bool"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"acceptablePrice","type":"uint256"},{"internalType":"uint256","name":"minOut","type":"uint256"},{"internalType":"uint256","name":"executionFee","type":"uint256"},{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"uint256","name":"blockTime","type":"uint256"},{"internalType":"bool","name":"withdrawETH","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"decreasePositionsIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"},{"internalType":"address payable","name":"_executionFeeReceiver","type":"address"}],"name":"executeDecreasePosition","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_endIndex","type":"uint256"},{"internalType":"address payable","name":"_executionFeeReceiver","type":"address"}],"name":"executeDecreasePositions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"},{"internalType":"address payable","name":"_executionFeeReceiver","type":"address"}],"name":"executeIncreasePosition","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_endIndex","type":"uint256"},{"internalType":"address payable","name":"_executionFeeReceiver","type":"address"}],"name":"executeIncreasePositions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"feeReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"}],"name":"getDecreasePositionRequestPath","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"}],"name":"getIncreasePositionRequestPath","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getRequestKey","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getRequestQueueLengths","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gov","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"increasePositionBufferBps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"increasePositionRequestKeys","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"increasePositionRequestKeysStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"increasePositionRequests","outputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"indexToken","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"minOut","type":"uint256"},{"internalType":"uint256","name":"sizeDelta","type":"uint256"},{"internalType":"bool","name":"isLong","type":"bool"},{"internalType":"uint256","name":"acceptablePrice","type":"uint256"},{"internalType":"uint256","name":"executionFee","type":"uint256"},{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"uint256","name":"blockTime","type":"uint256"},{"internalType":"bool","name":"hasCollateralInETH","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"increasePositionsIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isLeverageEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isPositionKeeper","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxGlobalLongSizes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxGlobalShortSizes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTimeDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minBlockDelayKeeper","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minExecutionFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minTimeDelayPublic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"positionCreator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"referralStorage","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"sendValue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minBlockDelayKeeper","type":"uint256"},{"internalType":"uint256","name":"_minTimeDelayPublic","type":"uint256"},{"internalType":"uint256","name":"_maxTimeDelay","type":"uint256"}],"name":"setDelayValues","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_depositFee","type":"uint256"}],"name":"setDepositFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gov","type":"address"}],"name":"setGov","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_increasePositionBufferBps","type":"uint256"}],"name":"setIncreasePositionBufferBps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isLeverageEnabled","type":"bool"}],"name":"setIsLeverageEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_longSizes","type":"uint256[]"},{"internalType":"uint256[]","name":"_shortSizes","type":"uint256[]"}],"name":"setMaxGlobalSizes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minExecutionFee","type":"uint256"}],"name":"setMinExecutionFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_positionCreator","type":"address"}],"name":"setPositionCreator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bool","name":"_isActive","type":"bool"}],"name":"setPositionKeeper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_referralStorage","type":"address"}],"name":"setReferralStorage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_increasePositionRequestKeysStart","type":"uint256"},{"internalType":"uint256","name":"_decreasePositionRequestKeysStart","type":"uint256"}],"name":"setRequestKeysStartValues","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405260646007556010805460ff60a01b1916600160a01b1790553480156200002957600080fd5b50604051620060b2380380620060b2833981810160405260a08110156200004f57600080fd5b508051602082015160408301516060840151608090940151600160008181558154336001600160a01b031991821681179093556003805482166001600160a01b0398891617905560048054821696881696909617909555600580548616969094169590951790925560069490945560028054909216179055600c91909155615fd4908190620000de90396000f3fe60806040526004361061027e5760003560e01c80626cc35e146102d357806304225954146103045780630d4d003d146103405780631045c74e1461038d578063126082cf146103c057806312d43a51146103d55780631bca8cf0146103ea5780631ce9cb8f146103ff5780631f285106146104325780632092d9fd146104de578063225fc9fd14610511578063233bfe3b1461054a57806324a084df1461057457806327b42c0f146105ad578063308aa81f146105e6578063332e0382146106165780633422ead1146106e657806336eba48a146107215780633a2a80c7146107545780633e72a262146107695780633fc8cef31461077e5780634067b132146107935780634278555f146107c9578063490ae210146107f35780635841fcaa1461081d5780635d5c22e81461083257806360a362e2146108ac57806362f8a3fe146108e5578063633451de1461091e57806363ae2103146109515780636730a3851461096657806367a527931461097b578063704b6c02146109905780637c2eb9f7146109c357806395e9bbd7146109ef5780639698d25a14610a1957806398d1e03a14610a4c5780639a20810014610a615780639b57862014610a9a578063ae4d7f9a14610aaf578063c987417014610ae2578063cb0269c914610bb8578063cfad57a214610bcd578063e1f21c6714610c00578063e24dd40414610c43578063e70dd2fc14610d32578063ef12c67e14610e14578063f255527814610fc6578063f2cea6a514611001578063f3883d8b1461103c578063f851a44014611075578063f887ea401461108a578063fa4445771461109f578063faf990f3146110d2578063fbfa77cf14611160578063fc2cee6214611175576102ce565b366102ce576005546001600160a01b031633146102cc5760405162461bcd60e51b8152600401808060200182810382526023815260200180615f2f6023913960400191505060405180910390fd5b005b600080fd5b3480156102df57600080fd5b506102e861119f565b604080516001600160a01b039092168252519081900360200190f35b34801561031057600080fd5b5061032e6004803603602081101561032757600080fd5b50356111ae565b60408051918252519081900360200190f35b34801561034c57600080fd5b506103796004803603604081101561036357600080fd5b50803590602001356001600160a01b03166111cc565b604080519115158252519081900360200190f35b34801561039957600080fd5b5061032e600480360360208110156103b057600080fd5b50356001600160a01b0316611646565b3480156103cc57600080fd5b5061032e611658565b3480156103e157600080fd5b506102e861165e565b3480156103f657600080fd5b5061032e61166d565b34801561040b57600080fd5b5061032e6004803603602081101561042257600080fd5b50356001600160a01b0316611673565b34801561043e57600080fd5b5061045c6004803603602081101561045557600080fd5b5035611685565b604051808d6001600160a01b031681526020018c6001600160a01b031681526020018b81526020018a81526020018915158152602001886001600160a01b0316815260200187815260200186815260200185815260200184815260200183815260200182151581526020019c5050505050505050505050505060405180910390f35b3480156104ea57600080fd5b506102cc6004803603602081101561050157600080fd5b50356001600160a01b03166116f1565b34801561051d57600080fd5b506103796004803603604081101561053457600080fd5b50803590602001356001600160a01b0316611760565b34801561055657600080fd5b506102cc6004803603602081101561056d57600080fd5b5035611b08565b34801561058057600080fd5b506102cc6004803603604081101561059757600080fd5b506001600160a01b038135169060200135611b90565b3480156105b957600080fd5b50610379600480360360408110156105d057600080fd5b50803590602001356001600160a01b0316611bf4565b3480156105f257600080fd5b506102cc6004803603604081101561060957600080fd5b5080359060200135611f87565b6102cc600480360361010081101561062d57600080fd5b810190602081018135600160201b81111561064757600080fd5b82018360208201111561065957600080fd5b803590602001918460208302840111600160201b8311171561067a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013515159060808101359060a08101359060c0013561201d565b3480156106f257600080fd5b506102cc6004803603604081101561070957600080fd5b506001600160a01b03813516906020013515156121e3565b34801561072d57600080fd5b506103796004803603602081101561074457600080fd5b50356001600160a01b0316612290565b34801561076057600080fd5b5061032e6122a5565b34801561077557600080fd5b506103796122ab565b34801561078a57600080fd5b506102e86122bb565b34801561079f57600080fd5b506102cc600480360360608110156107b657600080fd5b50803590602081013590604001356122ca565b3480156107d557600080fd5b5061032e600480360360208110156107ec57600080fd5b503561236b565b3480156107ff57600080fd5b506102cc6004803603602081101561081657600080fd5b5035612378565b34801561082957600080fd5b5061032e612400565b34801561083e57600080fd5b5061085c6004803603602081101561085557600080fd5b5035612406565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610898578181015183820152602001610880565b505050509050019250505060405180910390f35b3480156108b857600080fd5b50610379600480360360408110156108cf57600080fd5b50803590602001356001600160a01b0316612531565b3480156108f157600080fd5b5061032e6004803603604081101561090857600080fd5b506001600160a01b0381351690602001356128bf565b34801561092a57600080fd5b5061032e6004803603602081101561094157600080fd5b50356001600160a01b0316612905565b34801561095d57600080fd5b5061032e612917565b34801561097257600080fd5b506102e861291d565b34801561098757600080fd5b5061032e61292c565b34801561099c57600080fd5b506102cc600480360360208110156109b357600080fd5b50356001600160a01b0316612932565b3480156109cf57600080fd5b506102cc600480360360208110156109e657600080fd5b503515156129d3565b3480156109fb57600080fd5b5061085c60048036036020811015610a1257600080fd5b5035612a73565b348015610a2557600080fd5b5061032e60048036036020811015610a3c57600080fd5b50356001600160a01b0316612b90565b348015610a5857600080fd5b5061032e612ba2565b348015610a6d57600080fd5b506102cc60048036036040811015610a8457600080fd5b50803590602001356001600160a01b0316612ba8565b348015610aa657600080fd5b5061032e612d88565b348015610abb57600080fd5b506102cc60048036036020811015610ad257600080fd5b50356001600160a01b0316612d8e565b6102cc6004803603610120811015610af957600080fd5b810190602081018135600160201b811115610b1357600080fd5b820183602082011115610b2557600080fd5b803590602001918460208302840111600160201b83111715610b4657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013590608081013515159060a08101359060c08101359060e00135612e2f565b348015610bc457600080fd5b5061032e61301b565b348015610bd957600080fd5b506102cc60048036036020811015610bf057600080fd5b50356001600160a01b0316613021565b348015610c0c57600080fd5b506102cc60048036036060811015610c2357600080fd5b506001600160a01b03813581169160208101359091169060400135613090565b6102cc6004803603610160811015610c5a57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b811115610c8457600080fd5b820183602082011115610c9657600080fd5b803590602001918460208302840111600160201b83111715610cb757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013590608081013515159060a08101359060c08101359060e08101359061010001351515613165565b6102cc6004803603610140811015610d4957600080fd5b810190602081018135600160201b811115610d6357600080fd5b820183602082011115610d7557600080fd5b803590602001918460208302840111600160201b83111715610d9657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505081356001600160a01b0390811693506020830135926040810135925060608101351515916080820135169060a08101359060c08101359060e081013590610100013515156133ab565b348015610e2057600080fd5b506102cc60048036036060811015610e3757600080fd5b810190602081018135600160201b811115610e5157600080fd5b820183602082011115610e6357600080fd5b803590602001918460208302840111600160201b83111715610e8457600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610ed357600080fd5b820183602082011115610ee557600080fd5b803590602001918460208302840111600160201b83111715610f0657600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610f5557600080fd5b820183602082011115610f6757600080fd5b803590602001918460208302840111600160201b83111715610f8857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550613565945050505050565b348015610fd257600080fd5b506102cc60048036036040811015610fe957600080fd5b506001600160a01b0381358116916020013516613754565b34801561100d57600080fd5b50611016613838565b604080519485526020850193909352838301919091526060830152519081900360800190f35b34801561104857600080fd5b506102cc6004803603604081101561105f57600080fd5b50803590602001356001600160a01b031661384a565b34801561108157600080fd5b506102e8613a2a565b34801561109657600080fd5b506102e8613a39565b3480156110ab57600080fd5b5061032e600480360360208110156110c257600080fd5b50356001600160a01b0316613a48565b3480156110de57600080fd5b506110fc600480360360208110156110f557600080fd5b5035613a5a565b604080516001600160a01b039c8d1681529a909b1660208b0152898b01989098526060890196909652608088019490945291151560a087015260c086015260e085015261010084015261012083015215156101408201529051908190036101600190f35b34801561116c57600080fd5b506102e8613ac4565b34801561118157600080fd5b506102cc6004803603602081101561119857600080fd5b5035613ad3565b6008546001600160a01b031681565b601181815481106111bb57fe5b600091825260209091200154905081565b600060026000541415611214576040805162461bcd60e51b815260206004820152601f6024820152600080516020615cbd833981519152604482015290519081900360640190fd5b6002600055611221615ab5565b60008481526019602090815260409182902082516101a08101845281546001600160a01b03168152600182018054855181860281018601909652808652919492938581019392908301828280156112a157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611283575b505050918352505060028201546001600160a01b0390811660208301526003830154604083015260048301546060830152600583015460ff8082161515608085015261010091829004831660a0850152600685015460c0850152600785015460e08501526008850154918401919091526009840154610120840152600a840154610140840152600b9093015490921615156101609091015281519192501661134d57600191505061163b565b60006113688261014001518361016001518460000151613b5b565b90508061137a5760009250505061163b565b600085815260196020526040812080546001600160a01b0319168155906113a46001830182615b3c565b506002810180546001600160a01b0319169055600060038201819055600482018190556005820180546001600160a81b031916905560068201819055600782018190556008820181905560098201819055600a8201819055600b909101805460ff19169055825160208401518051611447929190849061142057fe5b60200260200101518560400151866060015187608001518860a00151308a60e00151613cfa565b9050600183602001515111156114b1576003546020840151805161149a926001600160a01b031691849160009061147a57fe5b60200260200101516001600160a01b03166140ad9092919063ffffffff16565b6114ae836020015184610100015130614104565b90505b826101800151156114cf576114ca818460c00151614182565b6114f0565b6114f08360c001518285602001516001876020015151038151811061147a57fe5b6114ff8361012001518661421d565b82600001516001600160a01b03167f21435c5b618d77ff3657140cd3318e2cffaebc5e0e1b7318f56a9ba4044c3ed284602001518560400151866060015187608001518860a001518960c001518a60e001518b61010001518c61012001516115758e61014001514361429690919063ffffffff16565b6101608f0151611586904290614296565b60405180806020018c6001600160a01b031681526020018b81526020018a81526020018915158152602001886001600160a01b0316815260200187815260200186815260200185815260200184815260200183815260200182810382528d818151815260200191508051906020019060200280838360005b838110156116165781810151838201526020016115fe565b505050509050019c5050505050505050505050505060405180910390a2600193505050505b600160005592915050565b600a6020526000908152604090205481565b61271081565b6001546001600160a01b031681565b60145481565b60096020526000908152604090205481565b6019602052600090815260409020805460028201546003830154600484015460058501546006860154600787015460088801546009890154600a8a0154600b909a01546001600160a01b03998a169a988a16999798969760ff808816986101009098049091169691168c565b6002546001600160a01b0316331461173e576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6000600260005414156117a8576040805162461bcd60e51b815260206004820152601f6024820152600080516020615cbd833981519152604482015290519081900360640190fd5b60026000556117b5615b5a565b60008481526017602090815260409182902082516101808101845281546001600160a01b031681526001820180548551818602810186019096528086529194929385810193929083018282801561183557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611817575b505050918352505060028201546001600160a01b039081166020830152600383015460408301526004830154606083015260058301546080830152600683015460ff908116151560a0840152600784015460c0840152600884015460e08401526009840154610100840152600a840154610120840152600b909301549092161515610140909101528151919250166118d157600191505061163b565b60006118ec82610120015183610140015184600001516142d8565b9050806118fe5760009250505061163b565b600085815260176020526040812080546001600160a01b0319168155906119286001830182615b3c565b506002810180546001600160a01b0319169055600060038201819055600482018190556005820181905560068201805460ff19908116909155600783018290556008830182905560098301829055600a830191909155600b90910180549091169055610160820151156119ac576119a782606001518360000151614182565b6119ca565b6119ca82600001518360600151846020015160008151811061147a57fe5b6119d98261010001518561421d565b81600001516001600160a01b03167f35b638e650e2328786fb405bd69d2083dbedc018d086662e74b775b4f1dae4bf83602001518460400151856060015186608001518760a001518860c001518960e001518a6101000151611a498c61012001514361429690919063ffffffff16565b6101408d0151611a5a904290614296565b60405180806020018b6001600160a01b031681526020018a8152602001898152602001888152602001871515815260200186815260200185815260200184815260200183815260200182810382528c818151815260200191508051906020019060200280838360005b83811015611adb578181015183820152602001611ac3565b505050509050019b50505050505050505050505060405180910390a2600192505050600160005592915050565b6002546001600160a01b03163314611b55576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b60078190556040805182815290517f21167d0d4661af93817ebce920f18986eed3d75d5e1c03f2aed05efcbafbc4529181900360200190a150565b6001546001600160a01b03163314611bdd576040805162461bcd60e51b81526020600482015260156024820152600080516020615cfe833981519152604482015290519081900360640190fd5b611bf06001600160a01b03831682614350565b5050565b600060026000541415611c3c576040805162461bcd60e51b815260206004820152601f6024820152600080516020615cbd833981519152604482015290519081900360640190fd5b6002600055611c49615b5a565b60008481526017602090815260409182902082516101808101845281546001600160a01b0316815260018201805485518186028101860190965280865291949293858101939290830182828015611cc957602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611cab575b505050918352505060028201546001600160a01b039081166020830152600383015460408301526004830154606083015260058301546080830152600683015460ff908116151560a0840152600784015460c0840152600884015460e08401526009840154610100840152600a840154610120840152600b90930154909216151561014090910152815191925016611d6557600191505061163b565b6000611d808261012001518361014001518460000151613b5b565b905080611d925760009250505061163b565b600085815260176020526040812080546001600160a01b031916815590611dbc6001830182615b3c565b506002810180546001600160a01b0319169055600060038201819055600482018190556005820181905560068201805460ff19908116909155600783018290556008830182905560098301829055600a830191909155600b90910180549091169055606082015115611eca57606082015160208301515160011015611e7957600354606084015160208501518051611e63936001600160a01b031692919060009061147a57fe5b611e768360200151846080015130614104565b90505b6000611e993385602001518487604001518860c001518960a00151614435565b60035460208601518051929350611ec7926001600160a01b0390921691849190600019810190811061147a57fe5b50505b815160208301518051611f089291906000198101908110611ee757fe5b602002602001015184604001518560a001518660c001518760e00151614514565b611f178261010001518561421d565b81600001516001600160a01b03167f1be316b94d38c07bd41cdb4913772d0a0a82802786a2f8b657b6e85dbcdfc64183602001518460400151856060015186608001518760a001518860c001518960e001518a6101000151611a498c61012001514361429690919063ffffffff16565b6002546001600160a01b03163314611fd4576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b60138290556014819055604080518381526020810183905281517febb0f666150f4be5b60c45df8f3e49992510b0128027fe58eea6110f296493bc929181900390910190a15050565b60026000541415612063576040805162461bcd60e51b815260206004820152601f6024820152600080516020615cbd833981519152604482015290519081900360640190fd5b6002600055600c548210156120a95760405162461bcd60e51b8152600401808060200182810382526024815260200180615c996024913960400191505060405180910390fd5b813410156120e85760405162461bcd60e51b8152600401808060200182810382526021815260200180615cdd6021913960400191505060405180910390fd5b8751600114806120f9575087516002145b6121345760405162461bcd60e51b8152600401808060200182810382526024815260200180615d496024913960400191505060405180910390fd5b60055488516001600160a01b0390911690899060009061215057fe5b60200260200101516001600160a01b0316146121a1576040805162461bcd60e51b815260206004820152601d6024820152600080516020615da7833981519152604482015290519081900360640190fd5b6121a9614a10565b6121b281614a7c565b60006121be3484614296565b90506121d3338a8a848b8b8b8b8b6001614af0565b5050600160005550505050505050565b6002546001600160a01b03163314612230576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b6001600160a01b038216600081815260156020908152604091829020805460ff1916851515908117909155825190815291517ffbabc02389290a451c6e600d05bf9887b99bfad39d8e1237e4e3df042e4941fe9281900390910190a25050565b60156020526000908152604090205460ff1681565b600e5481565b601054600160a01b900460ff1681565b6005546001600160a01b031681565b6002546001600160a01b03163314612317576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b600d839055600e829055600f819055604080518481526020810184905280820183905290517fb98e759701eaca2e60c25e91109003c1c7442ef731b5d569037063005da8254d9181900360600190a1505050565b601281815481106111bb57fe5b6002546001600160a01b031633146123c5576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b60068190556040805182815290517f974fd3c1fcb4653dfc4fb740c4c692cd212d55c28f163f310128cb64d83006759181900360200190a150565b600d5481565b6060612410615ab5565b60008381526019602090815260409182902082516101a08101845281546001600160a01b031681526001820180548551818602810186019096528086529194929385810193929083018282801561249057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612472575b505050918352505060028201546001600160a01b039081166020808401919091526003840154604084015260048401546060840152600584015460ff808216151560808601526101009182900490931660a0850152600685015460c0850152600785015460e08501526008850154908401526009840154610120840152600a840154610140840152600b909301541615156101609091015201519392505050565b600060026000541415612579576040805162461bcd60e51b815260206004820152601f6024820152600080516020615cbd833981519152604482015290519081900360640190fd5b6002600055612586615ab5565b60008481526019602090815260409182902082516101a08101845281546001600160a01b031681526001820180548551818602810186019096528086529194929385810193929083018282801561260657602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116125e8575b505050918352505060028201546001600160a01b0390811660208301526003830154604083015260048301546060830152600583015460ff8082161515608085015261010091829004831660a0850152600685015460c0850152600785015460e08501526008850154918401919091526009840154610120840152600a840154610140840152600b909301549092161515610160909101528151919250166126b257600191505061163b565b60006126cd82610140015183610160015184600001516142d8565b9050806126df5760009250505061163b565b600085815260196020526040812080546001600160a01b0319168155906127096001830182615b3c565b506002810180546001600160a01b0319169055600060038201819055600482018190556005820180546001600160a81b031916905560068201819055600782018190556008820181905560098201819055600a820155600b01805460ff1916905561012082015161277a908561421d565b81600001516001600160a01b03167f87abfd78e844f28318363bdf3da99eab2f4a2da9ff7ae365484507f7b6c3f80583602001518460400151856060015186608001518760a001518860c001518960e001518a61010001518b61012001516127f08d61014001514361429690919063ffffffff16565b6101608e0151612801904290614296565b60405180806020018c6001600160a01b031681526020018b81526020018a81526020018915158152602001886001600160a01b0316815260200187815260200186815260200185815260200184815260200183815260200182810382528d818151815260200191508051906020019060200280838360005b83811015612891578181015183820152602001612879565b505050509050019c5050505050505050505050505060405180910390a2600192505050600160005592915050565b6000828260405160200180836001600160a01b031660601b8152601401828152602001925050506040516020818303038152906040528051906020012090505b92915050565b60166020526000908152604090205481565b600c5481565b6010546001600160a01b031681565b60065481565b6001546001600160a01b0316331461297f576040805162461bcd60e51b81526020600482015260156024820152600080516020615cfe833981519152604482015290519081900360640190fd5b600280546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f5a272403b402d892977df56625f4164ccaf70ca3863991c43ecfe76a6905b0a19181900360200190a150565b6002546001600160a01b03163314612a20576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b60108054821515600160a01b810260ff60a01b199092169190911790915560408051918252517f4eb87a5935d402aa24c01b45bfb30adefcd2328b480f2d967864de4b64ea929f9181900360200190a150565b6060612a7d615b5a565b60008381526017602090815260409182902082516101808101845281546001600160a01b0316815260018201805485518186028101860190965280865291949293858101939290830182828015612afd57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612adf575b505050918352505060028201546001600160a01b0316602080830191909152600383015460408301526004830154606083015260058301546080830152600683015460ff908116151560a0840152600784015460c0840152600884015460e08401526009840154610100840152600a840154610120840152600b9093015490921615156101409091015201519392505050565b600b6020526000908152604090205481565b60075481565b3360009081526015602052604090205460ff16612bfa576040805162461bcd60e51b81526020600482015260196024820152600080516020615f0f833981519152604482015290519081900360640190fd5b601354601154808210612c0e575050611bf0565b80841115612c1a578093505b83821015612d8057600060118381548110612c3157fe5b90600052602060002001549050306001600160a01b03166327b42c0f82866040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050602060405180830381600087803b158015612c9557600080fd5b505af1925050508015612cba57506040513d6020811015612cb557600080fd5b505160015b612d4e576040805163225fc9fd60e01b8152600481018390526001600160a01b03861660248201529051309163225fc9fd9160448083019260209291908290030181600087803b158015612d0d57600080fd5b505af1925050508015612d3257506040513d6020811015612d2d57600080fd5b505160015b612d3b57612d49565b80612d47575050612d80565b505b612d5c565b80612d5a575050612d80565b505b60118381548110612d6957fe5b600091825260208220015550600190910190612c1a565b506013555050565b60135481565b6002546001600160a01b03163314612ddb576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b600880546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f828abcccea18192c21d645e575652c49e20b986dab777906fc473d056b01b6a89181900360200190a150565b60026000541415612e75576040805162461bcd60e51b815260206004820152601f6024820152600080516020615cbd833981519152604482015290519081900360640190fd5b6002600055600c54821015612ebb5760405162461bcd60e51b8152600401808060200182810382526024815260200180615c996024913960400191505060405180910390fd5b813414612ef95760405162461bcd60e51b8152600401808060200182810382526021815260200180615cdd6021913960400191505060405180910390fd5b885160011480612f0a575088516002145b612f455760405162461bcd60e51b8152600401808060200182810382526024815260200180615d496024913960400191505060405180910390fd5b612f4d614a10565b612f5681614a7c565b86156130085760045489516001600160a01b0390911690631b827878908b90600090612f7e57fe5b602002602001015133308b6040518563ffffffff1660e01b815260040180856001600160a01b03168152602001846001600160a01b03168152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015612fef57600080fd5b505af1158015613003573d6000803e3d6000fd5b505050505b6121d3338a8a8a8a8a8a8a8a6000614af0565b600f5481565b6001546001600160a01b0316331461306e576040805162461bcd60e51b81526020600482015260156024820152600080516020615cfe833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146130dd576040805162461bcd60e51b81526020600482015260156024820152600080516020615cfe833981519152604482015290519081900360640190fd5b826001600160a01b031663095ea7b383836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561313457600080fd5b505af1158015613148573d6000803e3d6000fd5b505050506040513d602081101561315e57600080fd5b5050505050565b6010546001600160a01b031633146131b2576040805162461bcd60e51b81526020600482015260196024820152600080516020615f0f833981519152604482015290519081900360640190fd5b600c548310156131f35760405162461bcd60e51b8152600401808060200182810382526024815260200180615c996024913960400191505060405180910390fd5b895160011480613204575089516002145b61323f5760405162461bcd60e51b8152600401808060200182810382526024815260200180615d496024913960400191505060405180910390fd5b613247614a10565b61325082614a7c565b80156132a257346132618985614dd0565b1461329d5760405162461bcd60e51b8152600401808060200182810382526021815260200180615cdd6021913960400191505060405180910390fd5b61338c565b3483146132e05760405162461bcd60e51b8152600401808060200182810382526021815260200180615cdd6021913960400191505060405180910390fd5b6004548a516001600160a01b0390911690631b827878908c9060009061330257fe5b60200260200101518d308c6040518563ffffffff1660e01b815260040180856001600160a01b03168152602001846001600160a01b03168152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561337357600080fd5b505af1158015613387573d6000803e3d6000fd5b505050505b61339e8b8b8b8b8b8b8b8b8b8a614af0565b5050505050505050505050565b600260005414156133f1576040805162461bcd60e51b815260206004820152601f6024820152600080516020615cbd833981519152604482015290519081900360640190fd5b6002600055600c548210156134375760405162461bcd60e51b8152600401808060200182810382526024815260200180615c996024913960400191505060405180910390fd5b8134146134755760405162461bcd60e51b8152600401808060200182810382526021815260200180615cdd6021913960400191505060405180910390fd5b895160011480613486575089516002145b6134c15760405162461bcd60e51b8152600401808060200182810382526024815260200180615d496024913960400191505060405180910390fd5b8015613539576005548a516001600160a01b03909116908b9060001981019081106134e857fe5b60200260200101516001600160a01b031614613539576040805162461bcd60e51b815260206004820152601d6024820152600080516020615da7833981519152604482015290519081900360640190fd5b613541614a10565b613554338b8b8b8b8b8b8b8b8b8b614e28565b505060016000555050505050505050565b6002546001600160a01b031633146135b2576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b60005b835181101561364d5760008482815181106135cc57fe5b602002602001015190508382815181106135e257fe5b6020026020010151600a6000836001600160a01b03166001600160a01b031681526020019081526020016000208190555082828151811061361f57fe5b6020908102919091018101516001600160a01b039092166000908152600b90915260409020556001016135b5565b507fae32d569b058895b9620d6552b09aaffedc9a6f396be4d595a224ad09f8b213983838360405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b838110156136ba5781810151838201526020016136a2565b50505050905001848103835286818151815260200191508051906020019060200280838360005b838110156136f95781810151838201526020016136e1565b50505050905001848103825285818151815260200191508051906020019060200280838360005b83811015613738578181015183820152602001613720565b50505050905001965050505050505060405180910390a1505050565b6002546001600160a01b031633146137a1576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b6001600160a01b038216600090815260096020526040902054806137c55750611bf0565b6001600160a01b0383166000818152600960205260408120556137e99083836140ad565b604080516001600160a01b0380861682528416602082015280820183905290517f4f1b51dd7a2fcb861aa2670f668be66835c4ee12b4bbbf037e4d0018f39819e49181900360600190a1505050565b60135460115460145460125490919293565b3360009081526015602052604090205460ff1661389c576040805162461bcd60e51b81526020600482015260196024820152600080516020615f0f833981519152604482015290519081900360640190fd5b6014546012548082106138b0575050611bf0565b808411156138bc578093505b83821015613a22576000601283815481106138d357fe5b90600052602060002001549050306001600160a01b0316630d4d003d82866040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050602060405180830381600087803b15801561393757600080fd5b505af192505050801561395c57506040513d602081101561395757600080fd5b505160015b6139f05760408051633051b17160e11b8152600481018390526001600160a01b0386166024820152905130916360a362e29160448083019260209291908290030181600087803b1580156139af57600080fd5b505af19250505080156139d457506040513d60208110156139cf57600080fd5b505160015b6139dd576139eb565b806139e9575050613a22565b505b6139fe565b806139fc575050613a22565b505b60128381548110613a0b57fe5b6000918252602082200155506001909101906138bc565b506014555050565b6002546001600160a01b031681565b6004546001600160a01b031681565b60186020526000908152604090205481565b6017602052600090815260409020805460028201546003830154600484015460058501546006860154600787015460088801546009890154600a8a0154600b909a01546001600160a01b03998a169a999098169896979596949560ff94851695939492939192168b565b6003546001600160a01b031681565b6002546001600160a01b03163314613b20576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b600c8190556040805182815290517f52a8358457e20bbb36e4086b83fb0749599f1893fe4c35a876c46dc4886d12db9181900360200190a150565b600042613b73600f5485614dd090919063ffffffff16565b11613baf5760405162461bcd60e51b8152600401808060200182810382526023815260200180615f7c6023913960400191505060405180910390fd5b600033301480613bce57503360009081526015602052604090205460ff165b601054909150600160a01b900460ff16158015613be9575080155b15613c29576040805162461bcd60e51b81526020600482015260196024820152600080516020615f0f833981519152604482015290519081900360640190fd5b8015613c4f5743613c45600d5487614dd090919063ffffffff16565b1115915050613cf3565b336001600160a01b03841614613c9a576040805162461bcd60e51b81526020600482015260196024820152600080516020615f0f833981519152604482015290519081900360640190fd5b42613cb0600e5486614dd090919063ffffffff16565b1115613ced5760405162461bcd60e51b8152600401808060200182810382526028815260200180615ebe6028913960400191505060405180910390fd5b60019150505b9392505050565b6003546000906001600160a01b03168415613dcb5782816001600160a01b03166381a612d68a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015613d5d57600080fd5b505afa158015613d71573d6000803e3d6000fd5b505050506040513d6020811015613d8757600080fd5b50511015613dc65760405162461bcd60e51b8152600401808060200182810382526030815260200180615ded6030913960400191505060405180910390fd5b613e82565b82816001600160a01b031663e124e6d28a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015613e1957600080fd5b505afa158015613e2d573d6000803e3d6000fd5b505050506040513d6020811015613e4357600080fd5b50511115613e825760405162461bcd60e51b8152600401808060200182810382526031815260200180615e8d6031913960400191505060405180910390fd5b6000816001600160a01b03166312d43a516040518163ffffffff1660e01b815260040160206040518083038186803b158015613ebd57600080fd5b505afa158015613ed1573d6000803e3d6000fd5b505050506040513d6020811015613ee757600080fd5b5051604080516306d63c1d60e41b81526001600160a01b038581166004830152915192935090831691636d63c1d09160248082019260009290919082900301818387803b158015613f3757600080fd5b505af1158015613f4b573d6000803e3d6000fd5b505050506000600460009054906101000a90046001600160a01b03166001600160a01b0316632662166b8d8d8d8d8d8d8d6040518863ffffffff1660e01b815260040180886001600160a01b03168152602001876001600160a01b03168152602001866001600160a01b031681526020018581526020018481526020018315158152602001826001600160a01b03168152602001975050505050505050602060405180830381600087803b15801561400257600080fd5b505af1158015614016573d6000803e3d6000fd5b505050506040513d602081101561402c57600080fd5b50516040805163d3c87bbb60e01b81526001600160a01b03868116600483015291519293509084169163d3c87bbb9160248082019260009290919082900301818387803b15801561407c57600080fd5b505af1158015614090573d6000803e3d6000fd5b5050505061409e8c8961514f565b9b9a5050505050505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526140ff9084906152d8565b505050565b600083516002141561414b576141448460008151811061412057fe5b60200260200101518560018151811061413557fe5b60200260200101518585615389565b9050613cf3565b60405162461bcd60e51b8152600401808060200182810382526029815260200180615ee66029913960400191505060405180910390fd5b60055460408051632e1a7d4d60e01b81526004810185905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b1580156141cf57600080fd5b505af11580156141e3573d6000803e3d6000fd5b50506040516001600160a01b038416925084156108fc02915084906000818181858888f193505050501580156140ff573d6000803e3d6000fd5b60055460408051632e1a7d4d60e01b81526004810185905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b15801561426a57600080fd5b505af115801561427e573d6000803e3d6000fd5b50611bf0925050506001600160a01b03821683614350565b6000613cf383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061545f565b60008033301480613bce57503360009081526015602052604090205460ff1660105490915060ff600160a01b90910416158015613be9575080613c29576040805162461bcd60e51b81526020600482015260196024820152600080516020615f0f833981519152604482015290519081900360640190fd5b804710156143a5576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d80600081146143f0576040519150601f19603f3d011682016040523d82523d6000602084013e6143f5565b606091505b50509050806140ff5760405162461bcd60e51b815260040180806020018281038252603a815260200180615d6d603a913960400191505060405180910390fd5b6000806144468888888888886154f6565b9050801561450557600061447d61271061447761447060065461271061429690919063ffffffff16565b8a906156d3565b9061572c565b9050600061448b8883614296565b905060008960018b51038151811061449f57fe5b602002602001015190506144e18260096000846001600160a01b03166001600160a01b0316815260200190815260200160002054614dd090919063ffffffff16565b6001600160a01b0390911660009081526009602052604090205550915061450a9050565b859150505b9695505050505050565b6003546001600160a01b031682156145e25781816001600160a01b031663e124e6d2876040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561457457600080fd5b505afa158015614588573d6000803e3d6000fd5b505050506040513d602081101561459e57600080fd5b505111156145dd5760405162461bcd60e51b8152600401808060200182810382526031815260200180615e8d6031913960400191505060405180910390fd5b614699565b81816001600160a01b03166381a612d6876040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561463057600080fd5b505afa158015614644573d6000803e3d6000fd5b505050506040513d602081101561465a57600080fd5b505110156146995760405162461bcd60e51b8152600401808060200182810382526030815260200180615ded6030913960400191505060405180910390fd5b821561478a576001600160a01b0385166000908152600a6020526040902054801580159061474857508061474686846001600160a01b031663f07456ce8a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561471457600080fd5b505afa158015614728573d6000803e3d6000fd5b505050506040513d602081101561473e57600080fd5b505190614dd0565b115b156147845760405162461bcd60e51b815260040180806020018281038252602e815260200180615c6b602e913960400191505060405180910390fd5b5061483f565b6001600160a01b0385166000908152600b602052604090205480158015906148015750806147ff86846001600160a01b0316638a78daa88a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561471457600080fd5b115b1561483d5760405162461bcd60e51b815260040180806020018281038252602f815260200180615e3d602f913960400191505060405180910390fd5b505b6000816001600160a01b03166312d43a516040518163ffffffff1660e01b815260040160206040518083038186803b15801561487a57600080fd5b505afa15801561488e573d6000803e3d6000fd5b505050506040513d60208110156148a457600080fd5b5051604080516306d63c1d60e41b81526001600160a01b038581166004830152915192935090831691636d63c1d09160248082019260009290919082900301818387803b1580156148f457600080fd5b505af1158015614908573d6000803e3d6000fd5b50506004805460408051630f8ee8bb60e11b81526001600160a01b038e8116948201949094528c841660248201528b84166044820152606481018b905289151560848201529051929091169350631f1dd176925060a48082019260009290919082900301818387803b15801561497d57600080fd5b505af1158015614991573d6000803e3d6000fd5b50505050806001600160a01b031663d3c87bbb836040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156149e457600080fd5b505af11580156149f8573d6000803e3d6000fd5b50505050614a06888661576b565b5050505050505050565b3415614a7a57600560009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015614a6657600080fd5b505af115801561315e573d6000803e3d6000fd5b565b8015801590614a9557506008546001600160a01b031615155b15614aed57600854604080516356b4b2ad60e01b81523360048201526024810184905290516001600160a01b03909216916356b4b2ad9160448082019260009290919082900301818387803b158015614a6657600080fd5b50565b6001600160a01b038a16600090815260166020526040812054614b14906001614dd0565b6001600160a01b038c1660009081526016602052604090208190559050614b39615b5a565b6040518061018001604052808d6001600160a01b031681526020018c81526020018b6001600160a01b031681526020018a8152602001898152602001888152602001871515815260200186815260200185815260200143815260200142815260200184151581525090506000614baf8d846128bf565b6000818152601760209081526040909120845181546001600160a01b0319166001600160a01b0390911617815584820151805193945085939192614bfb92600185019290910190615bd1565b5060408201518160020160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff02191690831515021790555060e082015181600701556101008201518160080155610120820151816009015561014082015181600a015561016082015181600b0160006101000a81548160ff02191690831515021790555090505060118190806001815401808255809150506001900390600052602060002001600090919091909150558c6001600160a01b03167fa89f00a1c1cd0de066abac1a05f9314520fef2a9b98f6a99ff4548ed1161c03c8d8d8d8d8d8d8d8d8c43423a60405180806020018d6001600160a01b031681526020018c81526020018b81526020018a8152602001891515815260200188815260200187815260200186815260200185815260200184815260200183815260200182810382528e818151815260200191508051906020019060200280838360005b83811015614da3578181015183820152602001614d8b565b505050509050019d505050505050505050505050505060405180910390a250505050505050505050505050565b600082820183811015613cf3576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b6001600160a01b038b16600090815260186020526040812054614e4c906001614dd0565b6001600160a01b038d1660009081526018602052604090208190559050614e71615ab5565b604051806101a001604052808e6001600160a01b031681526020018d81526020018c6001600160a01b031681526020018b81526020018a81526020018915158152602001886001600160a01b0316815260200187815260200186815260200185815260200143815260200142815260200184151581525090506000614ef68e846128bf565b6000818152601960209081526040909120845181546001600160a01b0319166001600160a01b0390911617815584820151805193945085939192614f4292600185019290910190615bd1565b5060408201518160020160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550606082015181600301556080820151816004015560a08201518160050160006101000a81548160ff02191690831515021790555060c08201518160050160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060e0820151816006015561010082015181600701556101208201518160080155610140820151816009015561016082015181600a015561018082015181600b0160006101000a81548160ff02191690831515021790555090505060128190806001815401808255809150506001900390600052602060002001600090919091909150558d6001600160a01b03167f506f2634e4508d88b04b7511af75c6d4c29b2b6f4f5067676b9400b28f3761d28e8e8e8e8e8e8e8e8e8d434260405180806020018d6001600160a01b031681526020018c81526020018b81526020018a15158152602001896001600160a01b0316815260200188815260200187815260200186815260200185815260200184815260200183815260200182810382528e818151815260200191508051906020019060200280838360005b83811015615121578181015183820152602001615109565b505050509050019d505050505050505050505050505060405180910390a25050505050505050505050505050565b6008546001600160a01b0316806151665750611bf0565b600080826001600160a01b031663534ef883866040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050604080518083038186803b1580156151b557600080fd5b505afa1580156151c9573d6000803e3d6000fd5b505050506040513d60408110156151df57600080fd5b5080516020909101519092509050816151fa57505050611bf0565b7f474c763ff84bf2c2039a6d9fea955ecd0f724030e3c365b91169c6a16fe751b78585600360009054906101000a90046001600160a01b03166001600160a01b031663318bc6896040518163ffffffff1660e01b815260040160206040518083038186803b15801561526b57600080fd5b505afa15801561527f573d6000803e3d6000fd5b505050506040513d602081101561529557600080fd5b5051604080516001600160a01b03948516815260208101939093528281019190915260608201869052918416608082015290519081900360a00190a15050505050565b606061532d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166158719092919063ffffffff16565b8051909150156140ff5780806020019051602081101561534c57600080fd5b50516140ff5760405162461bcd60e51b815260040180806020018281038252602a815260200180615f52602a913960400191505060405180910390fd5b60035460408051634998b10960e11b81526001600160a01b03878116600483015286811660248301528481166044830152915160009384931691639331621291606480830192602092919082900301818787803b1580156153e957600080fd5b505af11580156153fd573d6000803e3d6000fd5b505050506040513d602081101561541357600080fd5b50519050838110156154565760405162461bcd60e51b815260040180806020018281038252602b815260200180615d1e602b913960400191505060405180910390fd5b95945050505050565b600081848411156154ee5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156154b357818101518382015260200161549b565b50505050905090810190601f1680156154e05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000826155055750600061450a565b816155125750600161450a565b60008660018851038151811061552457fe5b602090810291909101015160035460408051634a3f088d60e01b81526001600160a01b038c81166004830152808516602483015289811660448301528815156064830152915193945091169160009182918491634a3f088d91608480830192610100929190829003018186803b15801561559d57600080fd5b505afa1580156155b1573d6000803e3d6000fd5b505050506040513d6101008110156155c857600080fd5b5080516020909101519092509050816155e857600094505050505061450a565b60006155f48388614dd0565b90506000846001600160a01b0316630a48d5a9878d6040518363ffffffff1660e01b815260040180836001600160a01b031681526020018281526020019250505060206040518083038186803b15801561564d57600080fd5b505afa158015615661573d6000803e3d6000fd5b505050506040513d602081101561567757600080fd5b5051905060006156878483614dd0565b9050600061569b85614477886127106156d3565b905060006156bc8361447760075461271001886156d390919063ffffffff16565b919091109f9e505050505050505050505050505050565b6000826156e2575060006128ff565b828202828482816156ef57fe5b0414613cf35760405162461bcd60e51b8152600401808060200182810382526021815260200180615e6c6021913960400191505060405180910390fd5b6000613cf383836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b815250615888565b6008546001600160a01b0316806157825750611bf0565b600080826001600160a01b031663534ef883866040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050604080518083038186803b1580156157d157600080fd5b505afa1580156157e5573d6000803e3d6000fd5b505050506040513d60408110156157fb57600080fd5b5080516020918201516003546040805163318bc68960e01b815290519396509194507fc2414023ce7002ee98557d1e7be21e5559073336f2217ee5f9b2e50fd85f71ee93899389936001600160a01b039093169263318bc689926004808301939192829003018186803b15801561526b57600080fd5b606061588084846000856158ed565b949350505050565b600081836158d75760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156154b357818101518382015260200161549b565b5060008385816158e357fe5b0495945050505050565b60608247101561592e5760405162461bcd60e51b8152600401808060200182810382526026815260200180615dc76026913960400191505060405180910390fd5b61593785615a49565b615988576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106159c75780518252601f1990920191602091820191016159a8565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114615a29576040519150601f19603f3d011682016040523d82523d6000602084013e615a2e565b606091505b5091509150615a3e828286615a4f565b979650505050505050565b3b151590565b60608315615a5e575081613cf3565b825115615a6e5782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156154b357818101518382015260200161549b565b604051806101a0016040528060006001600160a01b031681526020016060815260200160006001600160a01b03168152602001600081526020016000815260200160001515815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b5080546000825590600052602060002090810190614aed9190615c36565b60405180610180016040528060006001600160a01b031681526020016060815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600015158152602001600081526020016000815260200160008152602001600081526020016000151581525090565b828054828255906000526020600020908101928215615c26579160200282015b82811115615c2657825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190615bf1565b50615c32929150615c4b565b5090565b5b80821115615c325760008155600101615c37565b5b80821115615c325780546001600160a01b0319168155600101615c4c56fe42617365506f736974696f6e4d616e616765723a206d617820676c6f62616c206c6f6e6773206578636565646564506f736974696f6e526f757465723a20696e76616c696420657865637574696f6e4665655265656e7472616e637947756172643a207265656e7472616e742063616c6c00506f736974696f6e526f757465723a20696e76616c6964206d73672e76616c7565476f7665726e61626c653a20666f7262696464656e000000000000000000000042617365506f736974696f6e4d616e616765723a20696e73756666696369656e7420616d6f756e744f7574506f736974696f6e526f757465723a20696e76616c6964205f70617468206c656e677468416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564506f736974696f6e526f757465723a20696e76616c6964205f70617468000000416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c42617365506f736974696f6e4d616e616765723a206d61726b207072696365206c6f776572207468616e206c696d697442617365506f736974696f6e4d616e616765723a20666f7262696464656e000042617365506f736974696f6e4d616e616765723a206d617820676c6f62616c2073686f727473206578636565646564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7742617365506f736974696f6e4d616e616765723a206d61726b20707269636520686967686572207468616e206c696d6974506f736974696f6e526f757465723a206d696e2064656c6179206e6f74207965742070617373656442617365506f736974696f6e4d616e616765723a20696e76616c6964205f706174682e6c656e677468506f736974696f6e526f757465723a20666f7262696464656e0000000000000042617365506f736974696f6e4d616e616765723a20696e76616c69642073656e6465725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564506f736974696f6e526f757465723a2072657175657374206861732065787069726564a2646970667358221220b3e4baece2937428daeb935a22c8334dd87510290c58dc7290ba7ab11665cf9e64736f6c634300060c0033000000000000000000000000dfba8ad57d2c62f61f0a60b2c508bcdeb182f8550000000000000000000000003cd2f02b9e39ccc781d0c07fc0286f654e53a76d00000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000886c98b76000

Deployed Bytecode

0x60806040526004361061027e5760003560e01c80626cc35e146102d357806304225954146103045780630d4d003d146103405780631045c74e1461038d578063126082cf146103c057806312d43a51146103d55780631bca8cf0146103ea5780631ce9cb8f146103ff5780631f285106146104325780632092d9fd146104de578063225fc9fd14610511578063233bfe3b1461054a57806324a084df1461057457806327b42c0f146105ad578063308aa81f146105e6578063332e0382146106165780633422ead1146106e657806336eba48a146107215780633a2a80c7146107545780633e72a262146107695780633fc8cef31461077e5780634067b132146107935780634278555f146107c9578063490ae210146107f35780635841fcaa1461081d5780635d5c22e81461083257806360a362e2146108ac57806362f8a3fe146108e5578063633451de1461091e57806363ae2103146109515780636730a3851461096657806367a527931461097b578063704b6c02146109905780637c2eb9f7146109c357806395e9bbd7146109ef5780639698d25a14610a1957806398d1e03a14610a4c5780639a20810014610a615780639b57862014610a9a578063ae4d7f9a14610aaf578063c987417014610ae2578063cb0269c914610bb8578063cfad57a214610bcd578063e1f21c6714610c00578063e24dd40414610c43578063e70dd2fc14610d32578063ef12c67e14610e14578063f255527814610fc6578063f2cea6a514611001578063f3883d8b1461103c578063f851a44014611075578063f887ea401461108a578063fa4445771461109f578063faf990f3146110d2578063fbfa77cf14611160578063fc2cee6214611175576102ce565b366102ce576005546001600160a01b031633146102cc5760405162461bcd60e51b8152600401808060200182810382526023815260200180615f2f6023913960400191505060405180910390fd5b005b600080fd5b3480156102df57600080fd5b506102e861119f565b604080516001600160a01b039092168252519081900360200190f35b34801561031057600080fd5b5061032e6004803603602081101561032757600080fd5b50356111ae565b60408051918252519081900360200190f35b34801561034c57600080fd5b506103796004803603604081101561036357600080fd5b50803590602001356001600160a01b03166111cc565b604080519115158252519081900360200190f35b34801561039957600080fd5b5061032e600480360360208110156103b057600080fd5b50356001600160a01b0316611646565b3480156103cc57600080fd5b5061032e611658565b3480156103e157600080fd5b506102e861165e565b3480156103f657600080fd5b5061032e61166d565b34801561040b57600080fd5b5061032e6004803603602081101561042257600080fd5b50356001600160a01b0316611673565b34801561043e57600080fd5b5061045c6004803603602081101561045557600080fd5b5035611685565b604051808d6001600160a01b031681526020018c6001600160a01b031681526020018b81526020018a81526020018915158152602001886001600160a01b0316815260200187815260200186815260200185815260200184815260200183815260200182151581526020019c5050505050505050505050505060405180910390f35b3480156104ea57600080fd5b506102cc6004803603602081101561050157600080fd5b50356001600160a01b03166116f1565b34801561051d57600080fd5b506103796004803603604081101561053457600080fd5b50803590602001356001600160a01b0316611760565b34801561055657600080fd5b506102cc6004803603602081101561056d57600080fd5b5035611b08565b34801561058057600080fd5b506102cc6004803603604081101561059757600080fd5b506001600160a01b038135169060200135611b90565b3480156105b957600080fd5b50610379600480360360408110156105d057600080fd5b50803590602001356001600160a01b0316611bf4565b3480156105f257600080fd5b506102cc6004803603604081101561060957600080fd5b5080359060200135611f87565b6102cc600480360361010081101561062d57600080fd5b810190602081018135600160201b81111561064757600080fd5b82018360208201111561065957600080fd5b803590602001918460208302840111600160201b8311171561067a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013515159060808101359060a08101359060c0013561201d565b3480156106f257600080fd5b506102cc6004803603604081101561070957600080fd5b506001600160a01b03813516906020013515156121e3565b34801561072d57600080fd5b506103796004803603602081101561074457600080fd5b50356001600160a01b0316612290565b34801561076057600080fd5b5061032e6122a5565b34801561077557600080fd5b506103796122ab565b34801561078a57600080fd5b506102e86122bb565b34801561079f57600080fd5b506102cc600480360360608110156107b657600080fd5b50803590602081013590604001356122ca565b3480156107d557600080fd5b5061032e600480360360208110156107ec57600080fd5b503561236b565b3480156107ff57600080fd5b506102cc6004803603602081101561081657600080fd5b5035612378565b34801561082957600080fd5b5061032e612400565b34801561083e57600080fd5b5061085c6004803603602081101561085557600080fd5b5035612406565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610898578181015183820152602001610880565b505050509050019250505060405180910390f35b3480156108b857600080fd5b50610379600480360360408110156108cf57600080fd5b50803590602001356001600160a01b0316612531565b3480156108f157600080fd5b5061032e6004803603604081101561090857600080fd5b506001600160a01b0381351690602001356128bf565b34801561092a57600080fd5b5061032e6004803603602081101561094157600080fd5b50356001600160a01b0316612905565b34801561095d57600080fd5b5061032e612917565b34801561097257600080fd5b506102e861291d565b34801561098757600080fd5b5061032e61292c565b34801561099c57600080fd5b506102cc600480360360208110156109b357600080fd5b50356001600160a01b0316612932565b3480156109cf57600080fd5b506102cc600480360360208110156109e657600080fd5b503515156129d3565b3480156109fb57600080fd5b5061085c60048036036020811015610a1257600080fd5b5035612a73565b348015610a2557600080fd5b5061032e60048036036020811015610a3c57600080fd5b50356001600160a01b0316612b90565b348015610a5857600080fd5b5061032e612ba2565b348015610a6d57600080fd5b506102cc60048036036040811015610a8457600080fd5b50803590602001356001600160a01b0316612ba8565b348015610aa657600080fd5b5061032e612d88565b348015610abb57600080fd5b506102cc60048036036020811015610ad257600080fd5b50356001600160a01b0316612d8e565b6102cc6004803603610120811015610af957600080fd5b810190602081018135600160201b811115610b1357600080fd5b820183602082011115610b2557600080fd5b803590602001918460208302840111600160201b83111715610b4657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013590608081013515159060a08101359060c08101359060e00135612e2f565b348015610bc457600080fd5b5061032e61301b565b348015610bd957600080fd5b506102cc60048036036020811015610bf057600080fd5b50356001600160a01b0316613021565b348015610c0c57600080fd5b506102cc60048036036060811015610c2357600080fd5b506001600160a01b03813581169160208101359091169060400135613090565b6102cc6004803603610160811015610c5a57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b811115610c8457600080fd5b820183602082011115610c9657600080fd5b803590602001918460208302840111600160201b83111715610cb757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013590608081013515159060a08101359060c08101359060e08101359061010001351515613165565b6102cc6004803603610140811015610d4957600080fd5b810190602081018135600160201b811115610d6357600080fd5b820183602082011115610d7557600080fd5b803590602001918460208302840111600160201b83111715610d9657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505081356001600160a01b0390811693506020830135926040810135925060608101351515916080820135169060a08101359060c08101359060e081013590610100013515156133ab565b348015610e2057600080fd5b506102cc60048036036060811015610e3757600080fd5b810190602081018135600160201b811115610e5157600080fd5b820183602082011115610e6357600080fd5b803590602001918460208302840111600160201b83111715610e8457600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610ed357600080fd5b820183602082011115610ee557600080fd5b803590602001918460208302840111600160201b83111715610f0657600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610f5557600080fd5b820183602082011115610f6757600080fd5b803590602001918460208302840111600160201b83111715610f8857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550613565945050505050565b348015610fd257600080fd5b506102cc60048036036040811015610fe957600080fd5b506001600160a01b0381358116916020013516613754565b34801561100d57600080fd5b50611016613838565b604080519485526020850193909352838301919091526060830152519081900360800190f35b34801561104857600080fd5b506102cc6004803603604081101561105f57600080fd5b50803590602001356001600160a01b031661384a565b34801561108157600080fd5b506102e8613a2a565b34801561109657600080fd5b506102e8613a39565b3480156110ab57600080fd5b5061032e600480360360208110156110c257600080fd5b50356001600160a01b0316613a48565b3480156110de57600080fd5b506110fc600480360360208110156110f557600080fd5b5035613a5a565b604080516001600160a01b039c8d1681529a909b1660208b0152898b01989098526060890196909652608088019490945291151560a087015260c086015260e085015261010084015261012083015215156101408201529051908190036101600190f35b34801561116c57600080fd5b506102e8613ac4565b34801561118157600080fd5b506102cc6004803603602081101561119857600080fd5b5035613ad3565b6008546001600160a01b031681565b601181815481106111bb57fe5b600091825260209091200154905081565b600060026000541415611214576040805162461bcd60e51b815260206004820152601f6024820152600080516020615cbd833981519152604482015290519081900360640190fd5b6002600055611221615ab5565b60008481526019602090815260409182902082516101a08101845281546001600160a01b03168152600182018054855181860281018601909652808652919492938581019392908301828280156112a157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611283575b505050918352505060028201546001600160a01b0390811660208301526003830154604083015260048301546060830152600583015460ff8082161515608085015261010091829004831660a0850152600685015460c0850152600785015460e08501526008850154918401919091526009840154610120840152600a840154610140840152600b9093015490921615156101609091015281519192501661134d57600191505061163b565b60006113688261014001518361016001518460000151613b5b565b90508061137a5760009250505061163b565b600085815260196020526040812080546001600160a01b0319168155906113a46001830182615b3c565b506002810180546001600160a01b0319169055600060038201819055600482018190556005820180546001600160a81b031916905560068201819055600782018190556008820181905560098201819055600a8201819055600b909101805460ff19169055825160208401518051611447929190849061142057fe5b60200260200101518560400151866060015187608001518860a00151308a60e00151613cfa565b9050600183602001515111156114b1576003546020840151805161149a926001600160a01b031691849160009061147a57fe5b60200260200101516001600160a01b03166140ad9092919063ffffffff16565b6114ae836020015184610100015130614104565b90505b826101800151156114cf576114ca818460c00151614182565b6114f0565b6114f08360c001518285602001516001876020015151038151811061147a57fe5b6114ff8361012001518661421d565b82600001516001600160a01b03167f21435c5b618d77ff3657140cd3318e2cffaebc5e0e1b7318f56a9ba4044c3ed284602001518560400151866060015187608001518860a001518960c001518a60e001518b61010001518c61012001516115758e61014001514361429690919063ffffffff16565b6101608f0151611586904290614296565b60405180806020018c6001600160a01b031681526020018b81526020018a81526020018915158152602001886001600160a01b0316815260200187815260200186815260200185815260200184815260200183815260200182810382528d818151815260200191508051906020019060200280838360005b838110156116165781810151838201526020016115fe565b505050509050019c5050505050505050505050505060405180910390a2600193505050505b600160005592915050565b600a6020526000908152604090205481565b61271081565b6001546001600160a01b031681565b60145481565b60096020526000908152604090205481565b6019602052600090815260409020805460028201546003830154600484015460058501546006860154600787015460088801546009890154600a8a0154600b909a01546001600160a01b03998a169a988a16999798969760ff808816986101009098049091169691168c565b6002546001600160a01b0316331461173e576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6000600260005414156117a8576040805162461bcd60e51b815260206004820152601f6024820152600080516020615cbd833981519152604482015290519081900360640190fd5b60026000556117b5615b5a565b60008481526017602090815260409182902082516101808101845281546001600160a01b031681526001820180548551818602810186019096528086529194929385810193929083018282801561183557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611817575b505050918352505060028201546001600160a01b039081166020830152600383015460408301526004830154606083015260058301546080830152600683015460ff908116151560a0840152600784015460c0840152600884015460e08401526009840154610100840152600a840154610120840152600b909301549092161515610140909101528151919250166118d157600191505061163b565b60006118ec82610120015183610140015184600001516142d8565b9050806118fe5760009250505061163b565b600085815260176020526040812080546001600160a01b0319168155906119286001830182615b3c565b506002810180546001600160a01b0319169055600060038201819055600482018190556005820181905560068201805460ff19908116909155600783018290556008830182905560098301829055600a830191909155600b90910180549091169055610160820151156119ac576119a782606001518360000151614182565b6119ca565b6119ca82600001518360600151846020015160008151811061147a57fe5b6119d98261010001518561421d565b81600001516001600160a01b03167f35b638e650e2328786fb405bd69d2083dbedc018d086662e74b775b4f1dae4bf83602001518460400151856060015186608001518760a001518860c001518960e001518a6101000151611a498c61012001514361429690919063ffffffff16565b6101408d0151611a5a904290614296565b60405180806020018b6001600160a01b031681526020018a8152602001898152602001888152602001871515815260200186815260200185815260200184815260200183815260200182810382528c818151815260200191508051906020019060200280838360005b83811015611adb578181015183820152602001611ac3565b505050509050019b50505050505050505050505060405180910390a2600192505050600160005592915050565b6002546001600160a01b03163314611b55576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b60078190556040805182815290517f21167d0d4661af93817ebce920f18986eed3d75d5e1c03f2aed05efcbafbc4529181900360200190a150565b6001546001600160a01b03163314611bdd576040805162461bcd60e51b81526020600482015260156024820152600080516020615cfe833981519152604482015290519081900360640190fd5b611bf06001600160a01b03831682614350565b5050565b600060026000541415611c3c576040805162461bcd60e51b815260206004820152601f6024820152600080516020615cbd833981519152604482015290519081900360640190fd5b6002600055611c49615b5a565b60008481526017602090815260409182902082516101808101845281546001600160a01b0316815260018201805485518186028101860190965280865291949293858101939290830182828015611cc957602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611cab575b505050918352505060028201546001600160a01b039081166020830152600383015460408301526004830154606083015260058301546080830152600683015460ff908116151560a0840152600784015460c0840152600884015460e08401526009840154610100840152600a840154610120840152600b90930154909216151561014090910152815191925016611d6557600191505061163b565b6000611d808261012001518361014001518460000151613b5b565b905080611d925760009250505061163b565b600085815260176020526040812080546001600160a01b031916815590611dbc6001830182615b3c565b506002810180546001600160a01b0319169055600060038201819055600482018190556005820181905560068201805460ff19908116909155600783018290556008830182905560098301829055600a830191909155600b90910180549091169055606082015115611eca57606082015160208301515160011015611e7957600354606084015160208501518051611e63936001600160a01b031692919060009061147a57fe5b611e768360200151846080015130614104565b90505b6000611e993385602001518487604001518860c001518960a00151614435565b60035460208601518051929350611ec7926001600160a01b0390921691849190600019810190811061147a57fe5b50505b815160208301518051611f089291906000198101908110611ee757fe5b602002602001015184604001518560a001518660c001518760e00151614514565b611f178261010001518561421d565b81600001516001600160a01b03167f1be316b94d38c07bd41cdb4913772d0a0a82802786a2f8b657b6e85dbcdfc64183602001518460400151856060015186608001518760a001518860c001518960e001518a6101000151611a498c61012001514361429690919063ffffffff16565b6002546001600160a01b03163314611fd4576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b60138290556014819055604080518381526020810183905281517febb0f666150f4be5b60c45df8f3e49992510b0128027fe58eea6110f296493bc929181900390910190a15050565b60026000541415612063576040805162461bcd60e51b815260206004820152601f6024820152600080516020615cbd833981519152604482015290519081900360640190fd5b6002600055600c548210156120a95760405162461bcd60e51b8152600401808060200182810382526024815260200180615c996024913960400191505060405180910390fd5b813410156120e85760405162461bcd60e51b8152600401808060200182810382526021815260200180615cdd6021913960400191505060405180910390fd5b8751600114806120f9575087516002145b6121345760405162461bcd60e51b8152600401808060200182810382526024815260200180615d496024913960400191505060405180910390fd5b60055488516001600160a01b0390911690899060009061215057fe5b60200260200101516001600160a01b0316146121a1576040805162461bcd60e51b815260206004820152601d6024820152600080516020615da7833981519152604482015290519081900360640190fd5b6121a9614a10565b6121b281614a7c565b60006121be3484614296565b90506121d3338a8a848b8b8b8b8b6001614af0565b5050600160005550505050505050565b6002546001600160a01b03163314612230576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b6001600160a01b038216600081815260156020908152604091829020805460ff1916851515908117909155825190815291517ffbabc02389290a451c6e600d05bf9887b99bfad39d8e1237e4e3df042e4941fe9281900390910190a25050565b60156020526000908152604090205460ff1681565b600e5481565b601054600160a01b900460ff1681565b6005546001600160a01b031681565b6002546001600160a01b03163314612317576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b600d839055600e829055600f819055604080518481526020810184905280820183905290517fb98e759701eaca2e60c25e91109003c1c7442ef731b5d569037063005da8254d9181900360600190a1505050565b601281815481106111bb57fe5b6002546001600160a01b031633146123c5576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b60068190556040805182815290517f974fd3c1fcb4653dfc4fb740c4c692cd212d55c28f163f310128cb64d83006759181900360200190a150565b600d5481565b6060612410615ab5565b60008381526019602090815260409182902082516101a08101845281546001600160a01b031681526001820180548551818602810186019096528086529194929385810193929083018282801561249057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612472575b505050918352505060028201546001600160a01b039081166020808401919091526003840154604084015260048401546060840152600584015460ff808216151560808601526101009182900490931660a0850152600685015460c0850152600785015460e08501526008850154908401526009840154610120840152600a840154610140840152600b909301541615156101609091015201519392505050565b600060026000541415612579576040805162461bcd60e51b815260206004820152601f6024820152600080516020615cbd833981519152604482015290519081900360640190fd5b6002600055612586615ab5565b60008481526019602090815260409182902082516101a08101845281546001600160a01b031681526001820180548551818602810186019096528086529194929385810193929083018282801561260657602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116125e8575b505050918352505060028201546001600160a01b0390811660208301526003830154604083015260048301546060830152600583015460ff8082161515608085015261010091829004831660a0850152600685015460c0850152600785015460e08501526008850154918401919091526009840154610120840152600a840154610140840152600b909301549092161515610160909101528151919250166126b257600191505061163b565b60006126cd82610140015183610160015184600001516142d8565b9050806126df5760009250505061163b565b600085815260196020526040812080546001600160a01b0319168155906127096001830182615b3c565b506002810180546001600160a01b0319169055600060038201819055600482018190556005820180546001600160a81b031916905560068201819055600782018190556008820181905560098201819055600a820155600b01805460ff1916905561012082015161277a908561421d565b81600001516001600160a01b03167f87abfd78e844f28318363bdf3da99eab2f4a2da9ff7ae365484507f7b6c3f80583602001518460400151856060015186608001518760a001518860c001518960e001518a61010001518b61012001516127f08d61014001514361429690919063ffffffff16565b6101608e0151612801904290614296565b60405180806020018c6001600160a01b031681526020018b81526020018a81526020018915158152602001886001600160a01b0316815260200187815260200186815260200185815260200184815260200183815260200182810382528d818151815260200191508051906020019060200280838360005b83811015612891578181015183820152602001612879565b505050509050019c5050505050505050505050505060405180910390a2600192505050600160005592915050565b6000828260405160200180836001600160a01b031660601b8152601401828152602001925050506040516020818303038152906040528051906020012090505b92915050565b60166020526000908152604090205481565b600c5481565b6010546001600160a01b031681565b60065481565b6001546001600160a01b0316331461297f576040805162461bcd60e51b81526020600482015260156024820152600080516020615cfe833981519152604482015290519081900360640190fd5b600280546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f5a272403b402d892977df56625f4164ccaf70ca3863991c43ecfe76a6905b0a19181900360200190a150565b6002546001600160a01b03163314612a20576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b60108054821515600160a01b810260ff60a01b199092169190911790915560408051918252517f4eb87a5935d402aa24c01b45bfb30adefcd2328b480f2d967864de4b64ea929f9181900360200190a150565b6060612a7d615b5a565b60008381526017602090815260409182902082516101808101845281546001600160a01b0316815260018201805485518186028101860190965280865291949293858101939290830182828015612afd57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612adf575b505050918352505060028201546001600160a01b0316602080830191909152600383015460408301526004830154606083015260058301546080830152600683015460ff908116151560a0840152600784015460c0840152600884015460e08401526009840154610100840152600a840154610120840152600b9093015490921615156101409091015201519392505050565b600b6020526000908152604090205481565b60075481565b3360009081526015602052604090205460ff16612bfa576040805162461bcd60e51b81526020600482015260196024820152600080516020615f0f833981519152604482015290519081900360640190fd5b601354601154808210612c0e575050611bf0565b80841115612c1a578093505b83821015612d8057600060118381548110612c3157fe5b90600052602060002001549050306001600160a01b03166327b42c0f82866040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050602060405180830381600087803b158015612c9557600080fd5b505af1925050508015612cba57506040513d6020811015612cb557600080fd5b505160015b612d4e576040805163225fc9fd60e01b8152600481018390526001600160a01b03861660248201529051309163225fc9fd9160448083019260209291908290030181600087803b158015612d0d57600080fd5b505af1925050508015612d3257506040513d6020811015612d2d57600080fd5b505160015b612d3b57612d49565b80612d47575050612d80565b505b612d5c565b80612d5a575050612d80565b505b60118381548110612d6957fe5b600091825260208220015550600190910190612c1a565b506013555050565b60135481565b6002546001600160a01b03163314612ddb576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b600880546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f828abcccea18192c21d645e575652c49e20b986dab777906fc473d056b01b6a89181900360200190a150565b60026000541415612e75576040805162461bcd60e51b815260206004820152601f6024820152600080516020615cbd833981519152604482015290519081900360640190fd5b6002600055600c54821015612ebb5760405162461bcd60e51b8152600401808060200182810382526024815260200180615c996024913960400191505060405180910390fd5b813414612ef95760405162461bcd60e51b8152600401808060200182810382526021815260200180615cdd6021913960400191505060405180910390fd5b885160011480612f0a575088516002145b612f455760405162461bcd60e51b8152600401808060200182810382526024815260200180615d496024913960400191505060405180910390fd5b612f4d614a10565b612f5681614a7c565b86156130085760045489516001600160a01b0390911690631b827878908b90600090612f7e57fe5b602002602001015133308b6040518563ffffffff1660e01b815260040180856001600160a01b03168152602001846001600160a01b03168152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015612fef57600080fd5b505af1158015613003573d6000803e3d6000fd5b505050505b6121d3338a8a8a8a8a8a8a8a6000614af0565b600f5481565b6001546001600160a01b0316331461306e576040805162461bcd60e51b81526020600482015260156024820152600080516020615cfe833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146130dd576040805162461bcd60e51b81526020600482015260156024820152600080516020615cfe833981519152604482015290519081900360640190fd5b826001600160a01b031663095ea7b383836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561313457600080fd5b505af1158015613148573d6000803e3d6000fd5b505050506040513d602081101561315e57600080fd5b5050505050565b6010546001600160a01b031633146131b2576040805162461bcd60e51b81526020600482015260196024820152600080516020615f0f833981519152604482015290519081900360640190fd5b600c548310156131f35760405162461bcd60e51b8152600401808060200182810382526024815260200180615c996024913960400191505060405180910390fd5b895160011480613204575089516002145b61323f5760405162461bcd60e51b8152600401808060200182810382526024815260200180615d496024913960400191505060405180910390fd5b613247614a10565b61325082614a7c565b80156132a257346132618985614dd0565b1461329d5760405162461bcd60e51b8152600401808060200182810382526021815260200180615cdd6021913960400191505060405180910390fd5b61338c565b3483146132e05760405162461bcd60e51b8152600401808060200182810382526021815260200180615cdd6021913960400191505060405180910390fd5b6004548a516001600160a01b0390911690631b827878908c9060009061330257fe5b60200260200101518d308c6040518563ffffffff1660e01b815260040180856001600160a01b03168152602001846001600160a01b03168152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561337357600080fd5b505af1158015613387573d6000803e3d6000fd5b505050505b61339e8b8b8b8b8b8b8b8b8b8a614af0565b5050505050505050505050565b600260005414156133f1576040805162461bcd60e51b815260206004820152601f6024820152600080516020615cbd833981519152604482015290519081900360640190fd5b6002600055600c548210156134375760405162461bcd60e51b8152600401808060200182810382526024815260200180615c996024913960400191505060405180910390fd5b8134146134755760405162461bcd60e51b8152600401808060200182810382526021815260200180615cdd6021913960400191505060405180910390fd5b895160011480613486575089516002145b6134c15760405162461bcd60e51b8152600401808060200182810382526024815260200180615d496024913960400191505060405180910390fd5b8015613539576005548a516001600160a01b03909116908b9060001981019081106134e857fe5b60200260200101516001600160a01b031614613539576040805162461bcd60e51b815260206004820152601d6024820152600080516020615da7833981519152604482015290519081900360640190fd5b613541614a10565b613554338b8b8b8b8b8b8b8b8b8b614e28565b505060016000555050505050505050565b6002546001600160a01b031633146135b2576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b60005b835181101561364d5760008482815181106135cc57fe5b602002602001015190508382815181106135e257fe5b6020026020010151600a6000836001600160a01b03166001600160a01b031681526020019081526020016000208190555082828151811061361f57fe5b6020908102919091018101516001600160a01b039092166000908152600b90915260409020556001016135b5565b507fae32d569b058895b9620d6552b09aaffedc9a6f396be4d595a224ad09f8b213983838360405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b838110156136ba5781810151838201526020016136a2565b50505050905001848103835286818151815260200191508051906020019060200280838360005b838110156136f95781810151838201526020016136e1565b50505050905001848103825285818151815260200191508051906020019060200280838360005b83811015613738578181015183820152602001613720565b50505050905001965050505050505060405180910390a1505050565b6002546001600160a01b031633146137a1576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b6001600160a01b038216600090815260096020526040902054806137c55750611bf0565b6001600160a01b0383166000818152600960205260408120556137e99083836140ad565b604080516001600160a01b0380861682528416602082015280820183905290517f4f1b51dd7a2fcb861aa2670f668be66835c4ee12b4bbbf037e4d0018f39819e49181900360600190a1505050565b60135460115460145460125490919293565b3360009081526015602052604090205460ff1661389c576040805162461bcd60e51b81526020600482015260196024820152600080516020615f0f833981519152604482015290519081900360640190fd5b6014546012548082106138b0575050611bf0565b808411156138bc578093505b83821015613a22576000601283815481106138d357fe5b90600052602060002001549050306001600160a01b0316630d4d003d82866040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050602060405180830381600087803b15801561393757600080fd5b505af192505050801561395c57506040513d602081101561395757600080fd5b505160015b6139f05760408051633051b17160e11b8152600481018390526001600160a01b0386166024820152905130916360a362e29160448083019260209291908290030181600087803b1580156139af57600080fd5b505af19250505080156139d457506040513d60208110156139cf57600080fd5b505160015b6139dd576139eb565b806139e9575050613a22565b505b6139fe565b806139fc575050613a22565b505b60128381548110613a0b57fe5b6000918252602082200155506001909101906138bc565b506014555050565b6002546001600160a01b031681565b6004546001600160a01b031681565b60186020526000908152604090205481565b6017602052600090815260409020805460028201546003830154600484015460058501546006860154600787015460088801546009890154600a8a0154600b909a01546001600160a01b03998a169a999098169896979596949560ff94851695939492939192168b565b6003546001600160a01b031681565b6002546001600160a01b03163314613b20576040805162461bcd60e51b815260206004820152601e6024820152600080516020615e1d833981519152604482015290519081900360640190fd5b600c8190556040805182815290517f52a8358457e20bbb36e4086b83fb0749599f1893fe4c35a876c46dc4886d12db9181900360200190a150565b600042613b73600f5485614dd090919063ffffffff16565b11613baf5760405162461bcd60e51b8152600401808060200182810382526023815260200180615f7c6023913960400191505060405180910390fd5b600033301480613bce57503360009081526015602052604090205460ff165b601054909150600160a01b900460ff16158015613be9575080155b15613c29576040805162461bcd60e51b81526020600482015260196024820152600080516020615f0f833981519152604482015290519081900360640190fd5b8015613c4f5743613c45600d5487614dd090919063ffffffff16565b1115915050613cf3565b336001600160a01b03841614613c9a576040805162461bcd60e51b81526020600482015260196024820152600080516020615f0f833981519152604482015290519081900360640190fd5b42613cb0600e5486614dd090919063ffffffff16565b1115613ced5760405162461bcd60e51b8152600401808060200182810382526028815260200180615ebe6028913960400191505060405180910390fd5b60019150505b9392505050565b6003546000906001600160a01b03168415613dcb5782816001600160a01b03166381a612d68a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015613d5d57600080fd5b505afa158015613d71573d6000803e3d6000fd5b505050506040513d6020811015613d8757600080fd5b50511015613dc65760405162461bcd60e51b8152600401808060200182810382526030815260200180615ded6030913960400191505060405180910390fd5b613e82565b82816001600160a01b031663e124e6d28a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015613e1957600080fd5b505afa158015613e2d573d6000803e3d6000fd5b505050506040513d6020811015613e4357600080fd5b50511115613e825760405162461bcd60e51b8152600401808060200182810382526031815260200180615e8d6031913960400191505060405180910390fd5b6000816001600160a01b03166312d43a516040518163ffffffff1660e01b815260040160206040518083038186803b158015613ebd57600080fd5b505afa158015613ed1573d6000803e3d6000fd5b505050506040513d6020811015613ee757600080fd5b5051604080516306d63c1d60e41b81526001600160a01b038581166004830152915192935090831691636d63c1d09160248082019260009290919082900301818387803b158015613f3757600080fd5b505af1158015613f4b573d6000803e3d6000fd5b505050506000600460009054906101000a90046001600160a01b03166001600160a01b0316632662166b8d8d8d8d8d8d8d6040518863ffffffff1660e01b815260040180886001600160a01b03168152602001876001600160a01b03168152602001866001600160a01b031681526020018581526020018481526020018315158152602001826001600160a01b03168152602001975050505050505050602060405180830381600087803b15801561400257600080fd5b505af1158015614016573d6000803e3d6000fd5b505050506040513d602081101561402c57600080fd5b50516040805163d3c87bbb60e01b81526001600160a01b03868116600483015291519293509084169163d3c87bbb9160248082019260009290919082900301818387803b15801561407c57600080fd5b505af1158015614090573d6000803e3d6000fd5b5050505061409e8c8961514f565b9b9a5050505050505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526140ff9084906152d8565b505050565b600083516002141561414b576141448460008151811061412057fe5b60200260200101518560018151811061413557fe5b60200260200101518585615389565b9050613cf3565b60405162461bcd60e51b8152600401808060200182810382526029815260200180615ee66029913960400191505060405180910390fd5b60055460408051632e1a7d4d60e01b81526004810185905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b1580156141cf57600080fd5b505af11580156141e3573d6000803e3d6000fd5b50506040516001600160a01b038416925084156108fc02915084906000818181858888f193505050501580156140ff573d6000803e3d6000fd5b60055460408051632e1a7d4d60e01b81526004810185905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b15801561426a57600080fd5b505af115801561427e573d6000803e3d6000fd5b50611bf0925050506001600160a01b03821683614350565b6000613cf383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061545f565b60008033301480613bce57503360009081526015602052604090205460ff1660105490915060ff600160a01b90910416158015613be9575080613c29576040805162461bcd60e51b81526020600482015260196024820152600080516020615f0f833981519152604482015290519081900360640190fd5b804710156143a5576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d80600081146143f0576040519150601f19603f3d011682016040523d82523d6000602084013e6143f5565b606091505b50509050806140ff5760405162461bcd60e51b815260040180806020018281038252603a815260200180615d6d603a913960400191505060405180910390fd5b6000806144468888888888886154f6565b9050801561450557600061447d61271061447761447060065461271061429690919063ffffffff16565b8a906156d3565b9061572c565b9050600061448b8883614296565b905060008960018b51038151811061449f57fe5b602002602001015190506144e18260096000846001600160a01b03166001600160a01b0316815260200190815260200160002054614dd090919063ffffffff16565b6001600160a01b0390911660009081526009602052604090205550915061450a9050565b859150505b9695505050505050565b6003546001600160a01b031682156145e25781816001600160a01b031663e124e6d2876040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561457457600080fd5b505afa158015614588573d6000803e3d6000fd5b505050506040513d602081101561459e57600080fd5b505111156145dd5760405162461bcd60e51b8152600401808060200182810382526031815260200180615e8d6031913960400191505060405180910390fd5b614699565b81816001600160a01b03166381a612d6876040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561463057600080fd5b505afa158015614644573d6000803e3d6000fd5b505050506040513d602081101561465a57600080fd5b505110156146995760405162461bcd60e51b8152600401808060200182810382526030815260200180615ded6030913960400191505060405180910390fd5b821561478a576001600160a01b0385166000908152600a6020526040902054801580159061474857508061474686846001600160a01b031663f07456ce8a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561471457600080fd5b505afa158015614728573d6000803e3d6000fd5b505050506040513d602081101561473e57600080fd5b505190614dd0565b115b156147845760405162461bcd60e51b815260040180806020018281038252602e815260200180615c6b602e913960400191505060405180910390fd5b5061483f565b6001600160a01b0385166000908152600b602052604090205480158015906148015750806147ff86846001600160a01b0316638a78daa88a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561471457600080fd5b115b1561483d5760405162461bcd60e51b815260040180806020018281038252602f815260200180615e3d602f913960400191505060405180910390fd5b505b6000816001600160a01b03166312d43a516040518163ffffffff1660e01b815260040160206040518083038186803b15801561487a57600080fd5b505afa15801561488e573d6000803e3d6000fd5b505050506040513d60208110156148a457600080fd5b5051604080516306d63c1d60e41b81526001600160a01b038581166004830152915192935090831691636d63c1d09160248082019260009290919082900301818387803b1580156148f457600080fd5b505af1158015614908573d6000803e3d6000fd5b50506004805460408051630f8ee8bb60e11b81526001600160a01b038e8116948201949094528c841660248201528b84166044820152606481018b905289151560848201529051929091169350631f1dd176925060a48082019260009290919082900301818387803b15801561497d57600080fd5b505af1158015614991573d6000803e3d6000fd5b50505050806001600160a01b031663d3c87bbb836040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156149e457600080fd5b505af11580156149f8573d6000803e3d6000fd5b50505050614a06888661576b565b5050505050505050565b3415614a7a57600560009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015614a6657600080fd5b505af115801561315e573d6000803e3d6000fd5b565b8015801590614a9557506008546001600160a01b031615155b15614aed57600854604080516356b4b2ad60e01b81523360048201526024810184905290516001600160a01b03909216916356b4b2ad9160448082019260009290919082900301818387803b158015614a6657600080fd5b50565b6001600160a01b038a16600090815260166020526040812054614b14906001614dd0565b6001600160a01b038c1660009081526016602052604090208190559050614b39615b5a565b6040518061018001604052808d6001600160a01b031681526020018c81526020018b6001600160a01b031681526020018a8152602001898152602001888152602001871515815260200186815260200185815260200143815260200142815260200184151581525090506000614baf8d846128bf565b6000818152601760209081526040909120845181546001600160a01b0319166001600160a01b0390911617815584820151805193945085939192614bfb92600185019290910190615bd1565b5060408201518160020160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff02191690831515021790555060e082015181600701556101008201518160080155610120820151816009015561014082015181600a015561016082015181600b0160006101000a81548160ff02191690831515021790555090505060118190806001815401808255809150506001900390600052602060002001600090919091909150558c6001600160a01b03167fa89f00a1c1cd0de066abac1a05f9314520fef2a9b98f6a99ff4548ed1161c03c8d8d8d8d8d8d8d8d8c43423a60405180806020018d6001600160a01b031681526020018c81526020018b81526020018a8152602001891515815260200188815260200187815260200186815260200185815260200184815260200183815260200182810382528e818151815260200191508051906020019060200280838360005b83811015614da3578181015183820152602001614d8b565b505050509050019d505050505050505050505050505060405180910390a250505050505050505050505050565b600082820183811015613cf3576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b6001600160a01b038b16600090815260186020526040812054614e4c906001614dd0565b6001600160a01b038d1660009081526018602052604090208190559050614e71615ab5565b604051806101a001604052808e6001600160a01b031681526020018d81526020018c6001600160a01b031681526020018b81526020018a81526020018915158152602001886001600160a01b0316815260200187815260200186815260200185815260200143815260200142815260200184151581525090506000614ef68e846128bf565b6000818152601960209081526040909120845181546001600160a01b0319166001600160a01b0390911617815584820151805193945085939192614f4292600185019290910190615bd1565b5060408201518160020160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550606082015181600301556080820151816004015560a08201518160050160006101000a81548160ff02191690831515021790555060c08201518160050160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060e0820151816006015561010082015181600701556101208201518160080155610140820151816009015561016082015181600a015561018082015181600b0160006101000a81548160ff02191690831515021790555090505060128190806001815401808255809150506001900390600052602060002001600090919091909150558d6001600160a01b03167f506f2634e4508d88b04b7511af75c6d4c29b2b6f4f5067676b9400b28f3761d28e8e8e8e8e8e8e8e8e8d434260405180806020018d6001600160a01b031681526020018c81526020018b81526020018a15158152602001896001600160a01b0316815260200188815260200187815260200186815260200185815260200184815260200183815260200182810382528e818151815260200191508051906020019060200280838360005b83811015615121578181015183820152602001615109565b505050509050019d505050505050505050505050505060405180910390a25050505050505050505050505050565b6008546001600160a01b0316806151665750611bf0565b600080826001600160a01b031663534ef883866040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050604080518083038186803b1580156151b557600080fd5b505afa1580156151c9573d6000803e3d6000fd5b505050506040513d60408110156151df57600080fd5b5080516020909101519092509050816151fa57505050611bf0565b7f474c763ff84bf2c2039a6d9fea955ecd0f724030e3c365b91169c6a16fe751b78585600360009054906101000a90046001600160a01b03166001600160a01b031663318bc6896040518163ffffffff1660e01b815260040160206040518083038186803b15801561526b57600080fd5b505afa15801561527f573d6000803e3d6000fd5b505050506040513d602081101561529557600080fd5b5051604080516001600160a01b03948516815260208101939093528281019190915260608201869052918416608082015290519081900360a00190a15050505050565b606061532d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166158719092919063ffffffff16565b8051909150156140ff5780806020019051602081101561534c57600080fd5b50516140ff5760405162461bcd60e51b815260040180806020018281038252602a815260200180615f52602a913960400191505060405180910390fd5b60035460408051634998b10960e11b81526001600160a01b03878116600483015286811660248301528481166044830152915160009384931691639331621291606480830192602092919082900301818787803b1580156153e957600080fd5b505af11580156153fd573d6000803e3d6000fd5b505050506040513d602081101561541357600080fd5b50519050838110156154565760405162461bcd60e51b815260040180806020018281038252602b815260200180615d1e602b913960400191505060405180910390fd5b95945050505050565b600081848411156154ee5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156154b357818101518382015260200161549b565b50505050905090810190601f1680156154e05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000826155055750600061450a565b816155125750600161450a565b60008660018851038151811061552457fe5b602090810291909101015160035460408051634a3f088d60e01b81526001600160a01b038c81166004830152808516602483015289811660448301528815156064830152915193945091169160009182918491634a3f088d91608480830192610100929190829003018186803b15801561559d57600080fd5b505afa1580156155b1573d6000803e3d6000fd5b505050506040513d6101008110156155c857600080fd5b5080516020909101519092509050816155e857600094505050505061450a565b60006155f48388614dd0565b90506000846001600160a01b0316630a48d5a9878d6040518363ffffffff1660e01b815260040180836001600160a01b031681526020018281526020019250505060206040518083038186803b15801561564d57600080fd5b505afa158015615661573d6000803e3d6000fd5b505050506040513d602081101561567757600080fd5b5051905060006156878483614dd0565b9050600061569b85614477886127106156d3565b905060006156bc8361447760075461271001886156d390919063ffffffff16565b919091109f9e505050505050505050505050505050565b6000826156e2575060006128ff565b828202828482816156ef57fe5b0414613cf35760405162461bcd60e51b8152600401808060200182810382526021815260200180615e6c6021913960400191505060405180910390fd5b6000613cf383836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b815250615888565b6008546001600160a01b0316806157825750611bf0565b600080826001600160a01b031663534ef883866040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050604080518083038186803b1580156157d157600080fd5b505afa1580156157e5573d6000803e3d6000fd5b505050506040513d60408110156157fb57600080fd5b5080516020918201516003546040805163318bc68960e01b815290519396509194507fc2414023ce7002ee98557d1e7be21e5559073336f2217ee5f9b2e50fd85f71ee93899389936001600160a01b039093169263318bc689926004808301939192829003018186803b15801561526b57600080fd5b606061588084846000856158ed565b949350505050565b600081836158d75760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156154b357818101518382015260200161549b565b5060008385816158e357fe5b0495945050505050565b60608247101561592e5760405162461bcd60e51b8152600401808060200182810382526026815260200180615dc76026913960400191505060405180910390fd5b61593785615a49565b615988576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106159c75780518252601f1990920191602091820191016159a8565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114615a29576040519150601f19603f3d011682016040523d82523d6000602084013e615a2e565b606091505b5091509150615a3e828286615a4f565b979650505050505050565b3b151590565b60608315615a5e575081613cf3565b825115615a6e5782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156154b357818101518382015260200161549b565b604051806101a0016040528060006001600160a01b031681526020016060815260200160006001600160a01b03168152602001600081526020016000815260200160001515815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b5080546000825590600052602060002090810190614aed9190615c36565b60405180610180016040528060006001600160a01b031681526020016060815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600015158152602001600081526020016000815260200160008152602001600081526020016000151581525090565b828054828255906000526020600020908101928215615c26579160200282015b82811115615c2657825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190615bf1565b50615c32929150615c4b565b5090565b5b80821115615c325760008155600101615c37565b5b80821115615c325780546001600160a01b0319168155600101615c4c56fe42617365506f736974696f6e4d616e616765723a206d617820676c6f62616c206c6f6e6773206578636565646564506f736974696f6e526f757465723a20696e76616c696420657865637574696f6e4665655265656e7472616e637947756172643a207265656e7472616e742063616c6c00506f736974696f6e526f757465723a20696e76616c6964206d73672e76616c7565476f7665726e61626c653a20666f7262696464656e000000000000000000000042617365506f736974696f6e4d616e616765723a20696e73756666696369656e7420616d6f756e744f7574506f736974696f6e526f757465723a20696e76616c6964205f70617468206c656e677468416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564506f736974696f6e526f757465723a20696e76616c6964205f70617468000000416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c42617365506f736974696f6e4d616e616765723a206d61726b207072696365206c6f776572207468616e206c696d697442617365506f736974696f6e4d616e616765723a20666f7262696464656e000042617365506f736974696f6e4d616e616765723a206d617820676c6f62616c2073686f727473206578636565646564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7742617365506f736974696f6e4d616e616765723a206d61726b20707269636520686967686572207468616e206c696d6974506f736974696f6e526f757465723a206d696e2064656c6179206e6f74207965742070617373656442617365506f736974696f6e4d616e616765723a20696e76616c6964205f706174682e6c656e677468506f736974696f6e526f757465723a20666f7262696464656e0000000000000042617365506f736974696f6e4d616e616765723a20696e76616c69642073656e6465725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564506f736974696f6e526f757465723a2072657175657374206861732065787069726564a2646970667358221220b3e4baece2937428daeb935a22c8334dd87510290c58dc7290ba7ab11665cf9e64736f6c634300060c0033

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

000000000000000000000000dfba8ad57d2c62f61f0a60b2c508bcdeb182f8550000000000000000000000003cd2f02b9e39ccc781d0c07fc0286f654e53a76d00000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000886c98b76000

-----Decoded View---------------
Arg [0] : _vault (address): 0xDfbA8AD57d2c62F61F0a60B2C508bCdeb182f855
Arg [1] : _router (address): 0x3cd2F02B9e39ccC781d0C07fc0286F654e53A76D
Arg [2] : _weth (address): 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
Arg [3] : _depositFee (uint256): 30
Arg [4] : _minExecutionFee (uint256): 150000000000000

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000dfba8ad57d2c62f61f0a60b2c508bcdeb182f855
Arg [1] : 0000000000000000000000003cd2f02b9e39ccc781d0c07fc0286f654e53a76d
Arg [2] : 00000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1
Arg [3] : 000000000000000000000000000000000000000000000000000000000000001e
Arg [4] : 0000000000000000000000000000000000000000000000000000886c98b76000


Block Transaction Difficulty 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.