Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- Timelock
- Optimization enabled
- true
- Compiler version
- v0.6.12+commit.27d51765
- Optimization runs
- 15
- Verified at
- 2023-07-05T00:48:42.302496Z
Constructor Arguments
000000000000000000000000778f79b19ccd7effc0a7b3dbcb678b4d12f3e0ca000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005fec080a6e29add8752615bbe399f4db033b90a00000000000000000000000005fec080a6e29add8752615bbe399f4db033b90a0000000000000000000000009a31dde84c61062fd799a13a00cc07e1b6fa8013000000000000000000000000b46cd0a0aa278628e430a6ced38ae4f88036a854000000000000000000000000000000000000000000084595161401484a000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000001f4
Arg [0] (address) : 0x778f79b19ccd7effc0a7b3dbcb678b4d12f3e0ca
Arg [1] (uint256) : 0
Arg [2] (address) : 0x05fec080a6e29add8752615bbe399f4db033b90a
Arg [3] (address) : 0x05fec080a6e29add8752615bbe399f4db033b90a
Arg [4] (address) : 0x9a31dde84c61062fd799a13a00cc07e1b6fa8013
Arg [5] (address) : 0xb46cd0a0aa278628e430a6ced38ae4f88036a854
Arg [6] (uint256) : 10000000000000000000000000
Arg [7] (uint256) : 10
Arg [8] (uint256) : 500
contracts/peripherals/Timelock.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./interfaces/ITimelockTarget.sol"; import "./interfaces/ITimelock.sol"; import "./interfaces/IHandlerTarget.sol"; import "../access/interfaces/IAdmin.sol"; import "../core/interfaces/IVault.sol"; import "../core/interfaces/IExecutionFee.sol"; import "../core/interfaces/IVaultUtils.sol"; import "../core/interfaces/IKlpManager.sol"; import "../referrals/interfaces/IReferralStorage.sol"; import "../tokens/interfaces/IYieldToken.sol"; import "../tokens/interfaces/IBaseToken.sol"; import "../tokens/interfaces/IMintable.sol"; import "../tokens/interfaces/IUSDK.sol"; import "../staking/interfaces/IVester.sol"; import "../staking/interfaces/IRewardRouterV2.sol"; import "../libraries/math/SafeMath.sol"; import "../libraries/token/IERC20.sol"; contract Timelock is ITimelock { using SafeMath for uint256; uint256 public constant PRICE_PRECISION = 10 ** 30; uint256 public constant MAX_BUFFER = 5 days; uint256 public constant MAX_FUNDING_RATE_FACTOR = 200; // 0.02% uint256 public constant MAX_LEVERAGE_VALIDATION = 50 * 10000; // 50x uint256 public buffer; address public admin; address public tokenManager; address public mintReceiver; address public klpManager; address public rewardRouter; uint256 public maxTokenSupply; uint256 public marginFeeBasisPoints; uint256 public maxMarginFeeBasisPoints; bool public shouldToggleIsLeverageEnabled; mapping (bytes32 => uint256) public pendingActions; mapping (address => bool) public isHandler; mapping (address => bool) public isKeeper; event SignalPendingAction(bytes32 action); event SignalApprove(address token, address spender, uint256 amount, bytes32 action); event SignalWithdrawToken(address target, address token, address receiver, uint256 amount, bytes32 action); event SignalMint(address token, address receiver, uint256 amount, bytes32 action); event SignalSetGov(address target, address gov, bytes32 action); event SignalSetHandler(address target, address handler, bool isActive, bytes32 action); event SignalSetPriceFeed(address vault, address priceFeed, bytes32 action); event SignalRedeemUsdk(address vault, address token, uint256 amount); event SignalVaultSetTokenConfig( address vault, address token, uint256 tokenDecimals, uint256 tokenWeight, uint256 minProfitBps, uint256 maxUsdkAmount, bool isStable, bool isShortable ); event ClearAction(bytes32 action); modifier onlyAdmin() { require(msg.sender == admin, "Timelock: forbidden"); _; } modifier onlyHandlerAndAbove() { require(msg.sender == admin || isHandler[msg.sender], "Timelock: forbidden"); _; } modifier onlyKeeperAndAbove() { require(msg.sender == admin || isHandler[msg.sender] || isKeeper[msg.sender], "Timelock: forbidden"); _; } modifier onlyTokenManager() { require(msg.sender == tokenManager, "Timelock: forbidden"); _; } constructor( address _admin, uint256 _buffer, address _tokenManager, address _mintReceiver, address _klpManager, address _rewardRouter, uint256 _maxTokenSupply, uint256 _marginFeeBasisPoints, uint256 _maxMarginFeeBasisPoints ) public { require(_buffer <= MAX_BUFFER, "Timelock: invalid _buffer"); admin = _admin; buffer = _buffer; tokenManager = _tokenManager; mintReceiver = _mintReceiver; klpManager = _klpManager; rewardRouter = _rewardRouter; maxTokenSupply = _maxTokenSupply; marginFeeBasisPoints = _marginFeeBasisPoints; maxMarginFeeBasisPoints = _maxMarginFeeBasisPoints; } function setAdmin(address _admin) external override onlyTokenManager { admin = _admin; } function setExternalAdmin(address _target, address _admin) external onlyAdmin { require(_target != address(this), "Timelock: invalid _target"); IAdmin(_target).setAdmin(_admin); } function setContractHandler(address _handler, bool _isActive) external onlyAdmin { isHandler[_handler] = _isActive; } function initKlpManager() external onlyAdmin { IKlpManager _klpManager = IKlpManager(klpManager); IMintable klp = IMintable(_klpManager.klp()); klp.setMinter(klpManager, true); IUSDK usdk = IUSDK(_klpManager.usdk()); usdk.addVault(klpManager); IVault vault = _klpManager.vault(); vault.setManager(klpManager, true); } function initRewardRouter() external onlyAdmin { IRewardRouterV2 _rewardRouter = IRewardRouterV2(rewardRouter); IHandlerTarget(_rewardRouter.feeKlpTracker()).setHandler(rewardRouter, true); IHandlerTarget(_rewardRouter.stakedKlpTracker()).setHandler(rewardRouter, true); IHandlerTarget(klpManager).setHandler(rewardRouter, true); } function setKeeper(address _keeper, bool _isActive) external onlyAdmin { isKeeper[_keeper] = _isActive; } function setBuffer(uint256 _buffer) external onlyAdmin { require(_buffer <= MAX_BUFFER, "Timelock: invalid _buffer"); require(_buffer > buffer, "Timelock: buffer cannot be decreased"); buffer = _buffer; } function setMaxLeverage(address _vault, uint256 _maxLeverage) external onlyAdmin { require(_maxLeverage >= MAX_LEVERAGE_VALIDATION, "Timelock: invalid _maxLeverage"); IVault(_vault).setMaxLeverage(_maxLeverage); } function setFundingRate(address _vault, uint256 _fundingInterval, uint256 _fundingRateFactor, uint256 _stableFundingRateFactor) external onlyKeeperAndAbove { require(_fundingRateFactor < MAX_FUNDING_RATE_FACTOR, "Timelock: invalid _fundingRateFactor"); require(_stableFundingRateFactor < MAX_FUNDING_RATE_FACTOR, "Timelock: invalid _stableFundingRateFactor"); IVault(_vault).setFundingRate(_fundingInterval, _fundingRateFactor, _stableFundingRateFactor); } function setShouldToggleIsLeverageEnabled(bool _shouldToggleIsLeverageEnabled) external onlyHandlerAndAbove { shouldToggleIsLeverageEnabled = _shouldToggleIsLeverageEnabled; } function setMarginFeeBasisPoints(uint256 _marginFeeBasisPoints, uint256 _maxMarginFeeBasisPoints) external onlyHandlerAndAbove { marginFeeBasisPoints = _marginFeeBasisPoints; maxMarginFeeBasisPoints = _maxMarginFeeBasisPoints; } function setSwapFees( address _vault, uint256 _taxBasisPoints, uint256 _stableTaxBasisPoints, uint256 _mintBurnFeeBasisPoints, uint256 _swapFeeBasisPoints, uint256 _stableSwapFeeBasisPoints ) external onlyKeeperAndAbove { IVault vault = IVault(_vault); vault.setFees( _taxBasisPoints, _stableTaxBasisPoints, _mintBurnFeeBasisPoints, _swapFeeBasisPoints, _stableSwapFeeBasisPoints, maxMarginFeeBasisPoints, vault.liquidationFeeUsd(), vault.minProfitTime(), vault.hasDynamicFees() ); } // assign _marginFeeBasisPoints to this.marginFeeBasisPoints // because enableLeverage would update Vault.marginFeeBasisPoints to this.marginFeeBasisPoints // and disableLeverage would reset the Vault.marginFeeBasisPoints to this.maxMarginFeeBasisPoints function setFees( address _vault, uint256 _taxBasisPoints, uint256 _stableTaxBasisPoints, uint256 _mintBurnFeeBasisPoints, uint256 _swapFeeBasisPoints, uint256 _stableSwapFeeBasisPoints, uint256 _marginFeeBasisPoints, uint256 _liquidationFeeUsd, uint256 _minProfitTime, bool _hasDynamicFees ) external onlyKeeperAndAbove { marginFeeBasisPoints = _marginFeeBasisPoints; IVault(_vault).setFees( _taxBasisPoints, _stableTaxBasisPoints, _mintBurnFeeBasisPoints, _swapFeeBasisPoints, _stableSwapFeeBasisPoints, maxMarginFeeBasisPoints, _liquidationFeeUsd, _minProfitTime, _hasDynamicFees ); } function enableLeverage(address _vault) external override onlyHandlerAndAbove { IVault vault = IVault(_vault); if (shouldToggleIsLeverageEnabled) { vault.setIsLeverageEnabled(true); } vault.setFees( vault.taxBasisPoints(), vault.stableTaxBasisPoints(), vault.mintBurnFeeBasisPoints(), vault.swapFeeBasisPoints(), vault.stableSwapFeeBasisPoints(), marginFeeBasisPoints, vault.liquidationFeeUsd(), vault.minProfitTime(), vault.hasDynamicFees() ); } function disableLeverage(address _vault) external override onlyHandlerAndAbove { IVault vault = IVault(_vault); if (shouldToggleIsLeverageEnabled) { vault.setIsLeverageEnabled(false); } vault.setFees( vault.taxBasisPoints(), vault.stableTaxBasisPoints(), vault.mintBurnFeeBasisPoints(), vault.swapFeeBasisPoints(), vault.stableSwapFeeBasisPoints(), maxMarginFeeBasisPoints, // marginFeeBasisPoints vault.liquidationFeeUsd(), vault.minProfitTime(), vault.hasDynamicFees() ); } function setIsLeverageEnabled(address _vault, bool _isLeverageEnabled) external override onlyHandlerAndAbove { IVault(_vault).setIsLeverageEnabled(_isLeverageEnabled); } function setTokenConfig( address _vault, address _token, uint256 _tokenWeight, uint256 _minProfitBps, uint256 _maxUsdkAmount, uint256 _bufferAmount, uint256 _usdkAmount ) external onlyKeeperAndAbove { require(_minProfitBps <= 500, "Timelock: invalid _minProfitBps"); IVault vault = IVault(_vault); require(vault.whitelistedTokens(_token), "Timelock: token not yet whitelisted"); uint256 tokenDecimals = vault.tokenDecimals(_token); bool isStable = vault.stableTokens(_token); bool isShortable = vault.shortableTokens(_token); IVault(_vault).setTokenConfig( _token, tokenDecimals, _tokenWeight, _minProfitBps, _maxUsdkAmount, isStable, isShortable ); IVault(_vault).setBufferAmount(_token, _bufferAmount); IVault(_vault).setUsdkAmount(_token, _usdkAmount); } function setUsdkAmounts(address _vault, address[] memory _tokens, uint256[] memory _usdkAmounts) external onlyKeeperAndAbove { for (uint256 i = 0; i < _tokens.length; i++) { IVault(_vault).setUsdkAmount(_tokens[i], _usdkAmounts[i]); } } function updateUsdkSupply(uint256 usdkAmount) external onlyKeeperAndAbove { address usdk = IKlpManager(klpManager).usdk(); uint256 balance = IERC20(usdk).balanceOf(klpManager); IUSDK(usdk).addVault(address(this)); if (usdkAmount > balance) { uint256 mintAmount = usdkAmount.sub(balance); IUSDK(usdk).mint(klpManager, mintAmount); } else { uint256 burnAmount = balance.sub(usdkAmount); IUSDK(usdk).burn(klpManager, burnAmount); } IUSDK(usdk).removeVault(address(this)); } function setShortsTrackerAveragePriceWeight(uint256 _shortsTrackerAveragePriceWeight) external onlyAdmin { IKlpManager(klpManager).setShortsTrackerAveragePriceWeight(_shortsTrackerAveragePriceWeight); } function setKlpCooldownDuration(uint256 _cooldownDuration) external onlyAdmin { require(_cooldownDuration < 2 hours, "Timelock: invalid _cooldownDuration"); IKlpManager(klpManager).setCooldownDuration(_cooldownDuration); } function setMaxGlobalShortSize(address _vault, address _token, uint256 _amount) external onlyAdmin { IVault(_vault).setMaxGlobalShortSize(_token, _amount); } function removeAdmin(address _token, address _account) external onlyAdmin { IYieldToken(_token).removeAdmin(_account); } function setIsSwapEnabled(address _vault, bool _isSwapEnabled) external onlyKeeperAndAbove { IVault(_vault).setIsSwapEnabled(_isSwapEnabled); } function setTier(address _referralStorage, uint256 _tierId, uint256 _totalRebate, uint256 _discountShare) external onlyKeeperAndAbove { IReferralStorage(_referralStorage).setTier(_tierId, _totalRebate, _discountShare); } function setReferrerTier(address _referralStorage, address _referrer, uint256 _tierId) external onlyKeeperAndAbove { IReferralStorage(_referralStorage).setReferrerTier(_referrer, _tierId); } function govSetCodeOwner(address _referralStorage, bytes32 _code, address _newAccount) external onlyKeeperAndAbove { IReferralStorage(_referralStorage).govSetCodeOwner(_code, _newAccount); } function setVaultUtils(address _vault, IVaultUtils _vaultUtils) external onlyAdmin { IVault(_vault).setVaultUtils(_vaultUtils); } function setMaxGasPrice(address _vault, uint256 _maxGasPrice) external onlyAdmin { require(_maxGasPrice > 5000000000, "Invalid _maxGasPrice"); IVault(_vault).setMaxGasPrice(_maxGasPrice); } function withdrawFees(address _vault, address _token, address _receiver) external onlyAdmin { IVault(_vault).withdrawFees(_token, _receiver); } function batchWithdrawFees(address _vault, address[] memory _tokens) external onlyKeeperAndAbove { for (uint256 i = 0; i < _tokens.length; i++) { IVault(_vault).withdrawFees(_tokens[i], admin); } } function setInPrivateLiquidationMode(address _vault, bool _inPrivateLiquidationMode) external onlyAdmin { IVault(_vault).setInPrivateLiquidationMode(_inPrivateLiquidationMode); } function setLiquidator(address _vault, address _liquidator, bool _isActive) external onlyAdmin { IVault(_vault).setLiquidator(_liquidator, _isActive); } function setInPrivateTransferMode(address _token, bool _inPrivateTransferMode) external onlyAdmin { IBaseToken(_token).setInPrivateTransferMode(_inPrivateTransferMode); } function setMinExecutionFee(address _controller, uint256 _minExecutionFee) external onlyAdmin { IExecutionFee(_controller).setMinExecutionFee(_minExecutionFee); } function batchSetBonusRewards(address _vester, address[] memory _accounts, uint256[] memory _amounts) external onlyKeeperAndAbove { require(_accounts.length == _amounts.length, "Timelock: invalid lengths"); IHandlerTarget(_vester).setHandler(address(this), true); for (uint256 i = 0; i < _accounts.length; i++) { address account = _accounts[i]; uint256 amount = _amounts[i]; IVester(_vester).setBonusRewards(account, amount); } IHandlerTarget(_vester).setHandler(address(this), false); } function transferIn(address _sender, address _token, uint256 _amount) external onlyAdmin { IERC20(_token).transferFrom(_sender, address(this), _amount); } function signalApprove(address _token, address _spender, uint256 _amount) external onlyAdmin { bytes32 action = keccak256(abi.encodePacked("approve", _token, _spender, _amount)); _setPendingAction(action); emit SignalApprove(_token, _spender, _amount, action); } function approve(address _token, address _spender, uint256 _amount) external onlyAdmin { bytes32 action = keccak256(abi.encodePacked("approve", _token, _spender, _amount)); _validateAction(action); _clearAction(action); IERC20(_token).approve(_spender, _amount); } function signalWithdrawToken(address _target, address _token, address _receiver, uint256 _amount) external onlyAdmin { bytes32 action = keccak256(abi.encodePacked("withdrawToken", _target, _token, _receiver, _amount)); _setPendingAction(action); emit SignalWithdrawToken(_target, _token, _receiver, _amount, action); } function withdrawToken(address _target, address _token, address _receiver, uint256 _amount) external onlyAdmin { bytes32 action = keccak256(abi.encodePacked("withdrawToken", _target, _token, _receiver, _amount)); _validateAction(action); _clearAction(action); IBaseToken(_target).withdrawToken(_token, _receiver, _amount); } function signalMint(address _token, address _receiver, uint256 _amount) external onlyAdmin { bytes32 action = keccak256(abi.encodePacked("mint", _token, _receiver, _amount)); _setPendingAction(action); emit SignalMint(_token, _receiver, _amount, action); } function processMint(address _token, address _receiver, uint256 _amount) external onlyAdmin { bytes32 action = keccak256(abi.encodePacked("mint", _token, _receiver, _amount)); _validateAction(action); _clearAction(action); _mint(_token, _receiver, _amount); } function signalSetGov(address _target, address _gov) external override onlyAdmin { bytes32 action = keccak256(abi.encodePacked("setGov", _target, _gov)); _setPendingAction(action); emit SignalSetGov(_target, _gov, action); } function setGov(address _target, address _gov) external onlyAdmin { bytes32 action = keccak256(abi.encodePacked("setGov", _target, _gov)); _validateAction(action); _clearAction(action); ITimelockTarget(_target).setGov(_gov); } function signalSetHandler(address _target, address _handler, bool _isActive) external onlyAdmin { bytes32 action = keccak256(abi.encodePacked("setHandler", _target, _handler, _isActive)); _setPendingAction(action); emit SignalSetHandler(_target, _handler, _isActive, action); } function setHandler(address _target, address _handler, bool _isActive) external onlyAdmin { bytes32 action = keccak256(abi.encodePacked("setHandler", _target, _handler, _isActive)); _validateAction(action); _clearAction(action); IHandlerTarget(_target).setHandler(_handler, _isActive); } function signalSetPriceFeed(address _vault, address _priceFeed) external onlyAdmin { bytes32 action = keccak256(abi.encodePacked("setPriceFeed", _vault, _priceFeed)); _setPendingAction(action); emit SignalSetPriceFeed(_vault, _priceFeed, action); } function setPriceFeed(address _vault, address _priceFeed) external onlyAdmin { bytes32 action = keccak256(abi.encodePacked("setPriceFeed", _vault, _priceFeed)); _validateAction(action); _clearAction(action); IVault(_vault).setPriceFeed(_priceFeed); } function signalRedeemUsdk(address _vault, address _token, uint256 _amount) external onlyAdmin { bytes32 action = keccak256(abi.encodePacked("redeemUsdk", _vault, _token, _amount)); _setPendingAction(action); emit SignalRedeemUsdk(_vault, _token, _amount); } function redeemUsdk(address _vault, address _token, uint256 _amount) external onlyAdmin { bytes32 action = keccak256(abi.encodePacked("redeemUsdk", _vault, _token, _amount)); _validateAction(action); _clearAction(action); address usdk = IVault(_vault).usdk(); IVault(_vault).setManager(address(this), true); IUSDK(usdk).addVault(address(this)); IUSDK(usdk).mint(address(this), _amount); IERC20(usdk).transfer(address(_vault), _amount); IVault(_vault).sellUSDK(_token, mintReceiver); IVault(_vault).setManager(address(this), false); IUSDK(usdk).removeVault(address(this)); } function signalVaultSetTokenConfig( address _vault, address _token, uint256 _tokenDecimals, uint256 _tokenWeight, uint256 _minProfitBps, uint256 _maxUsdkAmount, bool _isStable, bool _isShortable ) external onlyAdmin { bytes32 action = keccak256(abi.encodePacked( "vaultSetTokenConfig", _vault, _token, _tokenDecimals, _tokenWeight, _minProfitBps, _maxUsdkAmount, _isStable, _isShortable )); _setPendingAction(action); emit SignalVaultSetTokenConfig( _vault, _token, _tokenDecimals, _tokenWeight, _minProfitBps, _maxUsdkAmount, _isStable, _isShortable ); } function vaultSetTokenConfig( address _vault, address _token, uint256 _tokenDecimals, uint256 _tokenWeight, uint256 _minProfitBps, uint256 _maxUsdkAmount, bool _isStable, bool _isShortable ) external onlyAdmin { bytes32 action = keccak256(abi.encodePacked( "vaultSetTokenConfig", _vault, _token, _tokenDecimals, _tokenWeight, _minProfitBps, _maxUsdkAmount, _isStable, _isShortable )); _validateAction(action); _clearAction(action); IVault(_vault).setTokenConfig( _token, _tokenDecimals, _tokenWeight, _minProfitBps, _maxUsdkAmount, _isStable, _isShortable ); } function cancelAction(bytes32 _action) external onlyAdmin { _clearAction(_action); } function _mint(address _token, address _receiver, uint256 _amount) private { IMintable mintable = IMintable(_token); if (!mintable.isMinter(address(this))) { mintable.setMinter(address(this), true); } mintable.mint(_receiver, _amount); require(IERC20(_token).totalSupply() <= maxTokenSupply, "Timelock: maxTokenSupply exceeded"); } function _setPendingAction(bytes32 _action) private { require(pendingActions[_action] == 0, "Timelock: action already signalled"); pendingActions[_action] = block.timestamp.add(buffer); emit SignalPendingAction(_action); } function _validateAction(bytes32 _action) private view { require(pendingActions[_action] != 0, "Timelock: action not signalled"); require(pendingActions[_action] < block.timestamp, "Timelock: action time not yet passed"); } function _clearAction(bytes32 _action) private { require(pendingActions[_action] != 0, "Timelock: invalid _action"); delete pendingActions[_action]; emit ClearAction(_action); } }
contracts/peripherals/interfaces/ITimelock.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface ITimelock { function setAdmin(address _admin) external; function enableLeverage(address _vault) external; function disableLeverage(address _vault) external; function setIsLeverageEnabled(address _vault, bool _isLeverageEnabled) external; function signalSetGov(address _target, address _gov) external; }
contracts/peripherals/interfaces/ITimelockTarget.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface ITimelockTarget { function setGov(address _gov) external; function withdrawToken(address _token, address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IBaseToken.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IBaseToken { function totalStaked() external view returns (uint256); function stakedBalance(address _account) external view returns (uint256); function removeAdmin(address _account) external; function setInPrivateTransferMode(bool _inPrivateTransferMode) external; function withdrawToken(address _token, address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IMintable.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IMintable { function isMinter(address _account) external returns (bool); function setMinter(address _minter, bool _isActive) external; function mint(address _account, uint256 _amount) external; function burn(address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IUSDK.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IUSDK { function addVault(address _vault) external; function removeVault(address _vault) external; function mint(address _account, uint256 _amount) external; function burn(address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IYieldToken.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IYieldToken { function totalStaked() external view returns (uint256); function stakedBalance(address _account) external view returns (uint256); function removeAdmin(address _account) external; }
contracts/access/interfaces/IAdmin.sol
//SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IAdmin { function setAdmin(address _admin) external; }
contracts/core/interfaces/IExecutionFee.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IExecutionFee { function setMinExecutionFee(uint256 _minExecutionFee) external; }
contracts/peripherals/interfaces/IHandlerTarget.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IHandlerTarget { function isHandler(address _account) external returns (bool); function setHandler(address _handler, bool _isActive) external; }
contracts/core/interfaces/IKlpManager.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./IVault.sol"; interface IKlpManager { function klp() external view returns (address); function usdk() external view returns (address); function vault() external view returns (IVault); function cooldownDuration() external returns (uint256); function getAumInUsdk(bool maximise) external view returns (uint256); function lastAddedAt(address _account) external returns (uint256); function addLiquidity(address _token, uint256 _amount, uint256 _minUsdk, uint256 _minKlp) external returns (uint256); function addLiquidityForAccount(address _fundingAccount, address _account, address _token, uint256 _amount, uint256 _minUsdk, uint256 _minKlp) external returns (uint256); function removeLiquidity(address _tokenOut, uint256 _klpAmount, uint256 _minOut, address _receiver) external returns (uint256); function removeLiquidityForAccount(address _account, address _tokenOut, uint256 _klpAmount, uint256 _minOut, address _receiver) external returns (uint256); function setShortsTrackerAveragePriceWeight(uint256 _shortsTrackerAveragePriceWeight) external; function setCooldownDuration(uint256 _cooldownDuration) external; }
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/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/libraries/math/SafeMath.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
contracts/libraries/token/IERC20.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
contracts/referrals/interfaces/IReferralStorage.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IReferralStorage { function codeOwners(bytes32 _code) external view returns (address); function traderReferralCodes(address _account) external view returns (bytes32); function referrerDiscountShares(address _account) external view returns (uint256); function referrerTiers(address _account) external view returns (uint256); function getTraderReferralInfo(address _account) external view returns (bytes32, address); function setTraderReferralCode(address _account, bytes32 _code) external; function setTier(uint256 _tierId, uint256 _totalRebate, uint256 _discountShare) external; function setReferrerTier(address _referrer, uint256 _tierId) external; function govSetCodeOwner(bytes32 _code, address _newAccount) external; }
contracts/staking/interfaces/IRewardRouterV2.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IRewardRouterV2 { function feeKlpTracker() external view returns (address); function stakedKlpTracker() external view returns (address); }
contracts/staking/interfaces/IVester.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IVester { function rewardTracker() external view returns (address); function claimForAccount(address _account, address _receiver) external returns (uint256); function claimable(address _account) external view returns (uint256); function cumulativeClaimAmounts(address _account) external view returns (uint256); function claimedAmounts(address _account) external view returns (uint256); function pairAmounts(address _account) external view returns (uint256); function getVestedAmount(address _account) external view returns (uint256); function transferredAverageStakedAmounts(address _account) external view returns (uint256); function transferredCumulativeRewards(address _account) external view returns (uint256); function cumulativeRewardDeductions(address _account) external view returns (uint256); function bonusRewards(address _account) external view returns (uint256); function transferStakeValues(address _sender, address _receiver) external; function setTransferredAverageStakedAmounts(address _account, uint256 _amount) external; function setTransferredCumulativeRewards(address _account, uint256 _amount) external; function setCumulativeRewardDeductions(address _account, uint256 _amount) external; function setBonusRewards(address _account, uint256 _amount) external; function getMaxVestableAmount(address _account) external view returns (uint256); function getCombinedAverageStakedAmount(address _account) external view returns (uint256); function depositForAccount(address _account, uint256 _amount) external; }
contracts/peripherals/interfaces/ITimelock.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface ITimelock { function setAdmin(address _admin) external; function enableLeverage(address _vault) external; function disableLeverage(address _vault) external; function setIsLeverageEnabled(address _vault, bool _isLeverageEnabled) external; function signalSetGov(address _target, address _gov) external; }
contracts/peripherals/interfaces/ITimelockTarget.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface ITimelockTarget { function setGov(address _gov) external; function withdrawToken(address _token, address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IBaseToken.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IBaseToken { function totalStaked() external view returns (uint256); function stakedBalance(address _account) external view returns (uint256); function removeAdmin(address _account) external; function setInPrivateTransferMode(bool _inPrivateTransferMode) external; function withdrawToken(address _token, address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IMintable.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IMintable { function isMinter(address _account) external returns (bool); function setMinter(address _minter, bool _isActive) external; function mint(address _account, uint256 _amount) external; function burn(address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IUSDK.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IUSDK { function addVault(address _vault) external; function removeVault(address _vault) external; function mint(address _account, uint256 _amount) external; function burn(address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IYieldToken.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IYieldToken { function totalStaked() external view returns (uint256); function stakedBalance(address _account) external view returns (uint256); function removeAdmin(address _account) external; }
contracts/access/interfaces/IAdmin.sol
//SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IAdmin { function setAdmin(address _admin) external; }
contracts/core/interfaces/IExecutionFee.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IExecutionFee { function setMinExecutionFee(uint256 _minExecutionFee) external; }
contracts/peripherals/interfaces/IHandlerTarget.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IHandlerTarget { function isHandler(address _account) external returns (bool); function setHandler(address _handler, bool _isActive) external; }
contracts/core/interfaces/IKlpManager.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./IVault.sol"; interface IKlpManager { function klp() external view returns (address); function usdk() external view returns (address); function vault() external view returns (IVault); function cooldownDuration() external returns (uint256); function getAumInUsdk(bool maximise) external view returns (uint256); function lastAddedAt(address _account) external returns (uint256); function addLiquidity(address _token, uint256 _amount, uint256 _minUsdk, uint256 _minKlp) external returns (uint256); function addLiquidityForAccount(address _fundingAccount, address _account, address _token, uint256 _amount, uint256 _minUsdk, uint256 _minKlp) external returns (uint256); function removeLiquidity(address _tokenOut, uint256 _klpAmount, uint256 _minOut, address _receiver) external returns (uint256); function removeLiquidityForAccount(address _account, address _tokenOut, uint256 _klpAmount, uint256 _minOut, address _receiver) external returns (uint256); function setShortsTrackerAveragePriceWeight(uint256 _shortsTrackerAveragePriceWeight) external; function setCooldownDuration(uint256 _cooldownDuration) external; }
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/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/libraries/math/SafeMath.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
contracts/libraries/token/IERC20.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
contracts/referrals/interfaces/IReferralStorage.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IReferralStorage { function codeOwners(bytes32 _code) external view returns (address); function traderReferralCodes(address _account) external view returns (bytes32); function referrerDiscountShares(address _account) external view returns (uint256); function referrerTiers(address _account) external view returns (uint256); function getTraderReferralInfo(address _account) external view returns (bytes32, address); function setTraderReferralCode(address _account, bytes32 _code) external; function setTier(uint256 _tierId, uint256 _totalRebate, uint256 _discountShare) external; function setReferrerTier(address _referrer, uint256 _tierId) external; function govSetCodeOwner(bytes32 _code, address _newAccount) external; }
contracts/staking/interfaces/IRewardRouterV2.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IRewardRouterV2 { function feeKlpTracker() external view returns (address); function stakedKlpTracker() external view returns (address); }
contracts/staking/interfaces/IVester.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IVester { function rewardTracker() external view returns (address); function claimForAccount(address _account, address _receiver) external returns (uint256); function claimable(address _account) external view returns (uint256); function cumulativeClaimAmounts(address _account) external view returns (uint256); function claimedAmounts(address _account) external view returns (uint256); function pairAmounts(address _account) external view returns (uint256); function getVestedAmount(address _account) external view returns (uint256); function transferredAverageStakedAmounts(address _account) external view returns (uint256); function transferredCumulativeRewards(address _account) external view returns (uint256); function cumulativeRewardDeductions(address _account) external view returns (uint256); function bonusRewards(address _account) external view returns (uint256); function transferStakeValues(address _sender, address _receiver) external; function setTransferredAverageStakedAmounts(address _account, uint256 _amount) external; function setTransferredCumulativeRewards(address _account, uint256 _amount) external; function setCumulativeRewardDeductions(address _account, uint256 _amount) external; function setBonusRewards(address _account, uint256 _amount) external; function getMaxVestableAmount(address _account) external view returns (uint256); function getCombinedAverageStakedAmount(address _account) external view returns (uint256); function depositForAccount(address _account, uint256 _amount) external; }
contracts/peripherals/interfaces/ITimelock.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface ITimelock { function setAdmin(address _admin) external; function enableLeverage(address _vault) external; function disableLeverage(address _vault) external; function setIsLeverageEnabled(address _vault, bool _isLeverageEnabled) external; function signalSetGov(address _target, address _gov) external; }
contracts/peripherals/interfaces/ITimelockTarget.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface ITimelockTarget { function setGov(address _gov) external; function withdrawToken(address _token, address _account, uint256 _amount) external; }
contracts/access/interfaces/IAdmin.sol
//SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IAdmin { function setAdmin(address _admin) external; }
contracts/core/interfaces/IExecutionFee.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IExecutionFee { function setMinExecutionFee(uint256 _minExecutionFee) external; }
contracts/peripherals/interfaces/IHandlerTarget.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IHandlerTarget { function isHandler(address _account) external returns (bool); function setHandler(address _handler, bool _isActive) external; }
contracts/core/interfaces/IKlpManager.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./IVault.sol"; interface IKlpManager { function klp() external view returns (address); function usdk() external view returns (address); function vault() external view returns (IVault); function cooldownDuration() external returns (uint256); function getAumInUsdk(bool maximise) external view returns (uint256); function lastAddedAt(address _account) external returns (uint256); function addLiquidity(address _token, uint256 _amount, uint256 _minUsdk, uint256 _minKlp) external returns (uint256); function addLiquidityForAccount(address _fundingAccount, address _account, address _token, uint256 _amount, uint256 _minUsdk, uint256 _minKlp) external returns (uint256); function removeLiquidity(address _tokenOut, uint256 _klpAmount, uint256 _minOut, address _receiver) external returns (uint256); function removeLiquidityForAccount(address _account, address _tokenOut, uint256 _klpAmount, uint256 _minOut, address _receiver) external returns (uint256); function setShortsTrackerAveragePriceWeight(uint256 _shortsTrackerAveragePriceWeight) external; function setCooldownDuration(uint256 _cooldownDuration) external; }
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/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/libraries/math/SafeMath.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
contracts/libraries/token/IERC20.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
contracts/referrals/interfaces/IReferralStorage.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IReferralStorage { function codeOwners(bytes32 _code) external view returns (address); function traderReferralCodes(address _account) external view returns (bytes32); function referrerDiscountShares(address _account) external view returns (uint256); function referrerTiers(address _account) external view returns (uint256); function getTraderReferralInfo(address _account) external view returns (bytes32, address); function setTraderReferralCode(address _account, bytes32 _code) external; function setTier(uint256 _tierId, uint256 _totalRebate, uint256 _discountShare) external; function setReferrerTier(address _referrer, uint256 _tierId) external; function govSetCodeOwner(bytes32 _code, address _newAccount) external; }
contracts/staking/interfaces/IRewardRouterV2.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IRewardRouterV2 { function feeKlpTracker() external view returns (address); function stakedKlpTracker() external view returns (address); }
contracts/staking/interfaces/IVester.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IVester { function rewardTracker() external view returns (address); function claimForAccount(address _account, address _receiver) external returns (uint256); function claimable(address _account) external view returns (uint256); function cumulativeClaimAmounts(address _account) external view returns (uint256); function claimedAmounts(address _account) external view returns (uint256); function pairAmounts(address _account) external view returns (uint256); function getVestedAmount(address _account) external view returns (uint256); function transferredAverageStakedAmounts(address _account) external view returns (uint256); function transferredCumulativeRewards(address _account) external view returns (uint256); function cumulativeRewardDeductions(address _account) external view returns (uint256); function bonusRewards(address _account) external view returns (uint256); function transferStakeValues(address _sender, address _receiver) external; function setTransferredAverageStakedAmounts(address _account, uint256 _amount) external; function setTransferredCumulativeRewards(address _account, uint256 _amount) external; function setCumulativeRewardDeductions(address _account, uint256 _amount) external; function setBonusRewards(address _account, uint256 _amount) external; function getMaxVestableAmount(address _account) external view returns (uint256); function getCombinedAverageStakedAmount(address _account) external view returns (uint256); function depositForAccount(address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IBaseToken.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IBaseToken { function totalStaked() external view returns (uint256); function stakedBalance(address _account) external view returns (uint256); function removeAdmin(address _account) external; function setInPrivateTransferMode(bool _inPrivateTransferMode) external; function withdrawToken(address _token, address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IMintable.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IMintable { function isMinter(address _account) external returns (bool); function setMinter(address _minter, bool _isActive) external; function mint(address _account, uint256 _amount) external; function burn(address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IUSDK.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IUSDK { function addVault(address _vault) external; function removeVault(address _vault) external; function mint(address _account, uint256 _amount) external; function burn(address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IYieldToken.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IYieldToken { function totalStaked() external view returns (uint256); function stakedBalance(address _account) external view returns (uint256); function removeAdmin(address _account) external; }
contracts/peripherals/interfaces/ITimelock.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface ITimelock { function setAdmin(address _admin) external; function enableLeverage(address _vault) external; function disableLeverage(address _vault) external; function setIsLeverageEnabled(address _vault, bool _isLeverageEnabled) external; function signalSetGov(address _target, address _gov) external; }
contracts/peripherals/interfaces/ITimelockTarget.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface ITimelockTarget { function setGov(address _gov) external; function withdrawToken(address _token, address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IBaseToken.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IBaseToken { function totalStaked() external view returns (uint256); function stakedBalance(address _account) external view returns (uint256); function removeAdmin(address _account) external; function setInPrivateTransferMode(bool _inPrivateTransferMode) external; function withdrawToken(address _token, address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IMintable.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IMintable { function isMinter(address _account) external returns (bool); function setMinter(address _minter, bool _isActive) external; function mint(address _account, uint256 _amount) external; function burn(address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IUSDK.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IUSDK { function addVault(address _vault) external; function removeVault(address _vault) external; function mint(address _account, uint256 _amount) external; function burn(address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IYieldToken.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IYieldToken { function totalStaked() external view returns (uint256); function stakedBalance(address _account) external view returns (uint256); function removeAdmin(address _account) external; }
contracts/access/interfaces/IAdmin.sol
//SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IAdmin { function setAdmin(address _admin) external; }
contracts/core/interfaces/IExecutionFee.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IExecutionFee { function setMinExecutionFee(uint256 _minExecutionFee) external; }
contracts/peripherals/interfaces/IHandlerTarget.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IHandlerTarget { function isHandler(address _account) external returns (bool); function setHandler(address _handler, bool _isActive) external; }
contracts/core/interfaces/IKlpManager.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./IVault.sol"; interface IKlpManager { function klp() external view returns (address); function usdk() external view returns (address); function vault() external view returns (IVault); function cooldownDuration() external returns (uint256); function getAumInUsdk(bool maximise) external view returns (uint256); function lastAddedAt(address _account) external returns (uint256); function addLiquidity(address _token, uint256 _amount, uint256 _minUsdk, uint256 _minKlp) external returns (uint256); function addLiquidityForAccount(address _fundingAccount, address _account, address _token, uint256 _amount, uint256 _minUsdk, uint256 _minKlp) external returns (uint256); function removeLiquidity(address _tokenOut, uint256 _klpAmount, uint256 _minOut, address _receiver) external returns (uint256); function removeLiquidityForAccount(address _account, address _tokenOut, uint256 _klpAmount, uint256 _minOut, address _receiver) external returns (uint256); function setShortsTrackerAveragePriceWeight(uint256 _shortsTrackerAveragePriceWeight) external; function setCooldownDuration(uint256 _cooldownDuration) external; }
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/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/libraries/math/SafeMath.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
contracts/libraries/token/IERC20.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
contracts/referrals/interfaces/IReferralStorage.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IReferralStorage { function codeOwners(bytes32 _code) external view returns (address); function traderReferralCodes(address _account) external view returns (bytes32); function referrerDiscountShares(address _account) external view returns (uint256); function referrerTiers(address _account) external view returns (uint256); function getTraderReferralInfo(address _account) external view returns (bytes32, address); function setTraderReferralCode(address _account, bytes32 _code) external; function setTier(uint256 _tierId, uint256 _totalRebate, uint256 _discountShare) external; function setReferrerTier(address _referrer, uint256 _tierId) external; function govSetCodeOwner(bytes32 _code, address _newAccount) external; }
contracts/staking/interfaces/IRewardRouterV2.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IRewardRouterV2 { function feeKlpTracker() external view returns (address); function stakedKlpTracker() external view returns (address); }
contracts/staking/interfaces/IVester.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IVester { function rewardTracker() external view returns (address); function claimForAccount(address _account, address _receiver) external returns (uint256); function claimable(address _account) external view returns (uint256); function cumulativeClaimAmounts(address _account) external view returns (uint256); function claimedAmounts(address _account) external view returns (uint256); function pairAmounts(address _account) external view returns (uint256); function getVestedAmount(address _account) external view returns (uint256); function transferredAverageStakedAmounts(address _account) external view returns (uint256); function transferredCumulativeRewards(address _account) external view returns (uint256); function cumulativeRewardDeductions(address _account) external view returns (uint256); function bonusRewards(address _account) external view returns (uint256); function transferStakeValues(address _sender, address _receiver) external; function setTransferredAverageStakedAmounts(address _account, uint256 _amount) external; function setTransferredCumulativeRewards(address _account, uint256 _amount) external; function setCumulativeRewardDeductions(address _account, uint256 _amount) external; function setBonusRewards(address _account, uint256 _amount) external; function getMaxVestableAmount(address _account) external view returns (uint256); function getCombinedAverageStakedAmount(address _account) external view returns (uint256); function depositForAccount(address _account, uint256 _amount) external; }
contracts/peripherals/interfaces/ITimelock.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface ITimelock { function setAdmin(address _admin) external; function enableLeverage(address _vault) external; function disableLeverage(address _vault) external; function setIsLeverageEnabled(address _vault, bool _isLeverageEnabled) external; function signalSetGov(address _target, address _gov) external; }
contracts/peripherals/interfaces/ITimelockTarget.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface ITimelockTarget { function setGov(address _gov) external; function withdrawToken(address _token, address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IBaseToken.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IBaseToken { function totalStaked() external view returns (uint256); function stakedBalance(address _account) external view returns (uint256); function removeAdmin(address _account) external; function setInPrivateTransferMode(bool _inPrivateTransferMode) external; function withdrawToken(address _token, address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IMintable.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IMintable { function isMinter(address _account) external returns (bool); function setMinter(address _minter, bool _isActive) external; function mint(address _account, uint256 _amount) external; function burn(address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IUSDK.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IUSDK { function addVault(address _vault) external; function removeVault(address _vault) external; function mint(address _account, uint256 _amount) external; function burn(address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IYieldToken.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IYieldToken { function totalStaked() external view returns (uint256); function stakedBalance(address _account) external view returns (uint256); function removeAdmin(address _account) external; }
contracts/access/interfaces/IAdmin.sol
//SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IAdmin { function setAdmin(address _admin) external; }
contracts/core/interfaces/IExecutionFee.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IExecutionFee { function setMinExecutionFee(uint256 _minExecutionFee) external; }
contracts/peripherals/interfaces/IHandlerTarget.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IHandlerTarget { function isHandler(address _account) external returns (bool); function setHandler(address _handler, bool _isActive) external; }
contracts/core/interfaces/IKlpManager.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./IVault.sol"; interface IKlpManager { function klp() external view returns (address); function usdk() external view returns (address); function vault() external view returns (IVault); function cooldownDuration() external returns (uint256); function getAumInUsdk(bool maximise) external view returns (uint256); function lastAddedAt(address _account) external returns (uint256); function addLiquidity(address _token, uint256 _amount, uint256 _minUsdk, uint256 _minKlp) external returns (uint256); function addLiquidityForAccount(address _fundingAccount, address _account, address _token, uint256 _amount, uint256 _minUsdk, uint256 _minKlp) external returns (uint256); function removeLiquidity(address _tokenOut, uint256 _klpAmount, uint256 _minOut, address _receiver) external returns (uint256); function removeLiquidityForAccount(address _account, address _tokenOut, uint256 _klpAmount, uint256 _minOut, address _receiver) external returns (uint256); function setShortsTrackerAveragePriceWeight(uint256 _shortsTrackerAveragePriceWeight) external; function setCooldownDuration(uint256 _cooldownDuration) external; }
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/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/libraries/math/SafeMath.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
contracts/libraries/token/IERC20.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
contracts/referrals/interfaces/IReferralStorage.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IReferralStorage { function codeOwners(bytes32 _code) external view returns (address); function traderReferralCodes(address _account) external view returns (bytes32); function referrerDiscountShares(address _account) external view returns (uint256); function referrerTiers(address _account) external view returns (uint256); function getTraderReferralInfo(address _account) external view returns (bytes32, address); function setTraderReferralCode(address _account, bytes32 _code) external; function setTier(uint256 _tierId, uint256 _totalRebate, uint256 _discountShare) external; function setReferrerTier(address _referrer, uint256 _tierId) external; function govSetCodeOwner(bytes32 _code, address _newAccount) external; }
contracts/staking/interfaces/IRewardRouterV2.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IRewardRouterV2 { function feeKlpTracker() external view returns (address); function stakedKlpTracker() external view returns (address); }
contracts/staking/interfaces/IVester.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IVester { function rewardTracker() external view returns (address); function claimForAccount(address _account, address _receiver) external returns (uint256); function claimable(address _account) external view returns (uint256); function cumulativeClaimAmounts(address _account) external view returns (uint256); function claimedAmounts(address _account) external view returns (uint256); function pairAmounts(address _account) external view returns (uint256); function getVestedAmount(address _account) external view returns (uint256); function transferredAverageStakedAmounts(address _account) external view returns (uint256); function transferredCumulativeRewards(address _account) external view returns (uint256); function cumulativeRewardDeductions(address _account) external view returns (uint256); function bonusRewards(address _account) external view returns (uint256); function transferStakeValues(address _sender, address _receiver) external; function setTransferredAverageStakedAmounts(address _account, uint256 _amount) external; function setTransferredCumulativeRewards(address _account, uint256 _amount) external; function setCumulativeRewardDeductions(address _account, uint256 _amount) external; function setBonusRewards(address _account, uint256 _amount) external; function getMaxVestableAmount(address _account) external view returns (uint256); function getCombinedAverageStakedAmount(address _account) external view returns (uint256); function depositForAccount(address _account, uint256 _amount) external; }
contracts/peripherals/interfaces/ITimelock.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface ITimelock { function setAdmin(address _admin) external; function enableLeverage(address _vault) external; function disableLeverage(address _vault) external; function setIsLeverageEnabled(address _vault, bool _isLeverageEnabled) external; function signalSetGov(address _target, address _gov) external; }
contracts/peripherals/interfaces/ITimelockTarget.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface ITimelockTarget { function setGov(address _gov) external; function withdrawToken(address _token, address _account, uint256 _amount) external; }
contracts/access/interfaces/IAdmin.sol
//SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IAdmin { function setAdmin(address _admin) external; }
contracts/core/interfaces/IExecutionFee.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IExecutionFee { function setMinExecutionFee(uint256 _minExecutionFee) external; }
contracts/peripherals/interfaces/IHandlerTarget.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IHandlerTarget { function isHandler(address _account) external returns (bool); function setHandler(address _handler, bool _isActive) external; }
contracts/core/interfaces/IKlpManager.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./IVault.sol"; interface IKlpManager { function klp() external view returns (address); function usdk() external view returns (address); function vault() external view returns (IVault); function cooldownDuration() external returns (uint256); function getAumInUsdk(bool maximise) external view returns (uint256); function lastAddedAt(address _account) external returns (uint256); function addLiquidity(address _token, uint256 _amount, uint256 _minUsdk, uint256 _minKlp) external returns (uint256); function addLiquidityForAccount(address _fundingAccount, address _account, address _token, uint256 _amount, uint256 _minUsdk, uint256 _minKlp) external returns (uint256); function removeLiquidity(address _tokenOut, uint256 _klpAmount, uint256 _minOut, address _receiver) external returns (uint256); function removeLiquidityForAccount(address _account, address _tokenOut, uint256 _klpAmount, uint256 _minOut, address _receiver) external returns (uint256); function setShortsTrackerAveragePriceWeight(uint256 _shortsTrackerAveragePriceWeight) external; function setCooldownDuration(uint256 _cooldownDuration) external; }
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/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/libraries/math/SafeMath.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
contracts/libraries/token/IERC20.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
contracts/referrals/interfaces/IReferralStorage.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IReferralStorage { function codeOwners(bytes32 _code) external view returns (address); function traderReferralCodes(address _account) external view returns (bytes32); function referrerDiscountShares(address _account) external view returns (uint256); function referrerTiers(address _account) external view returns (uint256); function getTraderReferralInfo(address _account) external view returns (bytes32, address); function setTraderReferralCode(address _account, bytes32 _code) external; function setTier(uint256 _tierId, uint256 _totalRebate, uint256 _discountShare) external; function setReferrerTier(address _referrer, uint256 _tierId) external; function govSetCodeOwner(bytes32 _code, address _newAccount) external; }
contracts/staking/interfaces/IRewardRouterV2.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IRewardRouterV2 { function feeKlpTracker() external view returns (address); function stakedKlpTracker() external view returns (address); }
contracts/staking/interfaces/IVester.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IVester { function rewardTracker() external view returns (address); function claimForAccount(address _account, address _receiver) external returns (uint256); function claimable(address _account) external view returns (uint256); function cumulativeClaimAmounts(address _account) external view returns (uint256); function claimedAmounts(address _account) external view returns (uint256); function pairAmounts(address _account) external view returns (uint256); function getVestedAmount(address _account) external view returns (uint256); function transferredAverageStakedAmounts(address _account) external view returns (uint256); function transferredCumulativeRewards(address _account) external view returns (uint256); function cumulativeRewardDeductions(address _account) external view returns (uint256); function bonusRewards(address _account) external view returns (uint256); function transferStakeValues(address _sender, address _receiver) external; function setTransferredAverageStakedAmounts(address _account, uint256 _amount) external; function setTransferredCumulativeRewards(address _account, uint256 _amount) external; function setCumulativeRewardDeductions(address _account, uint256 _amount) external; function setBonusRewards(address _account, uint256 _amount) external; function getMaxVestableAmount(address _account) external view returns (uint256); function getCombinedAverageStakedAmount(address _account) external view returns (uint256); function depositForAccount(address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IBaseToken.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IBaseToken { function totalStaked() external view returns (uint256); function stakedBalance(address _account) external view returns (uint256); function removeAdmin(address _account) external; function setInPrivateTransferMode(bool _inPrivateTransferMode) external; function withdrawToken(address _token, address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IMintable.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IMintable { function isMinter(address _account) external returns (bool); function setMinter(address _minter, bool _isActive) external; function mint(address _account, uint256 _amount) external; function burn(address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IUSDK.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IUSDK { function addVault(address _vault) external; function removeVault(address _vault) external; function mint(address _account, uint256 _amount) external; function burn(address _account, uint256 _amount) external; }
contracts/tokens/interfaces/IYieldToken.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IYieldToken { function totalStaked() external view returns (uint256); function stakedBalance(address _account) external view returns (uint256); function removeAdmin(address _account) external; }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_admin","internalType":"address"},{"type":"uint256","name":"_buffer","internalType":"uint256"},{"type":"address","name":"_tokenManager","internalType":"address"},{"type":"address","name":"_mintReceiver","internalType":"address"},{"type":"address","name":"_klpManager","internalType":"address"},{"type":"address","name":"_rewardRouter","internalType":"address"},{"type":"uint256","name":"_maxTokenSupply","internalType":"uint256"},{"type":"uint256","name":"_marginFeeBasisPoints","internalType":"uint256"},{"type":"uint256","name":"_maxMarginFeeBasisPoints","internalType":"uint256"}]},{"type":"event","name":"ClearAction","inputs":[{"type":"bytes32","name":"action","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"SignalApprove","inputs":[{"type":"address","name":"token","internalType":"address","indexed":false},{"type":"address","name":"spender","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"bytes32","name":"action","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"SignalMint","inputs":[{"type":"address","name":"token","internalType":"address","indexed":false},{"type":"address","name":"receiver","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"bytes32","name":"action","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"SignalPendingAction","inputs":[{"type":"bytes32","name":"action","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"SignalRedeemUsdk","inputs":[{"type":"address","name":"vault","internalType":"address","indexed":false},{"type":"address","name":"token","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SignalSetGov","inputs":[{"type":"address","name":"target","internalType":"address","indexed":false},{"type":"address","name":"gov","internalType":"address","indexed":false},{"type":"bytes32","name":"action","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"SignalSetHandler","inputs":[{"type":"address","name":"target","internalType":"address","indexed":false},{"type":"address","name":"handler","internalType":"address","indexed":false},{"type":"bool","name":"isActive","internalType":"bool","indexed":false},{"type":"bytes32","name":"action","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"SignalSetPriceFeed","inputs":[{"type":"address","name":"vault","internalType":"address","indexed":false},{"type":"address","name":"priceFeed","internalType":"address","indexed":false},{"type":"bytes32","name":"action","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"SignalVaultSetTokenConfig","inputs":[{"type":"address","name":"vault","internalType":"address","indexed":false},{"type":"address","name":"token","internalType":"address","indexed":false},{"type":"uint256","name":"tokenDecimals","internalType":"uint256","indexed":false},{"type":"uint256","name":"tokenWeight","internalType":"uint256","indexed":false},{"type":"uint256","name":"minProfitBps","internalType":"uint256","indexed":false},{"type":"uint256","name":"maxUsdkAmount","internalType":"uint256","indexed":false},{"type":"bool","name":"isStable","internalType":"bool","indexed":false},{"type":"bool","name":"isShortable","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"SignalWithdrawToken","inputs":[{"type":"address","name":"target","internalType":"address","indexed":false},{"type":"address","name":"token","internalType":"address","indexed":false},{"type":"address","name":"receiver","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"bytes32","name":"action","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_BUFFER","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_FUNDING_RATE_FACTOR","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_LEVERAGE_VALIDATION","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"PRICE_PRECISION","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"admin","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"approve","inputs":[{"type":"address","name":"_token","internalType":"address"},{"type":"address","name":"_spender","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"batchSetBonusRewards","inputs":[{"type":"address","name":"_vester","internalType":"address"},{"type":"address[]","name":"_accounts","internalType":"address[]"},{"type":"uint256[]","name":"_amounts","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"batchWithdrawFees","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"address[]","name":"_tokens","internalType":"address[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"buffer","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"cancelAction","inputs":[{"type":"bytes32","name":"_action","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"disableLeverage","inputs":[{"type":"address","name":"_vault","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"enableLeverage","inputs":[{"type":"address","name":"_vault","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"govSetCodeOwner","inputs":[{"type":"address","name":"_referralStorage","internalType":"address"},{"type":"bytes32","name":"_code","internalType":"bytes32"},{"type":"address","name":"_newAccount","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initKlpManager","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initRewardRouter","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isHandler","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isKeeper","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"klpManager","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"marginFeeBasisPoints","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxMarginFeeBasisPoints","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxTokenSupply","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"mintReceiver","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"pendingActions","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"processMint","inputs":[{"type":"address","name":"_token","internalType":"address"},{"type":"address","name":"_receiver","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"redeemUsdk","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"address","name":"_token","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeAdmin","inputs":[{"type":"address","name":"_token","internalType":"address"},{"type":"address","name":"_account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"rewardRouter","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAdmin","inputs":[{"type":"address","name":"_admin","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBuffer","inputs":[{"type":"uint256","name":"_buffer","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setContractHandler","inputs":[{"type":"address","name":"_handler","internalType":"address"},{"type":"bool","name":"_isActive","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setExternalAdmin","inputs":[{"type":"address","name":"_target","internalType":"address"},{"type":"address","name":"_admin","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFees","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"uint256","name":"_taxBasisPoints","internalType":"uint256"},{"type":"uint256","name":"_stableTaxBasisPoints","internalType":"uint256"},{"type":"uint256","name":"_mintBurnFeeBasisPoints","internalType":"uint256"},{"type":"uint256","name":"_swapFeeBasisPoints","internalType":"uint256"},{"type":"uint256","name":"_stableSwapFeeBasisPoints","internalType":"uint256"},{"type":"uint256","name":"_marginFeeBasisPoints","internalType":"uint256"},{"type":"uint256","name":"_liquidationFeeUsd","internalType":"uint256"},{"type":"uint256","name":"_minProfitTime","internalType":"uint256"},{"type":"bool","name":"_hasDynamicFees","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFundingRate","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"uint256","name":"_fundingInterval","internalType":"uint256"},{"type":"uint256","name":"_fundingRateFactor","internalType":"uint256"},{"type":"uint256","name":"_stableFundingRateFactor","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setGov","inputs":[{"type":"address","name":"_target","internalType":"address"},{"type":"address","name":"_gov","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setHandler","inputs":[{"type":"address","name":"_target","internalType":"address"},{"type":"address","name":"_handler","internalType":"address"},{"type":"bool","name":"_isActive","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setInPrivateLiquidationMode","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"bool","name":"_inPrivateLiquidationMode","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setInPrivateTransferMode","inputs":[{"type":"address","name":"_token","internalType":"address"},{"type":"bool","name":"_inPrivateTransferMode","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setIsLeverageEnabled","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"bool","name":"_isLeverageEnabled","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setIsSwapEnabled","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"bool","name":"_isSwapEnabled","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setKeeper","inputs":[{"type":"address","name":"_keeper","internalType":"address"},{"type":"bool","name":"_isActive","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setKlpCooldownDuration","inputs":[{"type":"uint256","name":"_cooldownDuration","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setLiquidator","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"address","name":"_liquidator","internalType":"address"},{"type":"bool","name":"_isActive","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMarginFeeBasisPoints","inputs":[{"type":"uint256","name":"_marginFeeBasisPoints","internalType":"uint256"},{"type":"uint256","name":"_maxMarginFeeBasisPoints","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxGasPrice","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"uint256","name":"_maxGasPrice","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxGlobalShortSize","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"address","name":"_token","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxLeverage","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"uint256","name":"_maxLeverage","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMinExecutionFee","inputs":[{"type":"address","name":"_controller","internalType":"address"},{"type":"uint256","name":"_minExecutionFee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPriceFeed","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"address","name":"_priceFeed","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setReferrerTier","inputs":[{"type":"address","name":"_referralStorage","internalType":"address"},{"type":"address","name":"_referrer","internalType":"address"},{"type":"uint256","name":"_tierId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setShortsTrackerAveragePriceWeight","inputs":[{"type":"uint256","name":"_shortsTrackerAveragePriceWeight","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setShouldToggleIsLeverageEnabled","inputs":[{"type":"bool","name":"_shouldToggleIsLeverageEnabled","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setSwapFees","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"uint256","name":"_taxBasisPoints","internalType":"uint256"},{"type":"uint256","name":"_stableTaxBasisPoints","internalType":"uint256"},{"type":"uint256","name":"_mintBurnFeeBasisPoints","internalType":"uint256"},{"type":"uint256","name":"_swapFeeBasisPoints","internalType":"uint256"},{"type":"uint256","name":"_stableSwapFeeBasisPoints","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTier","inputs":[{"type":"address","name":"_referralStorage","internalType":"address"},{"type":"uint256","name":"_tierId","internalType":"uint256"},{"type":"uint256","name":"_totalRebate","internalType":"uint256"},{"type":"uint256","name":"_discountShare","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTokenConfig","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"address","name":"_token","internalType":"address"},{"type":"uint256","name":"_tokenWeight","internalType":"uint256"},{"type":"uint256","name":"_minProfitBps","internalType":"uint256"},{"type":"uint256","name":"_maxUsdkAmount","internalType":"uint256"},{"type":"uint256","name":"_bufferAmount","internalType":"uint256"},{"type":"uint256","name":"_usdkAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setUsdkAmounts","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"address[]","name":"_tokens","internalType":"address[]"},{"type":"uint256[]","name":"_usdkAmounts","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setVaultUtils","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"address","name":"_vaultUtils","internalType":"contract IVaultUtils"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"shouldToggleIsLeverageEnabled","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"signalApprove","inputs":[{"type":"address","name":"_token","internalType":"address"},{"type":"address","name":"_spender","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"signalMint","inputs":[{"type":"address","name":"_token","internalType":"address"},{"type":"address","name":"_receiver","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"signalRedeemUsdk","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"address","name":"_token","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"signalSetGov","inputs":[{"type":"address","name":"_target","internalType":"address"},{"type":"address","name":"_gov","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"signalSetHandler","inputs":[{"type":"address","name":"_target","internalType":"address"},{"type":"address","name":"_handler","internalType":"address"},{"type":"bool","name":"_isActive","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"signalSetPriceFeed","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"address","name":"_priceFeed","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"signalVaultSetTokenConfig","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"address","name":"_token","internalType":"address"},{"type":"uint256","name":"_tokenDecimals","internalType":"uint256"},{"type":"uint256","name":"_tokenWeight","internalType":"uint256"},{"type":"uint256","name":"_minProfitBps","internalType":"uint256"},{"type":"uint256","name":"_maxUsdkAmount","internalType":"uint256"},{"type":"bool","name":"_isStable","internalType":"bool"},{"type":"bool","name":"_isShortable","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"signalWithdrawToken","inputs":[{"type":"address","name":"_target","internalType":"address"},{"type":"address","name":"_token","internalType":"address"},{"type":"address","name":"_receiver","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"tokenManager","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferIn","inputs":[{"type":"address","name":"_sender","internalType":"address"},{"type":"address","name":"_token","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateUsdkSupply","inputs":[{"type":"uint256","name":"usdkAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"vaultSetTokenConfig","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"address","name":"_token","internalType":"address"},{"type":"uint256","name":"_tokenDecimals","internalType":"uint256"},{"type":"uint256","name":"_tokenWeight","internalType":"uint256"},{"type":"uint256","name":"_minProfitBps","internalType":"uint256"},{"type":"uint256","name":"_maxUsdkAmount","internalType":"uint256"},{"type":"bool","name":"_isStable","internalType":"bool"},{"type":"bool","name":"_isShortable","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawFees","inputs":[{"type":"address","name":"_vault","internalType":"address"},{"type":"address","name":"_token","internalType":"address"},{"type":"address","name":"_receiver","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawToken","inputs":[{"type":"address","name":"_target","internalType":"address"},{"type":"address","name":"_token","internalType":"address"},{"type":"address","name":"_receiver","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]}]
Contract Creation Code
0x60806040523480156200001157600080fd5b5060405162005e5638038062005e5683398181016040526101208110156200003857600080fd5b508051602082015160408301516060840151608085015160a086015160c087015160e08801516101009098015196979596949593949293919290919062069780881115620000cd576040805162461bcd60e51b815260206004820152601960248201527f54696d656c6f636b3a20696e76616c6964205f62756666657200000000000000604482015290519081900360640190fd5b600180546001600160a01b03199081166001600160a01b039b8c16179091556000988955600280548216988b1698909817909755600380548816968a169690961790955560048054871694891694909417909355600580549095169190961617909255600693909355600755600891909155615d069081906200015090396000f3fe608060405234801561001057600080fd5b506004361061033c5760003560e01c80637b6f775a116101bb5780637b6f775a14610a1b57806380894d6214610a4757806386803c7214610a75578063879369c914610aa35780638a39735a14610ad95780638bf22c4614610ae15780638e34c98f14610b0d57806395082d2514610b2c578063996a7a1e14610b34578063996e2bc914610b62578063997696a814610b6a578063adc7ea3714610b87578063afd14deb14610ba4578063bc476dfd14610bac578063bc8a8ab914610bda578063c142940a14610c10578063c7bb26a014610c46578063ca150e3714610c4e578063cd2b123014610c56578063d1b9e85314610c84578063d3c87bbb14610cb2578063da76231614610cd8578063db1c844114610d1c578063dce6e18d14610d75578063df3a66d914610dab578063e12514bf14610de1578063e1f21c6714610e17578063e21b459114610e4d578063e30569e514610e70578063e3cbeb0f14610e8d578063e4652f4914610ee6578063e8ae227114610f1c578063edaafe2014610fcd578063f851a44014610fd5578063f93fb16714610fdd578063fe5a88ae146111105761033c565b80629a698e14610341578063087d81cf1461047657806309bcf3571461047e57806309cc9a08146104aa5780630e0dc426146104e05780630e9587f31461052e5780631154e80814610566578063117cf2041461059e578063185051c1146105cc578063204bbc54146105fa57806321754d9e1461063057806321bd05921461066c578063227f03eb1461069a57806323aaad12146106d257806324ccbe30146106ee578063268959e5146107265780632a709b14146107545780632ba3725a14610778578063318bc6891461079257806346ea87af1461079a57806347de43e2146107c05780634cd23f3b146107f85780634f5f6b5e1461083457806350f7c2041461085157806351a6de0d14610859578063558182941461088757806355ef1395146108bf5780635a3bb989146108ed57806361d07569146108f55780636ba42aaa146108fd5780636d63c1d0146109235780636e5227d414610949578063704b6c02146109aa57806376e11286146109d0578063781cc3d3146109fe575b600080fd5b6104746004803603606081101561035757600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561038157600080fd5b82018360208201111561039357600080fd5b803590602001918460208302840111600160201b831117156103b457600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561040357600080fd5b82018360208201111561041557600080fd5b803590602001918460208302840111600160201b8311171561043657600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061112d945050505050565b005b610474611389565b6104746004803603604081101561049457600080fd5b506001600160a01b03813516906020013561166b565b610474600480360360608110156104c057600080fd5b506001600160a01b0381358116916020810135909116906040013561171a565b610474600480360360e08110156104f657600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a08101359060c00135611819565b6104746004803603606081101561054457600080fd5b506001600160a01b038135811691602081013582169160409091013516611c92565b6104746004803603606081101561057c57600080fd5b506001600160a01b038135811691602081013590911690604001351515611d70565b610474600480360360408110156105b457600080fd5b506001600160a01b0381351690602001351515611e83565b610474600480360360408110156105e257600080fd5b506001600160a01b0381351690602001351515611f4c565b6104746004803603606081101561061057600080fd5b506001600160a01b03813581169160208101359160409091013516611fc4565b6104746004803603608081101561064657600080fd5b506001600160a01b0381358116916020810135821691604082013516906060013561209c565b6104746004803603604081101561068257600080fd5b506001600160a01b03813516906020013515156121e7565b610474600480360360808110156106b057600080fd5b506001600160a01b03813516906020810135906040810135906060013561227c565b6106da6123d1565b604080519115158252519081900360200190f35b6104746004803603606081101561070457600080fd5b506001600160a01b0381358116916020810135909116906040013515156123da565b6104746004803603604081101561073c57600080fd5b506001600160a01b03813581169160200135166124e3565b61075c61257f565b604080516001600160a01b039092168252519081900360200190f35b61078061258e565b60408051918252519081900360200190f35b610780612595565b6106da600480360360208110156107b057600080fd5b50356001600160a01b031661259b565b610474600480360360608110156107d657600080fd5b506001600160a01b0381358116916020810135909116906040013515156125b0565b6104746004803603608081101561080e57600080fd5b506001600160a01b03813581169160208101358216916040820135169060600135612656565b6104746004803603602081101561084a57600080fd5b5035612771565b61078061281d565b6104746004803603604081101561086f57600080fd5b506001600160a01b0381358116916020013516612823565b6104746004803603608081101561089d57600080fd5b506001600160a01b03813516906020810135906040810135906060013561291d565b610474600480360360408110156108d557600080fd5b506001600160a01b03813581169160200135166129f4565b61075c612aea565b610780612af9565b6106da6004803603602081101561091357600080fd5b50356001600160a01b0316612b00565b6104746004803603602081101561093957600080fd5b50356001600160a01b0316612b15565b610474600480360361014081101561096057600080fd5b506001600160a01b038135169060208101359060408101359060608101359060808101359060a08101359060c08101359060e0810135906101008101359061012001351515612fcb565b610474600480360360208110156109c057600080fd5b50356001600160a01b03166130fb565b610474600480360360408110156109e657600080fd5b506001600160a01b038135811691602001351661316a565b61047460048036036020811015610a1457600080fd5b5035613269565b61047460048036036040811015610a3157600080fd5b506001600160a01b0381351690602001356132c2565b61047460048036036040811015610a5d57600080fd5b506001600160a01b03813581169160200135166133ad565b61047460048036036040811015610a8b57600080fd5b506001600160a01b03813516906020013515156134a3565b61047460048036036060811015610ab957600080fd5b506001600160a01b03813581169160208101359091169060400135613538565b610780613636565b61047460048036036040811015610af757600080fd5b506001600160a01b03813516906020013561363b565b61047460048036036020811015610b2357600080fd5b5035151561371e565b610780613798565b61047460048036036040811015610b4a57600080fd5b506001600160a01b03813581169160200135166137a8565b610780613899565b61047460048036036020811015610b8057600080fd5b503561389f565b61047460048036036020811015610b9d57600080fd5b5035613bd0565b610474613cb6565b61047460048036036040811015610bc257600080fd5b506001600160a01b0381358116916020013516613f0c565b61047460048036036060811015610bf057600080fd5b506001600160a01b03813581169160208101359091169060400135613fa8565b61047460048036036060811015610c2657600080fd5b506001600160a01b0381358116916020810135909116906040013561406a565b61075c614142565b61075c614151565b61047460048036036040811015610c6c57600080fd5b506001600160a01b0381351690602001351515614160565b61047460048036036040811015610c9a57600080fd5b506001600160a01b038135169060200135151561420f565b61047460048036036020811015610cc857600080fd5b50356001600160a01b0316614287565b610474600480360360c0811015610cee57600080fd5b506001600160a01b038135169060208101359060408101359060608101359060808101359060a001356145c1565b6104746004803603610100811015610d3357600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a08101359060c081013515159060e001351515614832565b61047460048036036060811015610d8b57600080fd5b506001600160a01b0381358116916020810135909116906040013561498f565b61047460048036036060811015610dc157600080fd5b506001600160a01b03813581169160208101359091169060400135614a91565b61047460048036036060811015610df757600080fd5b506001600160a01b03813581169160208101359091169060400135614b35565b61047460048036036060811015610e2d57600080fd5b506001600160a01b03813581169160208101359091169060400135614f33565b61047460048036036040811015610e6357600080fd5b5080359060200135615068565b61078060048036036020811015610e8657600080fd5b50356150da565b6104746004803603610100811015610ea457600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a08101359060c081013515159060e0013515156150ec565b61047460048036036060811015610efc57600080fd5b506001600160a01b03813581169160208101359091169060400135615271565b61047460048036036040811015610f3257600080fd5b6001600160a01b038235169190810190604081016020820135600160201b811115610f5c57600080fd5b820183602082011115610f6e57600080fd5b803590602001918460208302840111600160201b83111715610f8f57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550615317945050505050565b610780615453565b61075c615459565b61047460048036036060811015610ff357600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561101d57600080fd5b82018360208201111561102f57600080fd5b803590602001918460208302840111600160201b8311171561105057600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561109f57600080fd5b8201836020820111156110b157600080fd5b803590602001918460208302840111600160201b831117156110d257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550615468945050505050565b6104746004803603602081101561112657600080fd5b5035615596565b6001546001600160a01b03163314806111555750336000908152600b602052604090205460ff165b8061116f5750336000908152600c602052604090205460ff165b6111ae576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b8051825114611200576040805162461bcd60e51b815260206004820152601960248201527854696d656c6f636b3a20696e76616c6964206c656e6774687360381b604482015290519081900360640190fd5b60408051639cb7de4b60e01b81523060048201526001602482015290516001600160a01b03851691639cb7de4b91604480830192600092919082900301818387803b15801561124e57600080fd5b505af1158015611262573d6000803e3d6000fd5b5050505060005b825181101561131f57600083828151811061128057fe5b60200260200101519050600083838151811061129857fe5b60200260200101519050856001600160a01b03166341f2272483836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156112f957600080fd5b505af115801561130d573d6000803e3d6000fd5b50506001909401935061126992505050565b5060408051639cb7de4b60e01b815230600482015260006024820181905291516001600160a01b03861692639cb7de4b926044808201939182900301818387803b15801561136c57600080fd5b505af1158015611380573d6000803e3d6000fd5b50505050505050565b6001546001600160a01b031633146113d6576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60048054604080516351dcbca760e01b815290516001600160a01b039092169260009284926351dcbca79281810192602092909190829003018186803b15801561141f57600080fd5b505afa158015611433573d6000803e3d6000fd5b505050506040513d602081101561144957600080fd5b5051600480546040805163cf456ae760e01b81526001600160a01b0392831693810193909352600160248401525192935083169163cf456ae79160448082019260009290919082900301818387803b1580156114a457600080fd5b505af11580156114b8573d6000803e3d6000fd5b505050506000826001600160a01b031663d858b2456040518163ffffffff1660e01b815260040160206040518083038186803b1580156114f757600080fd5b505afa15801561150b573d6000803e3d6000fd5b505050506040513d602081101561152157600080fd5b505160048054604080516312b5ad0160e11b81526001600160a01b03928316938101939093525192935083169163256b5a029160248082019260009290919082900301818387803b15801561157557600080fd5b505af1158015611589573d6000803e3d6000fd5b505050506000836001600160a01b031663fbfa77cf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156115c857600080fd5b505afa1580156115dc573d6000803e3d6000fd5b505050506040513d60208110156115f257600080fd5b505160048054604080516352f4877760e11b81526001600160a01b0392831693810193909352600160248401525192935083169163a5e90eee9160448082019260009290919082900301818387803b15801561164d57600080fd5b505af1158015611661573d6000803e3d6000fd5b5050505050505050565b6001546001600160a01b031633146116b8576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b816001600160a01b031663fc2cee62826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156116fe57600080fd5b505af1158015611712573d6000803e3d6000fd5b505050505050565b6001546001600160a01b03163314611767576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60408051631b5a5b9d60e21b6020808301919091526001600160601b0319606087811b8216602485015286901b166038830152604c80830185905283518084039091018152606c90920190925280519101206117c28161566e565b604080516001600160a01b038087168252851660208201528082018490526060810183905290517f23d37bec99db82564427c9bbfe48ad7434bccf413a40fd357fb838c90a0d68289181900360800190a150505050565b6001546001600160a01b03163314806118415750336000908152600b602052604090205460ff165b8061185b5750336000908152600c602052604090205460ff165b61189a576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6101f48411156118f1576040805162461bcd60e51b815260206004820152601f60248201527f54696d656c6f636b3a20696e76616c6964205f6d696e50726f66697442707300604482015290519081900360640190fd5b60408051630daf9c2160e41b81526001600160a01b0388811660048301529151899283169163daf9c210916024808301926020929190829003018186803b15801561193b57600080fd5b505afa15801561194f573d6000803e3d6000fd5b505050506040513d602081101561196557600080fd5b50516119a25760405162461bcd60e51b8152600401808060200182810382526023815260200180615bfb6023913960400191505060405180910390fd5b6000816001600160a01b0316638ee573ac896040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156119f157600080fd5b505afa158015611a05573d6000803e3d6000fd5b505050506040513d6020811015611a1b57600080fd5b5051604080516342b60b0360e01b81526001600160a01b038b811660048301529151929350600092918516916342b60b0391602480820192602092909190829003018186803b158015611a6d57600080fd5b505afa158015611a81573d6000803e3d6000fd5b505050506040513d6020811015611a9757600080fd5b50516040805163db3555fb60e01b81526001600160a01b038c8116600483015291519293506000929186169163db3555fb91602480820192602092909190829003018186803b158015611ae957600080fd5b505afa158015611afd573d6000803e3d6000fd5b505050506040513d6020811015611b1357600080fd5b505160408051633c5a6e3560e01b81526001600160a01b038d8116600483015260248201879052604482018d9052606482018c9052608482018b905285151560a483015283151560c48301529151929350908d1691633c5a6e359160e48082019260009290919082900301818387803b158015611b8f57600080fd5b505af1158015611ba3573d6000803e3d6000fd5b505050508a6001600160a01b0316638585f4d28b886040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611bfe57600080fd5b505af1158015611c12573d6000803e3d6000fd5b505050508a6001600160a01b03166399da72cc8b876040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611c6d57600080fd5b505af1158015611c81573d6000803e3d6000fd5b505050505050505050505050505050565b6001546001600160a01b03163314611cdf576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b826001600160a01b031663f255527883836040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b0316815260200192505050602060405180830381600087803b158015611d3f57600080fd5b505af1158015611d53573d6000803e3d6000fd5b505050506040513d6020811015611d6957600080fd5b5050505050565b6001546001600160a01b03163314611dbd576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516939b2ba2430b7323632b960b11b6020808301919091526001600160601b0319606087811b8216602a85015286901b16603e83015283151560f81b60528301528251603381840301815260539092019092528051910120611e2181615712565b611e2a816157be565b836001600160a01b0316639cb7de4b84846040518363ffffffff1660e01b815260040180836001600160a01b03168152602001821515815260200192505050600060405180830381600087803b15801561164d57600080fd5b6001546001600160a01b0316331480611eab5750336000908152600b602052604090205460ff165b80611ec55750336000908152600c602052604090205460ff165b611f04576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b816001600160a01b03166330455ede826040518263ffffffff1660e01b8152600401808215158152602001915050600060405180830381600087803b1580156116fe57600080fd5b6001546001600160a01b03163314611f99576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600b60205260409020805460ff1916911515919091179055565b6001546001600160a01b0316331480611fec5750336000908152600b602052604090205460ff165b806120065750336000908152600c602052604090205460ff165b612045576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b826001600160a01b031663dfcfa25083836040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050600060405180830381600087803b15801561136c57600080fd5b6001546001600160a01b031633146120e9576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516c3bb4ba34323930bbaa37b5b2b760991b6020808301919091526001600160601b0319606088811b8216602d85015287811b8216604185015286901b1660558301526069808301859052835180840390910181526089909201909252805191012061215781615712565b612160816157be565b846001600160a01b03166301e336678585856040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b1580156121c857600080fd5b505af11580156121dc573d6000803e3d6000fd5b505050505050505050565b6001546001600160a01b03163314612234576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b816001600160a01b031663f07bbf77826040518263ffffffff1660e01b8152600401808215158152602001915050600060405180830381600087803b1580156116fe57600080fd5b6001546001600160a01b03163314806122a45750336000908152600b602052604090205460ff165b806122be5750336000908152600c602052604090205460ff165b6122fd576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60c8821061233c5760405162461bcd60e51b8152600401808060200182810382526024815260200180615b926024913960400191505060405180910390fd5b60c8811061237b5760405162461bcd60e51b815260040180806020018281038252602a815260200180615ca7602a913960400191505060405180910390fd5b836001600160a01b0316638a27d4688484846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b15801561164d57600080fd5b60095460ff1681565b6001546001600160a01b03163314612427576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516939b2ba2430b7323632b960b11b6020808301919091526001600160601b0319606087811b8216602a85015286901b16603e83015283151560f81b6052830152825160338184030181526053909201909252805191012061248b8161566e565b604080516001600160a01b03808716825285166020820152831515818301526060810183905290517f1929c4e13b0dbbad7856b9ce1fc9dca98c7bf7cedd56e22c04dd60ad1d34fe4b9181900360800190a150505050565b6001546001600160a01b03163314612530576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b816001600160a01b0316631785f53c826040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156116fe57600080fd5b6002546001600160a01b031681565b6207a12081565b60075481565b600b6020526000908152604090205460ff1681565b6001546001600160a01b031633146125fd576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b826001600160a01b0316634453a37483836040518363ffffffff1660e01b815260040180836001600160a01b03168152602001821515815260200192505050600060405180830381600087803b15801561136c57600080fd5b6001546001600160a01b031633146126a3576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516c3bb4ba34323930bbaa37b5b2b760991b6020808301919091526001600160601b0319606088811b8216602d85015287811b8216604185015286901b166055830152606980830185905283518084039091018152608990920190925280519101206127118161566e565b604080516001600160a01b0380881682528087166020830152851681830152606081018490526080810183905290517f9ed7b0f07a9eed51079fab67f6d0f141f167f5b17fdb5a23282280e15fcafed39181900360a00190a15050505050565b6001546001600160a01b031633146127be576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60048054604080516327afb5af60e11b8152928301849052516001600160a01b0390911691634f5f6b5e91602480830192600092919082900301818387803b15801561280957600080fd5b505af1158015611d69573d6000803e3d6000fd5b60065481565b6001546001600160a01b03163314612870576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516539b2ba23b7bb60d11b6020808301919091526001600160601b0319606086811b8216602685015285901b16603a8301528251602e818403018152604e90920190925280519101206128c581615712565b6128ce816157be565b826001600160a01b031663cfad57a2836040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b15801561136c57600080fd5b6001546001600160a01b03163314806129455750336000908152600b602052604090205460ff165b8061295f5750336000908152600c602052604090205460ff165b61299e576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b836001600160a01b031663836a01878484846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b15801561164d57600080fd5b6001546001600160a01b03163314612a41576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6001600160a01b038216301415612a9b576040805162461bcd60e51b8152602060048201526019602482015278151a5b595b1bd8dace881a5b9d985b1a590817dd185c99d95d603a1b604482015290519081900360640190fd5b816001600160a01b031663704b6c02826040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156116fe57600080fd5b6005546001600160a01b031681565b6206978081565b600c6020526000908152604090205460ff1681565b6001546001600160a01b0316331480612b3d5750336000908152600b602052604090205460ff165b612b7c576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b600954819060ff1615612bea5760408051637c2eb9f760e01b81526001600482015290516001600160a01b03831691637c2eb9f791602480830192600092919082900301818387803b158015612bd157600080fd5b505af1158015612be5573d6000803e3d6000fd5b505050505b806001600160a01b03166340eb3802826001600160a01b0316637a210a2b6040518163ffffffff1660e01b815260040160206040518083038186803b158015612c3257600080fd5b505afa158015612c46573d6000803e3d6000fd5b505050506040513d6020811015612c5c57600080fd5b505160408051630875ab6160e11b815290516001600160a01b038616916310eb56c2916004808301926020929190829003018186803b158015612c9e57600080fd5b505afa158015612cb2573d6000803e3d6000fd5b505050506040513d6020811015612cc857600080fd5b505160408051631351ecc160e21b815290516001600160a01b03871691634d47b304916004808301926020929190829003018186803b158015612d0a57600080fd5b505afa158015612d1e573d6000803e3d6000fd5b505050506040513d6020811015612d3457600080fd5b50516040805163511791c960e11b815290516001600160a01b0388169163a22f2392916004808301926020929190829003018186803b158015612d7657600080fd5b505afa158015612d8a573d6000803e3d6000fd5b505050506040513d6020811015612da057600080fd5b50516040805163df73a26760e01b815290516001600160a01b0389169163df73a267916004808301926020929190829003018186803b158015612de257600080fd5b505afa158015612df6573d6000803e3d6000fd5b505050506040513d6020811015612e0c57600080fd5b5051600754604080516305d349a560e21b815290516001600160a01b038b169163174d2694916004808301926020929190829003018186803b158015612e5157600080fd5b505afa158015612e65573d6000803e3d6000fd5b505050506040513d6020811015612e7b57600080fd5b50516040805163d9ac422560e01b815290516001600160a01b038c169163d9ac4225916004808301926020929190829003018186803b158015612ebd57600080fd5b505afa158015612ed1573d6000803e3d6000fd5b505050506040513d6020811015612ee757600080fd5b505160408051639f392eb360e01b815290516001600160a01b038d1691639f392eb3916004808301926020929190829003018186803b158015612f2957600080fd5b505afa158015612f3d573d6000803e3d6000fd5b505050506040513d6020811015612f5357600080fd5b5051604080516001600160e01b031960e08d901b168152600481019a909a5260248a019890985260448901969096526064880194909452608487019290925260a486015260c485015260e484015215156101048301525161012480830192600092919082900301818387803b1580156116fe57600080fd5b6001546001600160a01b0316331480612ff35750336000908152600b602052604090205460ff165b8061300d5750336000908152600c602052604090205460ff165b61304c576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6007849055600854604080516320759c0160e11b8152600481018c9052602481018b9052604481018a9052606481018990526084810188905260a481019290925260c4820185905260e48201849052821515610104830152516001600160a01b038c16916340eb38029161012480830192600092919082900301818387803b1580156130d757600080fd5b505af11580156130eb573d6000803e3d6000fd5b5050505050505050505050505050565b6002546001600160a01b03163314613148576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146131b7576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516b1cd95d141c9a58d95199595960a21b6020808301919091526001600160601b0319606086811b8216602c85015285901b1682840152825160348184030181526054909201909252805191012061321181615712565b61321a816157be565b826001600160a01b031663724e78da836040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b15801561136c57600080fd5b6001546001600160a01b031633146132b6576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6132bf816157be565b50565b6001546001600160a01b0316331461330f576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6207a120811015613367576040805162461bcd60e51b815260206004820152601e60248201527f54696d656c6f636b3a20696e76616c6964205f6d61784c657665726167650000604482015290519081900360640190fd5b816001600160a01b031663d3127e63826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156116fe57600080fd5b6001546001600160a01b031633146133fa576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516b1cd95d141c9a58d95199595960a21b6020808301919091526001600160601b0319606086811b8216602c85015285901b168284015282516034818403018152605490920190925280519101206134548161566e565b604080516001600160a01b0380861682528416602082015280820183905290517fb878dd4b5762f4118ad54995be907dd2bcd915d942e4ac75580fba9b4ee4727f9181900360600190a1505050565b6001546001600160a01b031633146134f0576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b816001600160a01b0316635a47a1a7826040518263ffffffff1660e01b8152600401808215158152602001915050600060405180830381600087803b1580156116fe57600080fd5b6001546001600160a01b03163314613585576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516972656465656d5573646b60b01b6020808301919091526001600160601b0319606087811b8216602a85015286901b16603e830152605280830185905283518084039091018152607290920190925280519101206135e68161566e565b604080516001600160a01b0380871682528516602082015280820184905290517f5e43c563d1cb397f16aadf161baf1ab13e3008176aea8402e6501419ea2086e29181900360600190a150505050565b60c881565b6001546001600160a01b03163314613688576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b64012a05f20081116136d8576040805162461bcd60e51b8152602060048201526014602482015273496e76616c6964205f6d6178476173507269636560601b604482015290519081900360640190fd5b816001600160a01b031663d2fa635e826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156116fe57600080fd5b6001546001600160a01b03163314806137465750336000908152600b602052604090205460ff165b613785576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6009805460ff1916911515919091179055565b68327cb2734119d3b7a9601e1b81565b6001546001600160a01b031633146137f5576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516539b2ba23b7bb60d11b6020808301919091526001600160601b0319606086811b8216602685015285901b16603a8301528251602e818403018152604e909201909252805191012061384a8161566e565b604080516001600160a01b0380861682528416602082015280820183905290517f2701a94fd55a560e291f3c54d36580040670d6fde558a77a75d619e38139f7139181900360600190a1505050565b60085481565b6001546001600160a01b03163314806138c75750336000908152600b602052604090205460ff165b806138e15750336000908152600c602052604090205460ff165b613920576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6000600460009054906101000a90046001600160a01b03166001600160a01b031663d858b2456040518163ffffffff1660e01b815260040160206040518083038186803b15801561397057600080fd5b505afa158015613984573d6000803e3d6000fd5b505050506040513d602081101561399a57600080fd5b505160048054604080516370a0823160e01b81526001600160a01b039283169381019390935251929350600092908416916370a08231916024808301926020929190829003018186803b1580156139f057600080fd5b505afa158015613a04573d6000803e3d6000fd5b505050506040513d6020811015613a1a57600080fd5b5051604080516312b5ad0160e11b815230600482015290519192506001600160a01b0384169163256b5a029160248082019260009290919082900301818387803b158015613a6757600080fd5b505af1158015613a7b573d6000803e3d6000fd5b5050505080831115613b0a576000613a938483615863565b60048054604080516340c10f1960e01b81526001600160a01b039283169381019390935260248301849052519293508516916340c10f199160448082019260009290919082900301818387803b158015613aec57600080fd5b505af1158015613b00573d6000803e3d6000fd5b5050505050613b89565b6000613b168285615863565b6004805460408051632770a7eb60e21b81526001600160a01b03928316938101939093526024830184905251929350851691639dc29fac9160448082019260009290919082900301818387803b158015613b6f57600080fd5b505af1158015613b83573d6000803e3d6000fd5b50505050505b6040805163ceb68c2360e01b815230600482015290516001600160a01b0384169163ceb68c2391602480830192600092919082900301818387803b15801561136c57600080fd5b6001546001600160a01b03163314613c1d576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b62069780811115613c71576040805162461bcd60e51b81526020600482015260196024820152782a34b6b2b637b1b59d1034b73b30b634b2102fb13ab33332b960391b604482015290519081900360640190fd5b6000548111613cb15760405162461bcd60e51b8152600401808060200182810382526024815260200180615c426024913960400191505060405180910390fd5b600055565b6001546001600160a01b03163314613d03576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60055460408051636ca75e7960e01b815290516001600160a01b03909216918291636ca75e79916004808301926020929190829003018186803b158015613d4957600080fd5b505afa158015613d5d573d6000803e3d6000fd5b505050506040513d6020811015613d7357600080fd5b505160055460408051639cb7de4b60e01b81526001600160a01b0392831660048201526001602482015290519190921691639cb7de4b91604480830192600092919082900301818387803b158015613dca57600080fd5b505af1158015613dde573d6000803e3d6000fd5b50505050806001600160a01b031663a42c59236040518163ffffffff1660e01b815260040160206040518083038186803b158015613e1b57600080fd5b505afa158015613e2f573d6000803e3d6000fd5b505050506040513d6020811015613e4557600080fd5b505160055460408051639cb7de4b60e01b81526001600160a01b0392831660048201526001602482015290519190921691639cb7de4b91604480830192600092919082900301818387803b158015613e9c57600080fd5b505af1158015613eb0573d6000803e3d6000fd5b50506004805460055460408051639cb7de4b60e01b81526001600160a01b0392831694810194909452600160248501525191169350639cb7de4b9250604480830192600092919082900301818387803b15801561280957600080fd5b6001546001600160a01b03163314613f59576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b816001600160a01b03166371089f4d826040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156116fe57600080fd5b6001546001600160a01b03163314613ff5576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60408051631b5a5b9d60e21b6020808301919091526001600160601b0319606087811b8216602485015286901b166038830152604c80830185905283518084039091018152606c909201909252805191012061405081615712565b614059816157be565b6140648484846158ac565b50505050565b6001546001600160a01b03163314806140925750336000908152600b602052604090205460ff165b806140ac5750336000908152600c602052604090205460ff165b6140eb576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b826001600160a01b0316633fb8b32383836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561136c57600080fd5b6003546001600160a01b031681565b6004546001600160a01b031681565b6001546001600160a01b03163314806141885750336000908152600b602052604090205460ff165b6141c7576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b816001600160a01b0316637c2eb9f7826040518263ffffffff1660e01b8152600401808215158152602001915050600060405180830381600087803b1580156116fe57600080fd5b6001546001600160a01b0316331461425c576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600c60205260409020805460ff1916911515919091179055565b6001546001600160a01b03163314806142af5750336000908152600b602052604090205460ff165b6142ee576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b600954819060ff161561435a5760408051637c2eb9f760e01b815260006004820181905291516001600160a01b03841692637c2eb9f7926024808201939182900301818387803b15801561434157600080fd5b505af1158015614355573d6000803e3d6000fd5b505050505b806001600160a01b03166340eb3802826001600160a01b0316637a210a2b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156143a257600080fd5b505afa1580156143b6573d6000803e3d6000fd5b505050506040513d60208110156143cc57600080fd5b505160408051630875ab6160e11b815290516001600160a01b038616916310eb56c2916004808301926020929190829003018186803b15801561440e57600080fd5b505afa158015614422573d6000803e3d6000fd5b505050506040513d602081101561443857600080fd5b505160408051631351ecc160e21b815290516001600160a01b03871691634d47b304916004808301926020929190829003018186803b15801561447a57600080fd5b505afa15801561448e573d6000803e3d6000fd5b505050506040513d60208110156144a457600080fd5b50516040805163511791c960e11b815290516001600160a01b0388169163a22f2392916004808301926020929190829003018186803b1580156144e657600080fd5b505afa1580156144fa573d6000803e3d6000fd5b505050506040513d602081101561451057600080fd5b50516040805163df73a26760e01b815290516001600160a01b0389169163df73a267916004808301926020929190829003018186803b15801561455257600080fd5b505afa158015614566573d6000803e3d6000fd5b505050506040513d602081101561457c57600080fd5b5051600854604080516305d349a560e21b815290516001600160a01b038b169163174d2694916004808301926020929190829003018186803b158015612e5157600080fd5b6001546001600160a01b03163314806145e95750336000908152600b602052604090205460ff165b806146035750336000908152600c602052604090205460ff165b614642576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6000869050806001600160a01b03166340eb38028787878787600854886001600160a01b031663174d26946040518163ffffffff1660e01b815260040160206040518083038186803b15801561469757600080fd5b505afa1580156146ab573d6000803e3d6000fd5b505050506040513d60208110156146c157600080fd5b50516040805163d9ac422560e01b815290516001600160a01b038c169163d9ac4225916004808301926020929190829003018186803b15801561470357600080fd5b505afa158015614717573d6000803e3d6000fd5b505050506040513d602081101561472d57600080fd5b505160408051639f392eb360e01b815290516001600160a01b038d1691639f392eb3916004808301926020929190829003018186803b15801561476f57600080fd5b505afa158015614783573d6000803e3d6000fd5b505050506040513d602081101561479957600080fd5b5051604080516001600160e01b031960e08d901b168152600481019a909a5260248a019890985260448901969096526064880194909452608487019290925260a486015260c485015260e484015215156101048301525161012480830192600092919082900301818387803b15801561481157600080fd5b505af1158015614825573d6000803e3d6000fd5b5050505050505050505050565b6001546001600160a01b0316331461487f576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60408051727661756c74536574546f6b656e436f6e66696760681b6020808301919091526001600160601b031960608c811b821660338501528b901b166047830152605b8201899052607b8201889052609b820187905260bb820186905284151560f890811b60db840152841515901b60dc830152825160bd81840301815260dd90920190925280519101206149148161566e565b604080516001600160a01b03808c1682528a166020820152808201899052606081018890526080810187905260a0810186905284151560c082015283151560e082015290517f3510e9d8245371c6c1061c33781ce16bd0eafa03cd3d0781865036520af4c743918190036101000190a1505050505050505050565b6001546001600160a01b031633146149dc576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6040805166617070726f766560c81b6020808301919091526001600160601b0319606087811b8216602785015286901b16603b830152604f80830185905283518084039091018152606f9092019092528051910120614a3a8161566e565b604080516001600160a01b038087168252851660208201528082018490526060810183905290517f6af9d86ba7407a934e941ed8ae5f779369a88fe8ba2cd1c204185d6f8a8287fd9181900360800190a150505050565b6001546001600160a01b03163314614ade576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b826001600160a01b031663efa10a6e83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561136c57600080fd5b6001546001600160a01b03163314614b82576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516972656465656d5573646b60b01b6020808301919091526001600160601b0319606087811b8216602a85015286901b16603e83015260528083018590528351808403909101815260729092019092528051910120614be381615712565b614bec816157be565b6000846001600160a01b031663d858b2456040518163ffffffff1660e01b815260040160206040518083038186803b158015614c2757600080fd5b505afa158015614c3b573d6000803e3d6000fd5b505050506040513d6020811015614c5157600080fd5b5051604080516352f4877760e11b81523060048201526001602482015290519192506001600160a01b0387169163a5e90eee9160448082019260009290919082900301818387803b158015614ca557600080fd5b505af1158015614cb9573d6000803e3d6000fd5b5050604080516312b5ad0160e11b815230600482015290516001600160a01b038516935063256b5a029250602480830192600092919082900301818387803b158015614d0457600080fd5b505af1158015614d18573d6000803e3d6000fd5b5050604080516340c10f1960e01b81523060048201526024810187905290516001600160a01b03851693506340c10f199250604480830192600092919082900301818387803b158015614d6a57600080fd5b505af1158015614d7e573d6000803e3d6000fd5b50505050806001600160a01b031663a9059cbb86856040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015614dd957600080fd5b505af1158015614ded573d6000803e3d6000fd5b505050506040513d6020811015614e0357600080fd5b50506003546040805163a1155c4960e01b81526001600160a01b038781166004830152928316602482015290519187169163a1155c49916044808201926020929091908290030181600087803b158015614e5c57600080fd5b505af1158015614e70573d6000803e3d6000fd5b505050506040513d6020811015614e8657600080fd5b5050604080516352f4877760e11b815230600482015260006024820181905291516001600160a01b0388169263a5e90eee926044808201939182900301818387803b158015614ed457600080fd5b505af1158015614ee8573d6000803e3d6000fd5b50506040805163ceb68c2360e01b815230600482015290516001600160a01b038516935063ceb68c239250602480830192600092919082900301818387803b1580156121c857600080fd5b6001546001600160a01b03163314614f80576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6040805166617070726f766560c81b6020808301919091526001600160601b0319606087811b8216602785015286901b16603b830152604f80830185905283518084039091018152606f9092019092528051910120614fde81615712565b614fe7816157be565b836001600160a01b031663095ea7b384846040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561503e57600080fd5b505af1158015615052573d6000803e3d6000fd5b505050506040513d602081101561171257600080fd5b6001546001600160a01b03163314806150905750336000908152600b602052604090205460ff165b6150cf576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b600791909155600855565b600a6020526000908152604090205481565b6001546001600160a01b03163314615139576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60408051727661756c74536574546f6b656e436f6e66696760681b6020808301919091526001600160601b031960608c811b821660338501528b901b166047830152605b8201899052607b8201889052609b820187905260bb820186905284151560f890811b60db840152841515901b60dc830152825160bd81840301815260dd90920190925280519101206151ce81615712565b6151d7816157be565b60408051633c5a6e3560e01b81526001600160a01b038a81166004830152602482018a905260448201899052606482018890526084820187905285151560a483015284151560c48301529151918b1691633c5a6e359160e48082019260009290919082900301818387803b15801561524e57600080fd5b505af1158015615262573d6000803e3d6000fd5b50505050505050505050505050565b6001546001600160a01b031633146152be576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516323b872dd60e01b81526001600160a01b038581166004830152306024830152604482018490529151918416916323b872dd916064808201926020929091908290030181600087803b158015611d3f57600080fd5b6001546001600160a01b031633148061533f5750336000908152600b602052604090205460ff165b806153595750336000908152600c602052604090205460ff165b615398576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60005b815181101561544e57826001600160a01b031663f25552788383815181106153bf57fe5b602090810291909101810151600154604080516001600160e01b031960e087901b1681526001600160a01b03938416600482015292909116602483015251604480830193928290030181600087803b15801561541a57600080fd5b505af115801561542e573d6000803e3d6000fd5b505050506040513d602081101561544457600080fd5b505060010161539b565b505050565b60005481565b6001546001600160a01b031681565b6001546001600160a01b03163314806154905750336000908152600b602052604090205460ff165b806154aa5750336000908152600c602052604090205460ff165b6154e9576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60005b825181101561406457836001600160a01b03166399da72cc84838151811061551057fe5b602002602001015184848151811061552457fe5b60200260200101516040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561557257600080fd5b505af1158015615586573d6000803e3d6000fd5b5050600190920191506154ec9050565b6001546001600160a01b031633146155e3576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b611c2081106156235760405162461bcd60e51b8152600401808060200182810382526023815260200180615bb66023913960400191505060405180910390fd5b600480546040805163966be07560e01b8152928301849052516001600160a01b039091169163966be07591602480830192600092919082900301818387803b15801561280957600080fd5b6000818152600a6020526040902054156156b95760405162461bcd60e51b8152600401808060200182810382526022815260200180615bd96022913960400191505060405180910390fd5b6000546156c7904290615aa2565b6000828152600a602090815260409182902092909255805183815290517f5fb9c0ecf7b4a28c4c480212e868f9da7f373a2ed4d23498b0be6aadf35242fb929181900390910190a150565b6000818152600a6020526040902054615772576040805162461bcd60e51b815260206004820152601e60248201527f54696d656c6f636b3a20616374696f6e206e6f74207369676e616c6c65640000604482015290519081900360640190fd5b6000818152600a602052604090205442116132bf5760405162461bcd60e51b8152600401808060200182810382526024815260200180615c1e6024913960400191505060405180910390fd5b6000818152600a602052604090205461581a576040805162461bcd60e51b81526020600482015260196024820152782a34b6b2b637b1b59d1034b73b30b634b2102fb0b1ba34b7b760391b604482015290519081900360640190fd5b6000818152600a6020908152604080832092909255815183815291517f194ed6dd5e37e2acc44a19455c3f208c4831ee695fe362d9c4ef2d316bc53aec9281900390910190a150565b60006158a583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250615afa565b9392505050565b604080516355138f0d60e11b8152306004820152905184916001600160a01b0383169163aa271e1a916024808201926020929091908290030181600087803b1580156158f757600080fd5b505af115801561590b573d6000803e3d6000fd5b505050506040513d602081101561592157600080fd5b505161598e576040805163cf456ae760e01b81523060048201526001602482015290516001600160a01b0383169163cf456ae791604480830192600092919082900301818387803b15801561597557600080fd5b505af1158015615989573d6000803e3d6000fd5b505050505b806001600160a01b03166340c10f1984846040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156159e557600080fd5b505af11580156159f9573d6000803e3d6000fd5b50505050600654846001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015615a3957600080fd5b505afa158015615a4d573d6000803e3d6000fd5b505050506040513d6020811015615a6357600080fd5b505111156140645760405162461bcd60e51b8152600401808060200182810382526021815260200180615c866021913960400191505060405180910390fd5b6000828201838110156158a5576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b60008184841115615b895760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015615b4e578181015183820152602001615b36565b50505050905090810190601f168015615b7b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505090039056fe54696d656c6f636b3a20696e76616c6964205f66756e64696e6752617465466163746f7254696d656c6f636b3a20696e76616c6964205f636f6f6c646f776e4475726174696f6e54696d656c6f636b3a20616374696f6e20616c7265616479207369676e616c6c656454696d656c6f636b3a20746f6b656e206e6f74207965742077686974656c697374656454696d656c6f636b3a20616374696f6e2074696d65206e6f74207965742070617373656454696d656c6f636b3a206275666665722063616e6e6f742062652064656372656173656454696d656c6f636b3a20666f7262696464656e0000000000000000000000000054696d656c6f636b3a206d6178546f6b656e537570706c7920657863656564656454696d656c6f636b3a20696e76616c6964205f737461626c6546756e64696e6752617465466163746f72a26469706673582212209d202c54077518d5d4948c87fda7c68629f16ba49d1daf5bacf32b864f279bd664736f6c634300060c0033000000000000000000000000778f79b19ccd7effc0a7b3dbcb678b4d12f3e0ca000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005fec080a6e29add8752615bbe399f4db033b90a00000000000000000000000005fec080a6e29add8752615bbe399f4db033b90a0000000000000000000000009a31dde84c61062fd799a13a00cc07e1b6fa8013000000000000000000000000b46cd0a0aa278628e430a6ced38ae4f88036a854000000000000000000000000000000000000000000084595161401484a000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000001f4
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061033c5760003560e01c80637b6f775a116101bb5780637b6f775a14610a1b57806380894d6214610a4757806386803c7214610a75578063879369c914610aa35780638a39735a14610ad95780638bf22c4614610ae15780638e34c98f14610b0d57806395082d2514610b2c578063996a7a1e14610b34578063996e2bc914610b62578063997696a814610b6a578063adc7ea3714610b87578063afd14deb14610ba4578063bc476dfd14610bac578063bc8a8ab914610bda578063c142940a14610c10578063c7bb26a014610c46578063ca150e3714610c4e578063cd2b123014610c56578063d1b9e85314610c84578063d3c87bbb14610cb2578063da76231614610cd8578063db1c844114610d1c578063dce6e18d14610d75578063df3a66d914610dab578063e12514bf14610de1578063e1f21c6714610e17578063e21b459114610e4d578063e30569e514610e70578063e3cbeb0f14610e8d578063e4652f4914610ee6578063e8ae227114610f1c578063edaafe2014610fcd578063f851a44014610fd5578063f93fb16714610fdd578063fe5a88ae146111105761033c565b80629a698e14610341578063087d81cf1461047657806309bcf3571461047e57806309cc9a08146104aa5780630e0dc426146104e05780630e9587f31461052e5780631154e80814610566578063117cf2041461059e578063185051c1146105cc578063204bbc54146105fa57806321754d9e1461063057806321bd05921461066c578063227f03eb1461069a57806323aaad12146106d257806324ccbe30146106ee578063268959e5146107265780632a709b14146107545780632ba3725a14610778578063318bc6891461079257806346ea87af1461079a57806347de43e2146107c05780634cd23f3b146107f85780634f5f6b5e1461083457806350f7c2041461085157806351a6de0d14610859578063558182941461088757806355ef1395146108bf5780635a3bb989146108ed57806361d07569146108f55780636ba42aaa146108fd5780636d63c1d0146109235780636e5227d414610949578063704b6c02146109aa57806376e11286146109d0578063781cc3d3146109fe575b600080fd5b6104746004803603606081101561035757600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561038157600080fd5b82018360208201111561039357600080fd5b803590602001918460208302840111600160201b831117156103b457600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561040357600080fd5b82018360208201111561041557600080fd5b803590602001918460208302840111600160201b8311171561043657600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061112d945050505050565b005b610474611389565b6104746004803603604081101561049457600080fd5b506001600160a01b03813516906020013561166b565b610474600480360360608110156104c057600080fd5b506001600160a01b0381358116916020810135909116906040013561171a565b610474600480360360e08110156104f657600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a08101359060c00135611819565b6104746004803603606081101561054457600080fd5b506001600160a01b038135811691602081013582169160409091013516611c92565b6104746004803603606081101561057c57600080fd5b506001600160a01b038135811691602081013590911690604001351515611d70565b610474600480360360408110156105b457600080fd5b506001600160a01b0381351690602001351515611e83565b610474600480360360408110156105e257600080fd5b506001600160a01b0381351690602001351515611f4c565b6104746004803603606081101561061057600080fd5b506001600160a01b03813581169160208101359160409091013516611fc4565b6104746004803603608081101561064657600080fd5b506001600160a01b0381358116916020810135821691604082013516906060013561209c565b6104746004803603604081101561068257600080fd5b506001600160a01b03813516906020013515156121e7565b610474600480360360808110156106b057600080fd5b506001600160a01b03813516906020810135906040810135906060013561227c565b6106da6123d1565b604080519115158252519081900360200190f35b6104746004803603606081101561070457600080fd5b506001600160a01b0381358116916020810135909116906040013515156123da565b6104746004803603604081101561073c57600080fd5b506001600160a01b03813581169160200135166124e3565b61075c61257f565b604080516001600160a01b039092168252519081900360200190f35b61078061258e565b60408051918252519081900360200190f35b610780612595565b6106da600480360360208110156107b057600080fd5b50356001600160a01b031661259b565b610474600480360360608110156107d657600080fd5b506001600160a01b0381358116916020810135909116906040013515156125b0565b6104746004803603608081101561080e57600080fd5b506001600160a01b03813581169160208101358216916040820135169060600135612656565b6104746004803603602081101561084a57600080fd5b5035612771565b61078061281d565b6104746004803603604081101561086f57600080fd5b506001600160a01b0381358116916020013516612823565b6104746004803603608081101561089d57600080fd5b506001600160a01b03813516906020810135906040810135906060013561291d565b610474600480360360408110156108d557600080fd5b506001600160a01b03813581169160200135166129f4565b61075c612aea565b610780612af9565b6106da6004803603602081101561091357600080fd5b50356001600160a01b0316612b00565b6104746004803603602081101561093957600080fd5b50356001600160a01b0316612b15565b610474600480360361014081101561096057600080fd5b506001600160a01b038135169060208101359060408101359060608101359060808101359060a08101359060c08101359060e0810135906101008101359061012001351515612fcb565b610474600480360360208110156109c057600080fd5b50356001600160a01b03166130fb565b610474600480360360408110156109e657600080fd5b506001600160a01b038135811691602001351661316a565b61047460048036036020811015610a1457600080fd5b5035613269565b61047460048036036040811015610a3157600080fd5b506001600160a01b0381351690602001356132c2565b61047460048036036040811015610a5d57600080fd5b506001600160a01b03813581169160200135166133ad565b61047460048036036040811015610a8b57600080fd5b506001600160a01b03813516906020013515156134a3565b61047460048036036060811015610ab957600080fd5b506001600160a01b03813581169160208101359091169060400135613538565b610780613636565b61047460048036036040811015610af757600080fd5b506001600160a01b03813516906020013561363b565b61047460048036036020811015610b2357600080fd5b5035151561371e565b610780613798565b61047460048036036040811015610b4a57600080fd5b506001600160a01b03813581169160200135166137a8565b610780613899565b61047460048036036020811015610b8057600080fd5b503561389f565b61047460048036036020811015610b9d57600080fd5b5035613bd0565b610474613cb6565b61047460048036036040811015610bc257600080fd5b506001600160a01b0381358116916020013516613f0c565b61047460048036036060811015610bf057600080fd5b506001600160a01b03813581169160208101359091169060400135613fa8565b61047460048036036060811015610c2657600080fd5b506001600160a01b0381358116916020810135909116906040013561406a565b61075c614142565b61075c614151565b61047460048036036040811015610c6c57600080fd5b506001600160a01b0381351690602001351515614160565b61047460048036036040811015610c9a57600080fd5b506001600160a01b038135169060200135151561420f565b61047460048036036020811015610cc857600080fd5b50356001600160a01b0316614287565b610474600480360360c0811015610cee57600080fd5b506001600160a01b038135169060208101359060408101359060608101359060808101359060a001356145c1565b6104746004803603610100811015610d3357600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a08101359060c081013515159060e001351515614832565b61047460048036036060811015610d8b57600080fd5b506001600160a01b0381358116916020810135909116906040013561498f565b61047460048036036060811015610dc157600080fd5b506001600160a01b03813581169160208101359091169060400135614a91565b61047460048036036060811015610df757600080fd5b506001600160a01b03813581169160208101359091169060400135614b35565b61047460048036036060811015610e2d57600080fd5b506001600160a01b03813581169160208101359091169060400135614f33565b61047460048036036040811015610e6357600080fd5b5080359060200135615068565b61078060048036036020811015610e8657600080fd5b50356150da565b6104746004803603610100811015610ea457600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a08101359060c081013515159060e0013515156150ec565b61047460048036036060811015610efc57600080fd5b506001600160a01b03813581169160208101359091169060400135615271565b61047460048036036040811015610f3257600080fd5b6001600160a01b038235169190810190604081016020820135600160201b811115610f5c57600080fd5b820183602082011115610f6e57600080fd5b803590602001918460208302840111600160201b83111715610f8f57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550615317945050505050565b610780615453565b61075c615459565b61047460048036036060811015610ff357600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561101d57600080fd5b82018360208201111561102f57600080fd5b803590602001918460208302840111600160201b8311171561105057600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561109f57600080fd5b8201836020820111156110b157600080fd5b803590602001918460208302840111600160201b831117156110d257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550615468945050505050565b6104746004803603602081101561112657600080fd5b5035615596565b6001546001600160a01b03163314806111555750336000908152600b602052604090205460ff165b8061116f5750336000908152600c602052604090205460ff165b6111ae576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b8051825114611200576040805162461bcd60e51b815260206004820152601960248201527854696d656c6f636b3a20696e76616c6964206c656e6774687360381b604482015290519081900360640190fd5b60408051639cb7de4b60e01b81523060048201526001602482015290516001600160a01b03851691639cb7de4b91604480830192600092919082900301818387803b15801561124e57600080fd5b505af1158015611262573d6000803e3d6000fd5b5050505060005b825181101561131f57600083828151811061128057fe5b60200260200101519050600083838151811061129857fe5b60200260200101519050856001600160a01b03166341f2272483836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156112f957600080fd5b505af115801561130d573d6000803e3d6000fd5b50506001909401935061126992505050565b5060408051639cb7de4b60e01b815230600482015260006024820181905291516001600160a01b03861692639cb7de4b926044808201939182900301818387803b15801561136c57600080fd5b505af1158015611380573d6000803e3d6000fd5b50505050505050565b6001546001600160a01b031633146113d6576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60048054604080516351dcbca760e01b815290516001600160a01b039092169260009284926351dcbca79281810192602092909190829003018186803b15801561141f57600080fd5b505afa158015611433573d6000803e3d6000fd5b505050506040513d602081101561144957600080fd5b5051600480546040805163cf456ae760e01b81526001600160a01b0392831693810193909352600160248401525192935083169163cf456ae79160448082019260009290919082900301818387803b1580156114a457600080fd5b505af11580156114b8573d6000803e3d6000fd5b505050506000826001600160a01b031663d858b2456040518163ffffffff1660e01b815260040160206040518083038186803b1580156114f757600080fd5b505afa15801561150b573d6000803e3d6000fd5b505050506040513d602081101561152157600080fd5b505160048054604080516312b5ad0160e11b81526001600160a01b03928316938101939093525192935083169163256b5a029160248082019260009290919082900301818387803b15801561157557600080fd5b505af1158015611589573d6000803e3d6000fd5b505050506000836001600160a01b031663fbfa77cf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156115c857600080fd5b505afa1580156115dc573d6000803e3d6000fd5b505050506040513d60208110156115f257600080fd5b505160048054604080516352f4877760e11b81526001600160a01b0392831693810193909352600160248401525192935083169163a5e90eee9160448082019260009290919082900301818387803b15801561164d57600080fd5b505af1158015611661573d6000803e3d6000fd5b5050505050505050565b6001546001600160a01b031633146116b8576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b816001600160a01b031663fc2cee62826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156116fe57600080fd5b505af1158015611712573d6000803e3d6000fd5b505050505050565b6001546001600160a01b03163314611767576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60408051631b5a5b9d60e21b6020808301919091526001600160601b0319606087811b8216602485015286901b166038830152604c80830185905283518084039091018152606c90920190925280519101206117c28161566e565b604080516001600160a01b038087168252851660208201528082018490526060810183905290517f23d37bec99db82564427c9bbfe48ad7434bccf413a40fd357fb838c90a0d68289181900360800190a150505050565b6001546001600160a01b03163314806118415750336000908152600b602052604090205460ff165b8061185b5750336000908152600c602052604090205460ff165b61189a576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6101f48411156118f1576040805162461bcd60e51b815260206004820152601f60248201527f54696d656c6f636b3a20696e76616c6964205f6d696e50726f66697442707300604482015290519081900360640190fd5b60408051630daf9c2160e41b81526001600160a01b0388811660048301529151899283169163daf9c210916024808301926020929190829003018186803b15801561193b57600080fd5b505afa15801561194f573d6000803e3d6000fd5b505050506040513d602081101561196557600080fd5b50516119a25760405162461bcd60e51b8152600401808060200182810382526023815260200180615bfb6023913960400191505060405180910390fd5b6000816001600160a01b0316638ee573ac896040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156119f157600080fd5b505afa158015611a05573d6000803e3d6000fd5b505050506040513d6020811015611a1b57600080fd5b5051604080516342b60b0360e01b81526001600160a01b038b811660048301529151929350600092918516916342b60b0391602480820192602092909190829003018186803b158015611a6d57600080fd5b505afa158015611a81573d6000803e3d6000fd5b505050506040513d6020811015611a9757600080fd5b50516040805163db3555fb60e01b81526001600160a01b038c8116600483015291519293506000929186169163db3555fb91602480820192602092909190829003018186803b158015611ae957600080fd5b505afa158015611afd573d6000803e3d6000fd5b505050506040513d6020811015611b1357600080fd5b505160408051633c5a6e3560e01b81526001600160a01b038d8116600483015260248201879052604482018d9052606482018c9052608482018b905285151560a483015283151560c48301529151929350908d1691633c5a6e359160e48082019260009290919082900301818387803b158015611b8f57600080fd5b505af1158015611ba3573d6000803e3d6000fd5b505050508a6001600160a01b0316638585f4d28b886040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611bfe57600080fd5b505af1158015611c12573d6000803e3d6000fd5b505050508a6001600160a01b03166399da72cc8b876040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611c6d57600080fd5b505af1158015611c81573d6000803e3d6000fd5b505050505050505050505050505050565b6001546001600160a01b03163314611cdf576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b826001600160a01b031663f255527883836040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b0316815260200192505050602060405180830381600087803b158015611d3f57600080fd5b505af1158015611d53573d6000803e3d6000fd5b505050506040513d6020811015611d6957600080fd5b5050505050565b6001546001600160a01b03163314611dbd576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516939b2ba2430b7323632b960b11b6020808301919091526001600160601b0319606087811b8216602a85015286901b16603e83015283151560f81b60528301528251603381840301815260539092019092528051910120611e2181615712565b611e2a816157be565b836001600160a01b0316639cb7de4b84846040518363ffffffff1660e01b815260040180836001600160a01b03168152602001821515815260200192505050600060405180830381600087803b15801561164d57600080fd5b6001546001600160a01b0316331480611eab5750336000908152600b602052604090205460ff165b80611ec55750336000908152600c602052604090205460ff165b611f04576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b816001600160a01b03166330455ede826040518263ffffffff1660e01b8152600401808215158152602001915050600060405180830381600087803b1580156116fe57600080fd5b6001546001600160a01b03163314611f99576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600b60205260409020805460ff1916911515919091179055565b6001546001600160a01b0316331480611fec5750336000908152600b602052604090205460ff165b806120065750336000908152600c602052604090205460ff165b612045576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b826001600160a01b031663dfcfa25083836040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050600060405180830381600087803b15801561136c57600080fd5b6001546001600160a01b031633146120e9576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516c3bb4ba34323930bbaa37b5b2b760991b6020808301919091526001600160601b0319606088811b8216602d85015287811b8216604185015286901b1660558301526069808301859052835180840390910181526089909201909252805191012061215781615712565b612160816157be565b846001600160a01b03166301e336678585856040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b1580156121c857600080fd5b505af11580156121dc573d6000803e3d6000fd5b505050505050505050565b6001546001600160a01b03163314612234576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b816001600160a01b031663f07bbf77826040518263ffffffff1660e01b8152600401808215158152602001915050600060405180830381600087803b1580156116fe57600080fd5b6001546001600160a01b03163314806122a45750336000908152600b602052604090205460ff165b806122be5750336000908152600c602052604090205460ff165b6122fd576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60c8821061233c5760405162461bcd60e51b8152600401808060200182810382526024815260200180615b926024913960400191505060405180910390fd5b60c8811061237b5760405162461bcd60e51b815260040180806020018281038252602a815260200180615ca7602a913960400191505060405180910390fd5b836001600160a01b0316638a27d4688484846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b15801561164d57600080fd5b60095460ff1681565b6001546001600160a01b03163314612427576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516939b2ba2430b7323632b960b11b6020808301919091526001600160601b0319606087811b8216602a85015286901b16603e83015283151560f81b6052830152825160338184030181526053909201909252805191012061248b8161566e565b604080516001600160a01b03808716825285166020820152831515818301526060810183905290517f1929c4e13b0dbbad7856b9ce1fc9dca98c7bf7cedd56e22c04dd60ad1d34fe4b9181900360800190a150505050565b6001546001600160a01b03163314612530576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b816001600160a01b0316631785f53c826040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156116fe57600080fd5b6002546001600160a01b031681565b6207a12081565b60075481565b600b6020526000908152604090205460ff1681565b6001546001600160a01b031633146125fd576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b826001600160a01b0316634453a37483836040518363ffffffff1660e01b815260040180836001600160a01b03168152602001821515815260200192505050600060405180830381600087803b15801561136c57600080fd5b6001546001600160a01b031633146126a3576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516c3bb4ba34323930bbaa37b5b2b760991b6020808301919091526001600160601b0319606088811b8216602d85015287811b8216604185015286901b166055830152606980830185905283518084039091018152608990920190925280519101206127118161566e565b604080516001600160a01b0380881682528087166020830152851681830152606081018490526080810183905290517f9ed7b0f07a9eed51079fab67f6d0f141f167f5b17fdb5a23282280e15fcafed39181900360a00190a15050505050565b6001546001600160a01b031633146127be576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60048054604080516327afb5af60e11b8152928301849052516001600160a01b0390911691634f5f6b5e91602480830192600092919082900301818387803b15801561280957600080fd5b505af1158015611d69573d6000803e3d6000fd5b60065481565b6001546001600160a01b03163314612870576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516539b2ba23b7bb60d11b6020808301919091526001600160601b0319606086811b8216602685015285901b16603a8301528251602e818403018152604e90920190925280519101206128c581615712565b6128ce816157be565b826001600160a01b031663cfad57a2836040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b15801561136c57600080fd5b6001546001600160a01b03163314806129455750336000908152600b602052604090205460ff165b8061295f5750336000908152600c602052604090205460ff165b61299e576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b836001600160a01b031663836a01878484846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b15801561164d57600080fd5b6001546001600160a01b03163314612a41576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6001600160a01b038216301415612a9b576040805162461bcd60e51b8152602060048201526019602482015278151a5b595b1bd8dace881a5b9d985b1a590817dd185c99d95d603a1b604482015290519081900360640190fd5b816001600160a01b031663704b6c02826040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156116fe57600080fd5b6005546001600160a01b031681565b6206978081565b600c6020526000908152604090205460ff1681565b6001546001600160a01b0316331480612b3d5750336000908152600b602052604090205460ff165b612b7c576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b600954819060ff1615612bea5760408051637c2eb9f760e01b81526001600482015290516001600160a01b03831691637c2eb9f791602480830192600092919082900301818387803b158015612bd157600080fd5b505af1158015612be5573d6000803e3d6000fd5b505050505b806001600160a01b03166340eb3802826001600160a01b0316637a210a2b6040518163ffffffff1660e01b815260040160206040518083038186803b158015612c3257600080fd5b505afa158015612c46573d6000803e3d6000fd5b505050506040513d6020811015612c5c57600080fd5b505160408051630875ab6160e11b815290516001600160a01b038616916310eb56c2916004808301926020929190829003018186803b158015612c9e57600080fd5b505afa158015612cb2573d6000803e3d6000fd5b505050506040513d6020811015612cc857600080fd5b505160408051631351ecc160e21b815290516001600160a01b03871691634d47b304916004808301926020929190829003018186803b158015612d0a57600080fd5b505afa158015612d1e573d6000803e3d6000fd5b505050506040513d6020811015612d3457600080fd5b50516040805163511791c960e11b815290516001600160a01b0388169163a22f2392916004808301926020929190829003018186803b158015612d7657600080fd5b505afa158015612d8a573d6000803e3d6000fd5b505050506040513d6020811015612da057600080fd5b50516040805163df73a26760e01b815290516001600160a01b0389169163df73a267916004808301926020929190829003018186803b158015612de257600080fd5b505afa158015612df6573d6000803e3d6000fd5b505050506040513d6020811015612e0c57600080fd5b5051600754604080516305d349a560e21b815290516001600160a01b038b169163174d2694916004808301926020929190829003018186803b158015612e5157600080fd5b505afa158015612e65573d6000803e3d6000fd5b505050506040513d6020811015612e7b57600080fd5b50516040805163d9ac422560e01b815290516001600160a01b038c169163d9ac4225916004808301926020929190829003018186803b158015612ebd57600080fd5b505afa158015612ed1573d6000803e3d6000fd5b505050506040513d6020811015612ee757600080fd5b505160408051639f392eb360e01b815290516001600160a01b038d1691639f392eb3916004808301926020929190829003018186803b158015612f2957600080fd5b505afa158015612f3d573d6000803e3d6000fd5b505050506040513d6020811015612f5357600080fd5b5051604080516001600160e01b031960e08d901b168152600481019a909a5260248a019890985260448901969096526064880194909452608487019290925260a486015260c485015260e484015215156101048301525161012480830192600092919082900301818387803b1580156116fe57600080fd5b6001546001600160a01b0316331480612ff35750336000908152600b602052604090205460ff165b8061300d5750336000908152600c602052604090205460ff165b61304c576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6007849055600854604080516320759c0160e11b8152600481018c9052602481018b9052604481018a9052606481018990526084810188905260a481019290925260c4820185905260e48201849052821515610104830152516001600160a01b038c16916340eb38029161012480830192600092919082900301818387803b1580156130d757600080fd5b505af11580156130eb573d6000803e3d6000fd5b5050505050505050505050505050565b6002546001600160a01b03163314613148576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146131b7576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516b1cd95d141c9a58d95199595960a21b6020808301919091526001600160601b0319606086811b8216602c85015285901b1682840152825160348184030181526054909201909252805191012061321181615712565b61321a816157be565b826001600160a01b031663724e78da836040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b15801561136c57600080fd5b6001546001600160a01b031633146132b6576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6132bf816157be565b50565b6001546001600160a01b0316331461330f576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6207a120811015613367576040805162461bcd60e51b815260206004820152601e60248201527f54696d656c6f636b3a20696e76616c6964205f6d61784c657665726167650000604482015290519081900360640190fd5b816001600160a01b031663d3127e63826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156116fe57600080fd5b6001546001600160a01b031633146133fa576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516b1cd95d141c9a58d95199595960a21b6020808301919091526001600160601b0319606086811b8216602c85015285901b168284015282516034818403018152605490920190925280519101206134548161566e565b604080516001600160a01b0380861682528416602082015280820183905290517fb878dd4b5762f4118ad54995be907dd2bcd915d942e4ac75580fba9b4ee4727f9181900360600190a1505050565b6001546001600160a01b031633146134f0576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b816001600160a01b0316635a47a1a7826040518263ffffffff1660e01b8152600401808215158152602001915050600060405180830381600087803b1580156116fe57600080fd5b6001546001600160a01b03163314613585576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516972656465656d5573646b60b01b6020808301919091526001600160601b0319606087811b8216602a85015286901b16603e830152605280830185905283518084039091018152607290920190925280519101206135e68161566e565b604080516001600160a01b0380871682528516602082015280820184905290517f5e43c563d1cb397f16aadf161baf1ab13e3008176aea8402e6501419ea2086e29181900360600190a150505050565b60c881565b6001546001600160a01b03163314613688576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b64012a05f20081116136d8576040805162461bcd60e51b8152602060048201526014602482015273496e76616c6964205f6d6178476173507269636560601b604482015290519081900360640190fd5b816001600160a01b031663d2fa635e826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156116fe57600080fd5b6001546001600160a01b03163314806137465750336000908152600b602052604090205460ff165b613785576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6009805460ff1916911515919091179055565b68327cb2734119d3b7a9601e1b81565b6001546001600160a01b031633146137f5576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516539b2ba23b7bb60d11b6020808301919091526001600160601b0319606086811b8216602685015285901b16603a8301528251602e818403018152604e909201909252805191012061384a8161566e565b604080516001600160a01b0380861682528416602082015280820183905290517f2701a94fd55a560e291f3c54d36580040670d6fde558a77a75d619e38139f7139181900360600190a1505050565b60085481565b6001546001600160a01b03163314806138c75750336000908152600b602052604090205460ff165b806138e15750336000908152600c602052604090205460ff165b613920576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6000600460009054906101000a90046001600160a01b03166001600160a01b031663d858b2456040518163ffffffff1660e01b815260040160206040518083038186803b15801561397057600080fd5b505afa158015613984573d6000803e3d6000fd5b505050506040513d602081101561399a57600080fd5b505160048054604080516370a0823160e01b81526001600160a01b039283169381019390935251929350600092908416916370a08231916024808301926020929190829003018186803b1580156139f057600080fd5b505afa158015613a04573d6000803e3d6000fd5b505050506040513d6020811015613a1a57600080fd5b5051604080516312b5ad0160e11b815230600482015290519192506001600160a01b0384169163256b5a029160248082019260009290919082900301818387803b158015613a6757600080fd5b505af1158015613a7b573d6000803e3d6000fd5b5050505080831115613b0a576000613a938483615863565b60048054604080516340c10f1960e01b81526001600160a01b039283169381019390935260248301849052519293508516916340c10f199160448082019260009290919082900301818387803b158015613aec57600080fd5b505af1158015613b00573d6000803e3d6000fd5b5050505050613b89565b6000613b168285615863565b6004805460408051632770a7eb60e21b81526001600160a01b03928316938101939093526024830184905251929350851691639dc29fac9160448082019260009290919082900301818387803b158015613b6f57600080fd5b505af1158015613b83573d6000803e3d6000fd5b50505050505b6040805163ceb68c2360e01b815230600482015290516001600160a01b0384169163ceb68c2391602480830192600092919082900301818387803b15801561136c57600080fd5b6001546001600160a01b03163314613c1d576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b62069780811115613c71576040805162461bcd60e51b81526020600482015260196024820152782a34b6b2b637b1b59d1034b73b30b634b2102fb13ab33332b960391b604482015290519081900360640190fd5b6000548111613cb15760405162461bcd60e51b8152600401808060200182810382526024815260200180615c426024913960400191505060405180910390fd5b600055565b6001546001600160a01b03163314613d03576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60055460408051636ca75e7960e01b815290516001600160a01b03909216918291636ca75e79916004808301926020929190829003018186803b158015613d4957600080fd5b505afa158015613d5d573d6000803e3d6000fd5b505050506040513d6020811015613d7357600080fd5b505160055460408051639cb7de4b60e01b81526001600160a01b0392831660048201526001602482015290519190921691639cb7de4b91604480830192600092919082900301818387803b158015613dca57600080fd5b505af1158015613dde573d6000803e3d6000fd5b50505050806001600160a01b031663a42c59236040518163ffffffff1660e01b815260040160206040518083038186803b158015613e1b57600080fd5b505afa158015613e2f573d6000803e3d6000fd5b505050506040513d6020811015613e4557600080fd5b505160055460408051639cb7de4b60e01b81526001600160a01b0392831660048201526001602482015290519190921691639cb7de4b91604480830192600092919082900301818387803b158015613e9c57600080fd5b505af1158015613eb0573d6000803e3d6000fd5b50506004805460055460408051639cb7de4b60e01b81526001600160a01b0392831694810194909452600160248501525191169350639cb7de4b9250604480830192600092919082900301818387803b15801561280957600080fd5b6001546001600160a01b03163314613f59576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b816001600160a01b03166371089f4d826040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156116fe57600080fd5b6001546001600160a01b03163314613ff5576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60408051631b5a5b9d60e21b6020808301919091526001600160601b0319606087811b8216602485015286901b166038830152604c80830185905283518084039091018152606c909201909252805191012061405081615712565b614059816157be565b6140648484846158ac565b50505050565b6001546001600160a01b03163314806140925750336000908152600b602052604090205460ff165b806140ac5750336000908152600c602052604090205460ff165b6140eb576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b826001600160a01b0316633fb8b32383836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561136c57600080fd5b6003546001600160a01b031681565b6004546001600160a01b031681565b6001546001600160a01b03163314806141885750336000908152600b602052604090205460ff165b6141c7576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b816001600160a01b0316637c2eb9f7826040518263ffffffff1660e01b8152600401808215158152602001915050600060405180830381600087803b1580156116fe57600080fd5b6001546001600160a01b0316331461425c576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600c60205260409020805460ff1916911515919091179055565b6001546001600160a01b03163314806142af5750336000908152600b602052604090205460ff165b6142ee576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b600954819060ff161561435a5760408051637c2eb9f760e01b815260006004820181905291516001600160a01b03841692637c2eb9f7926024808201939182900301818387803b15801561434157600080fd5b505af1158015614355573d6000803e3d6000fd5b505050505b806001600160a01b03166340eb3802826001600160a01b0316637a210a2b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156143a257600080fd5b505afa1580156143b6573d6000803e3d6000fd5b505050506040513d60208110156143cc57600080fd5b505160408051630875ab6160e11b815290516001600160a01b038616916310eb56c2916004808301926020929190829003018186803b15801561440e57600080fd5b505afa158015614422573d6000803e3d6000fd5b505050506040513d602081101561443857600080fd5b505160408051631351ecc160e21b815290516001600160a01b03871691634d47b304916004808301926020929190829003018186803b15801561447a57600080fd5b505afa15801561448e573d6000803e3d6000fd5b505050506040513d60208110156144a457600080fd5b50516040805163511791c960e11b815290516001600160a01b0388169163a22f2392916004808301926020929190829003018186803b1580156144e657600080fd5b505afa1580156144fa573d6000803e3d6000fd5b505050506040513d602081101561451057600080fd5b50516040805163df73a26760e01b815290516001600160a01b0389169163df73a267916004808301926020929190829003018186803b15801561455257600080fd5b505afa158015614566573d6000803e3d6000fd5b505050506040513d602081101561457c57600080fd5b5051600854604080516305d349a560e21b815290516001600160a01b038b169163174d2694916004808301926020929190829003018186803b158015612e5157600080fd5b6001546001600160a01b03163314806145e95750336000908152600b602052604090205460ff165b806146035750336000908152600c602052604090205460ff165b614642576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6000869050806001600160a01b03166340eb38028787878787600854886001600160a01b031663174d26946040518163ffffffff1660e01b815260040160206040518083038186803b15801561469757600080fd5b505afa1580156146ab573d6000803e3d6000fd5b505050506040513d60208110156146c157600080fd5b50516040805163d9ac422560e01b815290516001600160a01b038c169163d9ac4225916004808301926020929190829003018186803b15801561470357600080fd5b505afa158015614717573d6000803e3d6000fd5b505050506040513d602081101561472d57600080fd5b505160408051639f392eb360e01b815290516001600160a01b038d1691639f392eb3916004808301926020929190829003018186803b15801561476f57600080fd5b505afa158015614783573d6000803e3d6000fd5b505050506040513d602081101561479957600080fd5b5051604080516001600160e01b031960e08d901b168152600481019a909a5260248a019890985260448901969096526064880194909452608487019290925260a486015260c485015260e484015215156101048301525161012480830192600092919082900301818387803b15801561481157600080fd5b505af1158015614825573d6000803e3d6000fd5b5050505050505050505050565b6001546001600160a01b0316331461487f576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60408051727661756c74536574546f6b656e436f6e66696760681b6020808301919091526001600160601b031960608c811b821660338501528b901b166047830152605b8201899052607b8201889052609b820187905260bb820186905284151560f890811b60db840152841515901b60dc830152825160bd81840301815260dd90920190925280519101206149148161566e565b604080516001600160a01b03808c1682528a166020820152808201899052606081018890526080810187905260a0810186905284151560c082015283151560e082015290517f3510e9d8245371c6c1061c33781ce16bd0eafa03cd3d0781865036520af4c743918190036101000190a1505050505050505050565b6001546001600160a01b031633146149dc576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6040805166617070726f766560c81b6020808301919091526001600160601b0319606087811b8216602785015286901b16603b830152604f80830185905283518084039091018152606f9092019092528051910120614a3a8161566e565b604080516001600160a01b038087168252851660208201528082018490526060810183905290517f6af9d86ba7407a934e941ed8ae5f779369a88fe8ba2cd1c204185d6f8a8287fd9181900360800190a150505050565b6001546001600160a01b03163314614ade576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b826001600160a01b031663efa10a6e83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561136c57600080fd5b6001546001600160a01b03163314614b82576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516972656465656d5573646b60b01b6020808301919091526001600160601b0319606087811b8216602a85015286901b16603e83015260528083018590528351808403909101815260729092019092528051910120614be381615712565b614bec816157be565b6000846001600160a01b031663d858b2456040518163ffffffff1660e01b815260040160206040518083038186803b158015614c2757600080fd5b505afa158015614c3b573d6000803e3d6000fd5b505050506040513d6020811015614c5157600080fd5b5051604080516352f4877760e11b81523060048201526001602482015290519192506001600160a01b0387169163a5e90eee9160448082019260009290919082900301818387803b158015614ca557600080fd5b505af1158015614cb9573d6000803e3d6000fd5b5050604080516312b5ad0160e11b815230600482015290516001600160a01b038516935063256b5a029250602480830192600092919082900301818387803b158015614d0457600080fd5b505af1158015614d18573d6000803e3d6000fd5b5050604080516340c10f1960e01b81523060048201526024810187905290516001600160a01b03851693506340c10f199250604480830192600092919082900301818387803b158015614d6a57600080fd5b505af1158015614d7e573d6000803e3d6000fd5b50505050806001600160a01b031663a9059cbb86856040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015614dd957600080fd5b505af1158015614ded573d6000803e3d6000fd5b505050506040513d6020811015614e0357600080fd5b50506003546040805163a1155c4960e01b81526001600160a01b038781166004830152928316602482015290519187169163a1155c49916044808201926020929091908290030181600087803b158015614e5c57600080fd5b505af1158015614e70573d6000803e3d6000fd5b505050506040513d6020811015614e8657600080fd5b5050604080516352f4877760e11b815230600482015260006024820181905291516001600160a01b0388169263a5e90eee926044808201939182900301818387803b158015614ed457600080fd5b505af1158015614ee8573d6000803e3d6000fd5b50506040805163ceb68c2360e01b815230600482015290516001600160a01b038516935063ceb68c239250602480830192600092919082900301818387803b1580156121c857600080fd5b6001546001600160a01b03163314614f80576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b6040805166617070726f766560c81b6020808301919091526001600160601b0319606087811b8216602785015286901b16603b830152604f80830185905283518084039091018152606f9092019092528051910120614fde81615712565b614fe7816157be565b836001600160a01b031663095ea7b384846040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561503e57600080fd5b505af1158015615052573d6000803e3d6000fd5b505050506040513d602081101561171257600080fd5b6001546001600160a01b03163314806150905750336000908152600b602052604090205460ff165b6150cf576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b600791909155600855565b600a6020526000908152604090205481565b6001546001600160a01b03163314615139576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60408051727661756c74536574546f6b656e436f6e66696760681b6020808301919091526001600160601b031960608c811b821660338501528b901b166047830152605b8201899052607b8201889052609b820187905260bb820186905284151560f890811b60db840152841515901b60dc830152825160bd81840301815260dd90920190925280519101206151ce81615712565b6151d7816157be565b60408051633c5a6e3560e01b81526001600160a01b038a81166004830152602482018a905260448201899052606482018890526084820187905285151560a483015284151560c48301529151918b1691633c5a6e359160e48082019260009290919082900301818387803b15801561524e57600080fd5b505af1158015615262573d6000803e3d6000fd5b50505050505050505050505050565b6001546001600160a01b031633146152be576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b604080516323b872dd60e01b81526001600160a01b038581166004830152306024830152604482018490529151918416916323b872dd916064808201926020929091908290030181600087803b158015611d3f57600080fd5b6001546001600160a01b031633148061533f5750336000908152600b602052604090205460ff165b806153595750336000908152600c602052604090205460ff165b615398576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60005b815181101561544e57826001600160a01b031663f25552788383815181106153bf57fe5b602090810291909101810151600154604080516001600160e01b031960e087901b1681526001600160a01b03938416600482015292909116602483015251604480830193928290030181600087803b15801561541a57600080fd5b505af115801561542e573d6000803e3d6000fd5b505050506040513d602081101561544457600080fd5b505060010161539b565b505050565b60005481565b6001546001600160a01b031681565b6001546001600160a01b03163314806154905750336000908152600b602052604090205460ff165b806154aa5750336000908152600c602052604090205460ff165b6154e9576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b60005b825181101561406457836001600160a01b03166399da72cc84838151811061551057fe5b602002602001015184848151811061552457fe5b60200260200101516040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561557257600080fd5b505af1158015615586573d6000803e3d6000fd5b5050600190920191506154ec9050565b6001546001600160a01b031633146155e3576040805162461bcd60e51b81526020600482015260136024820152600080516020615c66833981519152604482015290519081900360640190fd5b611c2081106156235760405162461bcd60e51b8152600401808060200182810382526023815260200180615bb66023913960400191505060405180910390fd5b600480546040805163966be07560e01b8152928301849052516001600160a01b039091169163966be07591602480830192600092919082900301818387803b15801561280957600080fd5b6000818152600a6020526040902054156156b95760405162461bcd60e51b8152600401808060200182810382526022815260200180615bd96022913960400191505060405180910390fd5b6000546156c7904290615aa2565b6000828152600a602090815260409182902092909255805183815290517f5fb9c0ecf7b4a28c4c480212e868f9da7f373a2ed4d23498b0be6aadf35242fb929181900390910190a150565b6000818152600a6020526040902054615772576040805162461bcd60e51b815260206004820152601e60248201527f54696d656c6f636b3a20616374696f6e206e6f74207369676e616c6c65640000604482015290519081900360640190fd5b6000818152600a602052604090205442116132bf5760405162461bcd60e51b8152600401808060200182810382526024815260200180615c1e6024913960400191505060405180910390fd5b6000818152600a602052604090205461581a576040805162461bcd60e51b81526020600482015260196024820152782a34b6b2b637b1b59d1034b73b30b634b2102fb0b1ba34b7b760391b604482015290519081900360640190fd5b6000818152600a6020908152604080832092909255815183815291517f194ed6dd5e37e2acc44a19455c3f208c4831ee695fe362d9c4ef2d316bc53aec9281900390910190a150565b60006158a583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250615afa565b9392505050565b604080516355138f0d60e11b8152306004820152905184916001600160a01b0383169163aa271e1a916024808201926020929091908290030181600087803b1580156158f757600080fd5b505af115801561590b573d6000803e3d6000fd5b505050506040513d602081101561592157600080fd5b505161598e576040805163cf456ae760e01b81523060048201526001602482015290516001600160a01b0383169163cf456ae791604480830192600092919082900301818387803b15801561597557600080fd5b505af1158015615989573d6000803e3d6000fd5b505050505b806001600160a01b03166340c10f1984846040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156159e557600080fd5b505af11580156159f9573d6000803e3d6000fd5b50505050600654846001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015615a3957600080fd5b505afa158015615a4d573d6000803e3d6000fd5b505050506040513d6020811015615a6357600080fd5b505111156140645760405162461bcd60e51b8152600401808060200182810382526021815260200180615c866021913960400191505060405180910390fd5b6000828201838110156158a5576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b60008184841115615b895760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015615b4e578181015183820152602001615b36565b50505050905090810190601f168015615b7b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505090039056fe54696d656c6f636b3a20696e76616c6964205f66756e64696e6752617465466163746f7254696d656c6f636b3a20696e76616c6964205f636f6f6c646f776e4475726174696f6e54696d656c6f636b3a20616374696f6e20616c7265616479207369676e616c6c656454696d656c6f636b3a20746f6b656e206e6f74207965742077686974656c697374656454696d656c6f636b3a20616374696f6e2074696d65206e6f74207965742070617373656454696d656c6f636b3a206275666665722063616e6e6f742062652064656372656173656454696d656c6f636b3a20666f7262696464656e0000000000000000000000000054696d656c6f636b3a206d6178546f6b656e537570706c7920657863656564656454696d656c6f636b3a20696e76616c6964205f737461626c6546756e64696e6752617465466163746f72a26469706673582212209d202c54077518d5d4948c87fda7c68629f16ba49d1daf5bacf32b864f279bd664736f6c634300060c0033