Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- VaultReader
- Optimization enabled
- true
- Compiler version
- v0.6.12+commit.27d51765
- Optimization runs
- 15
- Verified at
- 2023-07-05T00:52:39.986315Z
contracts/peripherals/VaultReader.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "../core/interfaces/IVault.sol"; import "../core/interfaces/IVaultPriceFeed.sol"; import "../core/interfaces/IBasePositionManager.sol"; contract VaultReader { function getVaultTokenInfoV3(address _vault, address _positionManager, address _weth, uint256 _usdkAmount, address[] memory _tokens) public view returns (uint256[] memory) { uint256 propsLength = 14; IVault vault = IVault(_vault); IVaultPriceFeed priceFeed = IVaultPriceFeed(vault.priceFeed()); IBasePositionManager positionManager = IBasePositionManager(_positionManager); uint256[] memory amounts = new uint256[](_tokens.length * propsLength); for (uint256 i = 0; i < _tokens.length; i++) { address token = _tokens[i]; if (token == address(0)) { token = _weth; } amounts[i * propsLength] = vault.poolAmounts(token); amounts[i * propsLength + 1] = vault.reservedAmounts(token); amounts[i * propsLength + 2] = vault.usdkAmounts(token); amounts[i * propsLength + 3] = vault.getRedemptionAmount(token, _usdkAmount); amounts[i * propsLength + 4] = vault.tokenWeights(token); amounts[i * propsLength + 5] = vault.bufferAmounts(token); amounts[i * propsLength + 6] = vault.maxUsdkAmounts(token); amounts[i * propsLength + 7] = vault.globalShortSizes(token); amounts[i * propsLength + 8] = positionManager.maxGlobalShortSizes(token); amounts[i * propsLength + 9] = vault.getMinPrice(token); amounts[i * propsLength + 10] = vault.getMaxPrice(token); amounts[i * propsLength + 11] = vault.guaranteedUsd(token); amounts[i * propsLength + 12] = priceFeed.getPrimaryPrice(token, false); amounts[i * propsLength + 13] = priceFeed.getPrimaryPrice(token, true); } return amounts; } function getVaultTokenInfoV4(address _vault, address _positionManager, address _weth, uint256 _usdkAmount, address[] memory _tokens) public view returns (uint256[] memory) { uint256 propsLength = 15; IVault vault = IVault(_vault); IVaultPriceFeed priceFeed = IVaultPriceFeed(vault.priceFeed()); IBasePositionManager positionManager = IBasePositionManager(_positionManager); uint256[] memory amounts = new uint256[](_tokens.length * propsLength); for (uint256 i = 0; i < _tokens.length; i++) { address token = _tokens[i]; if (token == address(0)) { token = _weth; } amounts[i * propsLength] = vault.poolAmounts(token); amounts[i * propsLength + 1] = vault.reservedAmounts(token); amounts[i * propsLength + 2] = vault.usdkAmounts(token); amounts[i * propsLength + 3] = vault.getRedemptionAmount(token, _usdkAmount); amounts[i * propsLength + 4] = vault.tokenWeights(token); amounts[i * propsLength + 5] = vault.bufferAmounts(token); amounts[i * propsLength + 6] = vault.maxUsdkAmounts(token); amounts[i * propsLength + 7] = vault.globalShortSizes(token); amounts[i * propsLength + 8] = positionManager.maxGlobalShortSizes(token); amounts[i * propsLength + 9] = positionManager.maxGlobalLongSizes(token); amounts[i * propsLength + 10] = vault.getMinPrice(token); amounts[i * propsLength + 11] = vault.getMaxPrice(token); amounts[i * propsLength + 12] = vault.guaranteedUsd(token); amounts[i * propsLength + 13] = priceFeed.getPrimaryPrice(token, false); amounts[i * propsLength + 14] = priceFeed.getPrimaryPrice(token, true); } return amounts; } }
contracts/core/interfaces/IBasePositionManager.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IBasePositionManager { function maxGlobalLongSizes(address _token) external view returns (uint256); function maxGlobalShortSizes(address _token) external view returns (uint256); }
contracts/core/interfaces/IVault.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./IVaultUtils.sol"; interface IVault { function isInitialized() external view returns (bool); function isSwapEnabled() external view returns (bool); function isLeverageEnabled() external view returns (bool); function setVaultUtils(IVaultUtils _vaultUtils) external; function setError(uint256 _errorCode, string calldata _error) external; function router() external view returns (address); function usdk() external view returns (address); function gov() external view returns (address); function whitelistedTokenCount() external view returns (uint256); function maxLeverage() external view returns (uint256); function minProfitTime() external view returns (uint256); function hasDynamicFees() external view returns (bool); function fundingInterval() external view returns (uint256); function totalTokenWeights() external view returns (uint256); function getTargetUsdkAmount(address _token) external view returns (uint256); function inManagerMode() external view returns (bool); function inPrivateLiquidationMode() external view returns (bool); function maxGasPrice() external view returns (uint256); function approvedRouters(address _account, address _router) external view returns (bool); function isLiquidator(address _account) external view returns (bool); function isManager(address _account) external view returns (bool); function minProfitBasisPoints(address _token) external view returns (uint256); function tokenBalances(address _token) external view returns (uint256); function lastFundingTimes(address _token) external view returns (uint256); function setMaxLeverage(uint256 _maxLeverage) external; function setInManagerMode(bool _inManagerMode) external; function setManager(address _manager, bool _isManager) external; function setIsSwapEnabled(bool _isSwapEnabled) external; function setIsLeverageEnabled(bool _isLeverageEnabled) external; function setMaxGasPrice(uint256 _maxGasPrice) external; function setUsdkAmount(address _token, uint256 _amount) external; function setBufferAmount(address _token, uint256 _amount) external; function setMaxGlobalShortSize(address _token, uint256 _amount) external; function setInPrivateLiquidationMode(bool _inPrivateLiquidationMode) external; function setLiquidator(address _liquidator, bool _isActive) external; function setFundingRate(uint256 _fundingInterval, uint256 _fundingRateFactor, uint256 _stableFundingRateFactor) external; function setFees( uint256 _taxBasisPoints, uint256 _stableTaxBasisPoints, uint256 _mintBurnFeeBasisPoints, uint256 _swapFeeBasisPoints, uint256 _stableSwapFeeBasisPoints, uint256 _marginFeeBasisPoints, uint256 _liquidationFeeUsd, uint256 _minProfitTime, bool _hasDynamicFees ) external; function setTokenConfig( address _token, uint256 _tokenDecimals, uint256 _redemptionBps, uint256 _minProfitBps, uint256 _maxUsdkAmount, bool _isStable, bool _isShortable ) external; function setPriceFeed(address _priceFeed) external; function withdrawFees(address _token, address _receiver) external returns (uint256); function directPoolDeposit(address _token) external; function buyUSDK(address _token, address _receiver) external returns (uint256); function sellUSDK(address _token, address _receiver) external returns (uint256); function swap(address _tokenIn, address _tokenOut, address _receiver) external returns (uint256); function increasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external; function decreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver) external returns (uint256); function validateLiquidation(address _account, address _collateralToken, address _indexToken, bool _isLong, bool _raise) external view returns (uint256, uint256); function liquidatePosition(address _account, address _collateralToken, address _indexToken, bool _isLong, address _feeReceiver) external; function tokenToUsdMin(address _token, uint256 _tokenAmount) external view returns (uint256); function priceFeed() external view returns (address); function fundingRateFactor() external view returns (uint256); function stableFundingRateFactor() external view returns (uint256); function cumulativeFundingRates(address _token) external view returns (uint256); function getNextFundingRate(address _token) external view returns (uint256); function getFeeBasisPoints(address _token, uint256 _usdkDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256); function liquidationFeeUsd() external view returns (uint256); function taxBasisPoints() external view returns (uint256); function stableTaxBasisPoints() external view returns (uint256); function mintBurnFeeBasisPoints() external view returns (uint256); function swapFeeBasisPoints() external view returns (uint256); function stableSwapFeeBasisPoints() external view returns (uint256); function marginFeeBasisPoints() external view returns (uint256); function allWhitelistedTokensLength() external view returns (uint256); function allWhitelistedTokens(uint256) external view returns (address); function whitelistedTokens(address _token) external view returns (bool); function stableTokens(address _token) external view returns (bool); function shortableTokens(address _token) external view returns (bool); function feeReserves(address _token) external view returns (uint256); function globalShortSizes(address _token) external view returns (uint256); function globalShortAveragePrices(address _token) external view returns (uint256); function maxGlobalShortSizes(address _token) external view returns (uint256); function tokenDecimals(address _token) external view returns (uint256); function tokenWeights(address _token) external view returns (uint256); function guaranteedUsd(address _token) external view returns (uint256); function poolAmounts(address _token) external view returns (uint256); function bufferAmounts(address _token) external view returns (uint256); function reservedAmounts(address _token) external view returns (uint256); function usdkAmounts(address _token) external view returns (uint256); function maxUsdkAmounts(address _token) external view returns (uint256); function getRedemptionAmount(address _token, uint256 _usdkAmount) external view returns (uint256); function getMaxPrice(address _token) external view returns (uint256); function getMinPrice(address _token) external view returns (uint256); function getDelta(address _indexToken, uint256 _size, uint256 _averagePrice, bool _isLong, uint256 _lastIncreasedTime) external view returns (bool, uint256); function getPosition(address _account, address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256, uint256, uint256, uint256, uint256, uint256, bool, uint256); }
contracts/core/interfaces/IVaultPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface IVaultPriceFeed { function adjustmentBasisPoints(address _token) external view returns (uint256); function isAdjustmentAdditive(address _token) external view returns (bool); function setAdjustment(address _token, bool _isAdditive, uint256 _adjustmentBps) external; function setIsSecondaryPriceEnabled(bool _isEnabled) external; function setSpreadBasisPoints(address _token, uint256 _spreadBasisPoints) external; function setSpreadThresholdBasisPoints(uint256 _spreadThresholdBasisPoints) external; function setFavorPrimaryPrice(bool _favorPrimaryPrice) external; function setMaxStrictPriceDeviation(uint256 _maxStrictPriceDeviation) external; function getPrice(address _token, bool _maximise, bool _includeAmmPrice, bool _useSwapPricing) external view returns (uint256); function getLatestPrimaryPrice(address _token) external view returns (uint256); function getPrimaryPrice(address _token, bool _maximise) external view returns (uint256); function setTokenConfig( address _token, bool _isStrictStable, bytes32 _oraclePriceId ) external; function setOracleNetwork( address _oracleNetwork ) external; }
contracts/core/interfaces/IVaultUtils.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IVaultUtils { function updateCumulativeFundingRate(address _collateralToken, address _indexToken) external returns (bool); function validateIncreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external view; function validateDecreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver) external view; function validateLiquidation(address _account, address _collateralToken, address _indexToken, bool _isLong, bool _raise) external view returns (uint256, uint256); function getEntryFundingRate(address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256); function getPositionFee(address _account, address _collateralToken, address _indexToken, bool _isLong, uint256 _sizeDelta) external view returns (uint256); function getFundingFee(address _account, address _collateralToken, address _indexToken, bool _isLong, uint256 _size, uint256 _entryFundingRate) external view returns (uint256); function getBuyUsdkFeeBasisPoints(address _token, uint256 _usdkAmount) external view returns (uint256); function getSellUsdkFeeBasisPoints(address _token, uint256 _usdkAmount) external view returns (uint256); function getSwapFeeBasisPoints(address _tokenIn, address _tokenOut, uint256 _usdkAmount) external view returns (uint256); function getFeeBasisPoints(address _token, uint256 _usdkDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256); }
contracts/core/interfaces/IBasePositionManager.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IBasePositionManager { function maxGlobalLongSizes(address _token) external view returns (uint256); function maxGlobalShortSizes(address _token) external view returns (uint256); }
contracts/core/interfaces/IVault.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./IVaultUtils.sol"; interface IVault { function isInitialized() external view returns (bool); function isSwapEnabled() external view returns (bool); function isLeverageEnabled() external view returns (bool); function setVaultUtils(IVaultUtils _vaultUtils) external; function setError(uint256 _errorCode, string calldata _error) external; function router() external view returns (address); function usdk() external view returns (address); function gov() external view returns (address); function whitelistedTokenCount() external view returns (uint256); function maxLeverage() external view returns (uint256); function minProfitTime() external view returns (uint256); function hasDynamicFees() external view returns (bool); function fundingInterval() external view returns (uint256); function totalTokenWeights() external view returns (uint256); function getTargetUsdkAmount(address _token) external view returns (uint256); function inManagerMode() external view returns (bool); function inPrivateLiquidationMode() external view returns (bool); function maxGasPrice() external view returns (uint256); function approvedRouters(address _account, address _router) external view returns (bool); function isLiquidator(address _account) external view returns (bool); function isManager(address _account) external view returns (bool); function minProfitBasisPoints(address _token) external view returns (uint256); function tokenBalances(address _token) external view returns (uint256); function lastFundingTimes(address _token) external view returns (uint256); function setMaxLeverage(uint256 _maxLeverage) external; function setInManagerMode(bool _inManagerMode) external; function setManager(address _manager, bool _isManager) external; function setIsSwapEnabled(bool _isSwapEnabled) external; function setIsLeverageEnabled(bool _isLeverageEnabled) external; function setMaxGasPrice(uint256 _maxGasPrice) external; function setUsdkAmount(address _token, uint256 _amount) external; function setBufferAmount(address _token, uint256 _amount) external; function setMaxGlobalShortSize(address _token, uint256 _amount) external; function setInPrivateLiquidationMode(bool _inPrivateLiquidationMode) external; function setLiquidator(address _liquidator, bool _isActive) external; function setFundingRate(uint256 _fundingInterval, uint256 _fundingRateFactor, uint256 _stableFundingRateFactor) external; function setFees( uint256 _taxBasisPoints, uint256 _stableTaxBasisPoints, uint256 _mintBurnFeeBasisPoints, uint256 _swapFeeBasisPoints, uint256 _stableSwapFeeBasisPoints, uint256 _marginFeeBasisPoints, uint256 _liquidationFeeUsd, uint256 _minProfitTime, bool _hasDynamicFees ) external; function setTokenConfig( address _token, uint256 _tokenDecimals, uint256 _redemptionBps, uint256 _minProfitBps, uint256 _maxUsdkAmount, bool _isStable, bool _isShortable ) external; function setPriceFeed(address _priceFeed) external; function withdrawFees(address _token, address _receiver) external returns (uint256); function directPoolDeposit(address _token) external; function buyUSDK(address _token, address _receiver) external returns (uint256); function sellUSDK(address _token, address _receiver) external returns (uint256); function swap(address _tokenIn, address _tokenOut, address _receiver) external returns (uint256); function increasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external; function decreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver) external returns (uint256); function validateLiquidation(address _account, address _collateralToken, address _indexToken, bool _isLong, bool _raise) external view returns (uint256, uint256); function liquidatePosition(address _account, address _collateralToken, address _indexToken, bool _isLong, address _feeReceiver) external; function tokenToUsdMin(address _token, uint256 _tokenAmount) external view returns (uint256); function priceFeed() external view returns (address); function fundingRateFactor() external view returns (uint256); function stableFundingRateFactor() external view returns (uint256); function cumulativeFundingRates(address _token) external view returns (uint256); function getNextFundingRate(address _token) external view returns (uint256); function getFeeBasisPoints(address _token, uint256 _usdkDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256); function liquidationFeeUsd() external view returns (uint256); function taxBasisPoints() external view returns (uint256); function stableTaxBasisPoints() external view returns (uint256); function mintBurnFeeBasisPoints() external view returns (uint256); function swapFeeBasisPoints() external view returns (uint256); function stableSwapFeeBasisPoints() external view returns (uint256); function marginFeeBasisPoints() external view returns (uint256); function allWhitelistedTokensLength() external view returns (uint256); function allWhitelistedTokens(uint256) external view returns (address); function whitelistedTokens(address _token) external view returns (bool); function stableTokens(address _token) external view returns (bool); function shortableTokens(address _token) external view returns (bool); function feeReserves(address _token) external view returns (uint256); function globalShortSizes(address _token) external view returns (uint256); function globalShortAveragePrices(address _token) external view returns (uint256); function maxGlobalShortSizes(address _token) external view returns (uint256); function tokenDecimals(address _token) external view returns (uint256); function tokenWeights(address _token) external view returns (uint256); function guaranteedUsd(address _token) external view returns (uint256); function poolAmounts(address _token) external view returns (uint256); function bufferAmounts(address _token) external view returns (uint256); function reservedAmounts(address _token) external view returns (uint256); function usdkAmounts(address _token) external view returns (uint256); function maxUsdkAmounts(address _token) external view returns (uint256); function getRedemptionAmount(address _token, uint256 _usdkAmount) external view returns (uint256); function getMaxPrice(address _token) external view returns (uint256); function getMinPrice(address _token) external view returns (uint256); function getDelta(address _indexToken, uint256 _size, uint256 _averagePrice, bool _isLong, uint256 _lastIncreasedTime) external view returns (bool, uint256); function getPosition(address _account, address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256, uint256, uint256, uint256, uint256, uint256, bool, uint256); }
contracts/core/interfaces/IVaultPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface IVaultPriceFeed { function adjustmentBasisPoints(address _token) external view returns (uint256); function isAdjustmentAdditive(address _token) external view returns (bool); function setAdjustment(address _token, bool _isAdditive, uint256 _adjustmentBps) external; function setIsSecondaryPriceEnabled(bool _isEnabled) external; function setSpreadBasisPoints(address _token, uint256 _spreadBasisPoints) external; function setSpreadThresholdBasisPoints(uint256 _spreadThresholdBasisPoints) external; function setFavorPrimaryPrice(bool _favorPrimaryPrice) external; function setMaxStrictPriceDeviation(uint256 _maxStrictPriceDeviation) external; function getPrice(address _token, bool _maximise, bool _includeAmmPrice, bool _useSwapPricing) external view returns (uint256); function getLatestPrimaryPrice(address _token) external view returns (uint256); function getPrimaryPrice(address _token, bool _maximise) external view returns (uint256); function setTokenConfig( address _token, bool _isStrictStable, bytes32 _oraclePriceId ) external; function setOracleNetwork( address _oracleNetwork ) external; }
contracts/core/interfaces/IVaultUtils.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IVaultUtils { function updateCumulativeFundingRate(address _collateralToken, address _indexToken) external returns (bool); function validateIncreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external view; function validateDecreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver) external view; function validateLiquidation(address _account, address _collateralToken, address _indexToken, bool _isLong, bool _raise) external view returns (uint256, uint256); function getEntryFundingRate(address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256); function getPositionFee(address _account, address _collateralToken, address _indexToken, bool _isLong, uint256 _sizeDelta) external view returns (uint256); function getFundingFee(address _account, address _collateralToken, address _indexToken, bool _isLong, uint256 _size, uint256 _entryFundingRate) external view returns (uint256); function getBuyUsdkFeeBasisPoints(address _token, uint256 _usdkAmount) external view returns (uint256); function getSellUsdkFeeBasisPoints(address _token, uint256 _usdkAmount) external view returns (uint256); function getSwapFeeBasisPoints(address _tokenIn, address _tokenOut, uint256 _usdkAmount) external view returns (uint256); function getFeeBasisPoints(address _token, uint256 _usdkDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256); }
contracts/core/interfaces/IBasePositionManager.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IBasePositionManager { function maxGlobalLongSizes(address _token) external view returns (uint256); function maxGlobalShortSizes(address _token) external view returns (uint256); }
contracts/core/interfaces/IVault.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./IVaultUtils.sol"; interface IVault { function isInitialized() external view returns (bool); function isSwapEnabled() external view returns (bool); function isLeverageEnabled() external view returns (bool); function setVaultUtils(IVaultUtils _vaultUtils) external; function setError(uint256 _errorCode, string calldata _error) external; function router() external view returns (address); function usdk() external view returns (address); function gov() external view returns (address); function whitelistedTokenCount() external view returns (uint256); function maxLeverage() external view returns (uint256); function minProfitTime() external view returns (uint256); function hasDynamicFees() external view returns (bool); function fundingInterval() external view returns (uint256); function totalTokenWeights() external view returns (uint256); function getTargetUsdkAmount(address _token) external view returns (uint256); function inManagerMode() external view returns (bool); function inPrivateLiquidationMode() external view returns (bool); function maxGasPrice() external view returns (uint256); function approvedRouters(address _account, address _router) external view returns (bool); function isLiquidator(address _account) external view returns (bool); function isManager(address _account) external view returns (bool); function minProfitBasisPoints(address _token) external view returns (uint256); function tokenBalances(address _token) external view returns (uint256); function lastFundingTimes(address _token) external view returns (uint256); function setMaxLeverage(uint256 _maxLeverage) external; function setInManagerMode(bool _inManagerMode) external; function setManager(address _manager, bool _isManager) external; function setIsSwapEnabled(bool _isSwapEnabled) external; function setIsLeverageEnabled(bool _isLeverageEnabled) external; function setMaxGasPrice(uint256 _maxGasPrice) external; function setUsdkAmount(address _token, uint256 _amount) external; function setBufferAmount(address _token, uint256 _amount) external; function setMaxGlobalShortSize(address _token, uint256 _amount) external; function setInPrivateLiquidationMode(bool _inPrivateLiquidationMode) external; function setLiquidator(address _liquidator, bool _isActive) external; function setFundingRate(uint256 _fundingInterval, uint256 _fundingRateFactor, uint256 _stableFundingRateFactor) external; function setFees( uint256 _taxBasisPoints, uint256 _stableTaxBasisPoints, uint256 _mintBurnFeeBasisPoints, uint256 _swapFeeBasisPoints, uint256 _stableSwapFeeBasisPoints, uint256 _marginFeeBasisPoints, uint256 _liquidationFeeUsd, uint256 _minProfitTime, bool _hasDynamicFees ) external; function setTokenConfig( address _token, uint256 _tokenDecimals, uint256 _redemptionBps, uint256 _minProfitBps, uint256 _maxUsdkAmount, bool _isStable, bool _isShortable ) external; function setPriceFeed(address _priceFeed) external; function withdrawFees(address _token, address _receiver) external returns (uint256); function directPoolDeposit(address _token) external; function buyUSDK(address _token, address _receiver) external returns (uint256); function sellUSDK(address _token, address _receiver) external returns (uint256); function swap(address _tokenIn, address _tokenOut, address _receiver) external returns (uint256); function increasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external; function decreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver) external returns (uint256); function validateLiquidation(address _account, address _collateralToken, address _indexToken, bool _isLong, bool _raise) external view returns (uint256, uint256); function liquidatePosition(address _account, address _collateralToken, address _indexToken, bool _isLong, address _feeReceiver) external; function tokenToUsdMin(address _token, uint256 _tokenAmount) external view returns (uint256); function priceFeed() external view returns (address); function fundingRateFactor() external view returns (uint256); function stableFundingRateFactor() external view returns (uint256); function cumulativeFundingRates(address _token) external view returns (uint256); function getNextFundingRate(address _token) external view returns (uint256); function getFeeBasisPoints(address _token, uint256 _usdkDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256); function liquidationFeeUsd() external view returns (uint256); function taxBasisPoints() external view returns (uint256); function stableTaxBasisPoints() external view returns (uint256); function mintBurnFeeBasisPoints() external view returns (uint256); function swapFeeBasisPoints() external view returns (uint256); function stableSwapFeeBasisPoints() external view returns (uint256); function marginFeeBasisPoints() external view returns (uint256); function allWhitelistedTokensLength() external view returns (uint256); function allWhitelistedTokens(uint256) external view returns (address); function whitelistedTokens(address _token) external view returns (bool); function stableTokens(address _token) external view returns (bool); function shortableTokens(address _token) external view returns (bool); function feeReserves(address _token) external view returns (uint256); function globalShortSizes(address _token) external view returns (uint256); function globalShortAveragePrices(address _token) external view returns (uint256); function maxGlobalShortSizes(address _token) external view returns (uint256); function tokenDecimals(address _token) external view returns (uint256); function tokenWeights(address _token) external view returns (uint256); function guaranteedUsd(address _token) external view returns (uint256); function poolAmounts(address _token) external view returns (uint256); function bufferAmounts(address _token) external view returns (uint256); function reservedAmounts(address _token) external view returns (uint256); function usdkAmounts(address _token) external view returns (uint256); function maxUsdkAmounts(address _token) external view returns (uint256); function getRedemptionAmount(address _token, uint256 _usdkAmount) external view returns (uint256); function getMaxPrice(address _token) external view returns (uint256); function getMinPrice(address _token) external view returns (uint256); function getDelta(address _indexToken, uint256 _size, uint256 _averagePrice, bool _isLong, uint256 _lastIncreasedTime) external view returns (bool, uint256); function getPosition(address _account, address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256, uint256, uint256, uint256, uint256, uint256, bool, uint256); }
contracts/core/interfaces/IVaultPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface IVaultPriceFeed { function adjustmentBasisPoints(address _token) external view returns (uint256); function isAdjustmentAdditive(address _token) external view returns (bool); function setAdjustment(address _token, bool _isAdditive, uint256 _adjustmentBps) external; function setIsSecondaryPriceEnabled(bool _isEnabled) external; function setSpreadBasisPoints(address _token, uint256 _spreadBasisPoints) external; function setSpreadThresholdBasisPoints(uint256 _spreadThresholdBasisPoints) external; function setFavorPrimaryPrice(bool _favorPrimaryPrice) external; function setMaxStrictPriceDeviation(uint256 _maxStrictPriceDeviation) external; function getPrice(address _token, bool _maximise, bool _includeAmmPrice, bool _useSwapPricing) external view returns (uint256); function getLatestPrimaryPrice(address _token) external view returns (uint256); function getPrimaryPrice(address _token, bool _maximise) external view returns (uint256); function setTokenConfig( address _token, bool _isStrictStable, bytes32 _oraclePriceId ) external; function setOracleNetwork( address _oracleNetwork ) external; }
contracts/core/interfaces/IVaultUtils.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IVaultUtils { function updateCumulativeFundingRate(address _collateralToken, address _indexToken) external returns (bool); function validateIncreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external view; function validateDecreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver) external view; function validateLiquidation(address _account, address _collateralToken, address _indexToken, bool _isLong, bool _raise) external view returns (uint256, uint256); function getEntryFundingRate(address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256); function getPositionFee(address _account, address _collateralToken, address _indexToken, bool _isLong, uint256 _sizeDelta) external view returns (uint256); function getFundingFee(address _account, address _collateralToken, address _indexToken, bool _isLong, uint256 _size, uint256 _entryFundingRate) external view returns (uint256); function getBuyUsdkFeeBasisPoints(address _token, uint256 _usdkAmount) external view returns (uint256); function getSellUsdkFeeBasisPoints(address _token, uint256 _usdkAmount) external view returns (uint256); function getSwapFeeBasisPoints(address _tokenIn, address _tokenOut, uint256 _usdkAmount) external view returns (uint256); function getFeeBasisPoints(address _token, uint256 _usdkDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256); }
contracts/core/interfaces/IBasePositionManager.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IBasePositionManager { function maxGlobalLongSizes(address _token) external view returns (uint256); function maxGlobalShortSizes(address _token) external view returns (uint256); }
contracts/core/interfaces/IVault.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./IVaultUtils.sol"; interface IVault { function isInitialized() external view returns (bool); function isSwapEnabled() external view returns (bool); function isLeverageEnabled() external view returns (bool); function setVaultUtils(IVaultUtils _vaultUtils) external; function setError(uint256 _errorCode, string calldata _error) external; function router() external view returns (address); function usdk() external view returns (address); function gov() external view returns (address); function whitelistedTokenCount() external view returns (uint256); function maxLeverage() external view returns (uint256); function minProfitTime() external view returns (uint256); function hasDynamicFees() external view returns (bool); function fundingInterval() external view returns (uint256); function totalTokenWeights() external view returns (uint256); function getTargetUsdkAmount(address _token) external view returns (uint256); function inManagerMode() external view returns (bool); function inPrivateLiquidationMode() external view returns (bool); function maxGasPrice() external view returns (uint256); function approvedRouters(address _account, address _router) external view returns (bool); function isLiquidator(address _account) external view returns (bool); function isManager(address _account) external view returns (bool); function minProfitBasisPoints(address _token) external view returns (uint256); function tokenBalances(address _token) external view returns (uint256); function lastFundingTimes(address _token) external view returns (uint256); function setMaxLeverage(uint256 _maxLeverage) external; function setInManagerMode(bool _inManagerMode) external; function setManager(address _manager, bool _isManager) external; function setIsSwapEnabled(bool _isSwapEnabled) external; function setIsLeverageEnabled(bool _isLeverageEnabled) external; function setMaxGasPrice(uint256 _maxGasPrice) external; function setUsdkAmount(address _token, uint256 _amount) external; function setBufferAmount(address _token, uint256 _amount) external; function setMaxGlobalShortSize(address _token, uint256 _amount) external; function setInPrivateLiquidationMode(bool _inPrivateLiquidationMode) external; function setLiquidator(address _liquidator, bool _isActive) external; function setFundingRate(uint256 _fundingInterval, uint256 _fundingRateFactor, uint256 _stableFundingRateFactor) external; function setFees( uint256 _taxBasisPoints, uint256 _stableTaxBasisPoints, uint256 _mintBurnFeeBasisPoints, uint256 _swapFeeBasisPoints, uint256 _stableSwapFeeBasisPoints, uint256 _marginFeeBasisPoints, uint256 _liquidationFeeUsd, uint256 _minProfitTime, bool _hasDynamicFees ) external; function setTokenConfig( address _token, uint256 _tokenDecimals, uint256 _redemptionBps, uint256 _minProfitBps, uint256 _maxUsdkAmount, bool _isStable, bool _isShortable ) external; function setPriceFeed(address _priceFeed) external; function withdrawFees(address _token, address _receiver) external returns (uint256); function directPoolDeposit(address _token) external; function buyUSDK(address _token, address _receiver) external returns (uint256); function sellUSDK(address _token, address _receiver) external returns (uint256); function swap(address _tokenIn, address _tokenOut, address _receiver) external returns (uint256); function increasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external; function decreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver) external returns (uint256); function validateLiquidation(address _account, address _collateralToken, address _indexToken, bool _isLong, bool _raise) external view returns (uint256, uint256); function liquidatePosition(address _account, address _collateralToken, address _indexToken, bool _isLong, address _feeReceiver) external; function tokenToUsdMin(address _token, uint256 _tokenAmount) external view returns (uint256); function priceFeed() external view returns (address); function fundingRateFactor() external view returns (uint256); function stableFundingRateFactor() external view returns (uint256); function cumulativeFundingRates(address _token) external view returns (uint256); function getNextFundingRate(address _token) external view returns (uint256); function getFeeBasisPoints(address _token, uint256 _usdkDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256); function liquidationFeeUsd() external view returns (uint256); function taxBasisPoints() external view returns (uint256); function stableTaxBasisPoints() external view returns (uint256); function mintBurnFeeBasisPoints() external view returns (uint256); function swapFeeBasisPoints() external view returns (uint256); function stableSwapFeeBasisPoints() external view returns (uint256); function marginFeeBasisPoints() external view returns (uint256); function allWhitelistedTokensLength() external view returns (uint256); function allWhitelistedTokens(uint256) external view returns (address); function whitelistedTokens(address _token) external view returns (bool); function stableTokens(address _token) external view returns (bool); function shortableTokens(address _token) external view returns (bool); function feeReserves(address _token) external view returns (uint256); function globalShortSizes(address _token) external view returns (uint256); function globalShortAveragePrices(address _token) external view returns (uint256); function maxGlobalShortSizes(address _token) external view returns (uint256); function tokenDecimals(address _token) external view returns (uint256); function tokenWeights(address _token) external view returns (uint256); function guaranteedUsd(address _token) external view returns (uint256); function poolAmounts(address _token) external view returns (uint256); function bufferAmounts(address _token) external view returns (uint256); function reservedAmounts(address _token) external view returns (uint256); function usdkAmounts(address _token) external view returns (uint256); function maxUsdkAmounts(address _token) external view returns (uint256); function getRedemptionAmount(address _token, uint256 _usdkAmount) external view returns (uint256); function getMaxPrice(address _token) external view returns (uint256); function getMinPrice(address _token) external view returns (uint256); function getDelta(address _indexToken, uint256 _size, uint256 _averagePrice, bool _isLong, uint256 _lastIncreasedTime) external view returns (bool, uint256); function getPosition(address _account, address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256, uint256, uint256, uint256, uint256, uint256, bool, uint256); }
contracts/core/interfaces/IVaultPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface IVaultPriceFeed { function adjustmentBasisPoints(address _token) external view returns (uint256); function isAdjustmentAdditive(address _token) external view returns (bool); function setAdjustment(address _token, bool _isAdditive, uint256 _adjustmentBps) external; function setIsSecondaryPriceEnabled(bool _isEnabled) external; function setSpreadBasisPoints(address _token, uint256 _spreadBasisPoints) external; function setSpreadThresholdBasisPoints(uint256 _spreadThresholdBasisPoints) external; function setFavorPrimaryPrice(bool _favorPrimaryPrice) external; function setMaxStrictPriceDeviation(uint256 _maxStrictPriceDeviation) external; function getPrice(address _token, bool _maximise, bool _includeAmmPrice, bool _useSwapPricing) external view returns (uint256); function getLatestPrimaryPrice(address _token) external view returns (uint256); function getPrimaryPrice(address _token, bool _maximise) external view returns (uint256); function setTokenConfig( address _token, bool _isStrictStable, bytes32 _oraclePriceId ) external; function setOracleNetwork( address _oracleNetwork ) external; }
contracts/core/interfaces/IVaultUtils.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IVaultUtils { function updateCumulativeFundingRate(address _collateralToken, address _indexToken) external returns (bool); function validateIncreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external view; function validateDecreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver) external view; function validateLiquidation(address _account, address _collateralToken, address _indexToken, bool _isLong, bool _raise) external view returns (uint256, uint256); function getEntryFundingRate(address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256); function getPositionFee(address _account, address _collateralToken, address _indexToken, bool _isLong, uint256 _sizeDelta) external view returns (uint256); function getFundingFee(address _account, address _collateralToken, address _indexToken, bool _isLong, uint256 _size, uint256 _entryFundingRate) external view returns (uint256); function getBuyUsdkFeeBasisPoints(address _token, uint256 _usdkAmount) external view returns (uint256); function getSellUsdkFeeBasisPoints(address _token, uint256 _usdkAmount) external view returns (uint256); function getSwapFeeBasisPoints(address _tokenIn, address _tokenOut, uint256 _usdkAmount) external view returns (uint256); function getFeeBasisPoints(address _token, uint256 _usdkDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256); }
contracts/core/interfaces/IBasePositionManager.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IBasePositionManager { function maxGlobalLongSizes(address _token) external view returns (uint256); function maxGlobalShortSizes(address _token) external view returns (uint256); }
contracts/core/interfaces/IVault.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./IVaultUtils.sol"; interface IVault { function isInitialized() external view returns (bool); function isSwapEnabled() external view returns (bool); function isLeverageEnabled() external view returns (bool); function setVaultUtils(IVaultUtils _vaultUtils) external; function setError(uint256 _errorCode, string calldata _error) external; function router() external view returns (address); function usdk() external view returns (address); function gov() external view returns (address); function whitelistedTokenCount() external view returns (uint256); function maxLeverage() external view returns (uint256); function minProfitTime() external view returns (uint256); function hasDynamicFees() external view returns (bool); function fundingInterval() external view returns (uint256); function totalTokenWeights() external view returns (uint256); function getTargetUsdkAmount(address _token) external view returns (uint256); function inManagerMode() external view returns (bool); function inPrivateLiquidationMode() external view returns (bool); function maxGasPrice() external view returns (uint256); function approvedRouters(address _account, address _router) external view returns (bool); function isLiquidator(address _account) external view returns (bool); function isManager(address _account) external view returns (bool); function minProfitBasisPoints(address _token) external view returns (uint256); function tokenBalances(address _token) external view returns (uint256); function lastFundingTimes(address _token) external view returns (uint256); function setMaxLeverage(uint256 _maxLeverage) external; function setInManagerMode(bool _inManagerMode) external; function setManager(address _manager, bool _isManager) external; function setIsSwapEnabled(bool _isSwapEnabled) external; function setIsLeverageEnabled(bool _isLeverageEnabled) external; function setMaxGasPrice(uint256 _maxGasPrice) external; function setUsdkAmount(address _token, uint256 _amount) external; function setBufferAmount(address _token, uint256 _amount) external; function setMaxGlobalShortSize(address _token, uint256 _amount) external; function setInPrivateLiquidationMode(bool _inPrivateLiquidationMode) external; function setLiquidator(address _liquidator, bool _isActive) external; function setFundingRate(uint256 _fundingInterval, uint256 _fundingRateFactor, uint256 _stableFundingRateFactor) external; function setFees( uint256 _taxBasisPoints, uint256 _stableTaxBasisPoints, uint256 _mintBurnFeeBasisPoints, uint256 _swapFeeBasisPoints, uint256 _stableSwapFeeBasisPoints, uint256 _marginFeeBasisPoints, uint256 _liquidationFeeUsd, uint256 _minProfitTime, bool _hasDynamicFees ) external; function setTokenConfig( address _token, uint256 _tokenDecimals, uint256 _redemptionBps, uint256 _minProfitBps, uint256 _maxUsdkAmount, bool _isStable, bool _isShortable ) external; function setPriceFeed(address _priceFeed) external; function withdrawFees(address _token, address _receiver) external returns (uint256); function directPoolDeposit(address _token) external; function buyUSDK(address _token, address _receiver) external returns (uint256); function sellUSDK(address _token, address _receiver) external returns (uint256); function swap(address _tokenIn, address _tokenOut, address _receiver) external returns (uint256); function increasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external; function decreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver) external returns (uint256); function validateLiquidation(address _account, address _collateralToken, address _indexToken, bool _isLong, bool _raise) external view returns (uint256, uint256); function liquidatePosition(address _account, address _collateralToken, address _indexToken, bool _isLong, address _feeReceiver) external; function tokenToUsdMin(address _token, uint256 _tokenAmount) external view returns (uint256); function priceFeed() external view returns (address); function fundingRateFactor() external view returns (uint256); function stableFundingRateFactor() external view returns (uint256); function cumulativeFundingRates(address _token) external view returns (uint256); function getNextFundingRate(address _token) external view returns (uint256); function getFeeBasisPoints(address _token, uint256 _usdkDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256); function liquidationFeeUsd() external view returns (uint256); function taxBasisPoints() external view returns (uint256); function stableTaxBasisPoints() external view returns (uint256); function mintBurnFeeBasisPoints() external view returns (uint256); function swapFeeBasisPoints() external view returns (uint256); function stableSwapFeeBasisPoints() external view returns (uint256); function marginFeeBasisPoints() external view returns (uint256); function allWhitelistedTokensLength() external view returns (uint256); function allWhitelistedTokens(uint256) external view returns (address); function whitelistedTokens(address _token) external view returns (bool); function stableTokens(address _token) external view returns (bool); function shortableTokens(address _token) external view returns (bool); function feeReserves(address _token) external view returns (uint256); function globalShortSizes(address _token) external view returns (uint256); function globalShortAveragePrices(address _token) external view returns (uint256); function maxGlobalShortSizes(address _token) external view returns (uint256); function tokenDecimals(address _token) external view returns (uint256); function tokenWeights(address _token) external view returns (uint256); function guaranteedUsd(address _token) external view returns (uint256); function poolAmounts(address _token) external view returns (uint256); function bufferAmounts(address _token) external view returns (uint256); function reservedAmounts(address _token) external view returns (uint256); function usdkAmounts(address _token) external view returns (uint256); function maxUsdkAmounts(address _token) external view returns (uint256); function getRedemptionAmount(address _token, uint256 _usdkAmount) external view returns (uint256); function getMaxPrice(address _token) external view returns (uint256); function getMinPrice(address _token) external view returns (uint256); function getDelta(address _indexToken, uint256 _size, uint256 _averagePrice, bool _isLong, uint256 _lastIncreasedTime) external view returns (bool, uint256); function getPosition(address _account, address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256, uint256, uint256, uint256, uint256, uint256, bool, uint256); }
contracts/core/interfaces/IVaultPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface IVaultPriceFeed { function adjustmentBasisPoints(address _token) external view returns (uint256); function isAdjustmentAdditive(address _token) external view returns (bool); function setAdjustment(address _token, bool _isAdditive, uint256 _adjustmentBps) external; function setIsSecondaryPriceEnabled(bool _isEnabled) external; function setSpreadBasisPoints(address _token, uint256 _spreadBasisPoints) external; function setSpreadThresholdBasisPoints(uint256 _spreadThresholdBasisPoints) external; function setFavorPrimaryPrice(bool _favorPrimaryPrice) external; function setMaxStrictPriceDeviation(uint256 _maxStrictPriceDeviation) external; function getPrice(address _token, bool _maximise, bool _includeAmmPrice, bool _useSwapPricing) external view returns (uint256); function getLatestPrimaryPrice(address _token) external view returns (uint256); function getPrimaryPrice(address _token, bool _maximise) external view returns (uint256); function setTokenConfig( address _token, bool _isStrictStable, bytes32 _oraclePriceId ) external; function setOracleNetwork( address _oracleNetwork ) external; }
contracts/core/interfaces/IVaultUtils.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IVaultUtils { function updateCumulativeFundingRate(address _collateralToken, address _indexToken) external returns (bool); function validateIncreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external view; function validateDecreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver) external view; function validateLiquidation(address _account, address _collateralToken, address _indexToken, bool _isLong, bool _raise) external view returns (uint256, uint256); function getEntryFundingRate(address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256); function getPositionFee(address _account, address _collateralToken, address _indexToken, bool _isLong, uint256 _sizeDelta) external view returns (uint256); function getFundingFee(address _account, address _collateralToken, address _indexToken, bool _isLong, uint256 _size, uint256 _entryFundingRate) external view returns (uint256); function getBuyUsdkFeeBasisPoints(address _token, uint256 _usdkAmount) external view returns (uint256); function getSellUsdkFeeBasisPoints(address _token, uint256 _usdkAmount) external view returns (uint256); function getSwapFeeBasisPoints(address _tokenIn, address _tokenOut, uint256 _usdkAmount) external view returns (uint256); function getFeeBasisPoints(address _token, uint256 _usdkDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256); }
contracts/core/interfaces/IBasePositionManager.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IBasePositionManager { function maxGlobalLongSizes(address _token) external view returns (uint256); function maxGlobalShortSizes(address _token) external view returns (uint256); }
contracts/core/interfaces/IVault.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./IVaultUtils.sol"; interface IVault { function isInitialized() external view returns (bool); function isSwapEnabled() external view returns (bool); function isLeverageEnabled() external view returns (bool); function setVaultUtils(IVaultUtils _vaultUtils) external; function setError(uint256 _errorCode, string calldata _error) external; function router() external view returns (address); function usdk() external view returns (address); function gov() external view returns (address); function whitelistedTokenCount() external view returns (uint256); function maxLeverage() external view returns (uint256); function minProfitTime() external view returns (uint256); function hasDynamicFees() external view returns (bool); function fundingInterval() external view returns (uint256); function totalTokenWeights() external view returns (uint256); function getTargetUsdkAmount(address _token) external view returns (uint256); function inManagerMode() external view returns (bool); function inPrivateLiquidationMode() external view returns (bool); function maxGasPrice() external view returns (uint256); function approvedRouters(address _account, address _router) external view returns (bool); function isLiquidator(address _account) external view returns (bool); function isManager(address _account) external view returns (bool); function minProfitBasisPoints(address _token) external view returns (uint256); function tokenBalances(address _token) external view returns (uint256); function lastFundingTimes(address _token) external view returns (uint256); function setMaxLeverage(uint256 _maxLeverage) external; function setInManagerMode(bool _inManagerMode) external; function setManager(address _manager, bool _isManager) external; function setIsSwapEnabled(bool _isSwapEnabled) external; function setIsLeverageEnabled(bool _isLeverageEnabled) external; function setMaxGasPrice(uint256 _maxGasPrice) external; function setUsdkAmount(address _token, uint256 _amount) external; function setBufferAmount(address _token, uint256 _amount) external; function setMaxGlobalShortSize(address _token, uint256 _amount) external; function setInPrivateLiquidationMode(bool _inPrivateLiquidationMode) external; function setLiquidator(address _liquidator, bool _isActive) external; function setFundingRate(uint256 _fundingInterval, uint256 _fundingRateFactor, uint256 _stableFundingRateFactor) external; function setFees( uint256 _taxBasisPoints, uint256 _stableTaxBasisPoints, uint256 _mintBurnFeeBasisPoints, uint256 _swapFeeBasisPoints, uint256 _stableSwapFeeBasisPoints, uint256 _marginFeeBasisPoints, uint256 _liquidationFeeUsd, uint256 _minProfitTime, bool _hasDynamicFees ) external; function setTokenConfig( address _token, uint256 _tokenDecimals, uint256 _redemptionBps, uint256 _minProfitBps, uint256 _maxUsdkAmount, bool _isStable, bool _isShortable ) external; function setPriceFeed(address _priceFeed) external; function withdrawFees(address _token, address _receiver) external returns (uint256); function directPoolDeposit(address _token) external; function buyUSDK(address _token, address _receiver) external returns (uint256); function sellUSDK(address _token, address _receiver) external returns (uint256); function swap(address _tokenIn, address _tokenOut, address _receiver) external returns (uint256); function increasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external; function decreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver) external returns (uint256); function validateLiquidation(address _account, address _collateralToken, address _indexToken, bool _isLong, bool _raise) external view returns (uint256, uint256); function liquidatePosition(address _account, address _collateralToken, address _indexToken, bool _isLong, address _feeReceiver) external; function tokenToUsdMin(address _token, uint256 _tokenAmount) external view returns (uint256); function priceFeed() external view returns (address); function fundingRateFactor() external view returns (uint256); function stableFundingRateFactor() external view returns (uint256); function cumulativeFundingRates(address _token) external view returns (uint256); function getNextFundingRate(address _token) external view returns (uint256); function getFeeBasisPoints(address _token, uint256 _usdkDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256); function liquidationFeeUsd() external view returns (uint256); function taxBasisPoints() external view returns (uint256); function stableTaxBasisPoints() external view returns (uint256); function mintBurnFeeBasisPoints() external view returns (uint256); function swapFeeBasisPoints() external view returns (uint256); function stableSwapFeeBasisPoints() external view returns (uint256); function marginFeeBasisPoints() external view returns (uint256); function allWhitelistedTokensLength() external view returns (uint256); function allWhitelistedTokens(uint256) external view returns (address); function whitelistedTokens(address _token) external view returns (bool); function stableTokens(address _token) external view returns (bool); function shortableTokens(address _token) external view returns (bool); function feeReserves(address _token) external view returns (uint256); function globalShortSizes(address _token) external view returns (uint256); function globalShortAveragePrices(address _token) external view returns (uint256); function maxGlobalShortSizes(address _token) external view returns (uint256); function tokenDecimals(address _token) external view returns (uint256); function tokenWeights(address _token) external view returns (uint256); function guaranteedUsd(address _token) external view returns (uint256); function poolAmounts(address _token) external view returns (uint256); function bufferAmounts(address _token) external view returns (uint256); function reservedAmounts(address _token) external view returns (uint256); function usdkAmounts(address _token) external view returns (uint256); function maxUsdkAmounts(address _token) external view returns (uint256); function getRedemptionAmount(address _token, uint256 _usdkAmount) external view returns (uint256); function getMaxPrice(address _token) external view returns (uint256); function getMinPrice(address _token) external view returns (uint256); function getDelta(address _indexToken, uint256 _size, uint256 _averagePrice, bool _isLong, uint256 _lastIncreasedTime) external view returns (bool, uint256); function getPosition(address _account, address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256, uint256, uint256, uint256, uint256, uint256, bool, uint256); }
contracts/core/interfaces/IVaultPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface IVaultPriceFeed { function adjustmentBasisPoints(address _token) external view returns (uint256); function isAdjustmentAdditive(address _token) external view returns (bool); function setAdjustment(address _token, bool _isAdditive, uint256 _adjustmentBps) external; function setIsSecondaryPriceEnabled(bool _isEnabled) external; function setSpreadBasisPoints(address _token, uint256 _spreadBasisPoints) external; function setSpreadThresholdBasisPoints(uint256 _spreadThresholdBasisPoints) external; function setFavorPrimaryPrice(bool _favorPrimaryPrice) external; function setMaxStrictPriceDeviation(uint256 _maxStrictPriceDeviation) external; function getPrice(address _token, bool _maximise, bool _includeAmmPrice, bool _useSwapPricing) external view returns (uint256); function getLatestPrimaryPrice(address _token) external view returns (uint256); function getPrimaryPrice(address _token, bool _maximise) external view returns (uint256); function setTokenConfig( address _token, bool _isStrictStable, bytes32 _oraclePriceId ) external; function setOracleNetwork( address _oracleNetwork ) external; }
contracts/core/interfaces/IVaultUtils.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IVaultUtils { function updateCumulativeFundingRate(address _collateralToken, address _indexToken) external returns (bool); function validateIncreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _sizeDelta, bool _isLong) external view; function validateDecreasePosition(address _account, address _collateralToken, address _indexToken, uint256 _collateralDelta, uint256 _sizeDelta, bool _isLong, address _receiver) external view; function validateLiquidation(address _account, address _collateralToken, address _indexToken, bool _isLong, bool _raise) external view returns (uint256, uint256); function getEntryFundingRate(address _collateralToken, address _indexToken, bool _isLong) external view returns (uint256); function getPositionFee(address _account, address _collateralToken, address _indexToken, bool _isLong, uint256 _sizeDelta) external view returns (uint256); function getFundingFee(address _account, address _collateralToken, address _indexToken, bool _isLong, uint256 _size, uint256 _entryFundingRate) external view returns (uint256); function getBuyUsdkFeeBasisPoints(address _token, uint256 _usdkAmount) external view returns (uint256); function getSellUsdkFeeBasisPoints(address _token, uint256 _usdkAmount) external view returns (uint256); function getSwapFeeBasisPoints(address _tokenIn, address _tokenOut, uint256 _usdkAmount) external view returns (uint256); function getFeeBasisPoints(address _token, uint256 _usdkDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256); }
Contract ABI
[{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"getVaultTokenInfoV3","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"address","name":"_positionManager","internalType":"address"},{"type":"address","name":"_weth","internalType":"address"},{"type":"uint256","name":"_usdkAmount","internalType":"uint256"},{"type":"address[]","name":"_tokens","internalType":"address[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"getVaultTokenInfoV4","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"address","name":"_positionManager","internalType":"address"},{"type":"address","name":"_weth","internalType":"address"},{"type":"uint256","name":"_usdkAmount","internalType":"uint256"},{"type":"address[]","name":"_tokens","internalType":"address[]"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b506115c0806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063d3f3265c1461003b578063f75e810114610154575b600080fd5b610104600480360360a081101561005157600080fd5b6001600160a01b03823581169260208101358216926040820135909216916060820135919081019060a081016080820135600160201b81111561009357600080fd5b8201836020820111156100a557600080fd5b803590602001918460208302840111600160201b831117156100c657600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061021d945050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610140578181015183820152602001610128565b505050509050019250505060405180910390f35b610104600480360360a081101561016a57600080fd5b6001600160a01b03823581169260208101358216926040820135909216916060820135919081019060a081016080820135600160201b8111156101ac57600080fd5b8201836020820111156101be57600080fd5b803590602001918460208302840111600160201b831117156101df57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610c27945050505050565b60606000600f905060008790506000816001600160a01b031663741bef1a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561026557600080fd5b505afa158015610279573d6000803e3d6000fd5b505050506040513d602081101561028f57600080fd5b50518551909150889060609085026001600160401b03811180156102b257600080fd5b506040519080825280602002602001820160405280156102dc578160200160208202803683370190505b50905060005b8751811015610c185760008882815181106102f957fe5b6020026020010151905060006001600160a01b0316816001600160a01b031614156103215750895b856001600160a01b03166352f55eed826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561036e57600080fd5b505afa158015610382573d6000803e3d6000fd5b505050506040513d602081101561039857600080fd5b505183518490848a029081106103aa57fe5b602002602001018181525050856001600160a01b031663c3c7b9e9826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561040357600080fd5b505afa158015610417573d6000803e3d6000fd5b505050506040513d602081101561042d57600080fd5b5051835184906001858b020190811061044257fe5b602002602001018181525050856001600160a01b03166366c483e9826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561049b57600080fd5b505afa1580156104af573d6000803e3d6000fd5b505050506040513d60208110156104c557600080fd5b5051835184906002858b02019081106104da57fe5b602002602001018181525050856001600160a01b0316632c668ec1828c6040518363ffffffff1660e01b815260040180836001600160a01b031681526020018281526020019250505060206040518083038186803b15801561053b57600080fd5b505afa15801561054f573d6000803e3d6000fd5b505050506040513d602081101561056557600080fd5b5051835184906003858b020190811061057a57fe5b602002602001018181525050856001600160a01b031663ab2f3ad4826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156105d357600080fd5b505afa1580156105e7573d6000803e3d6000fd5b505050506040513d60208110156105fd57600080fd5b5051835184906004858b020190811061061257fe5b602002602001018181525050856001600160a01b0316634a993ee9826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561066b57600080fd5b505afa15801561067f573d6000803e3d6000fd5b505050506040513d602081101561069557600080fd5b5051835184906005858b02019081106106aa57fe5b602002602001018181525050856001600160a01b031663b3eb635b826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561070357600080fd5b505afa158015610717573d6000803e3d6000fd5b505050506040513d602081101561072d57600080fd5b5051835184906006858b020190811061074257fe5b602002602001018181525050856001600160a01b0316638a78daa8826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561079b57600080fd5b505afa1580156107af573d6000803e3d6000fd5b505050506040513d60208110156107c557600080fd5b5051835184906007858b02019081106107da57fe5b602002602001018181525050836001600160a01b0316639698d25a826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561083357600080fd5b505afa158015610847573d6000803e3d6000fd5b505050506040513d602081101561085d57600080fd5b5051835184906008858b020190811061087257fe5b602002602001018181525050836001600160a01b0316631045c74e826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156108cb57600080fd5b505afa1580156108df573d6000803e3d6000fd5b505050506040513d60208110156108f557600080fd5b5051835184906009858b020190811061090a57fe5b602002602001018181525050856001600160a01b03166381a612d6826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561096357600080fd5b505afa158015610977573d6000803e3d6000fd5b505050506040513d602081101561098d57600080fd5b505183518490600a858b02019081106109a257fe5b602002602001018181525050856001600160a01b031663e124e6d2826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156109fb57600080fd5b505afa158015610a0f573d6000803e3d6000fd5b505050506040513d6020811015610a2557600080fd5b505183518490600b858b0201908110610a3a57fe5b602002602001018181525050856001600160a01b031663f07456ce826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610a9357600080fd5b505afa158015610aa7573d6000803e3d6000fd5b505050506040513d6020811015610abd57600080fd5b505183518490600c858b0201908110610ad257fe5b602090810291909101810191909152604080516356c8c2c160e01b81526001600160a01b038481166004830152600060248301529151918816926356c8c2c192604480840193829003018186803b158015610b2c57600080fd5b505afa158015610b40573d6000803e3d6000fd5b505050506040513d6020811015610b5657600080fd5b505183518490600d858b0201908110610b6b57fe5b602090810291909101810191909152604080516356c8c2c160e01b81526001600160a01b038481166004830152600160248301529151918816926356c8c2c192604480840193829003018186803b158015610bc557600080fd5b505afa158015610bd9573d6000803e3d6000fd5b505050506040513d6020811015610bef57600080fd5b505183518490600e858b0201908110610c0457fe5b6020908102919091010152506001016102e2565b509a9950505050505050505050565b60606000600e905060008790506000816001600160a01b031663741bef1a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c6f57600080fd5b505afa158015610c83573d6000803e3d6000fd5b505050506040513d6020811015610c9957600080fd5b50518551909150889060609085026001600160401b0381118015610cbc57600080fd5b50604051908082528060200260200182016040528015610ce6578160200160208202803683370190505b50905060005b8751811015610c18576000888281518110610d0357fe5b6020026020010151905060006001600160a01b0316816001600160a01b03161415610d2b5750895b856001600160a01b03166352f55eed826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610d7857600080fd5b505afa158015610d8c573d6000803e3d6000fd5b505050506040513d6020811015610da257600080fd5b505183518490848a02908110610db457fe5b602002602001018181525050856001600160a01b031663c3c7b9e9826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610e0d57600080fd5b505afa158015610e21573d6000803e3d6000fd5b505050506040513d6020811015610e3757600080fd5b5051835184906001858b0201908110610e4c57fe5b602002602001018181525050856001600160a01b03166366c483e9826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610ea557600080fd5b505afa158015610eb9573d6000803e3d6000fd5b505050506040513d6020811015610ecf57600080fd5b5051835184906002858b0201908110610ee457fe5b602002602001018181525050856001600160a01b0316632c668ec1828c6040518363ffffffff1660e01b815260040180836001600160a01b031681526020018281526020019250505060206040518083038186803b158015610f4557600080fd5b505afa158015610f59573d6000803e3d6000fd5b505050506040513d6020811015610f6f57600080fd5b5051835184906003858b0201908110610f8457fe5b602002602001018181525050856001600160a01b031663ab2f3ad4826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610fdd57600080fd5b505afa158015610ff1573d6000803e3d6000fd5b505050506040513d602081101561100757600080fd5b5051835184906004858b020190811061101c57fe5b602002602001018181525050856001600160a01b0316634a993ee9826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561107557600080fd5b505afa158015611089573d6000803e3d6000fd5b505050506040513d602081101561109f57600080fd5b5051835184906005858b02019081106110b457fe5b602002602001018181525050856001600160a01b031663b3eb635b826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561110d57600080fd5b505afa158015611121573d6000803e3d6000fd5b505050506040513d602081101561113757600080fd5b5051835184906006858b020190811061114c57fe5b602002602001018181525050856001600160a01b0316638a78daa8826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156111a557600080fd5b505afa1580156111b9573d6000803e3d6000fd5b505050506040513d60208110156111cf57600080fd5b5051835184906007858b02019081106111e457fe5b602002602001018181525050836001600160a01b0316639698d25a826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561123d57600080fd5b505afa158015611251573d6000803e3d6000fd5b505050506040513d602081101561126757600080fd5b5051835184906008858b020190811061127c57fe5b602002602001018181525050856001600160a01b03166381a612d6826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156112d557600080fd5b505afa1580156112e9573d6000803e3d6000fd5b505050506040513d60208110156112ff57600080fd5b5051835184906009858b020190811061131457fe5b602002602001018181525050856001600160a01b031663e124e6d2826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561136d57600080fd5b505afa158015611381573d6000803e3d6000fd5b505050506040513d602081101561139757600080fd5b505183518490600a858b02019081106113ac57fe5b602002602001018181525050856001600160a01b031663f07456ce826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561140557600080fd5b505afa158015611419573d6000803e3d6000fd5b505050506040513d602081101561142f57600080fd5b505183518490600b858b020190811061144457fe5b602090810291909101810191909152604080516356c8c2c160e01b81526001600160a01b038481166004830152600060248301529151918816926356c8c2c192604480840193829003018186803b15801561149e57600080fd5b505afa1580156114b2573d6000803e3d6000fd5b505050506040513d60208110156114c857600080fd5b505183518490600c858b02019081106114dd57fe5b602090810291909101810191909152604080516356c8c2c160e01b81526001600160a01b038481166004830152600160248301529151918816926356c8c2c192604480840193829003018186803b15801561153757600080fd5b505afa15801561154b573d6000803e3d6000fd5b505050506040513d602081101561156157600080fd5b505183518490600d858b020190811061157657fe5b602090810291909101015250600101610cec56fea2646970667358221220804e2f0a39089776323193a7aa8e69249ada118e480567223cae4ae47bf3729b64736f6c634300060c0033
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063d3f3265c1461003b578063f75e810114610154575b600080fd5b610104600480360360a081101561005157600080fd5b6001600160a01b03823581169260208101358216926040820135909216916060820135919081019060a081016080820135600160201b81111561009357600080fd5b8201836020820111156100a557600080fd5b803590602001918460208302840111600160201b831117156100c657600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061021d945050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610140578181015183820152602001610128565b505050509050019250505060405180910390f35b610104600480360360a081101561016a57600080fd5b6001600160a01b03823581169260208101358216926040820135909216916060820135919081019060a081016080820135600160201b8111156101ac57600080fd5b8201836020820111156101be57600080fd5b803590602001918460208302840111600160201b831117156101df57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610c27945050505050565b60606000600f905060008790506000816001600160a01b031663741bef1a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561026557600080fd5b505afa158015610279573d6000803e3d6000fd5b505050506040513d602081101561028f57600080fd5b50518551909150889060609085026001600160401b03811180156102b257600080fd5b506040519080825280602002602001820160405280156102dc578160200160208202803683370190505b50905060005b8751811015610c185760008882815181106102f957fe5b6020026020010151905060006001600160a01b0316816001600160a01b031614156103215750895b856001600160a01b03166352f55eed826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561036e57600080fd5b505afa158015610382573d6000803e3d6000fd5b505050506040513d602081101561039857600080fd5b505183518490848a029081106103aa57fe5b602002602001018181525050856001600160a01b031663c3c7b9e9826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561040357600080fd5b505afa158015610417573d6000803e3d6000fd5b505050506040513d602081101561042d57600080fd5b5051835184906001858b020190811061044257fe5b602002602001018181525050856001600160a01b03166366c483e9826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561049b57600080fd5b505afa1580156104af573d6000803e3d6000fd5b505050506040513d60208110156104c557600080fd5b5051835184906002858b02019081106104da57fe5b602002602001018181525050856001600160a01b0316632c668ec1828c6040518363ffffffff1660e01b815260040180836001600160a01b031681526020018281526020019250505060206040518083038186803b15801561053b57600080fd5b505afa15801561054f573d6000803e3d6000fd5b505050506040513d602081101561056557600080fd5b5051835184906003858b020190811061057a57fe5b602002602001018181525050856001600160a01b031663ab2f3ad4826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156105d357600080fd5b505afa1580156105e7573d6000803e3d6000fd5b505050506040513d60208110156105fd57600080fd5b5051835184906004858b020190811061061257fe5b602002602001018181525050856001600160a01b0316634a993ee9826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561066b57600080fd5b505afa15801561067f573d6000803e3d6000fd5b505050506040513d602081101561069557600080fd5b5051835184906005858b02019081106106aa57fe5b602002602001018181525050856001600160a01b031663b3eb635b826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561070357600080fd5b505afa158015610717573d6000803e3d6000fd5b505050506040513d602081101561072d57600080fd5b5051835184906006858b020190811061074257fe5b602002602001018181525050856001600160a01b0316638a78daa8826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561079b57600080fd5b505afa1580156107af573d6000803e3d6000fd5b505050506040513d60208110156107c557600080fd5b5051835184906007858b02019081106107da57fe5b602002602001018181525050836001600160a01b0316639698d25a826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561083357600080fd5b505afa158015610847573d6000803e3d6000fd5b505050506040513d602081101561085d57600080fd5b5051835184906008858b020190811061087257fe5b602002602001018181525050836001600160a01b0316631045c74e826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156108cb57600080fd5b505afa1580156108df573d6000803e3d6000fd5b505050506040513d60208110156108f557600080fd5b5051835184906009858b020190811061090a57fe5b602002602001018181525050856001600160a01b03166381a612d6826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561096357600080fd5b505afa158015610977573d6000803e3d6000fd5b505050506040513d602081101561098d57600080fd5b505183518490600a858b02019081106109a257fe5b602002602001018181525050856001600160a01b031663e124e6d2826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156109fb57600080fd5b505afa158015610a0f573d6000803e3d6000fd5b505050506040513d6020811015610a2557600080fd5b505183518490600b858b0201908110610a3a57fe5b602002602001018181525050856001600160a01b031663f07456ce826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610a9357600080fd5b505afa158015610aa7573d6000803e3d6000fd5b505050506040513d6020811015610abd57600080fd5b505183518490600c858b0201908110610ad257fe5b602090810291909101810191909152604080516356c8c2c160e01b81526001600160a01b038481166004830152600060248301529151918816926356c8c2c192604480840193829003018186803b158015610b2c57600080fd5b505afa158015610b40573d6000803e3d6000fd5b505050506040513d6020811015610b5657600080fd5b505183518490600d858b0201908110610b6b57fe5b602090810291909101810191909152604080516356c8c2c160e01b81526001600160a01b038481166004830152600160248301529151918816926356c8c2c192604480840193829003018186803b158015610bc557600080fd5b505afa158015610bd9573d6000803e3d6000fd5b505050506040513d6020811015610bef57600080fd5b505183518490600e858b0201908110610c0457fe5b6020908102919091010152506001016102e2565b509a9950505050505050505050565b60606000600e905060008790506000816001600160a01b031663741bef1a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c6f57600080fd5b505afa158015610c83573d6000803e3d6000fd5b505050506040513d6020811015610c9957600080fd5b50518551909150889060609085026001600160401b0381118015610cbc57600080fd5b50604051908082528060200260200182016040528015610ce6578160200160208202803683370190505b50905060005b8751811015610c18576000888281518110610d0357fe5b6020026020010151905060006001600160a01b0316816001600160a01b03161415610d2b5750895b856001600160a01b03166352f55eed826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610d7857600080fd5b505afa158015610d8c573d6000803e3d6000fd5b505050506040513d6020811015610da257600080fd5b505183518490848a02908110610db457fe5b602002602001018181525050856001600160a01b031663c3c7b9e9826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610e0d57600080fd5b505afa158015610e21573d6000803e3d6000fd5b505050506040513d6020811015610e3757600080fd5b5051835184906001858b0201908110610e4c57fe5b602002602001018181525050856001600160a01b03166366c483e9826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610ea557600080fd5b505afa158015610eb9573d6000803e3d6000fd5b505050506040513d6020811015610ecf57600080fd5b5051835184906002858b0201908110610ee457fe5b602002602001018181525050856001600160a01b0316632c668ec1828c6040518363ffffffff1660e01b815260040180836001600160a01b031681526020018281526020019250505060206040518083038186803b158015610f4557600080fd5b505afa158015610f59573d6000803e3d6000fd5b505050506040513d6020811015610f6f57600080fd5b5051835184906003858b0201908110610f8457fe5b602002602001018181525050856001600160a01b031663ab2f3ad4826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610fdd57600080fd5b505afa158015610ff1573d6000803e3d6000fd5b505050506040513d602081101561100757600080fd5b5051835184906004858b020190811061101c57fe5b602002602001018181525050856001600160a01b0316634a993ee9826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561107557600080fd5b505afa158015611089573d6000803e3d6000fd5b505050506040513d602081101561109f57600080fd5b5051835184906005858b02019081106110b457fe5b602002602001018181525050856001600160a01b031663b3eb635b826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561110d57600080fd5b505afa158015611121573d6000803e3d6000fd5b505050506040513d602081101561113757600080fd5b5051835184906006858b020190811061114c57fe5b602002602001018181525050856001600160a01b0316638a78daa8826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156111a557600080fd5b505afa1580156111b9573d6000803e3d6000fd5b505050506040513d60208110156111cf57600080fd5b5051835184906007858b02019081106111e457fe5b602002602001018181525050836001600160a01b0316639698d25a826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561123d57600080fd5b505afa158015611251573d6000803e3d6000fd5b505050506040513d602081101561126757600080fd5b5051835184906008858b020190811061127c57fe5b602002602001018181525050856001600160a01b03166381a612d6826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156112d557600080fd5b505afa1580156112e9573d6000803e3d6000fd5b505050506040513d60208110156112ff57600080fd5b5051835184906009858b020190811061131457fe5b602002602001018181525050856001600160a01b031663e124e6d2826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561136d57600080fd5b505afa158015611381573d6000803e3d6000fd5b505050506040513d602081101561139757600080fd5b505183518490600a858b02019081106113ac57fe5b602002602001018181525050856001600160a01b031663f07456ce826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561140557600080fd5b505afa158015611419573d6000803e3d6000fd5b505050506040513d602081101561142f57600080fd5b505183518490600b858b020190811061144457fe5b602090810291909101810191909152604080516356c8c2c160e01b81526001600160a01b038481166004830152600060248301529151918816926356c8c2c192604480840193829003018186803b15801561149e57600080fd5b505afa1580156114b2573d6000803e3d6000fd5b505050506040513d60208110156114c857600080fd5b505183518490600c858b02019081106114dd57fe5b602090810291909101810191909152604080516356c8c2c160e01b81526001600160a01b038481166004830152600160248301529151918816926356c8c2c192604480840193829003018186803b15801561153757600080fd5b505afa15801561154b573d6000803e3d6000fd5b505050506040513d602081101561156157600080fd5b505183518490600d858b020190811061157657fe5b602090810291909101015250600101610cec56fea2646970667358221220804e2f0a39089776323193a7aa8e69249ada118e480567223cae4ae47bf3729b64736f6c634300060c0033