ETH Price: $3,920.86 (+5.29%)

Contract

0x2264d1c908C4347F75F8eB438a4f94f4caecF634

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Liquidate Positi...148357732024-08-05 1:11:35122 days ago1722820295IN
0x2264d1c9...4caecF634
0 ETH0.002286156.64
Liquidate Positi...148262532024-08-04 17:12:05122 days ago1722791525IN
0x2264d1c9...4caecF634
0 ETH0.0001010.344
Liquidate Positi...148247052024-08-04 15:54:05122 days ago1722786845IN
0x2264d1c9...4caecF634
0 ETH0.000036780.121
Liquidate Positi...148232592024-08-04 14:41:07122 days ago1722782467IN
0x2264d1c9...4caecF634
0 ETH0.000020740.0646
Liquidate Positi...142468262024-07-15 11:02:44142 days ago1721041364IN
0x2264d1c9...4caecF634
0 ETH0.000015310.0529
Liquidate Positi...142468232024-07-15 11:02:35142 days ago1721041355IN
0x2264d1c9...4caecF634
0 ETH0.000015340.053
Liquidate Positi...142468192024-07-15 11:02:24142 days ago1721041344IN
0x2264d1c9...4caecF634
0 ETH0.000017450.0544
Liquidate Positi...142468162024-07-15 11:02:15142 days ago1721041335IN
0x2264d1c9...4caecF634
0 ETH0.000014670.0507
Liquidate Positi...142468132024-07-15 11:02:06142 days ago1721041326IN
0x2264d1c9...4caecF634
0 ETH0.000014670.0507
Liquidate Positi...142468092024-07-15 11:01:55142 days ago1721041315IN
0x2264d1c9...4caecF634
0 ETH0.0000160.0553
Liquidate Positi...142468062024-07-15 11:01:46142 days ago1721041306IN
0x2264d1c9...4caecF634
0 ETH0.000014880.0514
Liquidate Positi...142468032024-07-15 11:01:37142 days ago1721041297IN
0x2264d1c9...4caecF634
0 ETH0.000018720.0583
Liquidate Positi...142430592024-07-15 7:52:50143 days ago1721029970IN
0x2264d1c9...4caecF634
0 ETH0.000018550.0641
Liquidate Positi...142430552024-07-15 7:52:38143 days ago1721029958IN
0x2264d1c9...4caecF634
0 ETH0.000018550.0641
Liquidate Positi...142430442024-07-15 7:52:05143 days ago1721029925IN
0x2264d1c9...4caecF634
0 ETH0.000017510.0605
Liquidate Positi...142430412024-07-15 7:51:56143 days ago1721029916IN
0x2264d1c9...4caecF634
0 ETH0.000016140.0558
Liquidate Positi...142430382024-07-15 7:51:47143 days ago1721029907IN
0x2264d1c9...4caecF634
0 ETH0.000017130.0592
Liquidate Positi...142430342024-07-15 7:51:34143 days ago1721029894IN
0x2264d1c9...4caecF634
0 ETH0.000017920.0619
Liquidate Positi...142430312024-07-15 7:51:25143 days ago1721029885IN
0x2264d1c9...4caecF634
0 ETH0.000017920.0619
Liquidate Positi...142430282024-07-15 7:51:16143 days ago1721029876IN
0x2264d1c9...4caecF634
0 ETH0.000017630.0609
Liquidate Positi...142430252024-07-15 7:51:07143 days ago1721029867IN
0x2264d1c9...4caecF634
0 ETH0.000017940.062
Liquidate Positi...142430212024-07-15 7:50:54143 days ago1721029854IN
0x2264d1c9...4caecF634
0 ETH0.000017790.0615
Liquidate Positi...142430172024-07-15 7:50:42143 days ago1721029842IN
0x2264d1c9...4caecF634
0 ETH0.000017420.0602
Liquidate Positi...142430142024-07-15 7:50:33143 days ago1721029833IN
0x2264d1c9...4caecF634
0 ETH0.000017450.0603
Liquidate Positi...142430112024-07-15 7:50:24143 days ago1721029824IN
0x2264d1c9...4caecF634
0 ETH0.000016870.0583
View all transactions

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PositionManager

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion
File 1 of 18 : PositionManager.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.12;

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

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

contract PositionManager is BasePositionManager {
    address public orderBook;
    bool public inLegacyMode;

    bool public shouldValidateIncreaseOrder = true;
    uint256 public minStayingOpenTime = 900; // 15 min
    

    mapping(address => bool) public isOrderKeeper;
    mapping(address => bool) public isPartner;
    mapping(address => bool) public isLiquidator;
    mapping(address => uint256) public partnerMinStayingOpenTime;

    event SetOrderKeeper(address indexed account, bool isActive);
    event SetLiquidator(address indexed account, bool isActive);
    event SetPartner(address account, bool isActive);
    event SetOrderBook(address orderBook);
    event SetInLegacyMode(bool inLegacyMode);
    event SetShouldValidateIncreaseOrder(bool shouldValidateIncreaseOrder);
    event SetMinStayingOpenTime(uint256 _minStayingOpenTime);
    event SetPartnerMinStayingOpenTime(address indexed account, uint256 minTime);

    modifier onlyOrderKeeper() {
        require(isOrderKeeper[msg.sender], "PositionManager: forbidden");
        _;
    }

    modifier onlyLiquidator() {
        require(isLiquidator[msg.sender], "PositionManager: forbidden");
        _;
    }

    modifier onlyPartnersOrLegacyMode() {
        require(isPartner[msg.sender] || inLegacyMode, "PositionManager: forbidden");
        _;
    }

    constructor(
        address _vault,
        address _router,
        address _shortsTracker,
        address _weth,
        uint256 _depositFee,
        address _orderBook
    ) public BasePositionManager(_vault, _router, _shortsTracker, _weth, _depositFee) {
        orderBook = _orderBook;
    }

    function setOrderKeeper(address _account, bool _isActive) external onlyAdmin {
        isOrderKeeper[_account] = _isActive;
        emit SetOrderKeeper(_account, _isActive);
    }

    function setLiquidator(address _account, bool _isActive) external onlyAdmin {
        isLiquidator[_account] = _isActive;
        emit SetLiquidator(_account, _isActive);
    }

    function setPartnerMinStayingOpenTime(address _account, uint256 _minTime) external onlyAdmin {
        partnerMinStayingOpenTime[_account] = _minTime;
        emit SetPartnerMinStayingOpenTime(_account, _minTime);
    }

    function setPartner(address _account, bool _isActive) external onlyAdmin {
        isPartner[_account] = _isActive;
        emit SetPartner(_account, _isActive);
    }


    function setOrderBook(address _orderBook) external onlyAdmin {
        orderBook = _orderBook;
        emit SetOrderBook(_orderBook);
    }

    function setMinStayingOpenTime(
        uint256 _minStayingOpenTime
    ) external onlyAdmin {
        minStayingOpenTime = _minStayingOpenTime;
        emit SetMinStayingOpenTime(_minStayingOpenTime);
    }

    function setInLegacyMode(bool _inLegacyMode) external onlyAdmin {
        inLegacyMode = _inLegacyMode;
        emit SetInLegacyMode(_inLegacyMode);
    }

    function setShouldValidateIncreaseOrder(bool _shouldValidateIncreaseOrder) external onlyAdmin {
        shouldValidateIncreaseOrder = _shouldValidateIncreaseOrder;
        emit SetShouldValidateIncreaseOrder(_shouldValidateIncreaseOrder);
    }

    function increasePosition(
        address[] memory _path,
        address _indexToken,
        uint256 _amountIn,
        uint256 _minOut,
        uint256 _sizeDelta,
        bool _isLong,
        uint256 _price,
        bytes32 _referralCode
    ) external nonReentrant onlyPartnersOrLegacyMode {
        require(_path.length == 1 || _path.length == 2, "PositionManager: invalid _path.length");

        _setTraderReferralCode(_referralCode);

        if (_amountIn > 0) {
            if (_path.length == 1) {
                IRouter(router).pluginTransfer(_path[0], msg.sender, address(this), _amountIn);
            } else {
                IRouter(router).pluginTransfer(_path[0], msg.sender, vault, _amountIn);
                _amountIn = _swap(_path, _minOut, address(this));
            }

            uint256 afterFeeAmount = _collectFees(msg.sender, _path, _amountIn, _indexToken, _isLong, _sizeDelta);
            IERC20(_path[_path.length - 1]).safeTransfer(vault, afterFeeAmount);
        }

        _increasePosition(msg.sender, _path[_path.length - 1], _indexToken, _sizeDelta, _isLong, _price);
    }

    function increasePositionETH(
        address[] memory _path,
        address _indexToken,
        uint256 _minOut,
        uint256 _sizeDelta,
        bool _isLong,
        uint256 _price,
        bytes32 _referralCode
    ) external payable nonReentrant onlyPartnersOrLegacyMode {
        require(_path.length == 1 || _path.length == 2, "PositionManager: invalid _path.length");
        require(_path[0] == weth, "PositionManager: invalid _path");

        _setTraderReferralCode(_referralCode);

        if (msg.value > 0) {
            _transferInETH();
            uint256 _amountIn = msg.value;

            if (_path.length > 1) {
                IERC20(weth).safeTransfer(vault, msg.value);
                _amountIn = _swap(_path, _minOut, address(this));
            }

            uint256 afterFeeAmount = _collectFees(msg.sender, _path, _amountIn, _indexToken, _isLong, _sizeDelta);
            IERC20(_path[_path.length - 1]).safeTransfer(vault, afterFeeAmount);
        }

        _increasePosition(msg.sender, _path[_path.length - 1], _indexToken, _sizeDelta, _isLong, _price);
    }

    function decreasePosition(
        address _collateralToken,
        address _indexToken,
        uint256 _collateralDelta,
        uint256 _sizeDelta,
        bool _isLong,
        address _receiver,
        uint256 _price
    ) external nonReentrant onlyPartnersOrLegacyMode {
        _validatePositionTime(msg.sender, _collateralToken, _indexToken, _isLong);

        _decreasePosition(msg.sender, _collateralToken, _indexToken, _collateralDelta, _sizeDelta, _isLong, _receiver, _price);
    }

    function decreasePositionETH(
        address _collateralToken,
        address _indexToken,
        uint256 _collateralDelta,
        uint256 _sizeDelta,
        bool _isLong,
        address payable _receiver,
        uint256 _price
    ) external nonReentrant onlyPartnersOrLegacyMode {
        require(_collateralToken == weth, "PositionManager: invalid _collateralToken");
       _validatePositionTime(msg.sender, _collateralToken, _indexToken, _isLong);

        uint256 amountOut = _decreasePosition(msg.sender, _collateralToken, _indexToken, _collateralDelta, _sizeDelta, _isLong, address(this), _price);
        _transferOutETHWithGasLimitFallbackToWeth(amountOut, _receiver);
    }

    function decreasePositionAndSwap(
        address[] memory _path,
        address _indexToken,
        uint256 _collateralDelta,
        uint256 _sizeDelta,
        bool _isLong,
        address _receiver,
        uint256 _price,
        uint256 _minOut
    ) external nonReentrant onlyPartnersOrLegacyMode {
        require(_path.length == 2, "PositionManager: invalid _path.length");
        _validatePositionTime(msg.sender, _path[0], _indexToken, _isLong);

        uint256 amount = _decreasePosition(msg.sender, _path[0], _indexToken, _collateralDelta, _sizeDelta, _isLong, address(this), _price);
        IERC20(_path[0]).safeTransfer(vault, amount);
        _swap(_path, _minOut, _receiver);
    }

    function decreasePositionAndSwapETH(
        address[] memory _path,
        address _indexToken,
        uint256 _collateralDelta,
        uint256 _sizeDelta,
        bool _isLong,
        address payable _receiver,
        uint256 _price,
        uint256 _minOut
    ) external nonReentrant onlyPartnersOrLegacyMode {
        require(_path.length == 2, "PositionManager: invalid _path.length");
        require(_path[_path.length - 1] == weth, "PositionManager: invalid _path");
        _validatePositionTime(msg.sender, _path[0], _indexToken, _isLong);

        uint256 amount = _decreasePosition(msg.sender, _path[0], _indexToken, _collateralDelta, _sizeDelta, _isLong, address(this), _price);
        IERC20(_path[0]).safeTransfer(vault, amount);
        uint256 amountOut = _swap(_path, _minOut, address(this));
        _transferOutETHWithGasLimitFallbackToWeth(amountOut, _receiver);
    }

    function liquidatePosition(
        address _account,
        address _collateralToken,
        address _indexToken,
        bool _isLong,
        address _feeReceiver
    ) external nonReentrant onlyLiquidator {
        address _vault = vault;
        address timelock = IVault(_vault).gov();
        (uint256 size, , , , , , , ) = IVault(vault).getPosition(_account, _collateralToken, _indexToken, _isLong);

        uint256 markPrice = _isLong ? IVault(_vault).getMinPrice(_indexToken) : IVault(_vault).getMaxPrice(_indexToken);
        // should be called strictly before position is updated in Vault
        IShortsTracker(shortsTracker).updateGlobalShortData(_account, _collateralToken, _indexToken, _isLong, size, markPrice, false);

        ITimelock(timelock).enableLeverage(_vault);
        IVault(_vault).liquidatePosition(_account, _collateralToken, _indexToken, _isLong, _feeReceiver);
        ITimelock(timelock).disableLeverage(_vault);
    }

    function executeSwapOrder(address _account, uint256 _orderIndex, address payable _feeReceiver) external onlyOrderKeeper {
        IOrderBook(orderBook).executeSwapOrder(_account, _orderIndex, _feeReceiver);
    }

    function executeIncreaseOrder(address _account, uint256 _orderIndex, address payable _feeReceiver) external onlyOrderKeeper {
        _validateIncreaseOrder(_account, _orderIndex);

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

        (
            /*address purchaseToken*/,
            /*uint256 purchaseTokenAmount*/,
            address collateralToken,
            address indexToken,
            uint256 sizeDelta,
            bool isLong,
            /*uint256 triggerPrice*/,
            /*bool triggerAboveThreshold*/,
            /*uint256 executionFee*/
        ) = IOrderBook(orderBook).getIncreaseOrder(_account, _orderIndex);

        uint256 markPrice = isLong ? IVault(_vault).getMaxPrice(indexToken) : IVault(_vault).getMinPrice(indexToken);
        // should be called strictly before position is updated in Vault
        IShortsTracker(shortsTracker).updateGlobalShortData(_account, collateralToken, indexToken, isLong, sizeDelta, markPrice, true);

        ITimelock(timelock).enableLeverage(_vault);
        IOrderBook(orderBook).executeIncreaseOrder(_account, _orderIndex, _feeReceiver);
        ITimelock(timelock).disableLeverage(_vault);

        _emitIncreasePositionReferral(_account, sizeDelta);
    }

    function executeDecreaseOrder(address _account, uint256 _orderIndex, address payable _feeReceiver) external onlyOrderKeeper {
        address _vault = vault;
        address timelock = IVault(_vault).gov();

        (
            address collateralToken,
            /*uint256 collateralDelta*/,
            address indexToken,
            uint256 sizeDelta,
            bool isLong,
            /*uint256 triggerPrice*/,
            /*bool triggerAboveThreshold*/,
            /*uint256 executionFee*/
        ) = IOrderBook(orderBook).getDecreaseOrder(_account, _orderIndex);

        uint256 markPrice = isLong ? IVault(_vault).getMinPrice(indexToken) : IVault(_vault).getMaxPrice(indexToken);
        // should be called strictly before position is updated in Vault
        IShortsTracker(shortsTracker).updateGlobalShortData(_account, collateralToken, indexToken, isLong, sizeDelta, markPrice, false);

        ITimelock(timelock).enableLeverage(_vault);
        IOrderBook(orderBook).executeDecreaseOrder(_account, _orderIndex, _feeReceiver);
        ITimelock(timelock).disableLeverage(_vault);

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

    function _validateIncreaseOrder(address _account, uint256 _orderIndex) internal view {
        (
            address _purchaseToken,
            uint256 _purchaseTokenAmount,
            address _collateralToken,
            address _indexToken,
            uint256 _sizeDelta,
            bool _isLong,
            , // triggerPrice
            , // triggerAboveThreshold
            // executionFee
        ) = IOrderBook(orderBook).getIncreaseOrder(_account, _orderIndex);

        _validateMaxGlobalSize(_indexToken, _isLong, _sizeDelta);

        if (!shouldValidateIncreaseOrder) { return; }

        // shorts are okay
        if (!_isLong) { return; }

        // if the position size is not increasing, this is a collateral deposit
        require(_sizeDelta > 0, "PositionManager: long deposit");

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

        uint256 nextSize = size.add(_sizeDelta);
        uint256 collateralDelta = _vault.tokenToUsdMin(_purchaseToken, _purchaseTokenAmount);
        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 nextLeverageWithBuffer = nextSize.mul(BASIS_POINTS_DIVISOR + increasePositionBufferBps).div(nextCollateral);

        require(nextLeverageWithBuffer >= prevLeverage, "PositionManager: long leverage decrease");
    }
    function _validatePositionTime(
        address _account,
        address _collateralToken,
        address _indexToken,
        bool _isLong
    ) private view{
        IVault _vault = IVault(vault);
        (uint256 size, , , , , , , uint lastIncreasedTime) = _vault.getPosition(_account, _collateralToken, _indexToken, _isLong);
        require(size > 0, "PositionManager: empty position");
        uint256 minDelayTime = partnerMinStayingOpenTime[_account]>0 ? partnerMinStayingOpenTime[_account] : minStayingOpenTime;
        require(lastIncreasedTime.add(minDelayTime) <= block.timestamp, "PositionManager: min delay not yet passed");
    }
}

File 2 of 18 : Governable.sol
// 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;
    }
}

