S Price: $0.463782 (-5.00%)

Contract

0x8CbC45D772d2f127693abB8942d46fADEF198B4a

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

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

Contract Source Code Verified (Exact Match)

Contract Name:
SettingsManager

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
london EvmVersion, MIT license
File 1 of 13 : SettingsManager.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "./interfaces/ISettingsManager.sol";
import "./interfaces/ILiquidateVault.sol";
import "./interfaces/IPositionVault.sol";
import "./interfaces/IOperators.sol";
import "./interfaces/ITierInfo.sol";
import "../tokens/interfaces/INSUSD.sol";
import {Constants} from "../access/Constants.sol";

contract SettingsManager is ISettingsManager, Initializable, ReentrancyGuardUpgradeable, Constants {
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;

    // constants
    ILiquidateVault public liquidateVault;
    IPositionVault public positionVault;
    ITierInfo public tierInfo;
    IOperators public operators;
    address public nsusd;

    /* ========== VAULT SETTINGS ========== */
    uint256 public override cooldownDuration;
    mapping(address => bool) public override isWhitelistedFromCooldown;
    uint256 public override feeRewardBasisPoints;
    address public override feeManager;
    uint256 public override defaultMaxProfitPercent;

    event SetCooldownDuration(uint256 cooldownDuration);
    event SetIsWhitelistedFromCooldown(address addr, bool isWhitelisted);
    event SetIsWhitelistedFromTransferCooldown(address addr, bool isWhitelisted);
    event SetFeeRewardBasisPoints(uint256 feeRewardBasisPoints);
    event SetFeeManager(address indexed feeManager);
    event SetTierInfo(address indexed tierInfo);
    event SetDefaultMaxProfitPercent(uint256 defaultMaxProfitPercent);
    event SetMaxProfitPercent(uint256 tokenId, uint256 maxProfitPercent);
    event SetMaxTotalNslp(uint256 maxTotalNslp);

    /* ========== VAULT SWITCH ========== */
    mapping(address => bool) public override isDeposit;
    mapping(address => bool) public override isWithdraw;
    mapping(address => bool) public override isStakingEnabled;
    mapping(address => bool) public override isUnstakingEnabled;

    event SetEnableDeposit(address indexed token, bool isEnabled);
    event SetEnableWithdraw(address indexed token, bool isEnabled);
    event SetEnableStaking(address indexed token, bool isEnabled);
    event SetEnableUnstaking(address indexed token, bool isEnabled);

    /* ========== VAULT FEE ========== */
    mapping(address => uint256) public override depositFee;
    mapping(address => uint256) public override withdrawFee;
    mapping(address => uint256) public override stakingFee;
    mapping(address => uint256) public override unstakingFee;

    event SetDepositFee(address indexed token, uint256 indexed fee);
    event SetWithdrawFee(address indexed token, uint256 indexed fee);
    event SetStakingFee(address indexed token, uint256 indexed fee);
    event SetUnstakingFee(address indexed token, uint256 indexed fee);

    /* ========== TRADING FEE ========== */
    mapping(uint256 => mapping(bool => uint256)) public override tradingFee; // 100 = 0.1%
    mapping(address => uint256) public override deductFeePercent;

    event SetTradingFee(uint256 indexed tokenId, bool isLong, uint256 tradingFee);
    event SetDeductFeePercent(address indexed account, uint256 deductFee);

    /* ========== FUNDING FEE ========== */
    uint256 public override basisFundingRateFactor;
    mapping(uint256 => uint256) public override fundingRateFactor;
    uint256 public override maxFundingRate;

    event SetBasisFundingRateFactor(uint256 basisFundingRateFactor);
    event SetFundingRateFactor(uint256 indexed tokenId, uint256 fundingRateFactor);
    event SetMaxFundingRate(uint256 maxFundingRateFactor);

    mapping(uint256 => int256) public override fundingIndex;
    mapping(uint256 => uint256) public override lastFundingTimes;

    event UpdateFunding(uint256 indexed tokenId, int256 fundingIndex);

    /* ========== BORROW FEE ========== */
    uint256 public override defaultBorrowFeeFactor; // deprecated
    mapping(uint256 => uint256) public override borrowFeeFactor; // deprecated

    event SetBorrowFeeFactorPerAssetPerSide(uint256 tokenId, bool isLong, uint256 borrowFeeFactor);

    /* ========== REFER FEE ========== */
    mapping(address => uint256) public override referrerTiers;
    mapping(uint256 => uint256) public override tierFees;

    event SetReferrerTier(address referrer, uint256 tier);
    event SetTierFee(uint256 tier, uint256 fee);
    event SetTierRebate(uint256 tier, uint256 rebate);
    event SetPlatformFee(address platform, uint256 fee);

    /* ========== INCREASE/DECREASE POSITION ========== */
    mapping(uint256 => bool) public override isIncreasingPositionDisabled;
    mapping(uint256 => bool) public override isDecreasingPositionDisabled;
    uint256 public override minCollateral;
    uint256 public override closeDeltaTime;

    event SetIsIncreasingPositionDisabled(uint256 tokenId, bool isDisabled);
    event SetIsDecreasingPositionDisabled(uint256 tokenId, bool isDisabled);
    event SetMinCollateral(uint256 minCollateral);
    event SetCloseDeltaTime(uint256 deltaTime);
    event SetMinProfitDuration(uint256 tokenId, uint256 minProfitDuration);
    event SetMaxCloseProfit(uint256 tokenId, uint256 maxCloseProfit);
    event SetMaxCloseProfitPercent(uint256 tokenId, uint256 maxCloseProfitPercent);

    /* ========== OPEN INTEREST MECHANISM ========== */
    uint256 public defaultMaxOpenInterestPerUser;
    mapping(address => uint256) public maxOpenInterestPerUser;
    mapping(uint256 => mapping(bool => uint256)) public maxOpenInterestPerAssetPerSide;

    event SetDefaultMaxOpenInterestPerUser(uint256 maxOIAmount);
    event SetMaxOpenInterestPerUser(address indexed account, uint256 maxOIAmount);
    event SetMaxOpenInterestPerAssetPerSide(uint256 indexed tokenId, bool isLong, uint256 maxOIAmount);
    event SetMaxTotalOpenInterest(uint256 maxOIAmount);

    mapping(address => uint256) public override openInterestPerUser;
    mapping(uint256 => mapping(bool => uint256)) public override openInterestPerAssetPerSide;
    uint256 public override totalOpenInterest;

    event IncreaseOpenInterest(uint256 indexed id, bool isLong, uint256 amount);
    event DecreaseOpenInterest(uint256 indexed id, bool isLong, uint256 amount);

    /* ========== MARKET ORDER ========== */
    uint256 public override marketOrderGasFee;
    uint256 public override expiryDuration;
    uint256 public override selfExecuteCooldown;

    event SetMarketOrderGasFee(uint256 indexed fee);
    event SetExpiryDuration(uint256 expiryDuration);
    event SetSelfExecuteCooldown(uint256 selfExecuteCooldown);

    /* ========== TRIGGER ORDER ========== */
    uint256 public override triggerGasFee;
    uint256 public override maxTriggerPerPosition;
    uint256 public override priceMovementPercent;

    event SetTriggerGasFee(uint256 indexed fee);
    event SetMaxTriggerPerPosition(uint256 value);
    event SetPriceMovementPercent(uint256 priceMovementPercent);

    /* ========== ARTIFICIAL SLIPPAGE MECHANISM ========== */
    mapping(uint256 => uint256) public override slippageFactor;

    event SetSlippageFactor(uint256 indexed tokenId, uint256 slippageFactor);

    /* ========== LIQUIDATE MECHANISM ========== */
    mapping(uint256 => uint256) public liquidateThreshold;
    uint256 public override liquidationPendingTime;
    uint256 private unused; // removal of liquidationFee
    struct BountyPercent {
        uint32 firstCaller;
        uint32 resolver;
    } // pack to save gas
    BountyPercent private bountyPercent_;

    event SetLiquidateThreshold(uint256 indexed tokenId, uint256 newThreshold);
    event SetLiquidationPendingTime(uint256 liquidationPendingTime);
    event SetBountyPercent(uint32 bountyPercentFirstCaller, uint32 bountyPercentResolver);

    /* ========== DELEGATE MECHANISM========== */
    mapping(address => EnumerableSetUpgradeable.AddressSet) private _delegatesByMaster;
    mapping(address => bool) public globalDelegates; // treat these addrs already be delegated

    event GlobalDelegatesChange(address indexed delegate, bool allowed);

    /* ========== BAN MECHANISM========== */
    EnumerableSetUpgradeable.AddressSet private banWalletList;

    /* new variables */
    mapping(address => bool) public override isWhitelistedFromTransferCooldown;
    mapping(uint256 => uint256) public override maxProfitPercent;
    uint256 public maxTotalOpenInterest;
    mapping(uint256 => mapping(bool => uint256)) public borrowFeeFactorPerAssetPerSide;
    mapping(uint256 => uint256) public tierRebates; // tier => rebate percent for trader
    mapping(address => uint256) public override platformFees; // address of 3rd platform to receive platform fee => fee percent
    uint256 public override maxTotalNslp;

    mapping(uint256 => uint256) public override minProfitDurations; // tokenId => minProfitDuration
    mapping(uint256 => uint256) public override maxCloseProfits; // tokenId => maxCloseProfit
    mapping(uint256 => uint256) public override maxCloseProfitPercents; // tokenId => maxCloseProfitPercent

    /* ========== MODIFIERS ========== */
    modifier onlyVault() {
        require(msg.sender == address(positionVault) || msg.sender == address(liquidateVault), "Only vault");
        _;
    }

    modifier onlyOperator(uint256 level) {
        _onlyOperator(level);
        _;
    }

    function _onlyOperator(uint256 level) private view {
        require(operators.getOperatorLevel(msg.sender) >= level, "invalid operator");
    }

    /* ========== INITIALIZE FUNCTION========== */
    function initialize(
        address _liquidateVault,
        address _positionVault,
        address _operators,
        address _nsusd
    ) public initializer {
        __ReentrancyGuard_init();
        liquidateVault = ILiquidateVault(_liquidateVault);
        positionVault = IPositionVault(_positionVault);
        operators = IOperators(_operators);
        nsusd = _nsusd;
        priceMovementPercent = 50; // 0.05%
        defaultMaxProfitPercent = 10000; // 10%
        bountyPercent_ = BountyPercent({firstCaller: 20000, resolver: 50000}); // first caller 20%, resolver 50% and leftover to team
        liquidationPendingTime = 10; // allow 10 seconds for manager to resolve liquidation
        cooldownDuration = 3 hours;
        expiryDuration = 60; // 60 seconds
        selfExecuteCooldown = 60; // 60 seconds
        feeRewardBasisPoints = 50000; // 50%
        minCollateral = 5 * PRICE_PRECISION; // min 5 USD
        defaultBorrowFeeFactor = 10; // 0.01% per hour
        triggerGasFee = 0; //100 gwei;
        marketOrderGasFee = 0;
        basisFundingRateFactor = 10000;
        tierFees[0] = 5000; // 5% refer fee for default tier
        maxTriggerPerPosition = 10;
        defaultMaxOpenInterestPerUser = 10000000000000000 * PRICE_PRECISION;
        maxFundingRate = FUNDING_RATE_PRECISION / 100; // 1% per hour
        maxTotalOpenInterest = 10000000000 * PRICE_PRECISION;
        unused = 10000; // 10%
        maxTotalNslp = 20 * 10 ** 6 * 10 ** NSLP_DECIMALS; // 20mil max nslp supply
    }

    function initializeV2() public reinitializer(2) {
        bountyPercent_ = BountyPercent({firstCaller: 2000, resolver: 8000}); // first caller 2%, resolver 8% and leftover 90% to nslp
    }

    function initializeV3() public reinitializer(3) {
        maxTotalOpenInterest = 10000000000 * PRICE_PRECISION;
        defaultBorrowFeeFactor = 100; // 0.01% per hour
    }

    /* ========== VAULT SETTINGS ========== */
    /* OP FUNCTIONS */
    function setCooldownDuration(uint256 _cooldownDuration) external onlyOperator(3) {
        require(_cooldownDuration <= MAX_COOLDOWN_DURATION, "invalid cooldownDuration");
        cooldownDuration = _cooldownDuration;
        emit SetCooldownDuration(_cooldownDuration);
    }

    function setIsWhitelistedFromCooldown(address _addr, bool _isWhitelisted) external onlyOperator(3) {
        isWhitelistedFromCooldown[_addr] = _isWhitelisted;
        emit SetIsWhitelistedFromCooldown(_addr, _isWhitelisted);
    }

    function setIsWhitelistedFromTransferCooldown(address _addr, bool _isWhitelisted) external onlyOperator(3) {
        isWhitelistedFromTransferCooldown[_addr] = _isWhitelisted;
        emit SetIsWhitelistedFromTransferCooldown(_addr, _isWhitelisted);
    }

    function setFeeRewardBasisPoints(uint256 _feeRewardsBasisPoints) external onlyOperator(3) {
        require(_feeRewardsBasisPoints <= BASIS_POINTS_DIVISOR, "Above max");
        feeRewardBasisPoints = _feeRewardsBasisPoints;
        emit SetFeeRewardBasisPoints(_feeRewardsBasisPoints);
    }

    function setFeeManager(address _feeManager) external onlyOperator(3) {
        feeManager = _feeManager;
        emit SetFeeManager(_feeManager);
    }
    function setTierInfo(address _tierInfo) external onlyOperator(3){
        tierInfo = ITierInfo(_tierInfo);
        emit SetTierInfo(_tierInfo);
    }

    function setDefaultMaxProfitPercent(uint256 _defaultMaxProfitPercent) external onlyOperator(3) {
        defaultMaxProfitPercent = _defaultMaxProfitPercent;
        emit SetDefaultMaxProfitPercent(_defaultMaxProfitPercent);
    }

    function setMaxProfitPercent(uint256 _tokenId, uint256 _maxProfitPercent) external onlyOperator(3) {
        maxProfitPercent[_tokenId] = _maxProfitPercent;
        emit SetMaxProfitPercent(_tokenId, _maxProfitPercent);
    }

    function setMaxTotalNslp(uint256 _maxTotalNslp) external onlyOperator(3) {
        require(_maxTotalNslp > 0, "invalid maxTotalNslp");
        maxTotalNslp = _maxTotalNslp;
        emit SetMaxTotalNslp(_maxTotalNslp);
    }

    /* ========== VAULT SWITCH ========== */
    /* OP FUNCTIONS */
    function setEnableDeposit(address _token, bool _isEnabled) external onlyOperator(3) {
        isDeposit[_token] = _isEnabled;
        emit SetEnableDeposit(_token, _isEnabled);
    }

    function setEnableWithdraw(address _token, bool _isEnabled) external onlyOperator(3) {
        isWithdraw[_token] = _isEnabled;
        emit SetEnableWithdraw(_token, _isEnabled);
    }

    function setEnableStaking(address _token, bool _isEnabled) external onlyOperator(3) {
        isStakingEnabled[_token] = _isEnabled;
        emit SetEnableStaking(_token, _isEnabled);
    }

    function setEnableUnstaking(address _token, bool _isEnabled) external onlyOperator(3) {
        isUnstakingEnabled[_token] = _isEnabled;
        emit SetEnableUnstaking(_token, _isEnabled);
    }

    /* ========== VAULT FEE ========== */
    /* OP FUNCTIONS */
    function setDepositFee(address token, uint256 _fee) external onlyOperator(3) {
        require(_fee <= MAX_DEPOSIT_WITHDRAW_FEE, "Above max");
        depositFee[token] = _fee;
        emit SetDepositFee(token, _fee);
    }

    function setWithdrawFee(address token, uint256 _fee) external onlyOperator(3) {
        require(_fee <= MAX_DEPOSIT_WITHDRAW_FEE, "Above max");
        withdrawFee[token] = _fee;
        emit SetWithdrawFee(token, _fee);
    }

    function setStakingFee(address token, uint256 _fee) external onlyOperator(3) {
        require(_fee <= MAX_STAKING_UNSTAKING_FEE, "Above max");
        stakingFee[token] = _fee;
        emit SetStakingFee(token, _fee);
    }

    function setUnstakingFee(address token, uint256 _fee) external onlyOperator(3) {
        require(_fee <= MAX_STAKING_UNSTAKING_FEE, "Above max");
        unstakingFee[token] = _fee;
        emit SetUnstakingFee(token, _fee);
    }

    /* ========== TRADING FEE ========== */
    /* OP FUNCTIONS */
    function setTradingFee(uint256 _tokenId, bool _isLong, uint256 _tradingFee) external onlyOperator(3) {
        require(_tradingFee <= MAX_FEE_BASIS_POINTS, "Above max");
        tradingFee[_tokenId][_isLong] = _tradingFee;
        emit SetTradingFee(_tokenId, _isLong, _tradingFee);
    }

    function setDeductFeePercentForUser(address _account, uint256 _deductFee) external onlyOperator(2) {
        require(_deductFee <= BASIS_POINTS_DIVISOR, "Above max");
        deductFeePercent[_account] = _deductFee;
        emit SetDeductFeePercent(_account, _deductFee);
    }

    function getTierInfo(address _account) public override view returns (uint256) {
        return address(tierInfo) == address(0) ? BASIS_POINTS_DIVISOR : tierInfo.getTierInfo(_account);
    }

    /* VIEW FUNCTIONS */
    function getTradingFee(
        address _account,
        uint256 _tokenId,
        bool _isLong,
        uint256 _sizeDelta
    ) external view override returns (uint256) {

        return
        (getUndiscountedTradingFee(_tokenId, _isLong, _sizeDelta) *
        (BASIS_POINTS_DIVISOR - deductFeePercent[_account]) *
            getTierInfo(_account)) / BASIS_POINTS_DIVISOR ** 2;
    }

    function getUndiscountedTradingFee(
        uint256 _tokenId,
        bool _isLong,
        uint256 _sizeDelta
    ) public view override returns (uint256) {
        return (_sizeDelta * tradingFee[_tokenId][_isLong]) / BASIS_POINTS_DIVISOR;
    }

    /* ========== FUNDING FEE ========== */
    /* OP FUNCTIONS */
    function setBasisFundingRateFactor(uint256 _basisFundingRateFactor) external onlyOperator(3) {
        basisFundingRateFactor = _basisFundingRateFactor;
        emit SetBasisFundingRateFactor(_basisFundingRateFactor);
    }

    function setFundingRateFactor(uint256 _tokenId, uint256 _fundingRateFactor) external onlyOperator(3) {
        fundingRateFactor[_tokenId] = _fundingRateFactor;
        emit SetFundingRateFactor(_tokenId, _fundingRateFactor);
    }

    function setMaxFundingRate(uint256 _maxFundingRate) external onlyOperator(3) {
        require(_maxFundingRate <= MAX_FUNDING_RATE, "Above max");
        maxFundingRate = _maxFundingRate;
        emit SetMaxFundingRate(_maxFundingRate);
    }

    /* VAULT FUNCTIONS */
    // to update the fundingIndex every time before open interest changes
    function updateFunding(uint256 _tokenId) external override onlyVault {
        if (lastFundingTimes[_tokenId] != 0) {
            int256 latestFundingIndex = getLatestFundingIndex(_tokenId);
            fundingIndex[_tokenId] = latestFundingIndex;

            emit UpdateFunding(_tokenId, latestFundingIndex);
        }

        lastFundingTimes[_tokenId] = block.timestamp;
    }

    /* VIEW FUNCTIONS */
    // calculate fundingFee based on fundingIndex difference
    function getFundingFee(
        uint256 _tokenId,
        bool _isLong,
        uint256 _size,
        int256 _fundingIndex
    ) public view override returns (int256) {
        return
        _isLong
        ? (int256(_size) * (getLatestFundingIndex(_tokenId) - _fundingIndex)) / int256(FUNDING_RATE_PRECISION)
        : (int256(_size) * (_fundingIndex - getLatestFundingIndex(_tokenId))) / int256(FUNDING_RATE_PRECISION);
    }

    // calculate latestFundingIndex based on fundingChange
    function getLatestFundingIndex(uint256 _tokenId) public view returns (int256) {
        return fundingIndex[_tokenId] + getFundingChange(_tokenId);
    }

    // calculate fundingChange based on fundingRate and period it has taken effect
    function getFundingChange(uint256 _tokenId) public view returns (int256) {
        uint256 interval = block.timestamp - lastFundingTimes[_tokenId];
        if (interval == 0) return int256(0);

        return (getFundingRate(_tokenId) * int256(interval)) / int256(1 hours);
    }

    // calculate funding rate per hour with 1e15 decimals
    function getFundingRate(uint256 _tokenId) public view override returns (int256) {
        uint256 assetLongOI = openInterestPerAssetPerSide[_tokenId][true];
        uint256 assetShortOI = openInterestPerAssetPerSide[_tokenId][false];
        uint256 usdBalanceInVault = positionVault.getVaultUSDBalance();

        if (usdBalanceInVault == 0) return int256(0);

        if (assetLongOI >= assetShortOI) {
            uint256 fundingRate = ((assetLongOI - assetShortOI) *
            fundingRateFactor[_tokenId] *
            basisFundingRateFactor *
            BASIS_POINTS_DIVISOR) / usdBalanceInVault;

            if (fundingRate > maxFundingRate) {
                return int256(maxFundingRate);
            } else {
                return int256(fundingRate);
            }
        } else {
            uint256 fundingRate = ((assetShortOI - assetLongOI) *
            fundingRateFactor[_tokenId] *
            basisFundingRateFactor *
            BASIS_POINTS_DIVISOR) / usdBalanceInVault;

            if (fundingRate > maxFundingRate) {
                return -1 * int256(maxFundingRate);
            } else {
                return -1 * int256(fundingRate);
            }
        }
    }

    /* ========== BORROW FEE ========== */
    /* OP FUNCTIONS */
    function setBorrowFeeFactorPerAssetPerSide(
        uint256 _tokenId,
        bool _isLong,
        uint256 _borrowFeeFactor
    ) external onlyOperator(3) {
        require(_borrowFeeFactor <= MAX_BORROW_FEE_FACTOR * 10, "Above max");
        borrowFeeFactorPerAssetPerSide[_tokenId][_isLong] = _borrowFeeFactor;
        emit SetBorrowFeeFactorPerAssetPerSide(_tokenId, _isLong, _borrowFeeFactor);
    }

    /* VIEW FUNCTIONS */
    function getBorrowFee(
        uint256 _borrowedSize,
        uint256 _lastIncreasedTime,
        uint256 _tokenId,
        bool _isLong
    ) public view override returns (uint256) {
        return
        ((block.timestamp - _lastIncreasedTime) * _borrowedSize * getBorrowRate(_tokenId, _isLong)) /
        (BASIS_POINTS_DIVISOR * 10) /
        1 hours;
    }

    // get borrow rate per hour with 1e6 decimals
    function getBorrowRate(uint256 _tokenId, bool _isLong) public view returns (uint256) {
        return borrowFeeFactorPerAssetPerSide[_tokenId][_isLong];
    }

    /* ========== REFER FEE ========== */
    /* OP FUNCTIONS */
    function setReferrerTier(address _referrer, uint256 _tier) external onlyOperator(1) {
        referrerTiers[_referrer] = _tier;
        emit SetReferrerTier(_referrer, _tier);
    }

    function setTierFee(uint256 _tier, uint256 _fee) external onlyOperator(3) {
        require(_fee + tierRebates[_tier] <= BASIS_POINTS_DIVISOR, "Above max");
        tierFees[_tier] = _fee;
        emit SetTierFee(_tier, _fee);
    }

    function setTierRebate(uint256 _tier, uint256 _rebate) external onlyOperator(3) {
        require(_rebate + tierFees[_tier] <= BASIS_POINTS_DIVISOR, "Above max");
        tierRebates[_tier] = _rebate;
        emit SetTierRebate(_tier, _rebate);
    }

    function setPlatformFee(address _platform, uint256 _fee) external onlyOperator(3) {
        require(_fee <= BASIS_POINTS_DIVISOR, "Above max");
        platformFees[_platform] = _fee;
        emit SetPlatformFee(_platform, _fee);
    }

    /* VIEW FUNCTIONS */
    function getReferFee(address _refer) external view override returns (uint256) {
        return tierFees[referrerTiers[_refer]];
    }

    function getTraderRebate(address _refer) external view returns (uint256) {
        return tierRebates[referrerTiers[_refer]];
    }

    function getReferFeeAndTraderRebate(
        address _refer
    ) external view override returns (uint256 referFee, uint256 traderRebate) {
        uint256 tier = referrerTiers[_refer];

        referFee = tierFees[tier];
        traderRebate = tierRebates[tier];
    }

    /* ========== INCREASE/DECREASE POSITION ========== */
    /* OP FUNCTIONS */
    function setIsIncreasingPositionDisabled(uint256 _tokenId, bool _isDisabled) external onlyOperator(2) {
        isIncreasingPositionDisabled[_tokenId] = _isDisabled;
        emit SetIsIncreasingPositionDisabled(_tokenId, _isDisabled);
    }

    function setIsDecreasingPositionDisabled(uint256 _tokenId, bool _isDisabled) external onlyOperator(2) {
        isDecreasingPositionDisabled[_tokenId] = _isDisabled;
        emit SetIsDecreasingPositionDisabled(_tokenId, _isDisabled);
    }

    function setMinCollateral(uint256 _minCollateral) external onlyOperator(3) {
        minCollateral = _minCollateral;
        emit SetMinCollateral(_minCollateral);
    }

    function setCloseDeltaTime(uint256 _deltaTime) external onlyOperator(2) {
        require(_deltaTime <= MAX_DELTA_TIME, "Above max");
        closeDeltaTime = _deltaTime;
        emit SetCloseDeltaTime(_deltaTime);
    }

    function setMinProfitDuration(uint256 _tokenId, uint256 _minProfitDuration) external onlyOperator(3) {
        minProfitDurations[_tokenId] = _minProfitDuration;
        emit SetMinProfitDuration(_tokenId, _minProfitDuration);
    }

    function setMaxCloseProfit(uint256 _tokenId, uint256 _maxCloseProfit) external onlyOperator(3) {
        maxCloseProfits[_tokenId] = _maxCloseProfit;
        emit SetMaxCloseProfit(_tokenId, _maxCloseProfit);
    }

    function setMaxCloseProfitPercent(uint256 _tokenId, uint256 _maxCloseProfitPercent) external onlyOperator(3) {
        maxCloseProfitPercents[_tokenId] = _maxCloseProfitPercent;
        emit SetMaxCloseProfitPercent(_tokenId, _maxCloseProfitPercent);
    }

    /* VIEW FUNCTIONS */
    function getPnl(
        uint256 _tokenId,
        bool _isLong,
        uint256 _size,
        uint256 _averagePrice,
        uint256 _lastPrice,
        uint256 _lastIncreasedTime,
        uint256 _accruedBorrowFee,
        int256 _fundingIndex
    ) external view override returns (int256 pnl, int256 fundingFee, int256 borrowFee) {
        require(_averagePrice > 0, "avgPrice > 0");

        if (_isLong) {
            if (_lastPrice >= _averagePrice) {
                pnl = int256((_size * (_lastPrice - _averagePrice)) / _averagePrice);
            } else {
                pnl = -1 * int256((_size * (_averagePrice - _lastPrice)) / _averagePrice);
            }
        } else {
            if (_lastPrice <= _averagePrice) {
                pnl = int256((_size * (_averagePrice - _lastPrice)) / _averagePrice);
            } else {
                pnl = -1 * int256((_size * (_lastPrice - _averagePrice)) / _averagePrice);
            }
        }

        fundingFee = getFundingFee(_tokenId, _isLong, _size, _fundingIndex);
        borrowFee = int256(getBorrowFee(_size, _lastIncreasedTime, _tokenId, _isLong) + _accruedBorrowFee);

        pnl = pnl - fundingFee - borrowFee;
    }

    /* ========== OPEN INTEREST MECHANISM ========== */
    /* OP FUNCTIONS */
    function setDefaultMaxOpenInterestPerUser(uint256 _maxAmount) external onlyOperator(1) {
        defaultMaxOpenInterestPerUser = _maxAmount;
        emit SetDefaultMaxOpenInterestPerUser(_maxAmount);
    }

    function setMaxOpenInterestPerUser(address _account, uint256 _maxAmount) external onlyOperator(2) {
        maxOpenInterestPerUser[_account] = _maxAmount;
        emit SetMaxOpenInterestPerUser(_account, _maxAmount);
    }

    function setMaxOpenInterestPerAsset(uint256 _tokenId, uint256 _maxAmount) external onlyOperator(2) {
        setMaxOpenInterestPerAssetPerSide(_tokenId, true, _maxAmount);
        setMaxOpenInterestPerAssetPerSide(_tokenId, false, _maxAmount);
    }

    function setMaxOpenInterestPerAssetPerSide(
        uint256 _tokenId,
        bool _isLong,
        uint256 _maxAmount
    ) public onlyOperator(2) {
        maxOpenInterestPerAssetPerSide[_tokenId][_isLong] = _maxAmount;
        emit SetMaxOpenInterestPerAssetPerSide(_tokenId, _isLong, _maxAmount);
    }

    function setMaxTotalOpenInterest(uint256 _maxAmount) external onlyOperator(2) {
        maxTotalOpenInterest = _maxAmount;
        emit SetMaxTotalOpenInterest(_maxAmount);
    }

    /* VAULT FUNCTIONS */
    function increaseOpenInterest(
        uint256 _tokenId,
        address _sender,
        bool _isLong,
        uint256 _amount
    ) external override onlyVault {
        // check and increase openInterestPerUser
        uint256 _openInterestPerUser = openInterestPerUser[_sender];
        uint256 _maxOpenInterestPerUser = maxOpenInterestPerUser[_sender];
        if (_maxOpenInterestPerUser == 0) _maxOpenInterestPerUser = defaultMaxOpenInterestPerUser;
        require(_openInterestPerUser + _amount <= _maxOpenInterestPerUser, "user maxOI exceeded");
        openInterestPerUser[_sender] = _openInterestPerUser + _amount;

        // check and increase openInterestPerAssetPerSide
        uint256 _openInterestPerAssetPerSide = openInterestPerAssetPerSide[_tokenId][_isLong];
        require(
            _openInterestPerAssetPerSide + _amount <= maxOpenInterestPerAssetPerSide[_tokenId][_isLong],
            "asset side maxOI exceeded"
        );
        openInterestPerAssetPerSide[_tokenId][_isLong] = _openInterestPerAssetPerSide + _amount;

        // check and increase totalOpenInterest
        uint256 _totalOpenInterest = totalOpenInterest + _amount;
        require(_totalOpenInterest <= maxTotalOpenInterest, "maxTotalOpenInterest exceeded");
        totalOpenInterest = _totalOpenInterest;

        emit IncreaseOpenInterest(_tokenId, _isLong, _amount);
    }
    function getMaxOpenInterestAmount(
        uint256 _tokenId,
        address _sender,
        bool _isLong
    ) public view returns (uint256) {
        uint256 _maxOpenInterestPerUser = maxOpenInterestPerUser[_sender];
        if (_maxOpenInterestPerUser == 0) _maxOpenInterestPerUser = defaultMaxOpenInterestPerUser;

        uint256 _amount1 = _maxOpenInterestPerUser - openInterestPerUser[_sender];
        uint256 _amount2 = maxOpenInterestPerAssetPerSide[_tokenId][_isLong] - openInterestPerAssetPerSide[_tokenId][_isLong];
        uint256 _amount3 = maxTotalOpenInterest - totalOpenInterest;
        uint256 _minAmount12 = _amount1 < _amount2 ? _amount1 : _amount2;
        return _minAmount12 < _amount3 ? _minAmount12 : _amount3;

    }

    function decreaseOpenInterest(
        uint256 _tokenId,
        address _sender,
        bool _isLong,
        uint256 _amount
    ) external override onlyVault {
        uint256 _openInterestPerUser = openInterestPerUser[_sender];
        if (_openInterestPerUser < _amount) {
            openInterestPerUser[_sender] = 0;
        } else {
            openInterestPerUser[_sender] = _openInterestPerUser - _amount;
        }

        uint256 _openInterestPerAssetPerSide = openInterestPerAssetPerSide[_tokenId][_isLong];
        if (_openInterestPerAssetPerSide < _amount) {
            openInterestPerAssetPerSide[_tokenId][_isLong] = 0;
        } else {
            openInterestPerAssetPerSide[_tokenId][_isLong] = _openInterestPerAssetPerSide - _amount;
        }

        uint256 _totalOpenInterest = totalOpenInterest;
        if (_totalOpenInterest < _amount) {
            totalOpenInterest = 0;
        } else {
            totalOpenInterest = _totalOpenInterest - _amount;
        }

        emit DecreaseOpenInterest(_tokenId, _isLong, _amount);
    }

    /* ========== MARKET ORDER ========== */
    /* OP FUNCTIONS */
    function setMarketOrderGasFee(uint256 _fee) external onlyOperator(3) {
        require(_fee <= MAX_MARKET_ORDER_GAS_FEE, "Above max");
        marketOrderGasFee = _fee;
        emit SetMarketOrderGasFee(_fee);
    }

    function setExpiryDuration(uint256 _expiryDuration) external onlyOperator(3) {
        require(_expiryDuration <= MAX_EXPIRY_DURATION, "Above max");
        expiryDuration = _expiryDuration;
        emit SetExpiryDuration(_expiryDuration);
    }

    function setSelfExecuteCooldown(uint256 _selfExecuteCooldown) external onlyOperator(3) {
        require(_selfExecuteCooldown <= MAX_SELF_EXECUTE_COOLDOWN, "Above max");
        selfExecuteCooldown = _selfExecuteCooldown;
        emit SetSelfExecuteCooldown(_selfExecuteCooldown);
    }

    /* ========== TRIGGER ORDER ========== */
    /* OP FUNCTIONS */
    function setTriggerGasFee(uint256 _fee) external onlyOperator(3) {
        require(_fee <= MAX_TRIGGER_GAS_FEE, "Above max");
        triggerGasFee = _fee;
        emit SetTriggerGasFee(_fee);
    }

    function setMaxTriggerPerPosition(uint256 _value) external onlyOperator(3) {
        maxTriggerPerPosition = _value;
        emit SetMaxTriggerPerPosition(_value);
    }

    function setPriceMovementPercent(uint256 _priceMovementPercent) external onlyOperator(3) {
        require(_priceMovementPercent <= MAX_PRICE_MOVEMENT_PERCENT, "Above max");
        priceMovementPercent = _priceMovementPercent;
        emit SetPriceMovementPercent(_priceMovementPercent);
    }

    /* ========== ARTIFICIAL SLIPPAGE MECHANISM ========== */
    /* OP FUNCTIONS */
    function setSlippageFactor(uint256 _tokenId, uint256 _slippageFactor) external onlyOperator(3) {
        require(_slippageFactor <= BASIS_POINTS_DIVISOR, "Above max");
        slippageFactor[_tokenId] = _slippageFactor;
        emit SetSlippageFactor(_tokenId, _slippageFactor);
    }

    /* VIEW FUNCTIONS */
    function getPriceWithSlippage(
        uint256 _tokenId,
        bool _isLong,
        uint256 _size,
        uint256 _price
    ) external view override returns (uint256) {
        uint256 _slippageFactor = slippageFactor[_tokenId];

        if (_slippageFactor == 0) return _price;

        uint256 slippage = getSlippage(_slippageFactor, _size);

        return
        _isLong
        ? (_price * (BASIS_POINTS_DIVISOR + slippage)) / BASIS_POINTS_DIVISOR
        : (_price * (BASIS_POINTS_DIVISOR - slippage)) / BASIS_POINTS_DIVISOR;
    }

    function getSlippage(uint256 _slippageFactor, uint256 _size) public view returns (uint256) {
        return (_slippageFactor * (2 * totalOpenInterest + _size)) / (2 * positionVault.getVaultUSDBalance());
    }

    /* ========== LIQUIDATE MECHANISM ========== */
    /* OP FUNCTIONS */
    // the liquidateThreshold should range between 80% to 100%
    function setLiquidateThreshold(uint256 _tokenId, uint256 _liquidateThreshold) external onlyOperator(3) {
        require(
            _liquidateThreshold >= 8 * BASIS_POINTS_DIVISOR && _liquidateThreshold <= LIQUIDATE_THRESHOLD_DIVISOR,
            "Out of range"
        );
        liquidateThreshold[_tokenId] = _liquidateThreshold;
        emit SetLiquidateThreshold(_tokenId, _liquidateThreshold);
    }

    function setLiquidationPendingTime(uint256 _liquidationPendingTime) external onlyOperator(3) {
        require(_liquidationPendingTime <= 60, "Above max");
        liquidationPendingTime = _liquidationPendingTime;
        emit SetLiquidationPendingTime(_liquidationPendingTime);
    }

    function setBountyPercent(
        uint32 _bountyPercentFirstCaller,
        uint32 _bountyPercentResolver
    ) external onlyOperator(3) {
        require(_bountyPercentFirstCaller + _bountyPercentResolver <= BASIS_POINTS_DIVISOR, "invalid bountyPercent");
        bountyPercent_.firstCaller = _bountyPercentFirstCaller;
        bountyPercent_.resolver = _bountyPercentResolver;
        emit SetBountyPercent(_bountyPercentFirstCaller, _bountyPercentResolver);
    }

    /* VIEW FUNCTIONS */
    function bountyPercent() external view override returns (uint32, uint32) {
        return (bountyPercent_.firstCaller, bountyPercent_.resolver);
    }

    /* ========== DELEGATE MECHANISM========== */
    /* USER FUNCTIONS */
    function delegate(address[] memory _delegates) external {
        for (uint256 i = 0; i < _delegates.length; ++i) {
            EnumerableSetUpgradeable.add(_delegatesByMaster[msg.sender], _delegates[i]);
        }
    }

    function undelegate(address[] memory _delegates) external {
        for (uint256 i = 0; i < _delegates.length; ++i) {
            EnumerableSetUpgradeable.remove(_delegatesByMaster[msg.sender], _delegates[i]);
        }
    }

    /* OP FUNCTIONS */
    function setGlobalDelegates(address _delegate, bool _allowed) external onlyOperator(2) {
        globalDelegates[_delegate] = _allowed;
        emit GlobalDelegatesChange(_delegate, _allowed);
    }

    /* VIEW FUNCTIONS */
    function getDelegates(address _master) external view override returns (address[] memory) {
        return enumerate(_delegatesByMaster[_master]);
    }

    function checkDelegation(address _master, address _delegate) public view override returns (bool) {
        require(!checkBanList(_master), "account banned");
        return
        _master == _delegate ||
        globalDelegates[_delegate] ||
        EnumerableSetUpgradeable.contains(_delegatesByMaster[_master], _delegate);
    }

    /* ========== BAN MECHANISM========== */
    /* OP FUNCTIONS */
    function addWalletsToBanList(address[] memory _wallets) external onlyOperator(1) {
        for (uint256 i = 0; i < _wallets.length; ++i) {
            EnumerableSetUpgradeable.add(banWalletList, _wallets[i]);
        }
    }

    function removeWalletsFromBanList(address[] memory _wallets) external onlyOperator(1) {
        for (uint256 i = 0; i < _wallets.length; ++i) {
            EnumerableSetUpgradeable.remove(banWalletList, _wallets[i]);
        }
    }

    /* VIEW FUNCTIONS */
    function checkBanList(address _addr) public view override returns (bool) {
        return EnumerableSetUpgradeable.contains(banWalletList, _addr);
    }

    function enumerate(EnumerableSetUpgradeable.AddressSet storage set) internal view returns (address[] memory) {
        uint256 length = EnumerableSetUpgradeable.length(set);
        address[] memory output = new address[](length);
        for (uint256 i; i < length; ++i) {
            output[i] = EnumerableSetUpgradeable.at(set, i);
        }
        return output;
    }
}