File 3 of 18 : BasePositionManager.sol
// 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/IShortsTracker.sol";
import "./interfaces/IOrderBook.sol";
import "./interfaces/IBasePositionManager.sol";

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

import "./PositionUtils.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 shortsTracker;
    address public router;
    address public weth;

    uint256 public ethTransferGasLimit = 500 * 1000;

    // 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 SetEthTransferGasLimit(uint256 ethTransferGasLimit);
    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, "forbidden");
        _;
    }

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

        admin = msg.sender;
    }

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

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

    function setEthTransferGasLimit(uint256 _ethTransferGasLimit) external onlyAdmin {
        ethTransferGasLimit = _ethTransferGasLimit;
        emit SetEthTransferGasLimit(_ethTransferGasLimit);
    }

    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 _validateMaxGlobalSize(address _indexToken, bool _isLong, uint256 _sizeDelta) internal view {
        if (_sizeDelta == 0) {
            return;
        }

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

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

        PositionUtils.increasePosition(
            vault,
            router,
            shortsTracker,
            _account,
            _collateralToken,
            _indexToken,
            _sizeDelta,
            _isLong,
            _price
        );

        _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;

        uint256 markPrice = _isLong ? IVault(_vault).getMinPrice(_indexToken) : IVault(_vault).getMaxPrice(_indexToken);
        if (_isLong) {
            require(markPrice >= _price, "markPrice < price");
        } else {
            require(markPrice <= _price, "markPrice > price");
        }

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

        // should be called strictly before position is updated in Vault
        IShortsTracker(shortsTracker).updateGlobalShortData(_account, _collateralToken, _indexToken, _isLong, _sizeDelta, markPrice, false);

        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 _swap(address[] memory _path, uint256 _minOut, address _receiver) internal returns (uint256) {
        if (_path.length == 2) {
            return _vaultSwap(_path[0], _path[1], _minOut, _receiver);
        }
        revert("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, "insufficient amountOut");
        return amountOut;
    }

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

    function _transferOutETHWithGasLimitFallbackToWeth(uint256 _amountOut, address payable _receiver) internal {
        IWETH _weth = IWETH(weth);
        _weth.withdraw(_amountOut);

        (bool success, /* bytes memory data */) = _receiver.call{ value: _amountOut, gas: ethTransferGasLimit }("");

        if (success) { return; }

        // if the transfer failed, re-wrap the token and send it to the receiver
        _weth.deposit{ value: _amountOut }();
        _weth.transfer(address(_receiver), _amountOut);
    }

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

        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 _emitIncreasePositionReferral(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; }

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

        emit IncreasePositionReferral(
            _account,
            _sizeDelta,
            ITimelock(timelock).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; }

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

        emit DecreasePositionReferral(
            _account,
            _sizeDelta,
            ITimelock(timelock).marginFeeBasisPoints(),
            referralCode,
            referrer
        );
    }
}

File 4 of 18 : IBasePositionManager.sol
// 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);
}

File 5 of 18 : IOrderBook.sol
// 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;
}

File 6 of 18 : IRouter.sol
// 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 7 of 18 : IShortsTracker.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface IShortsTracker {
    function isGlobalShortDataReady() external view returns (bool);
    function globalShortAveragePrices(address _token) external view returns (uint256);
    function getNextGlobalShortData(
        address _account,
        address _collateralToken,
        address _indexToken,
        uint256 _nextPrice,
        uint256 _sizeDelta,
        bool _isIncrease
    ) external view returns (uint256, uint256);
    function updateGlobalShortData(
        address _account,
        address _collateralToken,
        address _indexToken,
        bool _isLong,
        uint256 _sizeDelta,
        uint256 _markPrice,
        bool _isIncrease
    ) external;
    function setIsGlobalShortDataReady(bool value) external;
    function setInitData(address[] calldata _tokens, uint256[] calldata _averagePrices) external;
}

File 8 of 18 : 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 usdq() external view returns (address);
    function gov() external view returns (address);
    function vaultUtils() external view returns (IVaultUtils);

    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 getTargetUsdqAmount(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 setUsdqAmount(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 _maxUsdqAmount,
        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 buyUSDQ(address _token, address _receiver) external returns (uint256);
    function sellUSDQ(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 validateLiquidation(address _account, address _collateralToken, address _indexToken, bool _isLong, bool _raise) external view returns (uint256, 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 _usdqDelta, 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 usdqAmounts(address _token) external view returns (uint256);
    function maxUsdqAmounts(address _token) external view returns (uint256);
    function getRedemptionAmount(address _token, uint256 _usdqAmount) 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);
}

File 9 of 18 : IVaultUtils.sol
// 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 getBuyUsdqFeeBasisPoints(address _token, uint256 _usdqAmount) external view returns (uint256);
    function getSellUsdqFeeBasisPoints(address _token, uint256 _usdqAmount) external view returns (uint256);
    function getSwapFeeBasisPoints(address _tokenIn, address _tokenOut, uint256 _usdqAmount) external view returns (uint256);
    function getFeeBasisPoints(address _token, uint256 _usdqDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256);
    function getMaxAmountIn(
        address _tokenIn,
        address _tokenOut
    ) external view returns (uint256);
}

File 10 of 18 : PositionUtils.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../libraries/math/SafeMath.sol";
import "../peripherals/interfaces/ITimelock.sol";

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

library PositionUtils {
    using SafeMath for uint256;

    uint256 public constant BASIS_POINTS_DIVISOR = 10000;

    event LeverageDecreased(uint256 collateralDelta, uint256 prevLeverage, uint256 nextLeverage);

    function shouldDeductFee(
        address _vault,
        address _account,
        address[] memory _path,
        uint256 _amountIn,
        address _indexToken,
        bool _isLong,
        uint256 _sizeDelta,
        uint256 _increasePositionBufferBps
    ) external 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);

        emit LeverageDecreased(collateralDelta, prevLeverage, nextLeverage);

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

    function increasePosition(
        address _vault,
        address _router,
        address _shortsTracker,
        address _account,
        address _collateralToken,
        address _indexToken,
        uint256 _sizeDelta,
        bool _isLong,
        uint256 _price
    ) external {
        uint256 markPrice = _isLong ? IVault(_vault).getMaxPrice(_indexToken) : IVault(_vault).getMinPrice(_indexToken);
        if (_isLong) {
            require(markPrice <= _price, "markPrice > price");
        } else {
            require(markPrice >= _price, "markPrice < price");
        }

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

        // should be called strictly before position is updated in Vault
        IShortsTracker(_shortsTracker).updateGlobalShortData(_account, _collateralToken, _indexToken, _isLong, _sizeDelta, markPrice, true);

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

File 11 of 18 : SafeMath.sol
// 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;
    }
}

File 12 of 18 : IERC20.sol
// 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);
}

File 13 of 18 : SafeERC20.sol
// 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");
        }
    }
}

File 14 of 18 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.12;