File 2 of 13 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

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

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

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

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

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

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

File 3 of 13 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

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

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // 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;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

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

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

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 4 of 13 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 5 of 13 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSetUpgradeable {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 6 of 13 : Constants.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

contract Constants {
    uint8 internal constant STAKING_PID_FOR_CHARGE_FEE = 1;
    uint256 internal constant BASIS_POINTS_DIVISOR = 100000;
    uint256 internal constant LIQUIDATE_THRESHOLD_DIVISOR = 10 * BASIS_POINTS_DIVISOR;
    uint256 internal constant DEFAULT_NSLP_PRICE = 100000;
    uint256 internal constant FUNDING_RATE_PRECISION = BASIS_POINTS_DIVISOR ** 3; // 1e15
    uint256 internal constant MAX_DEPOSIT_WITHDRAW_FEE = 10000; // 10%
    uint256 internal constant MAX_DELTA_TIME = 24 hours;
    uint256 internal constant MAX_COOLDOWN_DURATION = 30 days;
    uint256 internal constant MAX_FEE_BASIS_POINTS = 5000; // 5%
    uint256 internal constant MAX_PRICE_MOVEMENT_PERCENT = 10000; // 10%
    uint256 internal constant MAX_BORROW_FEE_FACTOR = 500; // 0.5% per hour
    uint256 internal constant MAX_FUNDING_RATE = FUNDING_RATE_PRECISION / 10; // 10% per hour
    uint256 internal constant MAX_STAKING_UNSTAKING_FEE = 10000; // 10%
    uint256 internal constant MAX_EXPIRY_DURATION = 60; // 60 seconds
    uint256 internal constant MAX_SELF_EXECUTE_COOLDOWN = 300; // 5 minutes
    uint256 internal constant MAX_TOKENFARM_COOLDOWN_DURATION = 4 weeks;
    uint256 internal constant MAX_TRIGGER_GAS_FEE = 1e8 gwei;
    uint256 internal constant MAX_MARKET_ORDER_GAS_FEE = 1e8 gwei;
    uint256 internal constant MAX_VESTING_DURATION = 700 days;
    uint256 internal constant MIN_LEVERAGE = 10000; // 1x
    uint256 internal constant POSITION_MARKET = 0;
    uint256 internal constant POSITION_LIMIT = 1;
    uint256 internal constant POSITION_STOP_MARKET = 2;
    uint256 internal constant POSITION_STOP_LIMIT = 3;
    uint256 internal constant POSITION_TRAILING_STOP = 4;
    uint256 internal constant PRICE_PRECISION = 10 ** 30;
    uint256 internal constant TRAILING_STOP_TYPE_AMOUNT = 0;
    uint256 internal constant TRAILING_STOP_TYPE_PERCENT = 1;
    uint256 internal constant NSLP_DECIMALS = 18;

    function uintToBytes(uint v) internal pure returns (bytes32 ret) {
        if (v == 0) {
            ret = "0";
        } else {
            while (v > 0) {
                ret = bytes32(uint(ret) / (2 ** 8));
                ret |= bytes32(((v % 10) + 48) * 2 ** (8 * 31));
                v /= 10;
            }
        }
        return ret;
    }

    function checkSlippage(bool isLong, uint256 allowedPrice, uint256 actualMarketPrice) internal pure {
        if (isLong) {
            require(
                actualMarketPrice <= allowedPrice,
                string(
                    abi.encodePacked(
                        "long: slippage exceeded ",
                        uintToBytes(actualMarketPrice),
                        " ",
                        uintToBytes(allowedPrice)
                    )
                )
            );
        } else {
            require(
                actualMarketPrice >= allowedPrice,
                string(
                    abi.encodePacked(
                        "short: slippage exceeded ",
                        uintToBytes(actualMarketPrice),
                        " ",
                        uintToBytes(allowedPrice)
                    )
                )
            );
        }
    }
}

File 7 of 13 : ILiquidateVault.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

import {Position, Order, OrderType} from "../structs.sol";

interface ILiquidateVault {
    function validateLiquidationWithPosid(uint256 _posId) external view returns (bool, int256, int256, int256);
    function liquidatePosition(uint256 _posId) external;
}

File 8 of 13 : IOperators.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

interface IOperators {
    function getOperatorLevel(address op) external view returns (uint256);
}

File 9 of 13 : IPositionVault.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

import {Position, Order, OrderType, PaidFees} from "../structs.sol";

interface IPositionVault {
    function newPositionOrder(
        address _account,
        uint256 _tokenId,
        bool _isLong,
        OrderType _orderType,
        uint256[] memory _params,
        address _refer
    ) external;

    function addOrRemoveCollateral(address _account, uint256 _posId, bool isPlus, uint256 _amount) external;

    function createAddPositionOrder(
        address _account,
        uint256 _posId,
        uint256 _collateralDelta,
        uint256 _sizeDelta,
        uint256 _allowedPrice
    ) external;

    function createDecreasePositionOrder(
        uint256 _posId,
        address _account,
        uint256 _sizeDelta,
        uint256 _allowedPrice
    ) external;

    function increasePosition(
        uint256 _posId,
        address _account,
        uint256 _tokenId,
        bool _isLong,
        uint256 _price,
        uint256 _collateralDelta,
        uint256 _sizeDelta,
        uint256 _fee
    ) external;

    function decreasePosition(uint256 _posId, uint256 _price, uint256 _sizeDelta) external;

    function decreasePositionByOrderVault(uint256 _posId, uint256 _price, uint256 _sizeDelta) external;

    function removeUserAlivePosition(address _user, uint256 _posId) external;

    function removeUserOpenOrder(address _user, uint256 _posId) external;

    function lastPosId() external view returns (uint256);
    function queueIndex() external view returns (uint256);
    function getNumOfUnexecuted() external view returns (uint256);
    function queuePosIds(uint256 _id) external view returns (uint256);

    function getPosition(uint256 _posId) external view returns (Position memory);

    function getUserPositionIds(address _account) external view returns (uint256[] memory);

    function getUserOpenOrderIds(address _account) external view returns (uint256[] memory);

    function getPaidFees(uint256 _posId) external view returns (PaidFees memory);

    function getVaultUSDBalance() external view returns (uint256);
    function executeOrders(uint256 numOfOrders) external;
}

File 10 of 13 : ISettingsManager.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

interface ISettingsManager {
    function decreaseOpenInterest(uint256 _tokenId, address _sender, bool _isLong, uint256 _amount) external;

    function increaseOpenInterest(uint256 _tokenId, address _sender, bool _isLong, uint256 _amount) external;

    function openInterestPerAssetPerSide(uint256 _tokenId, bool _isLong) external view returns (uint256);

    function openInterestPerUser(address _sender) external view returns (uint256);

    function bountyPercent() external view returns (uint32, uint32);

    function checkBanList(address _delegate) external view returns (bool);

    function checkDelegation(address _master, address _delegate) external view returns (bool);

    function minCollateral() external view returns (uint256);

    function closeDeltaTime() external view returns (uint256);

    function expiryDuration() external view returns (uint256);

    function selfExecuteCooldown() external view returns (uint256);

    function cooldownDuration() external view returns (uint256);

    function liquidationPendingTime() external view returns (uint256);

    function depositFee(address token) external view returns (uint256);

    function withdrawFee(address token) external view returns (uint256);

    function feeManager() external view returns (address);

    function feeRewardBasisPoints() external view returns (uint256);

    function defaultBorrowFeeFactor() external view returns (uint256);

    function borrowFeeFactor(uint256 tokenId) external view returns (uint256);

    function totalOpenInterest() external view returns (uint256);

    function basisFundingRateFactor() external view returns (uint256);

    function deductFeePercent(address _account) external view returns (uint256);

    function referrerTiers(address _referrer) external view returns (uint256);

    function tierFees(uint256 _tier) external view returns (uint256);

    function fundingIndex(uint256 _tokenId) external view returns (int256);

    function fundingRateFactor(uint256 _tokenId) external view returns (uint256);

    function slippageFactor(uint256 _tokenId) external view returns (uint256);

    function getFundingFee(
        uint256 _tokenId,
        bool _isLong,
        uint256 _size,
        int256 _fundingIndex
    ) external view returns (int256);

    function getFundingChange(uint256 _tokenId) external view returns (int256);

    function getBorrowRate(uint256 _tokenId, bool _isLong) external view returns (uint256);

    function getFundingRate(uint256 _tokenId) external view returns (int256);

    function getTradingFee(
        address _account,
        uint256 _tokenId,
        bool _isLong,
        uint256 _sizeDelta
    ) external view returns (uint256);

    function getPnl(
        uint256 _tokenId,
        bool _isLong,
        uint256 _size,
        uint256 _averagePrice,
        uint256 _lastPrice,
        uint256 _lastIncreasedTime,
        uint256 _accruedBorrowFee,
        int256 _fundingIndex
    ) external view returns (int256, int256, int256);

    function updateFunding(uint256 _tokenId) external;

    function getBorrowFee(
        uint256 _borrowedSize,
        uint256 _lastIncreasedTime,
        uint256 _tokenId,
        bool _isLong
    ) external view returns (uint256);

    function getUndiscountedTradingFee(
        uint256 _tokenId,
        bool _isLong,
        uint256 _sizeDelta
    ) external view returns (uint256);

    function getReferFee(address _refer) external view returns (uint256);

    function getReferFeeAndTraderRebate(address _refer) external view returns (uint256 referFee, uint256 traderRebate);

    function platformFees(address _platform) external view returns (uint256);

    function getPriceWithSlippage(
        uint256 _tokenId,
        bool _isLong,
        uint256 _size,
        uint256 _price
    ) external view returns (uint256);

    function getDelegates(address _master) external view returns (address[] memory);

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

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

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

    function isIncreasingPositionDisabled(uint256 _tokenId) external view returns (bool);

    function isDecreasingPositionDisabled(uint256 _tokenId) external view returns (bool);

    function isWhitelistedFromCooldown(address _addr) external view returns (bool);

    function isWhitelistedFromTransferCooldown(address _addr) external view returns (bool);

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

    function lastFundingTimes(uint256 _tokenId) external view returns (uint256);

    function liquidateThreshold(uint256) external view returns (uint256);

    function tradingFee(uint256 _tokenId, bool _isLong) external view returns (uint256);

    function defaultMaxOpenInterestPerUser() external view returns (uint256);

    function maxProfitPercent(uint256 _tokenId) external view returns (uint256);

    function defaultMaxProfitPercent() external view returns (uint256);

    function maxOpenInterestPerAssetPerSide(uint256 _tokenId, bool _isLong) external view returns (uint256);

    function priceMovementPercent() external view returns (uint256);

    function maxOpenInterestPerUser(address _account) external view returns (uint256);

    function stakingFee(address token) external view returns (uint256);

    function unstakingFee(address token) external view returns (uint256);

    function triggerGasFee() external view returns (uint256);

    function marketOrderGasFee() external view returns (uint256);

    function maxTriggerPerPosition() external view returns (uint256);

    function maxFundingRate() external view returns (uint256);

    function maxTotalNslp() external view returns (uint256);

    function minProfitDurations(uint256 tokenId) external view returns (uint256);

    function maxCloseProfits(uint256 tokenId) external view returns (uint256);

    function maxCloseProfitPercents(uint256 tokenId) external view returns (uint256);
    function getTierInfo(address _account) external view returns (uint256);

}

File 11 of 13 : ITierInfo.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

interface ITierInfo {
    function getTierInfo(address _account) external view returns (uint256);
}

File 12 of 13 : structs.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

enum OrderType {
    MARKET,
    LIMIT,
    STOP,
    STOP_LIMIT
}

enum OrderStatus {
    NONE,
    PENDING,
    FILLED,
    CANCELED
}

enum TriggerStatus {
    NONE,
    PENDING,
    OPEN,
    TRIGGERED,
    CANCELLED
}

struct Order {
    OrderStatus status;
    uint256 lmtPrice;
    uint256 size;
    uint256 collateral;
    uint256 positionType;
    uint256 stepAmount;
    uint256 stepType;
    uint256 stpPrice;
    uint256 timestamp;
}

struct AddPositionOrder {
    address owner;
    uint256 collateral;
    uint256 size;
    uint256 allowedPrice;
    uint256 timestamp;
    uint256 fee;
}

struct DecreasePositionOrder {
    uint256 size;
    uint256 allowedPrice;
    uint256 timestamp;
}

struct Position {
    address owner;
    address refer;
    bool isLong;
    uint256 tokenId;
    uint256 averagePrice;
    uint256 collateral;
    int256 fundingIndex;
    uint256 lastIncreasedTime;
    uint256 size;
    uint256 accruedBorrowFee;
}

struct PaidFees {
    uint256 paidPositionFee;
    uint256 paidBorrowFee;
    int256 paidFundingFee;
}

struct Temp {
    uint256 a;
    uint256 b;
    uint256 c;
    uint256 d;
    uint256 e;
}

struct TriggerInfo {
    bool isTP;
    uint256 amountPercent;
    uint256 createdAt;
    uint256 price;
    uint256 triggeredAmount;
    uint256 triggeredAt;
    TriggerStatus status;
}

struct PositionTrigger {
    TriggerInfo[] triggers;
}

File 13 of 13 : INSUSD.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

interface INSUSD {
    function burn(address _account, uint256 _amount) external;

    function mint(address _account, uint256 _amount) external;

    function balanceOf(address _account) external view returns (uint256);
}

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

Contract Security Audit

Contract ABI

API
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isLong","type":"bool"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DecreaseOpenInterest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":false,"internalType":"bool","name":"allowed","type":"bool"}],"name":"GlobalDelegatesChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isLong","type":"bool"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"IncreaseOpenInterest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"basisFundingRateFactor","type":"uint256"}],"name":"SetBasisFundingRateFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isLong","type":"bool"},{"indexed":false,"internalType":"uint256","name":"borrowFeeFactor","type":"uint256"}],"name":"SetBorrowFeeFactorPerAssetPerSide","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"bountyPercentFirstCaller","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"bountyPercentResolver","type":"uint32"}],"name":"SetBountyPercent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"deltaTime","type":"uint256"}],"name":"SetCloseDeltaTime","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"cooldownDuration","type":"uint256"}],"name":"SetCooldownDuration","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"deductFee","type":"uint256"}],"name":"SetDeductFeePercent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxOIAmount","type":"uint256"}],"name":"SetDefaultMaxOpenInterestPerUser","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"defaultMaxProfitPercent","type":"uint256"}],"name":"SetDefaultMaxProfitPercent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"SetDepositFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bool","name":"isEnabled","type":"bool"}],"name":"SetEnableDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bool","name":"isEnabled","type":"bool"}],"name":"SetEnableStaking","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bool","name":"isEnabled","type":"bool"}],"name":"SetEnableUnstaking","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bool","name":"isEnabled","type":"bool"}],"name":"SetEnableWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"expiryDuration","type":"uint256"}],"name":"SetExpiryDuration","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"feeManager","type":"address"}],"name":"SetFeeManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"feeRewardBasisPoints","type":"uint256"}],"name":"SetFeeRewardBasisPoints","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fundingRateFactor","type":"uint256"}],"name":"SetFundingRateFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isDisabled","type":"bool"}],"name":"SetIsDecreasingPositionDisabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isDisabled","type":"bool"}],"name":"SetIsIncreasingPositionDisabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"bool","name":"isWhitelisted","type":"bool"}],"name":"SetIsWhitelistedFromCooldown","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"bool","name":"isWhitelisted","type":"bool"}],"name":"SetIsWhitelistedFromTransferCooldown","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newThreshold","type":"uint256"}],"name":"SetLiquidateThreshold","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"liquidationPendingTime","type":"uint256"}],"name":"SetLiquidationPendingTime","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"SetMarketOrderGasFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxCloseProfit","type":"uint256"}],"name":"SetMaxCloseProfit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxCloseProfitPercent","type":"uint256"}],"name":"SetMaxCloseProfitPercent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxFundingRateFactor","type":"uint256"}],"name":"SetMaxFundingRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isLong","type":"bool"},{"indexed":false,"internalType":"uint256","name":"maxOIAmount","type":"uint256"}],"name":"SetMaxOpenInterestPerAssetPerSide","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"maxOIAmount","type":"uint256"}],"name":"SetMaxOpenInterestPerUser","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxProfitPercent","type":"uint256"}],"name":"SetMaxProfitPercent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxTotalNslp","type":"uint256"}],"name":"SetMaxTotalNslp","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxOIAmount","type":"uint256"}],"name":"SetMaxTotalOpenInterest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"SetMaxTriggerPerPosition","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minCollateral","type":"uint256"}],"name":"SetMinCollateral","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minProfitDuration","type":"uint256"}],"name":"SetMinProfitDuration","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"platform","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"SetPlatformFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"priceMovementPercent","type":"uint256"}],"name":"SetPriceMovementPercent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"referrer","type":"address"},{"indexed":false,"internalType":"uint256","name":"tier","type":"uint256"}],"name":"SetReferrerTier","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"selfExecuteCooldown","type":"uint256"}],"name":"SetSelfExecuteCooldown","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"slippageFactor","type":"uint256"}],"name":"SetSlippageFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"SetStakingFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tier","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"SetTierFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tierInfo","type":"address"}],"name":"SetTierInfo","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tier","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rebate","type":"uint256"}],"name":"SetTierRebate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isLong","type":"bool"},{"indexed":false,"internalType":"uint256","name":"tradingFee","type":"uint256"}],"name":"SetTradingFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"SetTriggerGasFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"SetUnstakingFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"SetWithdrawFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"int256","name":"fundingIndex","type":"int256"}],"name":"UpdateFunding","type":"event"},{"inputs":[{"internalType":"address[]","name":"_wallets","type":"address[]"}],"name":"addWalletsToBanList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"basisFundingRateFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"borrowFeeFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"name":"borrowFeeFactorPerAssetPerSide","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bountyPercent","outputs":[{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"checkBanList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_master","type":"address"},{"internalType":"address","name":"_delegate","type":"address"}],"name":"checkDelegation","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"closeDeltaTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cooldownDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_sender","type":"address"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"decreaseOpenInterest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"deductFeePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultBorrowFeeFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultMaxOpenInterestPerUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultMaxProfitPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_delegates","type":"address[]"}],"name":"delegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"depositFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expiryDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeRewardBasisPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"fundingIndex","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"fundingRateFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_borrowedSize","type":"uint256"},{"internalType":"uint256","name":"_lastIncreasedTime","type":"uint256"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"}],"name":"getBorrowFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"}],"name":"getBorrowRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_master","type":"address"}],"name":"getDelegates","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getFundingChange","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"uint256","name":"_size","type":"uint256"},{"internalType":"int256","name":"_fundingIndex","type":"int256"}],"name":"getFundingFee","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getFundingRate","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getLatestFundingIndex","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_sender","type":"address"},{"internalType":"bool","name":"_isLong","type":"bool"}],"name":"getMaxOpenInterestAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"uint256","name":"_size","type":"uint256"},{"internalType":"uint256","name":"_averagePrice","type":"uint256"},{"internalType":"uint256","name":"_lastPrice","type":"uint256"},{"internalType":"uint256","name":"_lastIncreasedTime","type":"uint256"},{"internalType":"uint256","name":"_accruedBorrowFee","type":"uint256"},{"internalType":"int256","name":"_fundingIndex","type":"int256"}],"name":"getPnl","outputs":[{"internalType":"int256","name":"pnl","type":"int256"},{"internalType":"int256","name":"fundingFee","type":"int256"},{"internalType":"int256","name":"borrowFee","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"uint256","name":"_size","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"getPriceWithSlippage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_refer","type":"address"}],"name":"getReferFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_refer","type":"address"}],"name":"getReferFeeAndTraderRebate","outputs":[{"internalType":"uint256","name":"referFee","type":"uint256"},{"internalType":"uint256","name":"traderRebate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_slippageFactor","type":"uint256"},{"internalType":"uint256","name":"_size","type":"uint256"}],"name":"getSlippage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getTierInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_refer","type":"address"}],"name":"getTraderRebate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"uint256","name":"_sizeDelta","type":"uint256"}],"name":"getTradingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"uint256","name":"_sizeDelta","type":"uint256"}],"name":"getUndiscountedTradingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"globalDelegates","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_sender","type":"address"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"increaseOpenInterest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_liquidateVault","type":"address"},{"internalType":"address","name":"_positionVault","type":"address"},{"internalType":"address","name":"_operators","type":"address"},{"internalType":"address","name":"_nsusd","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initializeV2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initializeV3","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isDecreasingPositionDisabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isDeposit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isIncreasingPositionDisabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isStakingEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isUnstakingEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWhitelistedFromCooldown","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWhitelistedFromTransferCooldown","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWithdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lastFundingTimes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"liquidateThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidateVault","outputs":[{"internalType":"contract ILiquidateVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidationPendingTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketOrderGasFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"maxCloseProfitPercents","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"maxCloseProfits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxFundingRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"name":"maxOpenInterestPerAssetPerSide","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxOpenInterestPerUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"maxProfitPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTotalNslp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTotalOpenInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTriggerPerPosition","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"minProfitDurations","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nsusd","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"name":"openInterestPerAssetPerSide","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"openInterestPerUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operators","outputs":[{"internalType":"contract IOperators","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"platformFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"positionVault","outputs":[{"internalType":"contract IPositionVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceMovementPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"referrerTiers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_wallets","type":"address[]"}],"name":"removeWalletsFromBanList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"selfExecuteCooldown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_basisFundingRateFactor","type":"uint256"}],"name":"setBasisFundingRateFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"uint256","name":"_borrowFeeFactor","type":"uint256"}],"name":"setBorrowFeeFactorPerAssetPerSide","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_bountyPercentFirstCaller","type":"uint32"},{"internalType":"uint32","name":"_bountyPercentResolver","type":"uint32"}],"name":"setBountyPercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_deltaTime","type":"uint256"}],"name":"setCloseDeltaTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cooldownDuration","type":"uint256"}],"name":"setCooldownDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_deductFee","type":"uint256"}],"name":"setDeductFeePercentForUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxAmount","type":"uint256"}],"name":"setDefaultMaxOpenInterestPerUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_defaultMaxProfitPercent","type":"uint256"}],"name":"setDefaultMaxProfitPercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setDepositFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_isEnabled","type":"bool"}],"name":"setEnableDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_isEnabled","type":"bool"}],"name":"setEnableStaking","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_isEnabled","type":"bool"}],"name":"setEnableUnstaking","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_isEnabled","type":"bool"}],"name":"setEnableWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_expiryDuration","type":"uint256"}],"name":"setExpiryDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeManager","type":"address"}],"name":"setFeeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feeRewardsBasisPoints","type":"uint256"}],"name":"setFeeRewardBasisPoints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_fundingRateFactor","type":"uint256"}],"name":"setFundingRateFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_delegate","type":"address"},{"internalType":"bool","name":"_allowed","type":"bool"}],"name":"setGlobalDelegates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_isDisabled","type":"bool"}],"name":"setIsDecreasingPositionDisabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_isDisabled","type":"bool"}],"name":"setIsIncreasingPositionDisabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"},{"internalType":"bool","name":"_isWhitelisted","type":"bool"}],"name":"setIsWhitelistedFromCooldown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"},{"internalType":"bool","name":"_isWhitelisted","type":"bool"}],"name":"setIsWhitelistedFromTransferCooldown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_liquidateThreshold","type":"uint256"}],"name":"setLiquidateThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_liquidationPendingTime","type":"uint256"}],"name":"setLiquidationPendingTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setMarketOrderGasFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_maxCloseProfit","type":"uint256"}],"name":"setMaxCloseProfit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_maxCloseProfitPercent","type":"uint256"}],"name":"setMaxCloseProfitPercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxFundingRate","type":"uint256"}],"name":"setMaxFundingRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_maxAmount","type":"uint256"}],"name":"setMaxOpenInterestPerAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"uint256","name":"_maxAmount","type":"uint256"}],"name":"setMaxOpenInterestPerAssetPerSide","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_maxAmount","type":"uint256"}],"name":"setMaxOpenInterestPerUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_maxProfitPercent","type":"uint256"}],"name":"setMaxProfitPercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxTotalNslp","type":"uint256"}],"name":"setMaxTotalNslp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxAmount","type":"uint256"}],"name":"setMaxTotalOpenInterest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"setMaxTriggerPerPosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minCollateral","type":"uint256"}],"name":"setMinCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_minProfitDuration","type":"uint256"}],"name":"setMinProfitDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_platform","type":"address"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setPlatformFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_priceMovementPercent","type":"uint256"}],"name":"setPriceMovementPercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_referrer","type":"address"},{"internalType":"uint256","name":"_tier","type":"uint256"}],"name":"setReferrerTier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_selfExecuteCooldown","type":"uint256"}],"name":"setSelfExecuteCooldown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_slippageFactor","type":"uint256"}],"name":"setSlippageFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setStakingFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tier","type":"uint256"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setTierFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tierInfo","type":"address"}],"name":"setTierInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tier","type":"uint256"},{"internalType":"uint256","name":"_rebate","type":"uint256"}],"name":"setTierRebate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"uint256","name":"_tradingFee","type":"uint256"}],"name":"setTradingFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setTriggerGasFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setUnstakingFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setWithdrawFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"slippageFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tierFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tierInfo","outputs":[{"internalType":"contract ITierInfo","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tierRebates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalOpenInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"name":"tradingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"triggerGasFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_delegates","type":"address[]"}],"name":"undelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"unstakingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"updateFunding","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"withdrawFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50614730806100206000396000f3fe608060405234801561001057600080fd5b50600436106108085760003560e01c8063892037cd11610421578063c906bdb11161022b578063de8f5a111161013b578063f59bc792116100c3578063fa5dc29111610092578063fa5dc2911461141e578063fb4f94e714611431578063fc1e2f0514611451578063fe4631f814611464578063ff27a1131461148457600080fd5b8063f59bc792146113c2578063f690a3a3146113d5578063f7a5dc08146113f8578063f8c8765e1461140b57600080fd5b8063e673df8a1161010a578063e673df8a14611340578063e708d45814611353578063eb802b1914611366578063f06be71c1461139c578063f3494992146113af57600080fd5b8063de8f5a11146112c7578063e0c78455146112e7578063e11b6e671461130a578063e4eefdc21461131d57600080fd5b8063d0f100aa116101be578063d5aa8aa91161018d578063d5aa8aa914611265578063d648273d14611285578063d6f9dbc314611298578063db16e989146112ab578063dc5f1fce146112b457600080fd5b8063d0f100aa14611208578063d0fb02031461121b578063d136545b1461122e578063d468e2a91461125c57600080fd5b8063cdbde18f116101fa578063cdbde18f146111c0578063ce5338ec146111c9578063ce9e8009146111ec578063cfa4a5bf146111f557600080fd5b8063c906bdb114611161578063cadd5f0014611174578063cb28bbeb14611194578063cd8dd99b146111b757600080fd5b8063b3075fb711610331578063bba8fb5a116102b9578063bfd2ed0111610288578063bfd2ed01146110e0578063c253e93914611108578063c2cd732e1461111b578063c42bf8cd1461112e578063c691a7ef1461114157600080fd5b8063bba8fb5a14611077578063bc12bc5d1461109a578063bd19a382146110ad578063beeccee6146110cd57600080fd5b8063b76b634d11610300578063b76b634d14610ffd578063b809d0f914611010578063b8420dd21461103b578063b9b42e691461104e578063ba2de9bc1461106e57600080fd5b8063b3075fb714610fae578063b3c1e3ae14610fce578063b3ee142414610fe1578063b6993e1014610fea57600080fd5b8063966be075116103b4578063a4b5eec111610383578063a4b5eec114610f14578063a6fee84f14610f27578063a9b9e38914610f3a578063ac0a724614610f4d578063b02bd44514610f7857600080fd5b8063966be07514610ed257806398654aff14610ee55780639e04877914610ef85780639f52a26114610f0157600080fd5b806391c736c3116103f057806391c736c314610e7957806391e432eb14610e9957806392c070aa14610eac578063938b7fa314610ebf57600080fd5b8063892037cd14610e155780638c0addbb14610e285780638cb5df1414610e3b5780638db1afb114610e6657600080fd5b80633ff9fd351161062257806365280c661161053257806380330768116104ba578063846321a411610489578063846321a414610da957806385a848ff14610dbc5780638637fa3f14610ddc578063886f712014610def5780638918c48914610e0257600080fd5b80638033076814610d4d57806380352cfd14610d605780638113dba514610d8057806382ff819214610da057600080fd5b80636e559b94116105015780636e559b9414610ce15780636ea9f13914610d015780637845cc3414610d145780637b58342b14610d275780637fa2e5ba14610d3a57600080fd5b806365280c6614610c9557806368d538a314610ca8578063690a961a14610cbb5780636aecd6ae14610cce57600080fd5b80634c41f869116105b557806358c167c41161058457806358c167c414610c13578063594ca01514610c265780635cd8a76b14610c7b57806361695ebe14610c8357806364c8bb7e14610c8c57600080fd5b80634c41f86914610bc7578063519e01b014610bda57806354e0fb2114610bed578063553eaed514610c0057600080fd5b806345bf7cfe116105f157806345bf7cfe14610b85578063472d35b914610b9857806347c6f0f414610bab5780634b7504b414610bb457600080fd5b80633ff9fd3514610b1e5780634032c51d14610b31578063449cbd5114610b5c5780634553216314610b7c57600080fd5b8063216b05911161071d57806330deb45d116106b0578063340dc04e1161067f578063340dc04e14610ad457806334c86b6b14610ae75780633526931514610afa57806338e454b114610b035780633fb8b32314610b0b57600080fd5b806330deb45d14610a6157806332243c7a14610a7457806332e8bc7214610aa157806333079ad014610ac157600080fd5b80632e79aba5116106ec5780632e79aba5146109e25780632f4b23ba14610a155780632f4b96aa14610a1e578063307726ef14610a4157600080fd5b8063216b05911461097157806323fc61601461098457806327a79e72146109a457806329fb5893146109cf57600080fd5b806314ec4683116107a0578063169db77d1161076f578063169db77d146108f557806316c62f3a1461091557806316df7b8c146109355780631ac3ddeb146109485780631c8444d01461096857600080fd5b806314ec46831461089c57806315502840146108af5780631582a018146108c2578063168be038146108e257600080fd5b8063095920e8116107dc578063095920e8146108585780630af1c2511461086d5780630c55fe6f146108765780631116e09a1461088957600080fd5b80622d6efd1461080d578063018f2d82146108335780630498cf871461083c578063070b1d491461084f575b600080fd5b61082061081b366004613e49565b6114a7565b6040519081526020015b60405180910390f35b610820603a5481565b61082061084a366004613e7e565b6114e4565b610820605c5481565b61086b610866366004613e7e565b611537565b005b610820604c5481565b61086b610884366004613e7e565b61157f565b61086b610897366004613eae565b6115eb565b61086b6108aa366004613ed8565b611660565b61086b6108bd366004613e7e565b6116ca565b6108206108d0366004613f0b565b604e6020526000908152604090205481565b61086b6108f0366004613e7e565b61172b565b610908610903366004613f0b565b61176b565b60405161082a9190613f26565b610820610923366004613f0b565b60556020526000908152604090205481565b61086b610943366004613f73565b611795565b610820610956366004613f0b565b60426020526000908152604090205481565b610820603c5481565b61086b61097f366004613ed8565b6117e5565b610820610992366004613e7e565b604b6020526000908152604090205481565b6037546109b7906001600160a01b031681565b6040516001600160a01b03909116815260200161082a565b61086b6109dd366004613eae565b611848565b610a056109f0366004613f0b565b60406020819052600091825290205460ff1681565b604051901515815260200161082a565b610820606b5481565b610a05610a2c366004613e7e565b60506020526000908152604090205460ff1681565b610820610a4f366004613e7e565b606a6020526000908152604090205481565b61086b610a6f366004613f73565b6118a0565b610820610a82366004613f95565b6000918252606c60209081526040808420921515845291905290205490565b610820610aaf366004613f0b565b606e6020526000908152604090205481565b61086b610acf366004613ed8565b611938565b61086b610ae2366004613f95565b61199b565b610820610af5366004613fb8565b6119f8565b61082060385481565b61086b611a69565b61086b610b19366004613eae565b611b24565b61086b610b2c366004613e7e565b611b80565b610820610b3f366004613f95565b604560209081526000928352604080842090915290825290205481565b610820610b6a366004613f0b565b60466020526000908152604090205481565b610820605e5481565b610820610b93366004613ffc565b611bf9565b61086b610ba6366004613f0b565b611c70565b61082060545481565b61086b610bc236600461404d565b611cc6565b61086b610bd536600461404d565b611d1c565b610a05610be8366004614112565b611d6e565b61086b610bfb366004613eae565b611e17565b61086b610c0e366004613f73565b611e8c565b610820610c21366004613f73565b611edf565b610c66610c34366004613f0b565b6001600160a01b03166000908152604e60209081526040808320548352604f825280832054606d909252909120549091565b6040805192835260208301919091520161082a565b61086b611f95565b610820605f5481565b610820605d5481565b61086b610ca336600461413c565b61204c565b61086b610cb6366004613e7e565b6121c3565b61086b610cc9366004613f73565b612225565b61086b610cdc366004613f73565b612278565b610820610cef366004613e7e565b604a6020526000908152604090205481565b61086b610d0f366004613e7e565b6122cb565b61086b610d22366004613f95565b61238e565b61086b610d3536600461404d565b6123eb565b610820610d48366004613f0b565b61242f565b61086b610d5b366004613e7e565b6124cf565b610820610d6e366004613f0b565b60416020526000908152604090205481565b610820610d8e366004613f0b565b60446020526000908152604090205481565b61082060475481565b61086b610db7366004613e7e565b612556565b610820610dca366004613f0b565b60436020526000908152604090205481565b61086b610dea366004613e49565b612596565b61086b610dfd36600461413c565b612623565b61086b610e10366004613eae565b612862565b61086b610e23366004613ed8565b6128dd565b61086b610e36366004613f73565b612940565b610820610e49366004613f95565b605660209081526000928352604080842090915290825290205481565b61086b610e74366004613eae565b612963565b610820610e87366004613e7e565b60706020526000908152604090205481565b61086b610ea7366004613f73565b6129e2565b61086b610eba366004613f0b565b612a71565b61086b610ecd366004613ed8565b612ac7565b61086b610ee0366004613e7e565b612b2e565b6034546109b7906001600160a01b031681565b61082060625481565b610820610f0f366004613e7e565b612bc1565b61086b610f22366004613e7e565b612d5d565b61086b610f35366004614184565b612dbe565b610a05610f48366004613f0b565b612e85565b610820610f5b366004613f95565b606c60209081526000928352604080842090915290825290205481565b610820610f86366004613f0b565b6001600160a01b03166000908152604e60209081526040808320548352606d90915290205490565b610820610fbc366004613e7e565b604f6020526000908152604090205481565b61086b610fdc366004613f73565b612e92565b610820605b5481565b61086b610ff8366004613f73565b612ee5565b61082061100b3660046141ae565b612f58565b61082061101e366004613f95565b605860209081526000928352604080842090915290825290205481565b6033546109b7906001600160a01b031681565b61082061105c366004613e7e565b60486020526000908152604090205481565b61082060525481565b610a05611085366004613f0b565b60666020526000908152604090205460ff1681565b61086b6110a8366004613ed8565b612fb0565b6108206110bb366004613e7e565b60726020526000908152604090205481565b61086b6110db366004613e7e565b613017565b6064546040805163ffffffff808416825264010000000090930490921660208301520161082a565b61086b611116366004613e7e565b61307e565b610820611129366004613e7e565b6130be565b61086b61113c36600461404d565b6130e2565b61082061114f366004613e7e565b606d6020526000908152604090205481565b61086b61116f366004613e49565b613121565b610820611182366004613e7e565b60716020526000908152604090205481565b610a056111a2366004613f0b565b60396020526000908152604090205460ff1681565b61082060535481565b610820606f5481565b610a056111d7366004613f0b565b603e6020526000908152604090205460ff1681565b610820605a5481565b6035546109b7906001600160a01b031681565b61086b611216366004613e7e565b613182565b603b546109b7906001600160a01b031681565b61124161123c3660046141ed565b6131c2565b6040805193845260208401929092529082015260600161082a565b61082060595481565b610820611273366004613e7e565b60606020526000908152604090205481565b61086b611293366004613e7e565b6132ef565b61086b6112a6366004613f73565b613351565b61082060495481565b6108206112c2366004613ffc565b613406565b6108206112d5366004613f0b565b60576020526000908152604090205481565b610a056112f5366004613f0b565b603f6020526000908152604090205460ff1681565b61082061131836600461424d565b61348a565b610a0561132b366004613f0b565b60696020526000908152604090205460ff1681565b6036546109b7906001600160a01b031681565b61086b611361366004613e49565b613554565b610820611374366004613f0b565b6001600160a01b03166000908152604e60209081526040808320548352604f90915290205490565b61086b6113aa366004613eae565b6135f1565b61086b6113bd366004613e7e565b613666565b61086b6113d0366004613e7e565b6136cd565b610a056113e3366004613f0b565b603d6020526000908152604090205460ff1681565b61086b611406366004613eae565b61370d565b61086b611419366004614289565b613782565b61086b61142c366004613ed8565b6139d6565b61082061143f366004613e7e565b60616020526000908152604090205481565b61086b61145f366004613e7e565b613a39565b610820611472366004613e7e565b604d6020526000908152604090205481565b610a05611492366004613e7e565b60516020526000908152604090205460ff1681565b60008381526045602090815260408083208515158452909152812054620186a0906114d290846142e8565b6114dc919061431d565b949350505050565b6000818152604b602052604081205481906114ff9042614331565b90508061150f5750600092915050565b610e108161151c85612bc1565b6115269190614348565b61153091906143cd565b9392505050565b600261154281613a9c565b606b8290556040518281527f1bee29f5fe0fcd199d9c2ca0b90ac5439fe01d250c1b82ad8cf6b0e389409dbc906020015b60405180910390a15050565b600261158a81613a9c565b620151808211156115b65760405162461bcd60e51b81526004016115ad906143fb565b60405180910390fd5b60538290556040518281527f3bbf6cdb9d1956e356e995277be510ce4a2d4ce456380101504c332b0bf6686b90602001611573565b60036115f681613a9c565b6127108211156116185760405162461bcd60e51b81526004016115ad906143fb565b6001600160a01b038316600081815260416020526040808220859055518492917ffaa48701cca36b4544975c3f9ebcd95bcedf6fdaf77ca2f822610da385535a4b91a3505050565b600361166b81613a9c565b6001600160a01b03831660008181526040602081815291819020805460ff191686151590811790915590519081527fbad484f44d8f0d73e4d611b642ee226861910b0eb9a0fb78ca37442e993fa84091015b60405180910390a2505050565b60036116d581613a9c565b603c8211156116f65760405162461bcd60e51b81526004016115ad906143fb565b605b8290556040518281527fb44c1c2484251161eac3fae49f55941ecd3ba9ff2e99b57ad297944a8975ba5390602001611573565b600161173681613a9c565b60548290556040518281527f3717f1dd1421b6fc8f96329a26dbe50ee5cd9f2d02b684857aa395b8355515bd90602001611573565b6001600160a01b038116600090815260656020526040902060609061178f90613b5b565b92915050565b60036117a081613a9c565b600083815260486020526040908190208390555183907f43c66b55902ede604a66723a5539a73924e9eedd2ba4b0fe4c690399c5de5d5e906116bd9085815260200190565b60036117f081613a9c565b6001600160a01b0383166000818152603e6020908152604091829020805460ff191686151590811790915591519182527f0cf6f741793803cd724cb79eeee1402635997f6c6edb705ce1fe217b4503f53591016116bd565b600261185381613a9c565b6001600160a01b03831660008181526055602052604090819020849055517f6522f04a6996a265e164e27a9877d2d2b7b581c8ac3f9440cc74978e5dbde7cf906116bd9085815260200190565b60036118ab81613a9c565b6000838152606d6020526040902054620186a0906118c9908461441e565b11156118e75760405162461bcd60e51b81526004016115ad906143fb565b6000838152604f602090815260409182902084905581518581529081018490527f205ef158e14a6d611608eaf18c1741c8f4898faa5e7b08bc06370631725f09a991015b60405180910390a1505050565b600361194381613a9c565b6001600160a01b0383166000818152603d6020908152604091829020805460ff191686151590811790915591519182527fff02a206e0096ee65f426cbdd38cc0036b0a9fc7dfceef4528af331622eca7cd91016116bd565b60026119a681613a9c565b600083815260506020908152604091829020805460ff19168515159081179091558251868152918201527fdb5d95906584e4b15c4eb5805af2b10e64d94c7091c9a0caf52def1d4b2a4968910161192b565b6000611a086002620186a061451a565b611a118661242f565b6001600160a01b038716600090815260466020526040902054611a3790620186a0614331565b611a428787876114a7565b611a4c91906142e8565b611a5691906142e8565b611a60919061431d565b95945050505050565b600054600390610100900460ff16158015611a8b575060005460ff8083169116105b611aa75760405162461bcd60e51b81526004016115ad90614529565b6000805461ffff191660ff831617610100179055611ad76c0c9f2c9cd04674edea400000006402540be4006142e8565b606b556064604c556000805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a150565b6001611b2f81613a9c565b6001600160a01b0383166000818152604e6020908152604091829020859055815192835282018490527f7696855cdbb94bb5a44cb0a95caff6f29173aa1cbfba193834b12b90827ce2bc910161192b565b6003611b8b81613a9c565b600a611b9b6003620186a061451a565b611ba5919061431d565b821115611bc45760405162461bcd60e51b81526004016115ad906143fb565b60498290556040518281527f3511a46416611db647471465fa49e5676f017dc030bfcbeb0dc856a3fb514ce890602001611573565b600083611c3a57611c0e6003620186a061451a565b611c17866130be565b611c219084614577565b611c2b9085614348565b611c3591906143cd565b611a60565b611c486003620186a061451a565b82611c52876130be565b611c5c9190614577565b611c669085614348565b611a6091906143cd565b6003611c7b81613a9c565b603b80546001600160a01b0319166001600160a01b0384169081179091556040517f5d0517e3a4eabea892d9750138cd21d4a6cf3b935b43d0598df7055f463819b290600090a25050565b60005b8151811015611d18573360009081526065602052604090208251611d079190849084908110611cfa57611cfa6145b6565b6020026020010151613c08565b50611d11816145cc565b9050611cc9565b5050565b60005b8151811015611d18573360009081526065602052604090208251611d5d9190849084908110611d5057611d506145b6565b6020026020010151613c1d565b50611d67816145cc565b9050611d1f565b6000611d7983612e85565b15611db75760405162461bcd60e51b815260206004820152600e60248201526d1858d8dbdd5b9d0818985b9b995960921b60448201526064016115ad565b816001600160a01b0316836001600160a01b03161480611def57506001600160a01b03821660009081526066602052604090205460ff165b8061153057506001600160a01b03831660009081526065602052604090206115309083613c32565b6003611e2281613a9c565b612710821115611e445760405162461bcd60e51b81526004016115ad906143fb565b6001600160a01b038316600081815260426020526040808220859055518492917f96d5b2cb815e5d31464fca16af36a6625a9d29b7ce1ceb91067735eaaa76f7ec91a3505050565b6003611e9781613a9c565b60008381526072602090815260409182902084905581518581529081018490527fbfac435eaf5762376cf33b823e87ba2d0a876fb34877d80ceebfd3a88a84bdcc910161192b565b6034546040805163061e56b560e01b815290516000926001600160a01b03169163061e56b5916004808301926020929190829003018186803b158015611f2457600080fd5b505afa158015611f38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5c91906145e7565b611f679060026142e8565b826059546002611f7791906142e8565b611f81919061441e565b611f8b90856142e8565b611530919061431d565b600054600290610100900460ff16158015611fb7575060005460ff8083169116105b611fd35760405162461bcd60e51b81526004016115ad90614529565b600080546040805180820182526107d08152611f406020918201526064805467ffffffffffffffff1916651f40000007d017905561ff001961010060ff871661ffff1990951685171716909355519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989101611b19565b6034546001600160a01b031633148061206f57506033546001600160a01b031633145b61208b5760405162461bcd60e51b81526004016115ad90614600565b6001600160a01b038316600090815260576020526040902054818110156120ca576001600160a01b0384166000908152605760205260408120556120ee565b6120d48282614331565b6001600160a01b0385166000908152605760205260409020555b6000858152605860209081526040808320861515845290915290205482811015612133576000868152605860209081526040808320871515845290915281205561215a565b61213d8382614331565b600087815260586020908152604080832088151584529091529020555b6059548381101561216f57600060595561217d565b6121798482614331565b6059555b6040805186151581526020810186905288917fc20378aec24e4dfcaab485d25d985840beb70f3b4888c9a933adaa8250a1df87910160405180910390a250505050505050565b60036121ce81613a9c565b6127108211156121f05760405162461bcd60e51b81526004016115ad906143fb565b605f8290556040518281527f66ace67844373113db2f9037189f4ba7ba184f2d8a6e9cf5f986167246b8829590602001611573565b600361223081613a9c565b60008381526070602090815260409182902084905581518581529081018490527fc828ac6c8fb60251a4ad4daf2f7b39f7458707355ac2eb469d0461fee230deee910161192b565b600361228381613a9c565b60008381526071602090815260409182902084905581518581529081018490527fb6b4c61c4d5686e7822b45e187bb3c18c6baa83f3d9c05fcbbeca7eef8a70243910161192b565b6034546001600160a01b03163314806122ee57506033546001600160a01b031633145b61230a5760405162461bcd60e51b81526004016115ad90614600565b6000818152604b60205260409020541561237b576000612329826130be565b6000838152604a6020526040908190208290555190915082907ff1b288d8485cd48c1515360fc5d58326a4ccfa7e739e9424ed747a77243c1f1e906123719084815260200190565b60405180910390a2505b6000908152604b60205260409020429055565b600261239981613a9c565b600083815260516020908152604091829020805460ff19168515159081179091558251868152918201527f3f0b9f7002cce208afd72d62fe3d274d0792d9de641486de135fd3406971cda4910161192b565b60016123f681613a9c565b60005b825181101561242a576124196067848381518110611d5057611d506145b6565b50612423816145cc565b90506123f9565b505050565b6035546000906001600160a01b0316156124c557603554604051633fd172dd60e11b81526001600160a01b03848116600483015290911690637fa2e5ba9060240160206040518083038186803b15801561248857600080fd5b505afa15801561249c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124c091906145e7565b61178f565b620186a092915050565b60036124da81613a9c565b600082116125215760405162461bcd60e51b81526020600482015260146024820152730696e76616c6964206d6178546f74616c4e736c760641b60448201526064016115ad565b606f8290556040518281527faa98b5a10fcbc52b973946c01214e522fce98654d91c422e3f7675eb6122fb7190602001611573565b600361256181613a9c565b60528290556040518281527f91d35bbd295b35ac714161948711d17a3043ec1b35fbf2bd2fe852fdb2de466e90602001611573565b60036125a181613a9c565b6113888211156125c35760405162461bcd60e51b81526004016115ad906143fb565b600084815260456020908152604080832086151580855290835292819020859055805192835290820184905285917f1f727472521c3ec72ca8cd77a2e45b6db7a5b18a85b0be2e3aaaff332933400591015b60405180910390a250505050565b6034546001600160a01b031633148061264657506033546001600160a01b031633145b6126625760405162461bcd60e51b81526004016115ad90614600565b6001600160a01b0383166000908152605760209081526040808320546055909252909120548061269157506054545b8061269c848461441e565b11156126e05760405162461bcd60e51b81526020600482015260136024820152721d5cd95c881b585e13d248195e18d959591959606a1b60448201526064016115ad565b6126ea838361441e565b6001600160a01b03861660009081526057602090815260408083209390935588825260588152828220871515808452908252838320548a84526056835284842091845291529190205461273d858361441e565b111561278b5760405162461bcd60e51b815260206004820152601960248201527f61737365742073696465206d61784f492065786365656465640000000000000060448201526064016115ad565b612795848261441e565b600088815260586020908152604080832089151584529091528120919091556059546127c290869061441e565b9050606b548111156128165760405162461bcd60e51b815260206004820152601d60248201527f6d6178546f74616c4f70656e496e74657265737420657863656564656400000060448201526064016115ad565b60598190556040805187151581526020810187905289917faed204c34a0af9193067932c1f3e7741ae18261796c002c1a9f866a4f85b617f910160405180910390a25050505050505050565b600261286d81613a9c565b620186a08211156128905760405162461bcd60e51b81526004016115ad906143fb565b6001600160a01b03831660008181526046602052604090819020849055517f4fe0615fde9fc69670e385e805a651c21b300ccb3c8efc54591573862423b083906116bd9085815260200190565b60026128e881613a9c565b6001600160a01b038316600081815260666020908152604091829020805460ff191686151590811790915591519182527fac6d06ea301ef1b854d9900d4b056b06ef2563c2b4947d7dce20243775a2554291016116bd565b600261294b81613a9c565b61295783600184613121565b61242a83600084613121565b600361296e81613a9c565b620186a08211156129915760405162461bcd60e51b81526004016115ad906143fb565b6001600160a01b0383166000818152606e6020908152604091829020859055815192835282018490527faf3cae1809c5f23bb23a7a33cc5e486cfd2674e0eda5f6dbee4be8472a5e3e9a910161192b565b60036129ed81613a9c565b6000838152604f6020526040902054620186a090612a0b908461441e565b1115612a295760405162461bcd60e51b81526004016115ad906143fb565b6000838152606d602090815260409182902084905581518581529081018490527fc3d3cc0c8b5fef4def81caf623ad62a4f4081e33c40ff413cecc2fc4888aa923910161192b565b6003612a7c81613a9c565b603580546001600160a01b0319166001600160a01b0384169081179091556040517f4873662e62eb3a54bc59a09ace28a0c2ead98e9e69c0214cf805115eb76d189c90600090a25050565b6003612ad281613a9c565b6001600160a01b038316600081815260396020908152604091829020805460ff19168615159081179091558251938452908301527fd76f458417b9634ff0c19dbecbc36901e7e09ea4d85ac4ddf7d2d884eacc622a910161192b565b6003612b3981613a9c565b62278d00821115612b8c5760405162461bcd60e51b815260206004820152601860248201527f696e76616c696420636f6f6c646f776e4475726174696f6e000000000000000060448201526064016115ad565b60388290556040518281527fd11d0ebdd6af0dec0dd89018cf0fd5ceb1791ceaf849b900d840af10435abc3990602001611573565b60008181526058602090815260408083206001845282528083205483805281842054603454835163061e56b560e01b815293519294919386936001600160a01b039092169263061e56b592600480840193829003018186803b158015612c2657600080fd5b505afa158015612c3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c5e91906145e7565b905080612c7057506000949350505050565b818310612cde5760475460008681526048602052604081205490918391620186a09190612c9d8789614331565b612ca791906142e8565b612cb191906142e8565b612cbb91906142e8565b612cc5919061431d565b9050604954811115611a60575050604954949350505050565b60475460008681526048602052604081205490918391620186a09190612d048888614331565b612d0e91906142e8565b612d1891906142e8565b612d2291906142e8565b612d2c919061431d565b9050604954811115612d5157604954612d4790600019614348565b9695505050505050565b612d4781600019614348565b6003612d6881613a9c565b603c821115612d895760405162461bcd60e51b81526004016115ad906143fb565b60628290556040518281527ffeaf36f587738424f11a276bc44e2d20068453949aed660ee27c6eb3c64665f490602001611573565b6003612dc981613a9c565b620186a0612dd78385614624565b63ffffffff161115612e235760405162461bcd60e51b81526020600482015260156024820152741a5b9d985b1a5908189bdd5b9d1e54195c98d95b9d605a1b60448201526064016115ad565b6064805463ffffffff85811667ffffffffffffffff199092168217640100000000918616918202179092556040805191825260208201929092527fb7943ac7a8e7d67e350b10a4800edd9dd9aa6f8c30b0ef91d3de727e661cf79b910161192b565b600061178f606783613c32565b6003612e9d81613a9c565b6000838152606a602090815260409182902084905581518581529081018490527f2ba23f722798f9488bfad4db3753e091112f45f0fa436b7cc57ca574f2769bd0910161192b565b6003612ef081613a9c565b620186a0821115612f135760405162461bcd60e51b81526004016115ad906143fb565b600083815260606020526040908190208390555183907f7f89cb9ce32d2edcd0ad6ff94105a6f7a6e650df0821dd7743b5933100a73162906116bd9085815260200190565b6000610e10612f6b620186a0600a6142e8565b6000858152606c60209081526040808320871515845290915290205487612f928842614331565b612f9c91906142e8565b612fa691906142e8565b611a56919061431d565b6003612fbb81613a9c565b6001600160a01b038316600081815260696020908152604091829020805460ff19168615159081179091558251938452908301527fdb60f686b7b9024036a84eb76cd92d65d58dc56a962bb166f70a58ad0d42f1a3910161192b565b600361302281613a9c565b67016345785d8a000082111561304a5760405162461bcd60e51b81526004016115ad906143fb565b605d82905560405182907fc33d0cce64cda1b6e98bb9430fc2e5f2ec44c5670fa9ba7863263f80bef4228890600090a25050565b600361308981613a9c565b603c8290556040518281527fd313e7f616b38b224c594766569f460dd4d687838351b892ddc6ee3807f05f0090602001611573565b60006130c9826114e4565b6000838152604a602052604090205461178f919061464c565b60016130ed81613a9c565b60005b825181101561242a576131106067848381518110611cfa57611cfa6145b6565b5061311a816145cc565b90506130f0565b600261312c81613a9c565b600084815260566020908152604080832086151580855290835292819020859055805192835290820184905285917f4e2eca7ddbd103904eca15f02af559359bcc1fc17e9f41bb3a7b778b984d10779101612615565b600361318d81613a9c565b60478290556040518281527f34f5f704d83d7385bb3cb043b16b8ac8a311e0a61e604f930dc18a4c90770c1990602001611573565b60008060008088116132055760405162461bcd60e51b815260206004820152600c60248201526b06176675072696365203e20360a41b60448201526064016115ad565b891561326357878710613238578761321d8189614331565b613227908b6142e8565b613231919061431d565b92506132a3565b876132438882614331565b61324d908b6142e8565b613257919061431d565b61323190600019614348565b878711613275578761321d8882614331565b876132808189614331565b61328a908b6142e8565b613294919061431d565b6132a090600019614348565b92505b6132af8b8b8b87611bf9565b9150846132be8a888e8e612f58565b6132c8919061441e565b9050806132d58385614577565b6132df9190614577565b9250985098509895505050505050565b60036132fa81613a9c565b61012c82111561331c5760405162461bcd60e51b81526004016115ad906143fb565b605c8290556040518281527f28e342c6badfb30e36b755ebd9a85eb09e37b4d0f21692c0678fc6403a63076890602001611573565b600361335c81613a9c565b61336a620186a060086142e8565b82101580156133865750613382620186a0600a6142e8565b8211155b6133c15760405162461bcd60e51b815260206004820152600c60248201526b4f7574206f662072616e676560a01b60448201526064016115ad565b600083815260616020526040908190208390555183907f33cf718637d6f1faf404b6902a2b551102381524c3b3c83f85cb3681e40758f7906116bd9085815260200190565b6000848152606060205260408120548061342357829150506114dc565b600061342f8286611edf565b90508561345d57620186a06134448282614331565b61344e90866142e8565b613458919061431d565b61347f565b620186a061346b828261441e565b61347590866142e8565b61347f919061431d565b979650505050505050565b6001600160a01b038216600090815260556020526040812054806134ad57506054545b6001600160a01b0384166000908152605760205260408120546134d09083614331565b6000878152605860209081526040808320881515808552908352818420548b8552605684528285209185529252822054929350909161350f9190614331565b90506000605954606b546135239190614331565b905060008284106135345782613536565b835b90508181106135455781613547565b805b9998505050505050505050565b600361355f81613a9c565b61356c6101f4600a6142e8565b82111561358b5760405162461bcd60e51b81526004016115ad906143fb565b6000848152606c60209081526040808320861515808552908352928190208590558051878152918201929092529081018390527f5c5e8d88e31ea4cc1b4cd3f95e2469183577d905231c014fa0eabcc1d5c23a549060600160405180910390a150505050565b60036135fc81613a9c565b61271082111561361e5760405162461bcd60e51b81526004016115ad906143fb565b6001600160a01b038316600081815260436020526040808220859055518492917fd611d8bdb8424ce163df70d8bbf3b419db69e594dbe962e4f79c67bded14b44491a3505050565b600361367181613a9c565b67016345785d8a00008211156136995760405162461bcd60e51b81526004016115ad906143fb565b605a82905560405182907f981ba501475b3f375a7073170c810e5d849a026a6c5cd0cb99728789c5a58d0090600090a25050565b60036136d881613a9c565b605e8290556040518281527fa0775c184c3a011d87511949ee47c17d243f24c01c19c37b386e4b403031376690602001611573565b600361371881613a9c565b61271082111561373a5760405162461bcd60e51b81526004016115ad906143fb565b6001600160a01b038316600081815260446020526040808220859055518492917f8152e32804e450cb0601b72748812b5ca55785d0a15fe66f811243845857e1ff91a3505050565b600054610100900460ff16158080156137a25750600054600160ff909116105b806137bc5750303b1580156137bc575060005460ff166001145b6137d85760405162461bcd60e51b81526004016115ad90614529565b6000805460ff1916600117905580156137fb576000805461ff0019166101001790555b613803613c54565b603380546001600160a01b03199081166001600160a01b0388811691909117909255603480548216878416179055603680548216868416179055603780549091169184169190911790556032605f55612710603c90815560408051808201909152614e20815261c35060209091018190526064805467ffffffffffffffff191665c35000004e20179055600a606255612a30603855605b829055605c91909155603a556138be6c0c9f2c9cd04674edea4000000060056142e8565b605255600a604c8190556000605d819055605a8190556127106047558052604f6020526113887f577c1e6a19430e0ea0e729206a98c24b31fb46a99e99442207e8bc668027b9eb55605e556139276c0c9f2c9cd04674edea40000000662386f26fc100006142e8565b605455606461393a6003620186a061451a565b613944919061431d565b6049556139636c0c9f2c9cd04674edea400000006402540be4006142e8565b606b556127106063556139786012600a61468d565b613986906301312d006142e8565b606f5580156139cf576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b60036139e181613a9c565b6001600160a01b0383166000818152603f6020908152604091829020805460ff191686151590811790915591519182527fefdb9a6fddb509d0a50837b2af22d8a3cb2676a5bdee7ce6c28d729d097ca15991016116bd565b6003613a4481613a9c565b620186a0821115613a675760405162461bcd60e51b81526004016115ad906143fb565b603a8290556040518281527f29b08db21dd9f62e4ded9c6141ac1e132cf17b1c0db5d90fbc928148dc8db82190602001611573565b60365460405163df07560560e01b815233600482015282916001600160a01b03169063df0756059060240160206040518083038186803b158015613adf57600080fd5b505afa158015613af3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b1791906145e7565b1015613b585760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b21037b832b930ba37b960811b60448201526064016115ad565b50565b60606000613b6883613c85565b905060008167ffffffffffffffff811115613b8557613b85614037565b604051908082528060200260200182016040528015613bae578160200160208202803683370190505b50905060005b82811015613c0057613bc68582613c8f565b828281518110613bd857613bd86145b6565b6001600160a01b0390921660209283029190910190910152613bf9816145cc565b9050613bb4565b509392505050565b6000611530836001600160a01b038416613c9b565b6000611530836001600160a01b038416613cea565b6001600160a01b03811660009081526001830160205260408120541515611530565b600054610100900460ff16613c7b5760405162461bcd60e51b81526004016115ad90614699565b613c83613ddd565b565b600061178f825490565b60006115308383613e0a565b6000818152600183016020526040812054613ce25750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561178f565b50600061178f565b60008181526001830160205260408120548015613dd3576000613d0e600183614331565b8554909150600090613d2290600190614331565b9050818114613d87576000866000018281548110613d4257613d426145b6565b9060005260206000200154905080876000018481548110613d6557613d656145b6565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613d9857613d986146e4565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061178f565b600091505061178f565b600054610100900460ff16613e045760405162461bcd60e51b81526004016115ad90614699565b60018055565b6000826000018281548110613e2157613e216145b6565b9060005260206000200154905092915050565b80358015158114613e4457600080fd5b919050565b600080600060608486031215613e5e57600080fd5b83359250613e6e60208501613e34565b9150604084013590509250925092565b600060208284031215613e9057600080fd5b5035919050565b80356001600160a01b0381168114613e4457600080fd5b60008060408385031215613ec157600080fd5b613eca83613e97565b946020939093013593505050565b60008060408385031215613eeb57600080fd5b613ef483613e97565b9150613f0260208401613e34565b90509250929050565b600060208284031215613f1d57600080fd5b61153082613e97565b6020808252825182820181905260009190848201906040850190845b81811015613f675783516001600160a01b031683529284019291840191600101613f42565b50909695505050505050565b60008060408385031215613f8657600080fd5b50508035926020909101359150565b60008060408385031215613fa857600080fd5b82359150613f0260208401613e34565b60008060008060808587031215613fce57600080fd5b613fd785613e97565b935060208501359250613fec60408601613e34565b9396929550929360600135925050565b6000806000806080858703121561401257600080fd5b8435935061402260208601613e34565b93969395505050506040820135916060013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561406057600080fd5b823567ffffffffffffffff8082111561407857600080fd5b818501915085601f83011261408c57600080fd5b81358181111561409e5761409e614037565b8060051b604051601f19603f830116810181811085821117156140c3576140c3614037565b6040529182528482019250838101850191888311156140e157600080fd5b938501935b82851015614106576140f785613e97565b845293850193928501926140e6565b98975050505050505050565b6000806040838503121561412557600080fd5b61412e83613e97565b9150613f0260208401613e97565b6000806000806080858703121561415257600080fd5b8435935061416260208601613e97565b9250613fec60408601613e34565b803563ffffffff81168114613e4457600080fd5b6000806040838503121561419757600080fd5b6141a083614170565b9150613f0260208401614170565b600080600080608085870312156141c457600080fd5b8435935060208501359250604085013591506141e260608601613e34565b905092959194509250565b600080600080600080600080610100898b03121561420a57600080fd5b8835975061421a60208a01613e34565b979a9799505050506040860135956060810135956080820135955060a0820135945060c0820135935060e0909101359150565b60008060006060848603121561426257600080fd5b8335925061427260208501613e97565b915061428060408501613e34565b90509250925092565b6000806000806080858703121561429f57600080fd5b6142a885613e97565b93506142b660208601613e97565b92506142c460408601613e97565b91506141e260608601613e97565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615614302576143026142d2565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261432c5761432c614307565b500490565b600082821015614343576143436142d2565b500390565b60006001600160ff1b038184138284138082168684048611161561436e5761436e6142d2565b600160ff1b600087128281168783058912161561438d5761438d6142d2565b600087129250878205871284841616156143a9576143a96142d2565b878505871281841616156143bf576143bf6142d2565b505050929093029392505050565b6000826143dc576143dc614307565b600160ff1b8214600019841416156143f6576143f66142d2565b500590565b602080825260099082015268082c4deecca40dac2f60bb1b604082015260600190565b60008219821115614431576144316142d2565b500190565b600181815b80851115614471578160001904821115614457576144576142d2565b8085161561446457918102915b93841c939080029061443b565b509250929050565b6000826144885750600161178f565b816144955750600061178f565b81600181146144ab57600281146144b5576144d1565b600191505061178f565b60ff8411156144c6576144c66142d2565b50506001821b61178f565b5060208310610133831016604e8410600b84101617156144f4575081810a61178f565b6144fe8383614436565b8060001904821115614512576145126142d2565b029392505050565b600061153060ff841683614479565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60008083128015600160ff1b850184121615614595576145956142d2565b6001600160ff1b03840183138116156145b0576145b06142d2565b50500390565b634e487b7160e01b600052603260045260246000fd5b60006000198214156145e0576145e06142d2565b5060010190565b6000602082840312156145f957600080fd5b5051919050565b6020808252600a908201526913db9b1e481d985d5b1d60b21b604082015260600190565b600063ffffffff808316818516808303821115614643576146436142d2565b01949350505050565b600080821280156001600160ff1b038490038513161561466e5761466e6142d2565b600160ff1b8390038412811615614687576146876142d2565b50500190565b60006115308383614479565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220a89c70e15c94c7fa04829dc1d0c4bd64d14fde713c865127cdad1afbc6ba400064736f6c63430008090033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106108085760003560e01c8063892037cd11610421578063c906bdb11161022b578063de8f5a111161013b578063f59bc792116100c3578063fa5dc29111610092578063fa5dc2911461141e578063fb4f94e714611431578063fc1e2f0514611451578063fe4631f814611464578063ff27a1131461148457600080fd5b8063f59bc792146113c2578063f690a3a3146113d5578063f7a5dc08146113f8578063f8c8765e1461140b57600080fd5b8063e673df8a1161010a578063e673df8a14611340578063e708d45814611353578063eb802b1914611366578063f06be71c1461139c578063f3494992146113af57600080fd5b8063de8f5a11146112c7578063e0c78455146112e7578063e11b6e671461130a578063e4eefdc21461131d57600080fd5b8063d0f100aa116101be578063d5aa8aa91161018d578063d5aa8aa914611265578063d648273d14611285578063d6f9dbc314611298578063db16e989146112ab578063dc5f1fce146112b457600080fd5b8063d0f100aa14611208578063d0fb02031461121b578063d136545b1461122e578063d468e2a91461125c57600080fd5b8063cdbde18f116101fa578063cdbde18f146111c0578063ce5338ec146111c9578063ce9e8009146111ec578063cfa4a5bf146111f557600080fd5b8063c906bdb114611161578063cadd5f0014611174578063cb28bbeb14611194578063cd8dd99b146111b757600080fd5b8063b3075fb711610331578063bba8fb5a116102b9578063bfd2ed0111610288578063bfd2ed01146110e0578063c253e93914611108578063c2cd732e1461111b578063c42bf8cd1461112e578063c691a7ef1461114157600080fd5b8063bba8fb5a14611077578063bc12bc5d1461109a578063bd19a382146110ad578063beeccee6146110cd57600080fd5b8063b76b634d11610300578063b76b634d14610ffd578063b809d0f914611010578063b8420dd21461103b578063b9b42e691461104e578063ba2de9bc1461106e57600080fd5b8063b3075fb714610fae578063b3c1e3ae14610fce578063b3ee142414610fe1578063b6993e1014610fea57600080fd5b8063966be075116103b4578063a4b5eec111610383578063a4b5eec114610f14578063a6fee84f14610f27578063a9b9e38914610f3a578063ac0a724614610f4d578063b02bd44514610f7857600080fd5b8063966be07514610ed257806398654aff14610ee55780639e04877914610ef85780639f52a26114610f0157600080fd5b806391c736c3116103f057806391c736c314610e7957806391e432eb14610e9957806392c070aa14610eac578063938b7fa314610ebf57600080fd5b8063892037cd14610e155780638c0addbb14610e285780638cb5df1414610e3b5780638db1afb114610e6657600080fd5b80633ff9fd351161062257806365280c661161053257806380330768116104ba578063846321a411610489578063846321a414610da957806385a848ff14610dbc5780638637fa3f14610ddc578063886f712014610def5780638918c48914610e0257600080fd5b80638033076814610d4d57806380352cfd14610d605780638113dba514610d8057806382ff819214610da057600080fd5b80636e559b94116105015780636e559b9414610ce15780636ea9f13914610d015780637845cc3414610d145780637b58342b14610d275780637fa2e5ba14610d3a57600080fd5b806365280c6614610c9557806368d538a314610ca8578063690a961a14610cbb5780636aecd6ae14610cce57600080fd5b80634c41f869116105b557806358c167c41161058457806358c167c414610c13578063594ca01514610c265780635cd8a76b14610c7b57806361695ebe14610c8357806364c8bb7e14610c8c57600080fd5b80634c41f86914610bc7578063519e01b014610bda57806354e0fb2114610bed578063553eaed514610c0057600080fd5b806345bf7cfe116105f157806345bf7cfe14610b85578063472d35b914610b9857806347c6f0f414610bab5780634b7504b414610bb457600080fd5b80633ff9fd3514610b1e5780634032c51d14610b31578063449cbd5114610b5c5780634553216314610b7c57600080fd5b8063216b05911161071d57806330deb45d116106b0578063340dc04e1161067f578063340dc04e14610ad457806334c86b6b14610ae75780633526931514610afa57806338e454b114610b035780633fb8b32314610b0b57600080fd5b806330deb45d14610a6157806332243c7a14610a7457806332e8bc7214610aa157806333079ad014610ac157600080fd5b80632e79aba5116106ec5780632e79aba5146109e25780632f4b23ba14610a155780632f4b96aa14610a1e578063307726ef14610a4157600080fd5b8063216b05911461097157806323fc61601461098457806327a79e72146109a457806329fb5893146109cf57600080fd5b806314ec4683116107a0578063169db77d1161076f578063169db77d146108f557806316c62f3a1461091557806316df7b8c146109355780631ac3ddeb146109485780631c8444d01461096857600080fd5b806314ec46831461089c57806315502840146108af5780631582a018146108c2578063168be038146108e257600080fd5b8063095920e8116107dc578063095920e8146108585780630af1c2511461086d5780630c55fe6f146108765780631116e09a1461088957600080fd5b80622d6efd1461080d578063018f2d82146108335780630498cf871461083c578063070b1d491461084f575b600080fd5b61082061081b366004613e49565b6114a7565b6040519081526020015b60405180910390f35b610820603a5481565b61082061084a366004613e7e565b6114e4565b610820605c5481565b61086b610866366004613e7e565b611537565b005b610820604c5481565b61086b610884366004613e7e565b61157f565b61086b610897366004613eae565b6115eb565b61086b6108aa366004613ed8565b611660565b61086b6108bd366004613e7e565b6116ca565b6108206108d0366004613f0b565b604e6020526000908152604090205481565b61086b6108f0366004613e7e565b61172b565b610908610903366004613f0b565b61176b565b60405161082a9190613f26565b610820610923366004613f0b565b60556020526000908152604090205481565b61086b610943366004613f73565b611795565b610820610956366004613f0b565b60426020526000908152604090205481565b610820603c5481565b61086b61097f366004613ed8565b6117e5565b610820610992366004613e7e565b604b6020526000908152604090205481565b6037546109b7906001600160a01b031681565b6040516001600160a01b03909116815260200161082a565b61086b6109dd366004613eae565b611848565b610a056109f0366004613f0b565b60406020819052600091825290205460ff1681565b604051901515815260200161082a565b610820606b5481565b610a05610a2c366004613e7e565b60506020526000908152604090205460ff1681565b610820610a4f366004613e7e565b606a6020526000908152604090205481565b61086b610a6f366004613f73565b6118a0565b610820610a82366004613f95565b6000918252606c60209081526040808420921515845291905290205490565b610820610aaf366004613f0b565b606e6020526000908152604090205481565b61086b610acf366004613ed8565b611938565b61086b610ae2366004613f95565b61199b565b610820610af5366004613fb8565b6119f8565b61082060385481565b61086b611a69565b61086b610b19366004613eae565b611b24565b61086b610b2c366004613e7e565b611b80565b610820610b3f366004613f95565b604560209081526000928352604080842090915290825290205481565b610820610b6a366004613f0b565b60466020526000908152604090205481565b610820605e5481565b610820610b93366004613ffc565b611bf9565b61086b610ba6366004613f0b565b611c70565b61082060545481565b61086b610bc236600461404d565b611cc6565b61086b610bd536600461404d565b611d1c565b610a05610be8366004614112565b611d6e565b61086b610bfb366004613eae565b611e17565b61086b610c0e366004613f73565b611e8c565b610820610c21366004613f73565b611edf565b610c66610c34366004613f0b565b6001600160a01b03166000908152604e60209081526040808320548352604f825280832054606d909252909120549091565b6040805192835260208301919091520161082a565b61086b611f95565b610820605f5481565b610820605d5481565b61086b610ca336600461413c565b61204c565b61086b610cb6366004613e7e565b6121c3565b61086b610cc9366004613f73565b612225565b61086b610cdc366004613f73565b612278565b610820610cef366004613e7e565b604a6020526000908152604090205481565b61086b610d0f366004613e7e565b6122cb565b61086b610d22366004613f95565b61238e565b61086b610d3536600461404d565b6123eb565b610820610d48366004613f0b565b61242f565b61086b610d5b366004613e7e565b6124cf565b610820610d6e366004613f0b565b60416020526000908152604090205481565b610820610d8e366004613f0b565b60446020526000908152604090205481565b61082060475481565b61086b610db7366004613e7e565b612556565b610820610dca366004613f0b565b60436020526000908152604090205481565b61086b610dea366004613e49565b612596565b61086b610dfd36600461413c565b612623565b61086b610e10366004613eae565b612862565b61086b610e23366004613ed8565b6128dd565b61086b610e36366004613f73565b612940565b610820610e49366004613f95565b605660209081526000928352604080842090915290825290205481565b61086b610e74366004613eae565b612963565b610820610e87366004613e7e565b60706020526000908152604090205481565b61086b610ea7366004613f73565b6129e2565b61086b610eba366004613f0b565b612a71565b61086b610ecd366004613ed8565b612ac7565b61086b610ee0366004613e7e565b612b2e565b6034546109b7906001600160a01b031681565b61082060625481565b610820610f0f366004613e7e565b612bc1565b61086b610f22366004613e7e565b612d5d565b61086b610f35366004614184565b612dbe565b610a05610f48366004613f0b565b612e85565b610820610f5b366004613f95565b606c60209081526000928352604080842090915290825290205481565b610820610f86366004613f0b565b6001600160a01b03166000908152604e60209081526040808320548352606d90915290205490565b610820610fbc366004613e7e565b604f6020526000908152604090205481565b61086b610fdc366004613f73565b612e92565b610820605b5481565b61086b610ff8366004613f73565b612ee5565b61082061100b3660046141ae565b612f58565b61082061101e366004613f95565b605860209081526000928352604080842090915290825290205481565b6033546109b7906001600160a01b031681565b61082061105c366004613e7e565b60486020526000908152604090205481565b61082060525481565b610a05611085366004613f0b565b60666020526000908152604090205460ff1681565b61086b6110a8366004613ed8565b612fb0565b6108206110bb366004613e7e565b60726020526000908152604090205481565b61086b6110db366004613e7e565b613017565b6064546040805163ffffffff808416825264010000000090930490921660208301520161082a565b61086b611116366004613e7e565b61307e565b610820611129366004613e7e565b6130be565b61086b61113c36600461404d565b6130e2565b61082061114f366004613e7e565b606d6020526000908152604090205481565b61086b61116f366004613e49565b613121565b610820611182366004613e7e565b60716020526000908152604090205481565b610a056111a2366004613f0b565b60396020526000908152604090205460ff1681565b61082060535481565b610820606f5481565b610a056111d7366004613f0b565b603e6020526000908152604090205460ff1681565b610820605a5481565b6035546109b7906001600160a01b031681565b61086b611216366004613e7e565b613182565b603b546109b7906001600160a01b031681565b61124161123c3660046141ed565b6131c2565b6040805193845260208401929092529082015260600161082a565b61082060595481565b610820611273366004613e7e565b60606020526000908152604090205481565b61086b611293366004613e7e565b6132ef565b61086b6112a6366004613f73565b613351565b61082060495481565b6108206112c2366004613ffc565b613406565b6108206112d5366004613f0b565b60576020526000908152604090205481565b610a056112f5366004613f0b565b603f6020526000908152604090205460ff1681565b61082061131836600461424d565b61348a565b610a0561132b366004613f0b565b60696020526000908152604090205460ff1681565b6036546109b7906001600160a01b031681565b61086b611361366004613e49565b613554565b610820611374366004613f0b565b6001600160a01b03166000908152604e60209081526040808320548352604f90915290205490565b61086b6113aa366004613eae565b6135f1565b61086b6113bd366004613e7e565b613666565b61086b6113d0366004613e7e565b6136cd565b610a056113e3366004613f0b565b603d6020526000908152604090205460ff1681565b61086b611406366004613eae565b61370d565b61086b611419366004614289565b613782565b61086b61142c366004613ed8565b6139d6565b61082061143f366004613e7e565b60616020526000908152604090205481565b61086b61145f366004613e7e565b613a39565b610820611472366004613e7e565b604d6020526000908152604090205481565b610a05611492366004613e7e565b60516020526000908152604090205460ff1681565b60008381526045602090815260408083208515158452909152812054620186a0906114d290846142e8565b6114dc919061431d565b949350505050565b6000818152604b602052604081205481906114ff9042614331565b90508061150f5750600092915050565b610e108161151c85612bc1565b6115269190614348565b61153091906143cd565b9392505050565b600261154281613a9c565b606b8290556040518281527f1bee29f5fe0fcd199d9c2ca0b90ac5439fe01d250c1b82ad8cf6b0e389409dbc906020015b60405180910390a15050565b600261158a81613a9c565b620151808211156115b65760405162461bcd60e51b81526004016115ad906143fb565b60405180910390fd5b60538290556040518281527f3bbf6cdb9d1956e356e995277be510ce4a2d4ce456380101504c332b0bf6686b90602001611573565b60036115f681613a9c565b6127108211156116185760405162461bcd60e51b81526004016115ad906143fb565b6001600160a01b038316600081815260416020526040808220859055518492917ffaa48701cca36b4544975c3f9ebcd95bcedf6fdaf77ca2f822610da385535a4b91a3505050565b600361166b81613a9c565b6001600160a01b03831660008181526040602081815291819020805460ff191686151590811790915590519081527fbad484f44d8f0d73e4d611b642ee226861910b0eb9a0fb78ca37442e993fa84091015b60405180910390a2505050565b60036116d581613a9c565b603c8211156116f65760405162461bcd60e51b81526004016115ad906143fb565b605b8290556040518281527fb44c1c2484251161eac3fae49f55941ecd3ba9ff2e99b57ad297944a8975ba5390602001611573565b600161173681613a9c565b60548290556040518281527f3717f1dd1421b6fc8f96329a26dbe50ee5cd9f2d02b684857aa395b8355515bd90602001611573565b6001600160a01b038116600090815260656020526040902060609061178f90613b5b565b92915050565b60036117a081613a9c565b600083815260486020526040908190208390555183907f43c66b55902ede604a66723a5539a73924e9eedd2ba4b0fe4c690399c5de5d5e906116bd9085815260200190565b60036117f081613a9c565b6001600160a01b0383166000818152603e6020908152604091829020805460ff191686151590811790915591519182527f0cf6f741793803cd724cb79eeee1402635997f6c6edb705ce1fe217b4503f53591016116bd565b600261185381613a9c565b6001600160a01b03831660008181526055602052604090819020849055517f6522f04a6996a265e164e27a9877d2d2b7b581c8ac3f9440cc74978e5dbde7cf906116bd9085815260200190565b60036118ab81613a9c565b6000838152606d6020526040902054620186a0906118c9908461441e565b11156118e75760405162461bcd60e51b81526004016115ad906143fb565b6000838152604f602090815260409182902084905581518581529081018490527f205ef158e14a6d611608eaf18c1741c8f4898faa5e7b08bc06370631725f09a991015b60405180910390a1505050565b600361194381613a9c565b6001600160a01b0383166000818152603d6020908152604091829020805460ff191686151590811790915591519182527fff02a206e0096ee65f426cbdd38cc0036b0a9fc7dfceef4528af331622eca7cd91016116bd565b60026119a681613a9c565b600083815260506020908152604091829020805460ff19168515159081179091558251868152918201527fdb5d95906584e4b15c4eb5805af2b10e64d94c7091c9a0caf52def1d4b2a4968910161192b565b6000611a086002620186a061451a565b611a118661242f565b6001600160a01b038716600090815260466020526040902054611a3790620186a0614331565b611a428787876114a7565b611a4c91906142e8565b611a5691906142e8565b611a60919061431d565b95945050505050565b600054600390610100900460ff16158015611a8b575060005460ff8083169116105b611aa75760405162461bcd60e51b81526004016115ad90614529565b6000805461ffff191660ff831617610100179055611ad76c0c9f2c9cd04674edea400000006402540be4006142e8565b606b556064604c556000805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a150565b6001611b2f81613a9c565b6001600160a01b0383166000818152604e6020908152604091829020859055815192835282018490527f7696855cdbb94bb5a44cb0a95caff6f29173aa1cbfba193834b12b90827ce2bc910161192b565b6003611b8b81613a9c565b600a611b9b6003620186a061451a565b611ba5919061431d565b821115611bc45760405162461bcd60e51b81526004016115ad906143fb565b60498290556040518281527f3511a46416611db647471465fa49e5676f017dc030bfcbeb0dc856a3fb514ce890602001611573565b600083611c3a57611c0e6003620186a061451a565b611c17866130be565b611c219084614577565b611c2b9085614348565b611c3591906143cd565b611a60565b611c486003620186a061451a565b82611c52876130be565b611c5c9190614577565b611c669085614348565b611a6091906143cd565b6003611c7b81613a9c565b603b80546001600160a01b0319166001600160a01b0384169081179091556040517f5d0517e3a4eabea892d9750138cd21d4a6cf3b935b43d0598df7055f463819b290600090a25050565b60005b8151811015611d18573360009081526065602052604090208251611d079190849084908110611cfa57611cfa6145b6565b6020026020010151613c08565b50611d11816145cc565b9050611cc9565b5050565b60005b8151811015611d18573360009081526065602052604090208251611d5d9190849084908110611d5057611d506145b6565b6020026020010151613c1d565b50611d67816145cc565b9050611d1f565b6000611d7983612e85565b15611db75760405162461bcd60e51b815260206004820152600e60248201526d1858d8dbdd5b9d0818985b9b995960921b60448201526064016115ad565b816001600160a01b0316836001600160a01b03161480611def57506001600160a01b03821660009081526066602052604090205460ff165b8061153057506001600160a01b03831660009081526065602052604090206115309083613c32565b6003611e2281613a9c565b612710821115611e445760405162461bcd60e51b81526004016115ad906143fb565b6001600160a01b038316600081815260426020526040808220859055518492917f96d5b2cb815e5d31464fca16af36a6625a9d29b7ce1ceb91067735eaaa76f7ec91a3505050565b6003611e9781613a9c565b60008381526072602090815260409182902084905581518581529081018490527fbfac435eaf5762376cf33b823e87ba2d0a876fb34877d80ceebfd3a88a84bdcc910161192b565b6034546040805163061e56b560e01b815290516000926001600160a01b03169163061e56b5916004808301926020929190829003018186803b158015611f2457600080fd5b505afa158015611f38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5c91906145e7565b611f679060026142e8565b826059546002611f7791906142e8565b611f81919061441e565b611f8b90856142e8565b611530919061431d565b600054600290610100900460ff16158015611fb7575060005460ff8083169116105b611fd35760405162461bcd60e51b81526004016115ad90614529565b600080546040805180820182526107d08152611f406020918201526064805467ffffffffffffffff1916651f40000007d017905561ff001961010060ff871661ffff1990951685171716909355519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989101611b19565b6034546001600160a01b031633148061206f57506033546001600160a01b031633145b61208b5760405162461bcd60e51b81526004016115ad90614600565b6001600160a01b038316600090815260576020526040902054818110156120ca576001600160a01b0384166000908152605760205260408120556120ee565b6120d48282614331565b6001600160a01b0385166000908152605760205260409020555b6000858152605860209081526040808320861515845290915290205482811015612133576000868152605860209081526040808320871515845290915281205561215a565b61213d8382614331565b600087815260586020908152604080832088151584529091529020555b6059548381101561216f57600060595561217d565b6121798482614331565b6059555b6040805186151581526020810186905288917fc20378aec24e4dfcaab485d25d985840beb70f3b4888c9a933adaa8250a1df87910160405180910390a250505050505050565b60036121ce81613a9c565b6127108211156121f05760405162461bcd60e51b81526004016115ad906143fb565b605f8290556040518281527f66ace67844373113db2f9037189f4ba7ba184f2d8a6e9cf5f986167246b8829590602001611573565b600361223081613a9c565b60008381526070602090815260409182902084905581518581529081018490527fc828ac6c8fb60251a4ad4daf2f7b39f7458707355ac2eb469d0461fee230deee910161192b565b600361228381613a9c565b60008381526071602090815260409182902084905581518581529081018490527fb6b4c61c4d5686e7822b45e187bb3c18c6baa83f3d9c05fcbbeca7eef8a70243910161192b565b6034546001600160a01b03163314806122ee57506033546001600160a01b031633145b61230a5760405162461bcd60e51b81526004016115ad90614600565b6000818152604b60205260409020541561237b576000612329826130be565b6000838152604a6020526040908190208290555190915082907ff1b288d8485cd48c1515360fc5d58326a4ccfa7e739e9424ed747a77243c1f1e906123719084815260200190565b60405180910390a2505b6000908152604b60205260409020429055565b600261239981613a9c565b600083815260516020908152604091829020805460ff19168515159081179091558251868152918201527f3f0b9f7002cce208afd72d62fe3d274d0792d9de641486de135fd3406971cda4910161192b565b60016123f681613a9c565b60005b825181101561242a576124196067848381518110611d5057611d506145b6565b50612423816145cc565b90506123f9565b505050565b6035546000906001600160a01b0316156124c557603554604051633fd172dd60e11b81526001600160a01b03848116600483015290911690637fa2e5ba9060240160206040518083038186803b15801561248857600080fd5b505afa15801561249c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124c091906145e7565b61178f565b620186a092915050565b60036124da81613a9c565b600082116125215760405162461bcd60e51b81526020600482015260146024820152730696e76616c6964206d6178546f74616c4e736c760641b60448201526064016115ad565b606f8290556040518281527faa98b5a10fcbc52b973946c01214e522fce98654d91c422e3f7675eb6122fb7190602001611573565b600361256181613a9c565b60528290556040518281527f91d35bbd295b35ac714161948711d17a3043ec1b35fbf2bd2fe852fdb2de466e90602001611573565b60036125a181613a9c565b6113888211156125c35760405162461bcd60e51b81526004016115ad906143fb565b600084815260456020908152604080832086151580855290835292819020859055805192835290820184905285917f1f727472521c3ec72ca8cd77a2e45b6db7a5b18a85b0be2e3aaaff332933400591015b60405180910390a250505050565b6034546001600160a01b031633148061264657506033546001600160a01b031633145b6126625760405162461bcd60e51b81526004016115ad90614600565b6001600160a01b0383166000908152605760209081526040808320546055909252909120548061269157506054545b8061269c848461441e565b11156126e05760405162461bcd60e51b81526020600482015260136024820152721d5cd95c881b585e13d248195e18d959591959606a1b60448201526064016115ad565b6126ea838361441e565b6001600160a01b03861660009081526057602090815260408083209390935588825260588152828220871515808452908252838320548a84526056835284842091845291529190205461273d858361441e565b111561278b5760405162461bcd60e51b815260206004820152601960248201527f61737365742073696465206d61784f492065786365656465640000000000000060448201526064016115ad565b612795848261441e565b600088815260586020908152604080832089151584529091528120919091556059546127c290869061441e565b9050606b548111156128165760405162461bcd60e51b815260206004820152601d60248201527f6d6178546f74616c4f70656e496e74657265737420657863656564656400000060448201526064016115ad565b60598190556040805187151581526020810187905289917faed204c34a0af9193067932c1f3e7741ae18261796c002c1a9f866a4f85b617f910160405180910390a25050505050505050565b600261286d81613a9c565b620186a08211156128905760405162461bcd60e51b81526004016115ad906143fb565b6001600160a01b03831660008181526046602052604090819020849055517f4fe0615fde9fc69670e385e805a651c21b300ccb3c8efc54591573862423b083906116bd9085815260200190565b60026128e881613a9c565b6001600160a01b038316600081815260666020908152604091829020805460ff191686151590811790915591519182527fac6d06ea301ef1b854d9900d4b056b06ef2563c2b4947d7dce20243775a2554291016116bd565b600261294b81613a9c565b61295783600184613121565b61242a83600084613121565b600361296e81613a9c565b620186a08211156129915760405162461bcd60e51b81526004016115ad906143fb565b6001600160a01b0383166000818152606e6020908152604091829020859055815192835282018490527faf3cae1809c5f23bb23a7a33cc5e486cfd2674e0eda5f6dbee4be8472a5e3e9a910161192b565b60036129ed81613a9c565b6000838152604f6020526040902054620186a090612a0b908461441e565b1115612a295760405162461bcd60e51b81526004016115ad906143fb565b6000838152606d602090815260409182902084905581518581529081018490527fc3d3cc0c8b5fef4def81caf623ad62a4f4081e33c40ff413cecc2fc4888aa923910161192b565b6003612a7c81613a9c565b603580546001600160a01b0319166001600160a01b0384169081179091556040517f4873662e62eb3a54bc59a09ace28a0c2ead98e9e69c0214cf805115eb76d189c90600090a25050565b6003612ad281613a9c565b6001600160a01b038316600081815260396020908152604091829020805460ff19168615159081179091558251938452908301527fd76f458417b9634ff0c19dbecbc36901e7e09ea4d85ac4ddf7d2d884eacc622a910161192b565b6003612b3981613a9c565b62278d00821115612b8c5760405162461bcd60e51b815260206004820152601860248201527f696e76616c696420636f6f6c646f776e4475726174696f6e000000000000000060448201526064016115ad565b60388290556040518281527fd11d0ebdd6af0dec0dd89018cf0fd5ceb1791ceaf849b900d840af10435abc3990602001611573565b60008181526058602090815260408083206001845282528083205483805281842054603454835163061e56b560e01b815293519294919386936001600160a01b039092169263061e56b592600480840193829003018186803b158015612c2657600080fd5b505afa158015612c3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c5e91906145e7565b905080612c7057506000949350505050565b818310612cde5760475460008681526048602052604081205490918391620186a09190612c9d8789614331565b612ca791906142e8565b612cb191906142e8565b612cbb91906142e8565b612cc5919061431d565b9050604954811115611a60575050604954949350505050565b60475460008681526048602052604081205490918391620186a09190612d048888614331565b612d0e91906142e8565b612d1891906142e8565b612d2291906142e8565b612d2c919061431d565b9050604954811115612d5157604954612d4790600019614348565b9695505050505050565b612d4781600019614348565b6003612d6881613a9c565b603c821115612d895760405162461bcd60e51b81526004016115ad906143fb565b60628290556040518281527ffeaf36f587738424f11a276bc44e2d20068453949aed660ee27c6eb3c64665f490602001611573565b6003612dc981613a9c565b620186a0612dd78385614624565b63ffffffff161115612e235760405162461bcd60e51b81526020600482015260156024820152741a5b9d985b1a5908189bdd5b9d1e54195c98d95b9d605a1b60448201526064016115ad565b6064805463ffffffff85811667ffffffffffffffff199092168217640100000000918616918202179092556040805191825260208201929092527fb7943ac7a8e7d67e350b10a4800edd9dd9aa6f8c30b0ef91d3de727e661cf79b910161192b565b600061178f606783613c32565b6003612e9d81613a9c565b6000838152606a602090815260409182902084905581518581529081018490527f2ba23f722798f9488bfad4db3753e091112f45f0fa436b7cc57ca574f2769bd0910161192b565b6003612ef081613a9c565b620186a0821115612f135760405162461bcd60e51b81526004016115ad906143fb565b600083815260606020526040908190208390555183907f7f89cb9ce32d2edcd0ad6ff94105a6f7a6e650df0821dd7743b5933100a73162906116bd9085815260200190565b6000610e10612f6b620186a0600a6142e8565b6000858152606c60209081526040808320871515845290915290205487612f928842614331565b612f9c91906142e8565b612fa691906142e8565b611a56919061431d565b6003612fbb81613a9c565b6001600160a01b038316600081815260696020908152604091829020805460ff19168615159081179091558251938452908301527fdb60f686b7b9024036a84eb76cd92d65d58dc56a962bb166f70a58ad0d42f1a3910161192b565b600361302281613a9c565b67016345785d8a000082111561304a5760405162461bcd60e51b81526004016115ad906143fb565b605d82905560405182907fc33d0cce64cda1b6e98bb9430fc2e5f2ec44c5670fa9ba7863263f80bef4228890600090a25050565b600361308981613a9c565b603c8290556040518281527fd313e7f616b38b224c594766569f460dd4d687838351b892ddc6ee3807f05f0090602001611573565b60006130c9826114e4565b6000838152604a602052604090205461178f919061464c565b60016130ed81613a9c565b60005b825181101561242a576131106067848381518110611cfa57611cfa6145b6565b5061311a816145cc565b90506130f0565b600261312c81613a9c565b600084815260566020908152604080832086151580855290835292819020859055805192835290820184905285917f4e2eca7ddbd103904eca15f02af559359bcc1fc17e9f41bb3a7b778b984d10779101612615565b600361318d81613a9c565b60478290556040518281527f34f5f704d83d7385bb3cb043b16b8ac8a311e0a61e604f930dc18a4c90770c1990602001611573565b60008060008088116132055760405162461bcd60e51b815260206004820152600c60248201526b06176675072696365203e20360a41b60448201526064016115ad565b891561326357878710613238578761321d8189614331565b613227908b6142e8565b613231919061431d565b92506132a3565b876132438882614331565b61324d908b6142e8565b613257919061431d565b61323190600019614348565b878711613275578761321d8882614331565b876132808189614331565b61328a908b6142e8565b613294919061431d565b6132a090600019614348565b92505b6132af8b8b8b87611bf9565b9150846132be8a888e8e612f58565b6132c8919061441e565b9050806132d58385614577565b6132df9190614577565b9250985098509895505050505050565b60036132fa81613a9c565b61012c82111561331c5760405162461bcd60e51b81526004016115ad906143fb565b605c8290556040518281527f28e342c6badfb30e36b755ebd9a85eb09e37b4d0f21692c0678fc6403a63076890602001611573565b600361335c81613a9c565b61336a620186a060086142e8565b82101580156133865750613382620186a0600a6142e8565b8211155b6133c15760405162461bcd60e51b815260206004820152600c60248201526b4f7574206f662072616e676560a01b60448201526064016115ad565b600083815260616020526040908190208390555183907f33cf718637d6f1faf404b6902a2b551102381524c3b3c83f85cb3681e40758f7906116bd9085815260200190565b6000848152606060205260408120548061342357829150506114dc565b600061342f8286611edf565b90508561345d57620186a06134448282614331565b61344e90866142e8565b613458919061431d565b61347f565b620186a061346b828261441e565b61347590866142e8565b61347f919061431d565b979650505050505050565b6001600160a01b038216600090815260556020526040812054806134ad57506054545b6001600160a01b0384166000908152605760205260408120546134d09083614331565b6000878152605860209081526040808320881515808552908352818420548b8552605684528285209185529252822054929350909161350f9190614331565b90506000605954606b546135239190614331565b905060008284106135345782613536565b835b90508181106135455781613547565b805b9998505050505050505050565b600361355f81613a9c565b61356c6101f4600a6142e8565b82111561358b5760405162461bcd60e51b81526004016115ad906143fb565b6000848152606c60209081526040808320861515808552908352928190208590558051878152918201929092529081018390527f5c5e8d88e31ea4cc1b4cd3f95e2469183577d905231c014fa0eabcc1d5c23a549060600160405180910390a150505050565b60036135fc81613a9c565b61271082111561361e5760405162461bcd60e51b81526004016115ad906143fb565b6001600160a01b038316600081815260436020526040808220859055518492917fd611d8bdb8424ce163df70d8bbf3b419db69e594dbe962e4f79c67bded14b44491a3505050565b600361367181613a9c565b67016345785d8a00008211156136995760405162461bcd60e51b81526004016115ad906143fb565b605a82905560405182907f981ba501475b3f375a7073170c810e5d849a026a6c5cd0cb99728789c5a58d0090600090a25050565b60036136d881613a9c565b605e8290556040518281527fa0775c184c3a011d87511949ee47c17d243f24c01c19c37b386e4b403031376690602001611573565b600361371881613a9c565b61271082111561373a5760405162461bcd60e51b81526004016115ad906143fb565b6001600160a01b038316600081815260446020526040808220859055518492917f8152e32804e450cb0601b72748812b5ca55785d0a15fe66f811243845857e1ff91a3505050565b600054610100900460ff16158080156137a25750600054600160ff909116105b806137bc5750303b1580156137bc575060005460ff166001145b6137d85760405162461bcd60e51b81526004016115ad90614529565b6000805460ff1916600117905580156137fb576000805461ff0019166101001790555b613803613c54565b603380546001600160a01b03199081166001600160a01b0388811691909117909255603480548216878416179055603680548216868416179055603780549091169184169190911790556032605f55612710603c90815560408051808201909152614e20815261c35060209091018190526064805467ffffffffffffffff191665c35000004e20179055600a606255612a30603855605b829055605c91909155603a556138be6c0c9f2c9cd04674edea4000000060056142e8565b605255600a604c8190556000605d819055605a8190556127106047558052604f6020526113887f577c1e6a19430e0ea0e729206a98c24b31fb46a99e99442207e8bc668027b9eb55605e556139276c0c9f2c9cd04674edea40000000662386f26fc100006142e8565b605455606461393a6003620186a061451a565b613944919061431d565b6049556139636c0c9f2c9cd04674edea400000006402540be4006142e8565b606b556127106063556139786012600a61468d565b613986906301312d006142e8565b606f5580156139cf576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b60036139e181613a9c565b6001600160a01b0383166000818152603f6020908152604091829020805460ff191686151590811790915591519182527fefdb9a6fddb509d0a50837b2af22d8a3cb2676a5bdee7ce6c28d729d097ca15991016116bd565b6003613a4481613a9c565b620186a0821115613a675760405162461bcd60e51b81526004016115ad906143fb565b603a8290556040518281527f29b08db21dd9f62e4ded9c6141ac1e132cf17b1c0db5d90fbc928148dc8db82190602001611573565b60365460405163df07560560e01b815233600482015282916001600160a01b03169063df0756059060240160206040518083038186803b158015613adf57600080fd5b505afa158015613af3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b1791906145e7565b1015613b585760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b21037b832b930ba37b960811b60448201526064016115ad565b50565b60606000613b6883613c85565b905060008167ffffffffffffffff811115613b8557613b85614037565b604051908082528060200260200182016040528015613bae578160200160208202803683370190505b50905060005b82811015613c0057613bc68582613c8f565b828281518110613bd857613bd86145b6565b6001600160a01b0390921660209283029190910190910152613bf9816145cc565b9050613bb4565b509392505050565b6000611530836001600160a01b038416613c9b565b6000611530836001600160a01b038416613cea565b6001600160a01b03811660009081526001830160205260408120541515611530565b600054610100900460ff16613c7b5760405162461bcd60e51b81526004016115ad90614699565b613c83613ddd565b565b600061178f825490565b60006115308383613e0a565b6000818152600183016020526040812054613ce25750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561178f565b50600061178f565b60008181526001830160205260408120548015613dd3576000613d0e600183614331565b8554909150600090613d2290600190614331565b9050818114613d87576000866000018281548110613d4257613d426145b6565b9060005260206000200154905080876000018481548110613d6557613d656145b6565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613d9857613d986146e4565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061178f565b600091505061178f565b600054610100900460ff16613e045760405162461bcd60e51b81526004016115ad90614699565b60018055565b6000826000018281548110613e2157613e216145b6565b9060005260206000200154905092915050565b80358015158114613e4457600080fd5b919050565b600080600060608486031215613e5e57600080fd5b83359250613e6e60208501613e34565b9150604084013590509250925092565b600060208284031215613e9057600080fd5b5035919050565b80356001600160a01b0381168114613e4457600080fd5b60008060408385031215613ec157600080fd5b613eca83613e97565b946020939093013593505050565b60008060408385031215613eeb57600080fd5b613ef483613e97565b9150613f0260208401613e34565b90509250929050565b600060208284031215613f1d57600080fd5b61153082613e97565b6020808252825182820181905260009190848201906040850190845b81811015613f675783516001600160a01b031683529284019291840191600101613f42565b50909695505050505050565b60008060408385031215613f8657600080fd5b50508035926020909101359150565b60008060408385031215613fa857600080fd5b82359150613f0260208401613e34565b60008060008060808587031215613fce57600080fd5b613fd785613e97565b935060208501359250613fec60408601613e34565b9396929550929360600135925050565b6000806000806080858703121561401257600080fd5b8435935061402260208601613e34565b93969395505050506040820135916060013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561406057600080fd5b823567ffffffffffffffff8082111561407857600080fd5b818501915085601f83011261408c57600080fd5b81358181111561409e5761409e614037565b8060051b604051601f19603f830116810181811085821117156140c3576140c3614037565b6040529182528482019250838101850191888311156140e157600080fd5b938501935b82851015614106576140f785613e97565b845293850193928501926140e6565b98975050505050505050565b6000806040838503121561412557600080fd5b61412e83613e97565b9150613f0260208401613e97565b6000806000806080858703121561415257600080fd5b8435935061416260208601613e97565b9250613fec60408601613e34565b803563ffffffff81168114613e4457600080fd5b6000806040838503121561419757600080fd5b6141a083614170565b9150613f0260208401614170565b600080600080608085870312156141c457600080fd5b8435935060208501359250604085013591506141e260608601613e34565b905092959194509250565b600080600080600080600080610100898b03121561420a57600080fd5b8835975061421a60208a01613e34565b979a9799505050506040860135956060810135956080820135955060a0820135945060c0820135935060e0909101359150565b60008060006060848603121561426257600080fd5b8335925061427260208501613e97565b915061428060408501613e34565b90509250925092565b6000806000806080858703121561429f57600080fd5b6142a885613e97565b93506142b660208601613e97565b92506142c460408601613e97565b91506141e260608601613e97565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615614302576143026142d2565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261432c5761432c614307565b500490565b600082821015614343576143436142d2565b500390565b60006001600160ff1b038184138284138082168684048611161561436e5761436e6142d2565b600160ff1b600087128281168783058912161561438d5761438d6142d2565b600087129250878205871284841616156143a9576143a96142d2565b878505871281841616156143bf576143bf6142d2565b505050929093029392505050565b6000826143dc576143dc614307565b600160ff1b8214600019841416156143f6576143f66142d2565b500590565b602080825260099082015268082c4deecca40dac2f60bb1b604082015260600190565b60008219821115614431576144316142d2565b500190565b600181815b80851115614471578160001904821115614457576144576142d2565b8085161561446457918102915b93841c939080029061443b565b509250929050565b6000826144885750600161178f565b816144955750600061178f565b81600181146144ab57600281146144b5576144d1565b600191505061178f565b60ff8411156144c6576144c66142d2565b50506001821b61178f565b5060208310610133831016604e8410600b84101617156144f4575081810a61178f565b6144fe8383614436565b8060001904821115614512576145126142d2565b029392505050565b600061153060ff841683614479565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60008083128015600160ff1b850184121615614595576145956142d2565b6001600160ff1b03840183138116156145b0576145b06142d2565b50500390565b634e487b7160e01b600052603260045260246000fd5b60006000198214156145e0576145e06142d2565b5060010190565b6000602082840312156145f957600080fd5b5051919050565b6020808252600a908201526913db9b1e481d985d5b1d60b21b604082015260600190565b600063ffffffff808316818516808303821115614643576146436142d2565b01949350505050565b600080821280156001600160ff1b038490038513161561466e5761466e6142d2565b600160ff1b8390038412811615614687576146876142d2565b50500190565b60006115308383614479565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220a89c70e15c94c7fa04829dc1d0c4bd64d14fde713c865127cdad1afbc6ba400064736f6c63430008090033

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

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

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.