/**
 * @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 15 of 18 : 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;
    }
}

File 16 of 18 : ITimelock.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface ITimelock {
    function marginFeeBasisPoints() external returns (uint256);
    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;
}

File 17 of 18 : IReferralStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface IReferralStorage {
    function codeOwners(bytes32 _code) external view returns (address);
    function traderReferralCodes(address _account) external view returns (bytes32);
    function referrerDiscountShares(address _account) external view returns (uint256);
    function referrerTiers(address _account) external view returns (uint256);
    function getTraderReferralInfo(address _account) external view returns (bytes32, address);
    function setTraderReferralCode(address _account, bytes32 _code) external;
    function setTier(uint256 _tierId, uint256 _totalRebate, uint256 _discountShare) external;
    function setReferrerTier(address _referrer, uint256 _tierId) external;
    function govSetCodeOwner(bytes32 _code, address _newAccount) external;
}

File 18 of 18 : IWETH.sol
//SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface IWETH {
    function deposit() external payable;
    function transfer(address to, uint value) external returns (bool);
    function withdraw(uint) external;
}

Settings
{
  "metadata": {
    "bytecodeHash": "none",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 1
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {
    "contracts/core/PositionUtils.sol": {
      "PositionUtils": "0x11e3657fcde2053db4ec0e6327c3908aaf449c7b"
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_vault","type":"address"},{"internalType":"address","name":"_router","type":"address"},{"internalType":"address","name":"_shortsTracker","type":"address"},{"internalType":"address","name":"_weth","type":"address"},{"internalType":"uint256","name":"_depositFee","type":"uint256"},{"internalType":"address","name":"_orderBook","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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":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":"depositFee","type":"uint256"}],"name":"SetDepositFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"ethTransferGasLimit","type":"uint256"}],"name":"SetEthTransferGasLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"inLegacyMode","type":"bool"}],"name":"SetInLegacyMode","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"increasePositionBufferBps","type":"uint256"}],"name":"SetIncreasePositionBufferBps","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"isActive","type":"bool"}],"name":"SetLiquidator","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":"_minStayingOpenTime","type":"uint256"}],"name":"SetMinStayingOpenTime","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"orderBook","type":"address"}],"name":"SetOrderBook","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"isActive","type":"bool"}],"name":"SetOrderKeeper","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"isActive","type":"bool"}],"name":"SetPartner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"minTime","type":"uint256"}],"name":"SetPartnerMinStayingOpenTime","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"referralStorage","type":"address"}],"name":"SetReferralStorage","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"shouldValidateIncreaseOrder","type":"bool"}],"name":"SetShouldValidateIncreaseOrder","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":"address","name":"_collateralToken","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":"_price","type":"uint256"}],"name":"decreasePosition","outputs":[],"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":"_price","type":"uint256"},{"internalType":"uint256","name":"_minOut","type":"uint256"}],"name":"decreasePositionAndSwap","outputs":[],"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 payable","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_minOut","type":"uint256"}],"name":"decreasePositionAndSwapETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collateralToken","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 payable","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"decreasePositionETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethTransferGasLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_orderIndex","type":"uint256"},{"internalType":"address payable","name":"_feeReceiver","type":"address"}],"name":"executeDecreaseOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_orderIndex","type":"uint256"},{"internalType":"address payable","name":"_feeReceiver","type":"address"}],"name":"executeIncreaseOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_orderIndex","type":"uint256"},{"internalType":"address payable","name":"_feeReceiver","type":"address"}],"name":"executeSwapOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"feeReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gov","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"inLegacyMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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":"_price","type":"uint256"},{"internalType":"bytes32","name":"_referralCode","type":"bytes32"}],"name":"increasePosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"increasePositionBufferBps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"_price","type":"uint256"},{"internalType":"bytes32","name":"_referralCode","type":"bytes32"}],"name":"increasePositionETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isLiquidator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isOrderKeeper","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isPartner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"address","name":"_collateralToken","type":"address"},{"internalType":"address","name":"_indexToken","type":"address"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"address","name":"_feeReceiver","type":"address"}],"name":"liquidatePosition","outputs":[],"stateMutability":"nonpayable","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":"minStayingOpenTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"orderBook","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"partnerMinStayingOpenTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"_depositFee","type":"uint256"}],"name":"setDepositFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ethTransferGasLimit","type":"uint256"}],"name":"setEthTransferGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gov","type":"address"}],"name":"setGov","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_inLegacyMode","type":"bool"}],"name":"setInLegacyMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_increasePositionBufferBps","type":"uint256"}],"name":"setIncreasePositionBufferBps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bool","name":"_isActive","type":"bool"}],"name":"setLiquidator","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":"_minStayingOpenTime","type":"uint256"}],"name":"setMinStayingOpenTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_orderBook","type":"address"}],"name":"setOrderBook","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bool","name":"_isActive","type":"bool"}],"name":"setOrderKeeper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bool","name":"_isActive","type":"bool"}],"name":"setPartner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_minTime","type":"uint256"}],"name":"setPartnerMinStayingOpenTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_referralStorage","type":"address"}],"name":"setReferralStorage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_shouldValidateIncreaseOrder","type":"bool"}],"name":"setShouldValidateIncreaseOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shortsTracker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"shouldValidateIncreaseOrder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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"}]

60806040526207a1206007556064600955600e805460ff60a81b1916600160a81b179055610384600f5534801561003557600080fd5b506040516200544f3803806200544f833981810160405260c081101561005a57600080fd5b508051602082015160408301516060840151608085015160a0909501516001600081905580546001600160a01b031990811633908117909255600380546001600160a01b039889169083161790556005805496881696821696909617909555600680549387169386169390931790925560089590955560048054928516928416929092179091556002805483169091179055600e805492909316911617905561534680620001096000396000f3fe60806040526004361061023c5760003560e01c80626cc35e1461029857806307c7edc3146102c95780631045c74e1461030c57806311d9444a14610351578063126082cf1461039457806312d43a51146103a9578063151cfeb3146103be5780631b904359146103f75780631ce9cb8f146104235780631e261538146104565780631e9f724b1461049157806321acf6591461056e578063233bfe3b146105a957806324a084df146105d35780632d79cf421461060c5780633039e37f146106215780633833f5f5146107015780633a9b52ad146107485780633fc8cef314610772578063430ed37c146107875780634453a374146107e65780634584bd4b14610821578063490ae210146108365780634bbd44eb14610860578063529a356f146108935780635fc8500e146108c6578063657bc5d0146109a657806367a52793146109bb578063704b6c02146109d0578063776af5ba14610a035780638541a68114610a185780638c0f9aac14610a4257806390205d8c14610a755780639698d25a14610ad457806398d1e03a14610b075780639a1598c814610b1c5780639c95332f14610b4f578063a6c96d8114610b7b578063ae4d7f9a14610c44578063b71a44b414610c77578063cfad57a214610c8c578063d38ab51914610cbf578063d4ca83f914610d02578063de2ea94814610d17578063e1f21c6714610d6c578063ef12c67e14610daf578063f255527814610f61578063f851a44014610f9c578063f887ea4014610fb1578063fbfa77cf14610fc657610293565b36610293576006546001600160a01b03163314610291576040805162461bcd60e51b815260206004820152600e60248201526d34b73b30b634b21039b2b73232b960911b604482015290519081900360640190fd5b005b600080fd5b3480156102a457600080fd5b506102ad610fdb565b604080516001600160a01b039092168252519081900360200190f35b3480156102d557600080fd5b50610291600480360360608110156102ec57600080fd5b506001600160a01b03813581169160208101359160409091013516610fea565b34801561031857600080fd5b5061033f6004803603602081101561032f57600080fd5b50356001600160a01b03166110b6565b60408051918252519081900360200190f35b34801561035d57600080fd5b506102916004803603606081101561037457600080fd5b506001600160a01b038135811691602081013591604090910135166110c8565b3480156103a057600080fd5b5061033f611528565b3480156103b557600080fd5b506102ad61152e565b3480156103ca57600080fd5b50610291600480360360408110156103e157600080fd5b506001600160a01b03813516906020013561153d565b34801561040357600080fd5b506102916004803603602081101561041a57600080fd5b503515156115dc565b34801561042f57600080fd5b5061033f6004803603602081101561044657600080fd5b50356001600160a01b031661167a565b34801561046257600080fd5b506102916004803603604081101561047957600080fd5b506001600160a01b038135169060200135151561168c565b34801561049d57600080fd5b5061029160048036036101008110156104b557600080fd5b810190602081018135600160201b8111156104cf57600080fd5b8201836020820111156104e157600080fd5b803590602001918460208302840111600160201b8311171561050257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013590608081013515159060a08101359060c00135611737565b34801561057a57600080fd5b506102916004803603604081101561059157600080fd5b506001600160a01b0381351690602001351515611a40565b3480156105b557600080fd5b50610291600480360360208110156105cc57600080fd5b5035611aef565b3480156105df57600080fd5b50610291600480360360408110156105f657600080fd5b506001600160a01b038135169060200135611b75565b34801561061857600080fd5b5061033f611bd9565b34801561062d57600080fd5b50610291600480360361010081101561064557600080fd5b810190602081018135600160201b81111561065f57600080fd5b82018360208201111561067157600080fd5b803590602001918460208302840111600160201b8311171561069257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505081356001600160a01b0390811693506020830135926040810135925060608101351515916080820135169060a08101359060c00135611bdf565b34801561070d57600080fd5b506107346004803603602081101561072457600080fd5b50356001600160a01b0316611dda565b604080519115158252519081900360200190f35b34801561075457600080fd5b506102916004803603602081101561076b57600080fd5b5035611def565b34801561077e57600080fd5b506102ad611e75565b34801561079357600080fd5b50610291600480360360e08110156107aa57600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608082013515159160a08101359091169060c00135611e84565b3480156107f257600080fd5b506102916004803603604081101561080957600080fd5b506001600160a01b0381351690602001351515611faa565b34801561082d57600080fd5b50610734612055565b34801561084257600080fd5b506102916004803603602081101561085957600080fd5b5035612065565b34801561086c57600080fd5b5061033f6004803603602081101561088357600080fd5b50356001600160a01b03166120eb565b34801561089f57600080fd5b50610734600480360360208110156108b657600080fd5b50356001600160a01b03166120fd565b3480156108d257600080fd5b5061029160048036036101008110156108ea57600080fd5b810190602081018135600160201b81111561090457600080fd5b82018360208201111561091657600080fd5b803590602001918460208302840111600160201b8311171561093757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505081356001600160a01b0390811693506020830135926040810135925060608101351515916080820135169060a08101359060c00135612112565b3480156109b257600080fd5b506102ad61225a565b3480156109c757600080fd5b5061033f612269565b3480156109dc57600080fd5b50610291600480360360208110156109f357600080fd5b50356001600160a01b031661226f565b348015610a0f57600080fd5b506102ad612310565b348015610a2457600080fd5b5061029160048036036020811015610a3b57600080fd5b503561231f565b348015610a4e57600080fd5b5061073460048036036020811015610a6557600080fd5b50356001600160a01b03166123a5565b348015610a8157600080fd5b50610291600480360360e0811015610a9857600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608082013515159160a08101359091169060c001356123ba565b348015610ae057600080fd5b5061033f60048036036020811015610af757600080fd5b50356001600160a01b0316612486565b348015610b1357600080fd5b5061033f612498565b348015610b2857600080fd5b5061029160048036036020811015610b3f57600080fd5b50356001600160a01b031661249e565b348015610b5b57600080fd5b5061029160048036036020811015610b7257600080fd5b5035151561253d565b610291600480360360e0811015610b9157600080fd5b810190602081018135600160201b811115610bab57600080fd5b820183602082011115610bbd57600080fd5b803590602001918460208302840111600160201b83111715610bde57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013515159060808101359060a001356125db565b348015610c5057600080fd5b5061029160048036036020811015610c6757600080fd5b50356001600160a01b0316612804565b348015610c8357600080fd5b5061033f6128a3565b348015610c9857600080fd5b5061029160048036036020811015610caf57600080fd5b50356001600160a01b03166128a9565b348015610ccb57600080fd5b5061029160048036036060811015610ce257600080fd5b506001600160a01b03813581169160208101359160409091013516612918565b348015610d0e57600080fd5b50610734612d79565b348015610d2357600080fd5b50610291600480360360a0811015610d3a57600080fd5b506001600160a01b03813581169160208101358216916040820135811691606081013515159160809091013516612d89565b348015610d7857600080fd5b5061029160048036036060811015610d8f57600080fd5b506001600160a01b0381358116916020810135909116906040013561322e565b348015610dbb57600080fd5b5061029160048036036060811015610dd257600080fd5b810190602081018135600160201b811115610dec57600080fd5b820183602082011115610dfe57600080fd5b803590602001918460208302840111600160201b83111715610e1f57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610e6e57600080fd5b820183602082011115610e8057600080fd5b803590602001918460208302840111600160201b83111715610ea157600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610ef057600080fd5b820183602082011115610f0257600080fd5b803590602001918460208302840111600160201b83111715610f2357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550613303945050505050565b348015610f6d57600080fd5b5061029160048036036040811015610f8457600080fd5b506001600160a01b03813581169160200135166134f0565b348015610fa857600080fd5b506102ad6135d2565b348015610fbd57600080fd5b506102ad6135e1565b348015610fd257600080fd5b506102ad6135f0565b600a546001600160a01b031681565b3360009081526010602052604090205460ff1661103c576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b600e54604080516307c7edc360e01b81526001600160a01b038681166004830152602482018690528481166044830152915191909216916307c7edc391606480830192600092919082900301818387803b15801561109957600080fd5b505af11580156110ad573d6000803e3d6000fd5b50505050505050565b600c6020526000908152604090205481565b3360009081526010602052604090205460ff1661111a576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b600354604080516312d43a5160e01b815290516001600160a01b039092169160009183916312d43a5191600480820192602092909190829003018186803b15801561116457600080fd5b505afa158015611178573d6000803e3d6000fd5b505050506040513d602081101561118e57600080fd5b5051600e5460408051630130197760e11b81526001600160a01b03898116600483015260248201899052915193945060009384938493849391169163026032ee9160448082019261010092909190829003018186803b1580156111f057600080fd5b505afa158015611204573d6000803e3d6000fd5b505050506040513d61010081101561121b57600080fd5b50805160408201516060830151608090930151919650945090925090506000816112bd57866001600160a01b031663e124e6d2856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561128c57600080fd5b505afa1580156112a0573d6000803e3d6000fd5b505050506040513d60208110156112b657600080fd5b5051611337565b866001600160a01b03166381a612d6856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561130a57600080fd5b505afa15801561131e573d6000803e3d6000fd5b505050506040513d602081101561133457600080fd5b50515b6004805460408051633cc8e33b60e21b81526001600160a01b038f8116948201949094528984166024820152888416604482015286151560648201526084810188905260a48101859052600060c482018190529151949550929091169263f3238cec9260e480820193929182900301818387803b1580156113b757600080fd5b505af11580156113cb573d6000803e3d6000fd5b50505050856001600160a01b0316636d63c1d0886040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b15801561141e57600080fd5b505af1158015611432573d6000803e3d6000fd5b5050600e54604080516308eca22560e11b81526001600160a01b038f81166004830152602482018f90528d8116604483015291519190921693506311d9444a9250606480830192600092919082900301818387803b15801561149357600080fd5b505af11580156114a7573d6000803e3d6000fd5b50505050856001600160a01b031663d3c87bbb886040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156114fa57600080fd5b505af115801561150e573d6000803e3d6000fd5b5050505061151c8a846135ff565b50505050505050505050565b61271081565b6001546001600160a01b031681565b6002546001600160a01b03163314611588576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6001600160a01b038216600081815260136020908152604091829020849055815184815291517f6b1e3c843407e072e0b29bbde7fa8e8bb9e8580b6b6002be285788429e8459169281900390910190a25050565b6002546001600160a01b03163314611627576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b600e8054821515600160a81b810260ff60a81b199092169190911790915560408051918252517fa956222e37fe025ff51e5440ac729a9bd417ff91e485e14dcffa2c0ba8894f409181900360200190a150565b600b6020526000908152604090205481565b6002546001600160a01b031633146116d7576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6001600160a01b038216600081815260106020908152604091829020805460ff1916851515908117909155825190815291517f1d5bc0255b943d6a5b5279e8a55d74d620baccbceecb25e87a3558f14c4c118e9281900390910190a25050565b6002600054141561177d576040805162461bcd60e51b815260206004820152601f6024820152600080516020615171833981519152604482015290519081900360640190fd5b600260009081553381526011602052604090205460ff16806117a85750600e54600160a01b900460ff165b6117e7576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b8751600114806117f8575087516002145b6118335760405162461bcd60e51b81526004018080602001828103825260258152602001806153156025913960400191505060405180910390fd5b61183c816137f4565b8515611a0c578751600114156118fc5760055488516001600160a01b0390911690631b827878908a9060009061186e57fe5b602002602001015133308a6040518563ffffffff1660e01b815260040180856001600160a01b03168152602001846001600160a01b03168152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156118df57600080fd5b505af11580156118f3573d6000803e3d6000fd5b505050506119ae565b60055488516001600160a01b0390911690631b827878908a9060009061191e57fe5b6020908102919091010151600354604080516001600160e01b031960e086901b1681526001600160a01b039384166004820152336024820152929091166044830152606482018a905251608480830192600092919082900301818387803b15801561198857600080fd5b505af115801561199c573d6000803e3d6000fd5b505050506119ab88863061387c565b95505b60006119be338a898b888a61390e565b9050611a0a600360009054906101000a90046001600160a01b0316828b60018d5103815181106119ea57fe5b60200260200101516001600160a01b0316613b049092919063ffffffff16565b505b611a31338960018b510381518110611a2057fe5b602002602001015189878787613b5b565b50506001600055505050505050565b6002546001600160a01b03163314611a8b576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6001600160a01b038216600081815260116020908152604091829020805460ff191685151590811790915582519384529083015280517fa4e46c70ff429a91de7d1716d736e877c7cca1c22ac850b23d242530dd95e4749281900390910190a15050565b6002546001600160a01b03163314611b3a576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60098190556040805182815290517f21167d0d4661af93817ebce920f18986eed3d75d5e1c03f2aed05efcbafbc4529181900360200190a150565b6001546001600160a01b03163314611bc2576040805162461bcd60e51b81526020600482015260156024820152600080516020615191833981519152604482015290519081900360640190fd5b611bd56001600160a01b03831682613c35565b5050565b60075481565b60026000541415611c25576040805162461bcd60e51b815260206004820152601f6024820152600080516020615171833981519152604482015290519081900360640190fd5b600260009081553381526011602052604090205460ff1680611c505750600e54600160a01b900460ff165b611c8f576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b8751600214611ccf5760405162461bcd60e51b81526004018080602001828103825260258152602001806153156025913960400191505060405180910390fd5b60065488516001600160a01b039091169089906000198101908110611cf057fe5b60200260200101516001600160a01b031614611d41576040805162461bcd60e51b815260206004820152601e6024820152600080516020615211833981519152604482015290519081900360640190fd5b611d613389600081518110611d5257fe5b60200260200101518987613d1a565b6000611d87338a600081518110611d7457fe5b60200260200101518a8a8a8a308a613ea6565b9050611db0600360009054906101000a90046001600160a01b0316828b6000815181106119ea57fe5b6000611dbd8a843061387c565b9050611dc98186614353565b505060016000555050505050505050565b60106020526000908152604090205460ff1681565b6002546001600160a01b03163314611e3a576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60078190556040805182815290517f4d371d598d3a13f99ce992a17975bbaf1e1c256e072ec7d2f93ce88e40d9ba1c9181900360200190a150565b6006546001600160a01b031681565b60026000541415611eca576040805162461bcd60e51b815260206004820152601f6024820152600080516020615171833981519152604482015290519081900360640190fd5b600260009081553381526011602052604090205460ff1680611ef55750600e54600160a01b900460ff165b611f34576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b6006546001600160a01b03888116911614611f805760405162461bcd60e51b81526004018080602001828103825260298152602001806152996029913960400191505060405180910390fd5b611f8c33888886613d1a565b6000611f9e3389898989893089613ea6565b9050611a318184614353565b6002546001600160a01b03163314611ff5576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6001600160a01b038216600081815260126020908152604091829020805460ff1916851515908117909155825190815291517f8c0d56805c3b43d441481229dc64bee168253ffe4305f37ab7cfe63b1c4268c69281900390910190a25050565b600e54600160a81b900460ff1681565b6002546001600160a01b031633146120b0576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60088190556040805182815290517f974fd3c1fcb4653dfc4fb740c4c692cd212d55c28f163f310128cb64d83006759181900360200190a150565b60136020526000908152604090205481565b60126020526000908152604090205460ff1681565b60026000541415612158576040805162461bcd60e51b815260206004820152601f6024820152600080516020615171833981519152604482015290519081900360640190fd5b600260009081553381526011602052604090205460ff16806121835750600e54600160a01b900460ff165b6121c2576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b87516002146122025760405162461bcd60e51b81526004018080602001828103825260258152602001806153156025913960400191505060405180910390fd5b6122133389600081518110611d5257fe5b6000612226338a600081518110611d7457fe5b905061224f600360009054906101000a90046001600160a01b0316828b6000815181106119ea57fe5b611dc989838661387c565b6004546001600160a01b031681565b60085481565b6001546001600160a01b031633146122bc576040805162461bcd60e51b81526020600482015260156024820152600080516020615191833981519152604482015290519081900360640190fd5b600280546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f5a272403b402d892977df56625f4164ccaf70ca3863991c43ecfe76a6905b0a19181900360200190a150565b600e546001600160a01b031681565b6002546001600160a01b0316331461236a576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b600f8190556040805182815290517f84a322f9a1c11064ccce3a397d245d08f0c4966f135287307b2640cb92a058349181900360200190a150565b60116020526000908152604090205460ff1681565b60026000541415612400576040805162461bcd60e51b815260206004820152601f6024820152600080516020615171833981519152604482015290519081900360640190fd5b600260009081553381526011602052604090205460ff168061242b5750600e54600160a01b900460ff165b61246a576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b61247633888886613d1a565b611a313388888888888888613ea6565b600d6020526000908152604090205481565b60095481565b6002546001600160a01b031633146124e9576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b600e80546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f583d5a8a640dd23e92c793dba00c959d15eaf43d4530f3bbf15229c80869d23c9181900360200190a150565b6002546001600160a01b03163314612588576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b600e8054821515600160a01b810260ff60a01b199092169190911790915560408051918252517feac6b3611e79ff0d8ea5daa8439f6b1ab7eea4ebf95f1dd360417f712c3fc3049181900360200190a150565b60026000541415612621576040805162461bcd60e51b815260206004820152601f6024820152600080516020615171833981519152604482015290519081900360640190fd5b600260009081553381526011602052604090205460ff168061264c5750600e54600160a01b900460ff165b61268b576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b86516001148061269c575086516002145b6126d75760405162461bcd60e51b81526004018080602001828103825260258152602001806153156025913960400191505060405180910390fd5b60065487516001600160a01b039091169088906000906126f357fe5b60200260200101516001600160a01b031614612744576040805162461bcd60e51b815260206004820152601e6024820152600080516020615211833981519152604482015290519081900360640190fd5b61274d816137f4565b34156127d15761275b6144f3565b865134906001101561279257600354600654612784916001600160a01b03918216911634613b04565b61278f88873061387c565b90505b60006127a2338a848b898b61390e565b90506127ce600360009054906101000a90046001600160a01b0316828b60018d5103815181106119ea57fe5b50505b6127f6338860018a5103815181106127e557fe5b602002602001015188878787613b5b565b505060016000555050505050565b6002546001600160a01b0316331461284f576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b600a80546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f828abcccea18192c21d645e575652c49e20b986dab777906fc473d056b01b6a89181900360200190a150565b600f5481565b6001546001600160a01b031633146128f6576040805162461bcd60e51b81526020600482015260156024820152600080516020615191833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b3360009081526010602052604090205460ff1661296a576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b612974838361454b565b600354604080516312d43a5160e01b815290516001600160a01b039092169160009183916312d43a5191600480820192602092909190829003018186803b1580156129be57600080fd5b505afa1580156129d2573d6000803e3d6000fd5b505050506040513d60208110156129e857600080fd5b5051600e546040805163d3bab1d160e01b81526001600160a01b03898116600483015260248201899052915193945060009384938493849391169163d3bab1d19160448082019261012092909190829003018186803b158015612a4a57600080fd5b505afa158015612a5e573d6000803e3d6000fd5b505050506040513d610120811015612a7557600080fd5b5060408101516060820151608083015160a09093015191965094509092509050600081612b1a57866001600160a01b03166381a612d6856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612ae957600080fd5b505afa158015612afd573d6000803e3d6000fd5b505050506040513d6020811015612b1357600080fd5b5051612b94565b866001600160a01b031663e124e6d2856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612b6757600080fd5b505afa158015612b7b573d6000803e3d6000fd5b505050506040513d6020811015612b9157600080fd5b50515b6004805460408051633cc8e33b60e21b81526001600160a01b038f8116948201949094528984166024820152888416604482015286151560648201526084810188905260a48101859052600160c4820152905193945091169163f3238cec9160e48082019260009290919082900301818387803b158015612c1457600080fd5b505af1158015612c28573d6000803e3d6000fd5b50505050856001600160a01b0316636d63c1d0886040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b158015612c7b57600080fd5b505af1158015612c8f573d6000803e3d6000fd5b5050600e546040805163d38ab51960e01b81526001600160a01b038f81166004830152602482018f90528d81166044830152915191909216935063d38ab5199250606480830192600092919082900301818387803b158015612cf057600080fd5b505af1158015612d04573d6000803e3d6000fd5b50505050856001600160a01b031663d3c87bbb886040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b158015612d5757600080fd5b505af1158015612d6b573d6000803e3d6000fd5b5050505061151c8a8461486e565b600e54600160a01b900460ff1681565b60026000541415612dcf576040805162461bcd60e51b815260206004820152601f6024820152600080516020615171833981519152604482015290519081900360640190fd5b600260009081553381526012602052604090205460ff16612e25576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b600354604080516312d43a5160e01b815290516001600160a01b039092169160009183916312d43a5191600480820192602092909190829003018186803b158015612e6f57600080fd5b505afa158015612e83573d6000803e3d6000fd5b505050506040513d6020811015612e9957600080fd5b505160035460408051634a3f088d60e01b81526001600160a01b038b811660048301528a811660248301528981166044830152881515606483015291519394506000939190921691634a3f088d91608480830192610100929190829003018186803b158015612f0757600080fd5b505afa158015612f1b573d6000803e3d6000fd5b505050506040513d610100811015612f3257600080fd5b50519050600085612fbb57836001600160a01b031663e124e6d2886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612f8a57600080fd5b505afa158015612f9e573d6000803e3d6000fd5b505050506040513d6020811015612fb457600080fd5b5051613035565b836001600160a01b03166381a612d6886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561300857600080fd5b505afa15801561301c573d6000803e3d6000fd5b505050506040513d602081101561303257600080fd5b50515b6004805460408051633cc8e33b60e21b81526001600160a01b038e8116948201949094528c841660248201528b841660448201528a151560648201526084810187905260a48101859052600060c482018190529151949550929091169263f3238cec9260e480820193929182900301818387803b1580156130b557600080fd5b505af11580156130c9573d6000803e3d6000fd5b50505050826001600160a01b0316636d63c1d0856040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b15801561311c57600080fd5b505af1158015613130573d6000803e3d6000fd5b505060408051631bc5d52960e31b81526001600160a01b038d811660048301528c811660248301528b811660448301528a1515606483015289811660848301529151918816935063de2ea948925060a48082019260009290919082900301818387803b15801561319f57600080fd5b505af11580156131b3573d6000803e3d6000fd5b50505050826001600160a01b031663d3c87bbb856040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b15801561320657600080fd5b505af115801561321a573d6000803e3d6000fd5b505060016000555050505050505050505050565b6001546001600160a01b0316331461327b576040805162461bcd60e51b81526020600482015260156024820152600080516020615191833981519152604482015290519081900360640190fd5b826001600160a01b031663095ea7b383836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156132d257600080fd5b505af11580156132e6573d6000803e3d6000fd5b505050506040513d60208110156132fc57600080fd5b5050505050565b6002546001600160a01b0316331461334e576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60005b83518110156133e957600084828151811061336857fe5b6020026020010151905083828151811061337e57fe5b6020026020010151600c6000836001600160a01b03166001600160a01b03168152602001908152602001600020819055508282815181106133bb57fe5b6020908102919091018101516001600160a01b039092166000908152600d9091526040902055600101613351565b507fae32d569b058895b9620d6552b09aaffedc9a6f396be4d595a224ad09f8b213983838360405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b8381101561345657818101518382015260200161343e565b50505050905001848103835286818151815260200191508051906020019060200280838360005b8381101561349557818101518382015260200161347d565b50505050905001848103825285818151815260200191508051906020019060200280838360005b838110156134d45781810151838201526020016134bc565b50505050905001965050505050505060405180910390a1505050565b6002546001600160a01b0316331461353b576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6001600160a01b0382166000908152600b60205260409020548061355f5750611bd5565b6001600160a01b0383166000818152600b6020526040812055613583908383613b04565b604080516001600160a01b0380861682528416602082015280820183905290517f4f1b51dd7a2fcb861aa2670f668be66835c4ee12b4bbbf037e4d0018f39819e49181900360600190a1505050565b6002546001600160a01b031681565b6005546001600160a01b031681565b6003546001600160a01b031681565b600a546001600160a01b0316806136165750611bd5565b600080826001600160a01b031663534ef883866040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050604080518083038186803b15801561366557600080fd5b505afa158015613679573d6000803e3d6000fd5b505050506040513d604081101561368f57600080fd5b5080516020909101519092509050816136aa57505050611bd5565b600354604080516312d43a5160e01b815290516000926001600160a01b0316916312d43a51916004808301926020929190829003018186803b1580156136ef57600080fd5b505afa158015613703573d6000803e3d6000fd5b505050506040513d602081101561371957600080fd5b50516040805163318bc68960e01b815290519192507f474c763ff84bf2c2039a6d9fea955ecd0f724030e3c365b91169c6a16fe751b791889188916001600160a01b0386169163318bc6899160048083019260209291908290030181600087803b15801561378657600080fd5b505af115801561379a573d6000803e3d6000fd5b505050506040513d60208110156137b057600080fd5b5051604080516001600160a01b03948516815260208101939093528281019190915260608201879052918516608082015290519081900360a00190a1505050505050565b801580159061380d5750600a546001600160a01b031615155b1561387957600a54604080516356b4b2ad60e01b81523360048201526024810184905290516001600160a01b03909216916356b4b2ad9160448082019260009290919082900301818387803b15801561386557600080fd5b505af11580156132fc573d6000803e3d6000fd5b50565b60008351600214156138c3576138bc8460008151811061389857fe5b6020026020010151856001815181106138ad57fe5b602002602001015185856149f5565b9050613907565b6040805162461bcd60e51b81526020600482015260146024820152730d2dcecc2d8d2c840bee0c2e8d05cd8cadccee8d60631b604482015290519081900360640190fd5b9392505050565b6000807311e3657fcde2053db4ec0e6327c3908aaf449c7b63e0cab550600360009054906101000a90046001600160a01b03168a8a8a8a8a8a6009546040518963ffffffff1660e01b815260040180896001600160a01b03168152602001886001600160a01b0316815260200180602001878152602001866001600160a01b031681526020018515158152602001848152602001838152602001828103825288818151815260200191508051906020019060200280838360005b838110156139e05781810151838201526020016139c8565b50505050905001995050505050505050505060206040518083038186803b158015613a0a57600080fd5b505af4158015613a1e573d6000803e3d6000fd5b505050506040513d6020811015613a3457600080fd5b505190508015613af5576000613a6d612710613a67613a60600854612710614ada90919063ffffffff16565b8a90614b25565b90614b7e565b90506000613a7b8883614ada565b905060008960018b510381518110613a8f57fe5b60200260200101519050613ad182600b6000846001600160a01b03166001600160a01b0316815260200190815260200160002054614bbd90919063ffffffff16565b6001600160a01b039091166000908152600b6020526040902055509150613afa9050565b859150505b9695505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052613b56908490614c15565b505050565b613b66848385614cc6565b60035460055460048054604080516317c3cf0f60e31b81526001600160a01b03958616938101939093529284166024830152831660448201528883166064820152878316608482015291861660a483015260c4820185905283151560e48301526101048201839052517311e3657fcde2053db4ec0e6327c3908aaf449c7b9163be1e787891610124808301926000929190829003018186803b158015613c0b57600080fd5b505af4158015613c1f573d6000803e3d6000fd5b50505050613c2d868461486e565b505050505050565b80471015613c8a576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d8060008114613cd5576040519150601f19603f3d011682016040523d82523d6000602084013e613cda565b606091505b5050905080613b565760405162461bcd60e51b815260040180806020018281038252603a8152602001806151b1603a913960400191505060405180910390fd5b60035460408051634a3f088d60e01b81526001600160a01b0387811660048301528681166024830152858116604483015284151560648301529151919092169160009182918491634a3f088d9160848082019261010092909190829003018186803b158015613d8857600080fd5b505afa158015613d9c573d6000803e3d6000fd5b505050506040513d610100811015613db357600080fd5b50805160e090910151909250905081613e13576040805162461bcd60e51b815260206004820152601f60248201527f506f736974696f6e4d616e616765723a20656d70747920706f736974696f6e00604482015290519081900360640190fd5b6001600160a01b038716600090815260136020526040812054613e3857600f54613e52565b6001600160a01b0388166000908152601360205260409020545b905042613e5f8383614bbd565b1115613e9c5760405162461bcd60e51b81526004018080602001828103825260298152602001806152c26029913960400191505060405180910390fd5b5050505050505050565b6003546000906001600160a01b03168185613f3957816001600160a01b031663e124e6d28a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015613f0857600080fd5b505afa158015613f1c573d6000803e3d6000fd5b505050506040513d6020811015613f3257600080fd5b5051613fb3565b816001600160a01b03166381a612d68a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015613f8657600080fd5b505afa158015613f9a573d6000803e3d6000fd5b505050506040513d6020811015613fb057600080fd5b50515b905085156140095783811015614004576040805162461bcd60e51b81526020600482015260116024820152706d61726b5072696365203c20707269636560781b604482015290519081900360640190fd5b614052565b83811115614052576040805162461bcd60e51b81526020600482015260116024820152706d61726b5072696365203e20707269636560781b604482015290519081900360640190fd5b6000826001600160a01b03166312d43a516040518163ffffffff1660e01b815260040160206040518083038186803b15801561408d57600080fd5b505afa1580156140a1573d6000803e3d6000fd5b505050506040513d60208110156140b757600080fd5b81019080805190602001909291905050509050600460009054906101000a90046001600160a01b03166001600160a01b031663f3238cec8d8d8d8b8d8860006040518863ffffffff1660e01b815260040180886001600160a01b03168152602001876001600160a01b03168152602001866001600160a01b0316815260200185151581526020018481526020018381526020018215158152602001975050505050505050600060405180830381600087803b15801561417557600080fd5b505af1158015614189573d6000803e3d6000fd5b50505050806001600160a01b0316636d63c1d0846040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156141dc57600080fd5b505af11580156141f0573d6000803e3d6000fd5b505050506000600560009054906101000a90046001600160a01b03166001600160a01b0316632662166b8e8e8e8e8e8e8e6040518863ffffffff1660e01b815260040180886001600160a01b03168152602001876001600160a01b03168152602001866001600160a01b031681526020018581526020018481526020018315158152602001826001600160a01b03168152602001975050505050505050602060405180830381600087803b1580156142a757600080fd5b505af11580156142bb573d6000803e3d6000fd5b505050506040513d60208110156142d157600080fd5b50516040805163d3c87bbb60e01b81526001600160a01b03878116600483015291519293509084169163d3c87bbb9160248082019260009290919082900301818387803b15801561432157600080fd5b505af1158015614335573d6000803e3d6000fd5b505050506143438d8a6135ff565b9c9b505050505050505050505050565b60065460408051632e1a7d4d60e01b81526004810185905290516001600160a01b03909216918291632e1a7d4d91602480830192600092919082900301818387803b1580156143a157600080fd5b505af11580156143b5573d6000803e3d6000fd5b5050600754604051600093506001600160a01b0386169250869084818181858888f193505050503d8060008114614408576040519150601f19603f3d011682016040523d82523d6000602084013e61440d565b606091505b50509050801561441e575050611bd5565b816001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b15801561445957600080fd5b505af115801561446d573d6000803e3d6000fd5b5050505050816001600160a01b031663a9059cbb84866040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156144c957600080fd5b505af11580156144dd573d6000803e3d6000fd5b505050506040513d6020811015613c2d57600080fd5b341561454957600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561386557600080fd5b565b600e546040805163d3bab1d160e01b81526001600160a01b03858116600483015260248201859052915160009384938493849384938493169163d3bab1d191604480830192610120929190829003018186803b1580156145aa57600080fd5b505afa1580156145be573d6000803e3d6000fd5b505050506040513d6101208110156145d557600080fd5b508051602082015160408301516060840151608085015160a090950151939a5091985096509450909250905061460c838284614cc6565b600e54600160a81b900460ff1661462857505050505050611bd5565b8061463857505050505050611bd5565b6000821161468d576040805162461bcd60e51b815260206004820152601d60248201527f506f736974696f6e4d616e616765723a206c6f6e67206465706f736974000000604482015290519081900360640190fd5b60035460408051634a3f088d60e01b81526001600160a01b038b811660048301528781166024830152868116604483015284151560648301529151919092169160009182918491634a3f088d9160848082019261010092909190829003018186803b1580156146fb57600080fd5b505afa15801561470f573d6000803e3d6000fd5b505050506040513d61010081101561472657600080fd5b50805160209091015190925090508161474757505050505050505050611bd5565b60006147538387614bbd565b90506000846001600160a01b0316630a48d5a98c8c6040518363ffffffff1660e01b815260040180836001600160a01b031681526020018281526020019250505060206040518083038186803b1580156147ac57600080fd5b505afa1580156147c0573d6000803e3d6000fd5b505050506040513d60208110156147d657600080fd5b5051905060006147e68483614bbd565b905060006147fa85613a6788612710614b25565b9050600061481b83613a676009546127100188614b2590919063ffffffff16565b90508181101561485c5760405162461bcd60e51b81526004018080602001828103825260278152602001806152726027913960400191505060405180910390fd5b50505050505050505050505050505050565b600a546001600160a01b0316806148855750611bd5565b600080826001600160a01b031663534ef883866040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050604080518083038186803b1580156148d457600080fd5b505afa1580156148e8573d6000803e3d6000fd5b505050506040513d60408110156148fe57600080fd5b50805160209091015190925090508161491957505050611bd5565b600354604080516312d43a5160e01b815290516000926001600160a01b0316916312d43a51916004808301926020929190829003018186803b15801561495e57600080fd5b505afa158015614972573d6000803e3d6000fd5b505050506040513d602081101561498857600080fd5b50516040805163318bc68960e01b815290519192507fc2414023ce7002ee98557d1e7be21e5559073336f2217ee5f9b2e50fd85f71ee91889188916001600160a01b0386169163318bc6899160048083019260209291908290030181600087803b15801561378657600080fd5b60035460408051634998b10960e11b81526001600160a01b03878116600483015286811660248301528481166044830152915160009384931691639331621291606480830192602092919082900301818787803b158015614a5557600080fd5b505af1158015614a69573d6000803e3d6000fd5b505050506040513d6020811015614a7f57600080fd5b5051905083811015614ad1576040805162461bcd60e51b81526020600482015260166024820152751a5b9cdd59999a58da595b9d08185b5bdd5b9d13dd5d60521b604482015290519081900360640190fd5b95945050505050565b6000614b1c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250614e95565b90505b92915050565b600082614b3457506000614b1f565b82820282848281614b4157fe5b0414614b1c5760405162461bcd60e51b81526004018080602001828103825260218152602001806152316021913960400191505060405180910390fd5b6000614b1c83836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b815250614f2c565b600082820183811015614b1c576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b6060614c6a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614f919092919063ffffffff16565b805190915015613b5657808060200190516020811015614c8957600080fd5b5051613b565760405162461bcd60e51b815260040180806020018281038252602a8152602001806152eb602a913960400191505060405180910390fd5b80614cd057613b56565b8115614dce576001600160a01b0383166000908152600c60205260409020548015801590614d8157506003546040805163783a2b6760e11b81526001600160a01b03878116600483015291518493614d7f93879391169163f07456ce91602480820192602092909190829003018186803b158015614d4d57600080fd5b505afa158015614d61573d6000803e3d6000fd5b505050506040513d6020811015614d7757600080fd5b505190614bbd565b115b15614dc8576040805162461bcd60e51b81526020600482015260126024820152711b585e081b1bdb99dcc8195e18d95959195960721b604482015290519081900360640190fd5b50613b56565b6001600160a01b0383166000908152600d60205260409020548015801590614e4757506003546040805163114f1b5560e31b81526001600160a01b03878116600483015291518493614e45938793911691638a78daa891602480820192602092909190829003018186803b158015614d4d57600080fd5b115b15614e8f576040805162461bcd60e51b81526020600482015260136024820152721b585e081cda1bdc9d1cc8195e18d959591959606a1b604482015290519081900360640190fd5b50505050565b60008184841115614f245760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614ee9578181015183820152602001614ed1565b50505050905090810190601f168015614f165780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183614f7b5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315614ee9578181015183820152602001614ed1565b506000838581614f8757fe5b0495945050505050565b6060614fa08484600085614fa8565b949350505050565b606082471015614fe95760405162461bcd60e51b81526004018080602001828103825260268152602001806151eb6026913960400191505060405180910390fd5b614ff285615104565b615043576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106150825780518252601f199092019160209182019101615063565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146150e4576040519150601f19603f3d011682016040523d82523d6000602084013e6150e9565b606091505b50915091506150f982828661510a565b979650505050505050565b3b151590565b60608315615119575081613907565b8251156151295782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315614ee9578181015183820152602001614ed156fe5265656e7472616e637947756172643a207265656e7472616e742063616c6c00476f7665726e61626c653a20666f7262696464656e0000000000000000000000416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c506f736974696f6e4d616e616765723a20696e76616c6964205f706174680000536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77506f736974696f6e4d616e616765723a20666f7262696464656e000000000000506f736974696f6e4d616e616765723a206c6f6e67206c65766572616765206465637265617365506f736974696f6e4d616e616765723a20696e76616c6964205f636f6c6c61746572616c546f6b656e506f736974696f6e4d616e616765723a206d696e2064656c6179206e6f7420796574207061737365645361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564506f736974696f6e4d616e616765723a20696e76616c6964205f706174682e6c656e677468a164736f6c634300060c000a00000000000000000000000099b31498b0a1dae01fc3433e3cb60f095340935c0000000000000000000000001fe9fba5955af58c18057213f0151bbe893ab2c8000000000000000000000000e5041618b6de86a3ae68db2283b92295a7b5ae6a0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e9000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000007e01238227213c513010f5fabd0634febee93ee5

Deployed Bytecode

0x60806040526004361061023c5760003560e01c80626cc35e1461029857806307c7edc3146102c95780631045c74e1461030c57806311d9444a14610351578063126082cf1461039457806312d43a51146103a9578063151cfeb3146103be5780631b904359146103f75780631ce9cb8f146104235780631e261538146104565780631e9f724b1461049157806321acf6591461056e578063233bfe3b146105a957806324a084df146105d35780632d79cf421461060c5780633039e37f146106215780633833f5f5146107015780633a9b52ad146107485780633fc8cef314610772578063430ed37c146107875780634453a374146107e65780634584bd4b14610821578063490ae210146108365780634bbd44eb14610860578063529a356f146108935780635fc8500e146108c6578063657bc5d0146109a657806367a52793146109bb578063704b6c02146109d0578063776af5ba14610a035780638541a68114610a185780638c0f9aac14610a4257806390205d8c14610a755780639698d25a14610ad457806398d1e03a14610b075780639a1598c814610b1c5780639c95332f14610b4f578063a6c96d8114610b7b578063ae4d7f9a14610c44578063b71a44b414610c77578063cfad57a214610c8c578063d38ab51914610cbf578063d4ca83f914610d02578063de2ea94814610d17578063e1f21c6714610d6c578063ef12c67e14610daf578063f255527814610f61578063f851a44014610f9c578063f887ea4014610fb1578063fbfa77cf14610fc657610293565b36610293576006546001600160a01b03163314610291576040805162461bcd60e51b815260206004820152600e60248201526d34b73b30b634b21039b2b73232b960911b604482015290519081900360640190fd5b005b600080fd5b3480156102a457600080fd5b506102ad610fdb565b604080516001600160a01b039092168252519081900360200190f35b3480156102d557600080fd5b50610291600480360360608110156102ec57600080fd5b506001600160a01b03813581169160208101359160409091013516610fea565b34801561031857600080fd5b5061033f6004803603602081101561032f57600080fd5b50356001600160a01b03166110b6565b60408051918252519081900360200190f35b34801561035d57600080fd5b506102916004803603606081101561037457600080fd5b506001600160a01b038135811691602081013591604090910135166110c8565b3480156103a057600080fd5b5061033f611528565b3480156103b557600080fd5b506102ad61152e565b3480156103ca57600080fd5b50610291600480360360408110156103e157600080fd5b506001600160a01b03813516906020013561153d565b34801561040357600080fd5b506102916004803603602081101561041a57600080fd5b503515156115dc565b34801561042f57600080fd5b5061033f6004803603602081101561044657600080fd5b50356001600160a01b031661167a565b34801561046257600080fd5b506102916004803603604081101561047957600080fd5b506001600160a01b038135169060200135151561168c565b34801561049d57600080fd5b5061029160048036036101008110156104b557600080fd5b810190602081018135600160201b8111156104cf57600080fd5b8201836020820111156104e157600080fd5b803590602001918460208302840111600160201b8311171561050257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013590608081013515159060a08101359060c00135611737565b34801561057a57600080fd5b506102916004803603604081101561059157600080fd5b506001600160a01b0381351690602001351515611a40565b3480156105b557600080fd5b50610291600480360360208110156105cc57600080fd5b5035611aef565b3480156105df57600080fd5b50610291600480360360408110156105f657600080fd5b506001600160a01b038135169060200135611b75565b34801561061857600080fd5b5061033f611bd9565b34801561062d57600080fd5b50610291600480360361010081101561064557600080fd5b810190602081018135600160201b81111561065f57600080fd5b82018360208201111561067157600080fd5b803590602001918460208302840111600160201b8311171561069257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505081356001600160a01b0390811693506020830135926040810135925060608101351515916080820135169060a08101359060c00135611bdf565b34801561070d57600080fd5b506107346004803603602081101561072457600080fd5b50356001600160a01b0316611dda565b604080519115158252519081900360200190f35b34801561075457600080fd5b506102916004803603602081101561076b57600080fd5b5035611def565b34801561077e57600080fd5b506102ad611e75565b34801561079357600080fd5b50610291600480360360e08110156107aa57600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608082013515159160a08101359091169060c00135611e84565b3480156107f257600080fd5b506102916004803603604081101561080957600080fd5b506001600160a01b0381351690602001351515611faa565b34801561082d57600080fd5b50610734612055565b34801561084257600080fd5b506102916004803603602081101561085957600080fd5b5035612065565b34801561086c57600080fd5b5061033f6004803603602081101561088357600080fd5b50356001600160a01b03166120eb565b34801561089f57600080fd5b50610734600480360360208110156108b657600080fd5b50356001600160a01b03166120fd565b3480156108d257600080fd5b5061029160048036036101008110156108ea57600080fd5b810190602081018135600160201b81111561090457600080fd5b82018360208201111561091657600080fd5b803590602001918460208302840111600160201b8311171561093757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505081356001600160a01b0390811693506020830135926040810135925060608101351515916080820135169060a08101359060c00135612112565b3480156109b257600080fd5b506102ad61225a565b3480156109c757600080fd5b5061033f612269565b3480156109dc57600080fd5b50610291600480360360208110156109f357600080fd5b50356001600160a01b031661226f565b348015610a0f57600080fd5b506102ad612310565b348015610a2457600080fd5b5061029160048036036020811015610a3b57600080fd5b503561231f565b348015610a4e57600080fd5b5061073460048036036020811015610a6557600080fd5b50356001600160a01b03166123a5565b348015610a8157600080fd5b50610291600480360360e0811015610a9857600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608082013515159160a08101359091169060c001356123ba565b348015610ae057600080fd5b5061033f60048036036020811015610af757600080fd5b50356001600160a01b0316612486565b348015610b1357600080fd5b5061033f612498565b348015610b2857600080fd5b5061029160048036036020811015610b3f57600080fd5b50356001600160a01b031661249e565b348015610b5b57600080fd5b5061029160048036036020811015610b7257600080fd5b5035151561253d565b610291600480360360e0811015610b9157600080fd5b810190602081018135600160201b811115610bab57600080fd5b820183602082011115610bbd57600080fd5b803590602001918460208302840111600160201b83111715610bde57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013515159060808101359060a001356125db565b348015610c5057600080fd5b5061029160048036036020811015610c6757600080fd5b50356001600160a01b0316612804565b348015610c8357600080fd5b5061033f6128a3565b348015610c9857600080fd5b5061029160048036036020811015610caf57600080fd5b50356001600160a01b03166128a9565b348015610ccb57600080fd5b5061029160048036036060811015610ce257600080fd5b506001600160a01b03813581169160208101359160409091013516612918565b348015610d0e57600080fd5b50610734612d79565b348015610d2357600080fd5b50610291600480360360a0811015610d3a57600080fd5b506001600160a01b03813581169160208101358216916040820135811691606081013515159160809091013516612d89565b348015610d7857600080fd5b5061029160048036036060811015610d8f57600080fd5b506001600160a01b0381358116916020810135909116906040013561322e565b348015610dbb57600080fd5b5061029160048036036060811015610dd257600080fd5b810190602081018135600160201b811115610dec57600080fd5b820183602082011115610dfe57600080fd5b803590602001918460208302840111600160201b83111715610e1f57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610e6e57600080fd5b820183602082011115610e8057600080fd5b803590602001918460208302840111600160201b83111715610ea157600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610ef057600080fd5b820183602082011115610f0257600080fd5b803590602001918460208302840111600160201b83111715610f2357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550613303945050505050565b348015610f6d57600080fd5b5061029160048036036040811015610f8457600080fd5b506001600160a01b03813581169160200135166134f0565b348015610fa857600080fd5b506102ad6135d2565b348015610fbd57600080fd5b506102ad6135e1565b348015610fd257600080fd5b506102ad6135f0565b600a546001600160a01b031681565b3360009081526010602052604090205460ff1661103c576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b600e54604080516307c7edc360e01b81526001600160a01b038681166004830152602482018690528481166044830152915191909216916307c7edc391606480830192600092919082900301818387803b15801561109957600080fd5b505af11580156110ad573d6000803e3d6000fd5b50505050505050565b600c6020526000908152604090205481565b3360009081526010602052604090205460ff1661111a576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b600354604080516312d43a5160e01b815290516001600160a01b039092169160009183916312d43a5191600480820192602092909190829003018186803b15801561116457600080fd5b505afa158015611178573d6000803e3d6000fd5b505050506040513d602081101561118e57600080fd5b5051600e5460408051630130197760e11b81526001600160a01b03898116600483015260248201899052915193945060009384938493849391169163026032ee9160448082019261010092909190829003018186803b1580156111f057600080fd5b505afa158015611204573d6000803e3d6000fd5b505050506040513d61010081101561121b57600080fd5b50805160408201516060830151608090930151919650945090925090506000816112bd57866001600160a01b031663e124e6d2856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561128c57600080fd5b505afa1580156112a0573d6000803e3d6000fd5b505050506040513d60208110156112b657600080fd5b5051611337565b866001600160a01b03166381a612d6856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561130a57600080fd5b505afa15801561131e573d6000803e3d6000fd5b505050506040513d602081101561133457600080fd5b50515b6004805460408051633cc8e33b60e21b81526001600160a01b038f8116948201949094528984166024820152888416604482015286151560648201526084810188905260a48101859052600060c482018190529151949550929091169263f3238cec9260e480820193929182900301818387803b1580156113b757600080fd5b505af11580156113cb573d6000803e3d6000fd5b50505050856001600160a01b0316636d63c1d0886040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b15801561141e57600080fd5b505af1158015611432573d6000803e3d6000fd5b5050600e54604080516308eca22560e11b81526001600160a01b038f81166004830152602482018f90528d8116604483015291519190921693506311d9444a9250606480830192600092919082900301818387803b15801561149357600080fd5b505af11580156114a7573d6000803e3d6000fd5b50505050856001600160a01b031663d3c87bbb886040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156114fa57600080fd5b505af115801561150e573d6000803e3d6000fd5b5050505061151c8a846135ff565b50505050505050505050565b61271081565b6001546001600160a01b031681565b6002546001600160a01b03163314611588576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6001600160a01b038216600081815260136020908152604091829020849055815184815291517f6b1e3c843407e072e0b29bbde7fa8e8bb9e8580b6b6002be285788429e8459169281900390910190a25050565b6002546001600160a01b03163314611627576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b600e8054821515600160a81b810260ff60a81b199092169190911790915560408051918252517fa956222e37fe025ff51e5440ac729a9bd417ff91e485e14dcffa2c0ba8894f409181900360200190a150565b600b6020526000908152604090205481565b6002546001600160a01b031633146116d7576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6001600160a01b038216600081815260106020908152604091829020805460ff1916851515908117909155825190815291517f1d5bc0255b943d6a5b5279e8a55d74d620baccbceecb25e87a3558f14c4c118e9281900390910190a25050565b6002600054141561177d576040805162461bcd60e51b815260206004820152601f6024820152600080516020615171833981519152604482015290519081900360640190fd5b600260009081553381526011602052604090205460ff16806117a85750600e54600160a01b900460ff165b6117e7576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b8751600114806117f8575087516002145b6118335760405162461bcd60e51b81526004018080602001828103825260258152602001806153156025913960400191505060405180910390fd5b61183c816137f4565b8515611a0c578751600114156118fc5760055488516001600160a01b0390911690631b827878908a9060009061186e57fe5b602002602001015133308a6040518563ffffffff1660e01b815260040180856001600160a01b03168152602001846001600160a01b03168152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156118df57600080fd5b505af11580156118f3573d6000803e3d6000fd5b505050506119ae565b60055488516001600160a01b0390911690631b827878908a9060009061191e57fe5b6020908102919091010151600354604080516001600160e01b031960e086901b1681526001600160a01b039384166004820152336024820152929091166044830152606482018a905251608480830192600092919082900301818387803b15801561198857600080fd5b505af115801561199c573d6000803e3d6000fd5b505050506119ab88863061387c565b95505b60006119be338a898b888a61390e565b9050611a0a600360009054906101000a90046001600160a01b0316828b60018d5103815181106119ea57fe5b60200260200101516001600160a01b0316613b049092919063ffffffff16565b505b611a31338960018b510381518110611a2057fe5b602002602001015189878787613b5b565b50506001600055505050505050565b6002546001600160a01b03163314611a8b576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6001600160a01b038216600081815260116020908152604091829020805460ff191685151590811790915582519384529083015280517fa4e46c70ff429a91de7d1716d736e877c7cca1c22ac850b23d242530dd95e4749281900390910190a15050565b6002546001600160a01b03163314611b3a576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60098190556040805182815290517f21167d0d4661af93817ebce920f18986eed3d75d5e1c03f2aed05efcbafbc4529181900360200190a150565b6001546001600160a01b03163314611bc2576040805162461bcd60e51b81526020600482015260156024820152600080516020615191833981519152604482015290519081900360640190fd5b611bd56001600160a01b03831682613c35565b5050565b60075481565b60026000541415611c25576040805162461bcd60e51b815260206004820152601f6024820152600080516020615171833981519152604482015290519081900360640190fd5b600260009081553381526011602052604090205460ff1680611c505750600e54600160a01b900460ff165b611c8f576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b8751600214611ccf5760405162461bcd60e51b81526004018080602001828103825260258152602001806153156025913960400191505060405180910390fd5b60065488516001600160a01b039091169089906000198101908110611cf057fe5b60200260200101516001600160a01b031614611d41576040805162461bcd60e51b815260206004820152601e6024820152600080516020615211833981519152604482015290519081900360640190fd5b611d613389600081518110611d5257fe5b60200260200101518987613d1a565b6000611d87338a600081518110611d7457fe5b60200260200101518a8a8a8a308a613ea6565b9050611db0600360009054906101000a90046001600160a01b0316828b6000815181106119ea57fe5b6000611dbd8a843061387c565b9050611dc98186614353565b505060016000555050505050505050565b60106020526000908152604090205460ff1681565b6002546001600160a01b03163314611e3a576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60078190556040805182815290517f4d371d598d3a13f99ce992a17975bbaf1e1c256e072ec7d2f93ce88e40d9ba1c9181900360200190a150565b6006546001600160a01b031681565b60026000541415611eca576040805162461bcd60e51b815260206004820152601f6024820152600080516020615171833981519152604482015290519081900360640190fd5b600260009081553381526011602052604090205460ff1680611ef55750600e54600160a01b900460ff165b611f34576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b6006546001600160a01b03888116911614611f805760405162461bcd60e51b81526004018080602001828103825260298152602001806152996029913960400191505060405180910390fd5b611f8c33888886613d1a565b6000611f9e3389898989893089613ea6565b9050611a318184614353565b6002546001600160a01b03163314611ff5576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6001600160a01b038216600081815260126020908152604091829020805460ff1916851515908117909155825190815291517f8c0d56805c3b43d441481229dc64bee168253ffe4305f37ab7cfe63b1c4268c69281900390910190a25050565b600e54600160a81b900460ff1681565b6002546001600160a01b031633146120b0576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60088190556040805182815290517f974fd3c1fcb4653dfc4fb740c4c692cd212d55c28f163f310128cb64d83006759181900360200190a150565b60136020526000908152604090205481565b60126020526000908152604090205460ff1681565b60026000541415612158576040805162461bcd60e51b815260206004820152601f6024820152600080516020615171833981519152604482015290519081900360640190fd5b600260009081553381526011602052604090205460ff16806121835750600e54600160a01b900460ff165b6121c2576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b87516002146122025760405162461bcd60e51b81526004018080602001828103825260258152602001806153156025913960400191505060405180910390fd5b6122133389600081518110611d5257fe5b6000612226338a600081518110611d7457fe5b905061224f600360009054906101000a90046001600160a01b0316828b6000815181106119ea57fe5b611dc989838661387c565b6004546001600160a01b031681565b60085481565b6001546001600160a01b031633146122bc576040805162461bcd60e51b81526020600482015260156024820152600080516020615191833981519152604482015290519081900360640190fd5b600280546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f5a272403b402d892977df56625f4164ccaf70ca3863991c43ecfe76a6905b0a19181900360200190a150565b600e546001600160a01b031681565b6002546001600160a01b0316331461236a576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b600f8190556040805182815290517f84a322f9a1c11064ccce3a397d245d08f0c4966f135287307b2640cb92a058349181900360200190a150565b60116020526000908152604090205460ff1681565b60026000541415612400576040805162461bcd60e51b815260206004820152601f6024820152600080516020615171833981519152604482015290519081900360640190fd5b600260009081553381526011602052604090205460ff168061242b5750600e54600160a01b900460ff165b61246a576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b61247633888886613d1a565b611a313388888888888888613ea6565b600d6020526000908152604090205481565b60095481565b6002546001600160a01b031633146124e9576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b600e80546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f583d5a8a640dd23e92c793dba00c959d15eaf43d4530f3bbf15229c80869d23c9181900360200190a150565b6002546001600160a01b03163314612588576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b600e8054821515600160a01b810260ff60a01b199092169190911790915560408051918252517feac6b3611e79ff0d8ea5daa8439f6b1ab7eea4ebf95f1dd360417f712c3fc3049181900360200190a150565b60026000541415612621576040805162461bcd60e51b815260206004820152601f6024820152600080516020615171833981519152604482015290519081900360640190fd5b600260009081553381526011602052604090205460ff168061264c5750600e54600160a01b900460ff165b61268b576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b86516001148061269c575086516002145b6126d75760405162461bcd60e51b81526004018080602001828103825260258152602001806153156025913960400191505060405180910390fd5b60065487516001600160a01b039091169088906000906126f357fe5b60200260200101516001600160a01b031614612744576040805162461bcd60e51b815260206004820152601e6024820152600080516020615211833981519152604482015290519081900360640190fd5b61274d816137f4565b34156127d15761275b6144f3565b865134906001101561279257600354600654612784916001600160a01b03918216911634613b04565b61278f88873061387c565b90505b60006127a2338a848b898b61390e565b90506127ce600360009054906101000a90046001600160a01b0316828b60018d5103815181106119ea57fe5b50505b6127f6338860018a5103815181106127e557fe5b602002602001015188878787613b5b565b505060016000555050505050565b6002546001600160a01b0316331461284f576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b600a80546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f828abcccea18192c21d645e575652c49e20b986dab777906fc473d056b01b6a89181900360200190a150565b600f5481565b6001546001600160a01b031633146128f6576040805162461bcd60e51b81526020600482015260156024820152600080516020615191833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b3360009081526010602052604090205460ff1661296a576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b612974838361454b565b600354604080516312d43a5160e01b815290516001600160a01b039092169160009183916312d43a5191600480820192602092909190829003018186803b1580156129be57600080fd5b505afa1580156129d2573d6000803e3d6000fd5b505050506040513d60208110156129e857600080fd5b5051600e546040805163d3bab1d160e01b81526001600160a01b03898116600483015260248201899052915193945060009384938493849391169163d3bab1d19160448082019261012092909190829003018186803b158015612a4a57600080fd5b505afa158015612a5e573d6000803e3d6000fd5b505050506040513d610120811015612a7557600080fd5b5060408101516060820151608083015160a09093015191965094509092509050600081612b1a57866001600160a01b03166381a612d6856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612ae957600080fd5b505afa158015612afd573d6000803e3d6000fd5b505050506040513d6020811015612b1357600080fd5b5051612b94565b866001600160a01b031663e124e6d2856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612b6757600080fd5b505afa158015612b7b573d6000803e3d6000fd5b505050506040513d6020811015612b9157600080fd5b50515b6004805460408051633cc8e33b60e21b81526001600160a01b038f8116948201949094528984166024820152888416604482015286151560648201526084810188905260a48101859052600160c4820152905193945091169163f3238cec9160e48082019260009290919082900301818387803b158015612c1457600080fd5b505af1158015612c28573d6000803e3d6000fd5b50505050856001600160a01b0316636d63c1d0886040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b158015612c7b57600080fd5b505af1158015612c8f573d6000803e3d6000fd5b5050600e546040805163d38ab51960e01b81526001600160a01b038f81166004830152602482018f90528d81166044830152915191909216935063d38ab5199250606480830192600092919082900301818387803b158015612cf057600080fd5b505af1158015612d04573d6000803e3d6000fd5b50505050856001600160a01b031663d3c87bbb886040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b158015612d5757600080fd5b505af1158015612d6b573d6000803e3d6000fd5b5050505061151c8a8461486e565b600e54600160a01b900460ff1681565b60026000541415612dcf576040805162461bcd60e51b815260206004820152601f6024820152600080516020615171833981519152604482015290519081900360640190fd5b600260009081553381526012602052604090205460ff16612e25576040805162461bcd60e51b815260206004820152601a6024820152600080516020615252833981519152604482015290519081900360640190fd5b600354604080516312d43a5160e01b815290516001600160a01b039092169160009183916312d43a5191600480820192602092909190829003018186803b158015612e6f57600080fd5b505afa158015612e83573d6000803e3d6000fd5b505050506040513d6020811015612e9957600080fd5b505160035460408051634a3f088d60e01b81526001600160a01b038b811660048301528a811660248301528981166044830152881515606483015291519394506000939190921691634a3f088d91608480830192610100929190829003018186803b158015612f0757600080fd5b505afa158015612f1b573d6000803e3d6000fd5b505050506040513d610100811015612f3257600080fd5b50519050600085612fbb57836001600160a01b031663e124e6d2886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612f8a57600080fd5b505afa158015612f9e573d6000803e3d6000fd5b505050506040513d6020811015612fb457600080fd5b5051613035565b836001600160a01b03166381a612d6886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561300857600080fd5b505afa15801561301c573d6000803e3d6000fd5b505050506040513d602081101561303257600080fd5b50515b6004805460408051633cc8e33b60e21b81526001600160a01b038e8116948201949094528c841660248201528b841660448201528a151560648201526084810187905260a48101859052600060c482018190529151949550929091169263f3238cec9260e480820193929182900301818387803b1580156130b557600080fd5b505af11580156130c9573d6000803e3d6000fd5b50505050826001600160a01b0316636d63c1d0856040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b15801561311c57600080fd5b505af1158015613130573d6000803e3d6000fd5b505060408051631bc5d52960e31b81526001600160a01b038d811660048301528c811660248301528b811660448301528a1515606483015289811660848301529151918816935063de2ea948925060a48082019260009290919082900301818387803b15801561319f57600080fd5b505af11580156131b3573d6000803e3d6000fd5b50505050826001600160a01b031663d3c87bbb856040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b15801561320657600080fd5b505af115801561321a573d6000803e3d6000fd5b505060016000555050505050505050505050565b6001546001600160a01b0316331461327b576040805162461bcd60e51b81526020600482015260156024820152600080516020615191833981519152604482015290519081900360640190fd5b826001600160a01b031663095ea7b383836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156132d257600080fd5b505af11580156132e6573d6000803e3d6000fd5b505050506040513d60208110156132fc57600080fd5b5050505050565b6002546001600160a01b0316331461334e576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60005b83518110156133e957600084828151811061336857fe5b6020026020010151905083828151811061337e57fe5b6020026020010151600c6000836001600160a01b03166001600160a01b03168152602001908152602001600020819055508282815181106133bb57fe5b6020908102919091018101516001600160a01b039092166000908152600d9091526040902055600101613351565b507fae32d569b058895b9620d6552b09aaffedc9a6f396be4d595a224ad09f8b213983838360405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b8381101561345657818101518382015260200161343e565b50505050905001848103835286818151815260200191508051906020019060200280838360005b8381101561349557818101518382015260200161347d565b50505050905001848103825285818151815260200191508051906020019060200280838360005b838110156134d45781810151838201526020016134bc565b50505050905001965050505050505060405180910390a1505050565b6002546001600160a01b0316331461353b576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6001600160a01b0382166000908152600b60205260409020548061355f5750611bd5565b6001600160a01b0383166000818152600b6020526040812055613583908383613b04565b604080516001600160a01b0380861682528416602082015280820183905290517f4f1b51dd7a2fcb861aa2670f668be66835c4ee12b4bbbf037e4d0018f39819e49181900360600190a1505050565b6002546001600160a01b031681565b6005546001600160a01b031681565b6003546001600160a01b031681565b600a546001600160a01b0316806136165750611bd5565b600080826001600160a01b031663534ef883866040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050604080518083038186803b15801561366557600080fd5b505afa158015613679573d6000803e3d6000fd5b505050506040513d604081101561368f57600080fd5b5080516020909101519092509050816136aa57505050611bd5565b600354604080516312d43a5160e01b815290516000926001600160a01b0316916312d43a51916004808301926020929190829003018186803b1580156136ef57600080fd5b505afa158015613703573d6000803e3d6000fd5b505050506040513d602081101561371957600080fd5b50516040805163318bc68960e01b815290519192507f474c763ff84bf2c2039a6d9fea955ecd0f724030e3c365b91169c6a16fe751b791889188916001600160a01b0386169163318bc6899160048083019260209291908290030181600087803b15801561378657600080fd5b505af115801561379a573d6000803e3d6000fd5b505050506040513d60208110156137b057600080fd5b5051604080516001600160a01b03948516815260208101939093528281019190915260608201879052918516608082015290519081900360a00190a1505050505050565b801580159061380d5750600a546001600160a01b031615155b1561387957600a54604080516356b4b2ad60e01b81523360048201526024810184905290516001600160a01b03909216916356b4b2ad9160448082019260009290919082900301818387803b15801561386557600080fd5b505af11580156132fc573d6000803e3d6000fd5b50565b60008351600214156138c3576138bc8460008151811061389857fe5b6020026020010151856001815181106138ad57fe5b602002602001015185856149f5565b9050613907565b6040805162461bcd60e51b81526020600482015260146024820152730d2dcecc2d8d2c840bee0c2e8d05cd8cadccee8d60631b604482015290519081900360640190fd5b9392505050565b6000807311e3657fcde2053db4ec0e6327c3908aaf449c7b63e0cab550600360009054906101000a90046001600160a01b03168a8a8a8a8a8a6009546040518963ffffffff1660e01b815260040180896001600160a01b03168152602001886001600160a01b0316815260200180602001878152602001866001600160a01b031681526020018515158152602001848152602001838152602001828103825288818151815260200191508051906020019060200280838360005b838110156139e05781810151838201526020016139c8565b50505050905001995050505050505050505060206040518083038186803b158015613a0a57600080fd5b505af4158015613a1e573d6000803e3d6000fd5b505050506040513d6020811015613a3457600080fd5b505190508015613af5576000613a6d612710613a67613a60600854612710614ada90919063ffffffff16565b8a90614b25565b90614b7e565b90506000613a7b8883614ada565b905060008960018b510381518110613a8f57fe5b60200260200101519050613ad182600b6000846001600160a01b03166001600160a01b0316815260200190815260200160002054614bbd90919063ffffffff16565b6001600160a01b039091166000908152600b6020526040902055509150613afa9050565b859150505b9695505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052613b56908490614c15565b505050565b613b66848385614cc6565b60035460055460048054604080516317c3cf0f60e31b81526001600160a01b03958616938101939093529284166024830152831660448201528883166064820152878316608482015291861660a483015260c4820185905283151560e48301526101048201839052517311e3657fcde2053db4ec0e6327c3908aaf449c7b9163be1e787891610124808301926000929190829003018186803b158015613c0b57600080fd5b505af4158015613c1f573d6000803e3d6000fd5b50505050613c2d868461486e565b505050505050565b80471015613c8a576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d8060008114613cd5576040519150601f19603f3d011682016040523d82523d6000602084013e613cda565b606091505b5050905080613b565760405162461bcd60e51b815260040180806020018281038252603a8152602001806151b1603a913960400191505060405180910390fd5b60035460408051634a3f088d60e01b81526001600160a01b0387811660048301528681166024830152858116604483015284151560648301529151919092169160009182918491634a3f088d9160848082019261010092909190829003018186803b158015613d8857600080fd5b505afa158015613d9c573d6000803e3d6000fd5b505050506040513d610100811015613db357600080fd5b50805160e090910151909250905081613e13576040805162461bcd60e51b815260206004820152601f60248201527f506f736974696f6e4d616e616765723a20656d70747920706f736974696f6e00604482015290519081900360640190fd5b6001600160a01b038716600090815260136020526040812054613e3857600f54613e52565b6001600160a01b0388166000908152601360205260409020545b905042613e5f8383614bbd565b1115613e9c5760405162461bcd60e51b81526004018080602001828103825260298152602001806152c26029913960400191505060405180910390fd5b5050505050505050565b6003546000906001600160a01b03168185613f3957816001600160a01b031663e124e6d28a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015613f0857600080fd5b505afa158015613f1c573d6000803e3d6000fd5b505050506040513d6020811015613f3257600080fd5b5051613fb3565b816001600160a01b03166381a612d68a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015613f8657600080fd5b505afa158015613f9a573d6000803e3d6000fd5b505050506040513d6020811015613fb057600080fd5b50515b905085156140095783811015614004576040805162461bcd60e51b81526020600482015260116024820152706d61726b5072696365203c20707269636560781b604482015290519081900360640190fd5b614052565b83811115614052576040805162461bcd60e51b81526020600482015260116024820152706d61726b5072696365203e20707269636560781b604482015290519081900360640190fd5b6000826001600160a01b03166312d43a516040518163ffffffff1660e01b815260040160206040518083038186803b15801561408d57600080fd5b505afa1580156140a1573d6000803e3d6000fd5b505050506040513d60208110156140b757600080fd5b81019080805190602001909291905050509050600460009054906101000a90046001600160a01b03166001600160a01b031663f3238cec8d8d8d8b8d8860006040518863ffffffff1660e01b815260040180886001600160a01b03168152602001876001600160a01b03168152602001866001600160a01b0316815260200185151581526020018481526020018381526020018215158152602001975050505050505050600060405180830381600087803b15801561417557600080fd5b505af1158015614189573d6000803e3d6000fd5b50505050806001600160a01b0316636d63c1d0846040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156141dc57600080fd5b505af11580156141f0573d6000803e3d6000fd5b505050506000600560009054906101000a90046001600160a01b03166001600160a01b0316632662166b8e8e8e8e8e8e8e6040518863ffffffff1660e01b815260040180886001600160a01b03168152602001876001600160a01b03168152602001866001600160a01b031681526020018581526020018481526020018315158152602001826001600160a01b03168152602001975050505050505050602060405180830381600087803b1580156142a757600080fd5b505af11580156142bb573d6000803e3d6000fd5b505050506040513d60208110156142d157600080fd5b50516040805163d3c87bbb60e01b81526001600160a01b03878116600483015291519293509084169163d3c87bbb9160248082019260009290919082900301818387803b15801561432157600080fd5b505af1158015614335573d6000803e3d6000fd5b505050506143438d8a6135ff565b9c9b505050505050505050505050565b60065460408051632e1a7d4d60e01b81526004810185905290516001600160a01b03909216918291632e1a7d4d91602480830192600092919082900301818387803b1580156143a157600080fd5b505af11580156143b5573d6000803e3d6000fd5b5050600754604051600093506001600160a01b0386169250869084818181858888f193505050503d8060008114614408576040519150601f19603f3d011682016040523d82523d6000602084013e61440d565b606091505b50509050801561441e575050611bd5565b816001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b15801561445957600080fd5b505af115801561446d573d6000803e3d6000fd5b5050505050816001600160a01b031663a9059cbb84866040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156144c957600080fd5b505af11580156144dd573d6000803e3d6000fd5b505050506040513d6020811015613c2d57600080fd5b341561454957600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561386557600080fd5b565b600e546040805163d3bab1d160e01b81526001600160a01b03858116600483015260248201859052915160009384938493849384938493169163d3bab1d191604480830192610120929190829003018186803b1580156145aa57600080fd5b505afa1580156145be573d6000803e3d6000fd5b505050506040513d6101208110156145d557600080fd5b508051602082015160408301516060840151608085015160a090950151939a5091985096509450909250905061460c838284614cc6565b600e54600160a81b900460ff1661462857505050505050611bd5565b8061463857505050505050611bd5565b6000821161468d576040805162461bcd60e51b815260206004820152601d60248201527f506f736974696f6e4d616e616765723a206c6f6e67206465706f736974000000604482015290519081900360640190fd5b60035460408051634a3f088d60e01b81526001600160a01b038b811660048301528781166024830152868116604483015284151560648301529151919092169160009182918491634a3f088d9160848082019261010092909190829003018186803b1580156146fb57600080fd5b505afa15801561470f573d6000803e3d6000fd5b505050506040513d61010081101561472657600080fd5b50805160209091015190925090508161474757505050505050505050611bd5565b60006147538387614bbd565b90506000846001600160a01b0316630a48d5a98c8c6040518363ffffffff1660e01b815260040180836001600160a01b031681526020018281526020019250505060206040518083038186803b1580156147ac57600080fd5b505afa1580156147c0573d6000803e3d6000fd5b505050506040513d60208110156147d657600080fd5b5051905060006147e68483614bbd565b905060006147fa85613a6788612710614b25565b9050600061481b83613a676009546127100188614b2590919063ffffffff16565b90508181101561485c5760405162461bcd60e51b81526004018080602001828103825260278152602001806152726027913960400191505060405180910390fd5b50505050505050505050505050505050565b600a546001600160a01b0316806148855750611bd5565b600080826001600160a01b031663534ef883866040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050604080518083038186803b1580156148d457600080fd5b505afa1580156148e8573d6000803e3d6000fd5b505050506040513d60408110156148fe57600080fd5b50805160209091015190925090508161491957505050611bd5565b600354604080516312d43a5160e01b815290516000926001600160a01b0316916312d43a51916004808301926020929190829003018186803b15801561495e57600080fd5b505afa158015614972573d6000803e3d6000fd5b505050506040513d602081101561498857600080fd5b50516040805163318bc68960e01b815290519192507fc2414023ce7002ee98557d1e7be21e5559073336f2217ee5f9b2e50fd85f71ee91889188916001600160a01b0386169163318bc6899160048083019260209291908290030181600087803b15801561378657600080fd5b60035460408051634998b10960e11b81526001600160a01b03878116600483015286811660248301528481166044830152915160009384931691639331621291606480830192602092919082900301818787803b158015614a5557600080fd5b505af1158015614a69573d6000803e3d6000fd5b505050506040513d6020811015614a7f57600080fd5b5051905083811015614ad1576040805162461bcd60e51b81526020600482015260166024820152751a5b9cdd59999a58da595b9d08185b5bdd5b9d13dd5d60521b604482015290519081900360640190fd5b95945050505050565b6000614b1c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250614e95565b90505b92915050565b600082614b3457506000614b1f565b82820282848281614b4157fe5b0414614b1c5760405162461bcd60e51b81526004018080602001828103825260218152602001806152316021913960400191505060405180910390fd5b6000614b1c83836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b815250614f2c565b600082820183811015614b1c576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b6060614c6a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614f919092919063ffffffff16565b805190915015613b5657808060200190516020811015614c8957600080fd5b5051613b565760405162461bcd60e51b815260040180806020018281038252602a8152602001806152eb602a913960400191505060405180910390fd5b80614cd057613b56565b8115614dce576001600160a01b0383166000908152600c60205260409020548015801590614d8157506003546040805163783a2b6760e11b81526001600160a01b03878116600483015291518493614d7f93879391169163f07456ce91602480820192602092909190829003018186803b158015614d4d57600080fd5b505afa158015614d61573d6000803e3d6000fd5b505050506040513d6020811015614d7757600080fd5b505190614bbd565b115b15614dc8576040805162461bcd60e51b81526020600482015260126024820152711b585e081b1bdb99dcc8195e18d95959195960721b604482015290519081900360640190fd5b50613b56565b6001600160a01b0383166000908152600d60205260409020548015801590614e4757506003546040805163114f1b5560e31b81526001600160a01b03878116600483015291518493614e45938793911691638a78daa891602480820192602092909190829003018186803b158015614d4d57600080fd5b115b15614e8f576040805162461bcd60e51b81526020600482015260136024820152721b585e081cda1bdc9d1cc8195e18d959591959606a1b604482015290519081900360640190fd5b50505050565b60008184841115614f245760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614ee9578181015183820152602001614ed1565b50505050905090810190601f168015614f165780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183614f7b5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315614ee9578181015183820152602001614ed1565b506000838581614f8757fe5b0495945050505050565b6060614fa08484600085614fa8565b949350505050565b606082471015614fe95760405162461bcd60e51b81526004018080602001828103825260268152602001806151eb6026913960400191505060405180910390fd5b614ff285615104565b615043576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106150825780518252601f199092019160209182019101615063565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146150e4576040519150601f19603f3d011682016040523d82523d6000602084013e6150e9565b606091505b50915091506150f982828661510a565b979650505050505050565b3b151590565b60608315615119575081613907565b8251156151295782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315614ee9578181015183820152602001614ed156fe5265656e7472616e637947756172643a207265656e7472616e742063616c6c00476f7665726e61626c653a20666f7262696464656e0000000000000000000000416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c506f736974696f6e4d616e616765723a20696e76616c6964205f706174680000536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77506f736974696f6e4d616e616765723a20666f7262696464656e000000000000506f736974696f6e4d616e616765723a206c6f6e67206c65766572616765206465637265617365506f736974696f6e4d616e616765723a20696e76616c6964205f636f6c6c61746572616c546f6b656e506f736974696f6e4d616e616765723a206d696e2064656c6179206e6f7420796574207061737365645361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564506f736974696f6e4d616e616765723a20696e76616c6964205f706174682e6c656e677468a164736f6c634300060c000a

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

00000000000000000000000099b31498b0a1dae01fc3433e3cb60f095340935c0000000000000000000000001fe9fba5955af58c18057213f0151bbe893ab2c8000000000000000000000000e5041618b6de86a3ae68db2283b92295a7b5ae6a0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e9000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000007e01238227213c513010f5fabd0634febee93ee5

-----Decoded View---------------
Arg [0] : _vault (address): 0x99B31498B0a1Dae01fc3433e3Cb60F095340935C
Arg [1] : _router (address): 0x1FE9fBA5955Af58C18057213F0151BBE893aB2c8
Arg [2] : _shortsTracker (address): 0xE5041618b6de86A3AE68Db2283b92295a7B5aE6a
Arg [3] : _weth (address): 0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9
Arg [4] : _depositFee (uint256): 30
Arg [5] : _orderBook (address): 0x7e01238227213C513010F5fAbD0634fEBee93EE5

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 00000000000000000000000099b31498b0a1dae01fc3433e3cb60f095340935c
Arg [1] : 0000000000000000000000001fe9fba5955af58c18057213f0151bbe893ab2c8
Arg [2] : 000000000000000000000000e5041618b6de86a3ae68db2283b92295a7b5ae6a
Arg [3] : 0000000000000000000000004f9a0e7fd2bf6067db6994cf12e4495df938e6e9
Arg [4] : 000000000000000000000000000000000000000000000000000000000000001e
Arg [5] : 0000000000000000000000007e01238227213c513010f5fabd0634febee93ee5


Block Transaction Gas Used Reward
view all blocks sequenced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.