Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- FastPriceFeed
- Optimization enabled
- true
- Compiler version
- v0.6.12+commit.27d51765
- Optimization runs
- 16
- Verified at
- 2023-07-04T11:09:28.107561Z
Constructor Arguments
000000000000000000000000000000000000000000000000000000000000012c0000000000000000000000000000000000000000000000000000000000000e10000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000af0f3e675bb15f506cbd560dbbe18f67b16c8c510000000000000000000000002a079157d67d0057aa16f774049e18b02ee05fe1000000000000000000000000257901ce646a7a6aa6af13226b2a5bf6a634bb33
Arg [0] (uint256) : 300
Arg [1] (uint256) : 3600
Arg [2] (uint256) : 1
Arg [3] (uint256) : 250
Arg [4] (address) : 0xaf0f3e675bb15f506cbd560dbbe18f67b16c8c51
Arg [5] (address) : 0x2a079157d67d0057aa16f774049e18b02ee05fe1
Arg [6] (address) : 0x257901ce646a7a6aa6af13226b2a5bf6a634bb33
contracts/oracle/FastPriceFeed.sol
// SPDX-License-Identifier: MIT import "../libraries/math/SafeMath.sol"; import "./interfaces/ISecondaryPriceFeed.sol"; import "./interfaces/IFastPriceFeed.sol"; import "./interfaces/IFastPriceEvents.sol"; import "../core/interfaces/IVaultPriceFeed.sol"; import "../core/interfaces/IPositionRouter.sol"; import "../access/Governable.sol"; pragma solidity 0.6.12; contract FastPriceFeed is ISecondaryPriceFeed, IFastPriceFeed, Governable { using SafeMath for uint256; // fit data in a uint256 slot to save gas costs struct PriceDataItem { uint160 refPrice; // Chainlink price uint32 refTime; // last updated at time uint32 cumulativeRefDelta; // cumulative Chainlink price delta uint32 cumulativeFastDelta; // cumulative fast price delta } uint256 public constant PRICE_PRECISION = 10 ** 30; uint256 public constant CUMULATIVE_DELTA_PRECISION = 10 * 1000 * 1000; uint256 public constant MAX_REF_PRICE = type(uint160).max; uint256 public constant MAX_CUMULATIVE_REF_DELTA = type(uint32).max; uint256 public constant MAX_CUMULATIVE_FAST_DELTA = type(uint32).max; // uint256(~0) is 256 bits of 1s // shift the 1s by (256 - 32) to get (256 - 32) 0s followed by 32 1s uint256 constant public BITMASK_32 = uint256(~0) >> (256 - 32); uint256 public constant BASIS_POINTS_DIVISOR = 10000; uint256 public constant MAX_PRICE_DURATION = 30 minutes; bool public isInitialized; bool public isSpreadEnabled = false; address public vaultPriceFeed; address public fastPriceEvents; address public tokenManager; address public positionRouter; uint256 public override lastUpdatedAt; uint256 public override lastUpdatedBlock; uint256 public priceDuration; uint256 public maxPriceUpdateDelay; uint256 public spreadBasisPointsIfInactive; uint256 public spreadBasisPointsIfChainError; uint256 public minBlockInterval; uint256 public maxTimeDeviation; uint256 public priceDataInterval; // allowed deviation from primary price uint256 public maxDeviationBasisPoints; uint256 public minAuthorizations; uint256 public disableFastPriceVoteCount = 0; mapping (address => bool) public isUpdater; mapping (address => uint256) public prices; mapping (address => PriceDataItem) public priceData; mapping (address => uint256) public maxCumulativeDeltaDiffs; mapping (address => bool) public isSigner; mapping (address => bool) public disableFastPriceVotes; // array of tokens used in setCompactedPrices, saves L1 calldata gas costs address[] imported.tokens; // array of tokenPrecisions used in setCompactedPrices, saves L1 calldata gas costs // if the token price will be sent with 3 decimals, then tokenPrecision for that token // should be 10 ** 3 uint256[] public tokenPrecisions; event DisableFastPrice(address signer); event EnableFastPrice(address signer); event PriceData(address token, uint256 refPrice, uint256 fastPrice, uint256 cumulativeRefDelta, uint256 cumulativeFastDelta); event MaxCumulativeDeltaDiffExceeded(address token, uint256 refPrice, uint256 fastPrice, uint256 cumulativeRefDelta, uint256 cumulativeFastDelta); modifier onlySigner() { require(isSigner[msg.sender], "FastPriceFeed: forbidden"); _; } modifier onlyUpdater() { require(isUpdater[msg.sender], "FastPriceFeed: forbidden"); _; } modifier onlyTokenManager() { require(msg.sender == tokenManager, "FastPriceFeed: forbidden"); _; } constructor( uint256 _priceDuration, uint256 _maxPriceUpdateDelay, uint256 _minBlockInterval, uint256 _maxDeviationBasisPoints, address _fastPriceEvents, address _tokenManager, address _positionRouter ) public { require(_priceDuration <= MAX_PRICE_DURATION, "FastPriceFeed: invalid _priceDuration"); priceDuration = _priceDuration; maxPriceUpdateDelay = _maxPriceUpdateDelay; minBlockInterval = _minBlockInterval; maxDeviationBasisPoints = _maxDeviationBasisPoints; fastPriceEvents = _fastPriceEvents; tokenManager = _tokenManager; positionRouter = _positionRouter; } function initialize(uint256 _minAuthorizations, address[] memory _signers, address[] memory _updaters) public onlyGov { require(!isInitialized, "FastPriceFeed: already initialized"); isInitialized = true; minAuthorizations = _minAuthorizations; for (uint256 i = 0; i < _signers.length; i++) { address signer = _signers[i]; isSigner[signer] = true; } for (uint256 i = 0; i < _updaters.length; i++) { address updater = _updaters[i]; isUpdater[updater] = true; } } function setSigner(address _account, bool _isActive) external override onlyGov { isSigner[_account] = _isActive; } function setUpdater(address _account, bool _isActive) external override onlyGov { isUpdater[_account] = _isActive; } function setFastPriceEvents(address _fastPriceEvents) external onlyGov { fastPriceEvents = _fastPriceEvents; } function setVaultPriceFeed(address _vaultPriceFeed) external override onlyGov { vaultPriceFeed = _vaultPriceFeed; } function setMaxTimeDeviation(uint256 _maxTimeDeviation) external onlyGov { maxTimeDeviation = _maxTimeDeviation; } function setPriceDuration(uint256 _priceDuration) external override onlyGov { require(_priceDuration <= MAX_PRICE_DURATION, "FastPriceFeed: invalid _priceDuration"); priceDuration = _priceDuration; } function setMaxPriceUpdateDelay(uint256 _maxPriceUpdateDelay) external override onlyGov { maxPriceUpdateDelay = _maxPriceUpdateDelay; } function setSpreadBasisPointsIfInactive(uint256 _spreadBasisPointsIfInactive) external override onlyGov { spreadBasisPointsIfInactive = _spreadBasisPointsIfInactive; } function setSpreadBasisPointsIfChainError(uint256 _spreadBasisPointsIfChainError) external override onlyGov { spreadBasisPointsIfChainError = _spreadBasisPointsIfChainError; } function setMinBlockInterval(uint256 _minBlockInterval) external override onlyGov { minBlockInterval = _minBlockInterval; } function setIsSpreadEnabled(bool _isSpreadEnabled) external override onlyGov { isSpreadEnabled = _isSpreadEnabled; } function setLastUpdatedAt(uint256 _lastUpdatedAt) external onlyGov { lastUpdatedAt = _lastUpdatedAt; } function setTokenManager(address _tokenManager) external onlyTokenManager { tokenManager = _tokenManager; } function setMaxDeviationBasisPoints(uint256 _maxDeviationBasisPoints) external override onlyTokenManager { maxDeviationBasisPoints = _maxDeviationBasisPoints; } function setMaxCumulativeDeltaDiffs(address[] memory _tokens, uint256[] memory _maxCumulativeDeltaDiffs) external override onlyTokenManager { for (uint256 i = 0; i < _tokens.length; i++) { address token = _tokens[i]; maxCumulativeDeltaDiffs[token] = _maxCumulativeDeltaDiffs[i]; } } function setPriceDataInterval(uint256 _priceDataInterval) external override onlyTokenManager { priceDataInterval = _priceDataInterval; } function setMinAuthorizations(uint256 _minAuthorizations) external onlyTokenManager { minAuthorizations = _minAuthorizations; } function setTokens(address[] memory _tokens, uint256[] memory _tokenPrecisions) external onlyGov { require(_tokens.length == _tokenPrecisions.length, "FastPriceFeed: invalid lengths"); tokens = _tokens; tokenPrecisions = _tokenPrecisions; } function setPrices(address[] memory _tokens, uint256[] memory _prices, uint256 _timestamp) external onlyUpdater { bool shouldUpdate = _setLastUpdatedValues(_timestamp); if (shouldUpdate) { address _fastPriceEvents = fastPriceEvents; address _vaultPriceFeed = vaultPriceFeed; for (uint256 i = 0; i < _tokens.length; i++) { address token = _tokens[i]; _setPrice(token, _prices[i], _vaultPriceFeed, _fastPriceEvents); } } } function setCompactedPrices(uint256[] memory _priceBitArray, uint256 _timestamp) external onlyUpdater { bool shouldUpdate = _setLastUpdatedValues(_timestamp); if (shouldUpdate) { address _fastPriceEvents = fastPriceEvents; address _vaultPriceFeed = vaultPriceFeed; for (uint256 i = 0; i < _priceBitArray.length; i++) { uint256 priceBits = _priceBitArray[i]; for (uint256 j = 0; j < 8; j++) { uint256 index = i * 8 + j; if (index >= tokens.length) { return; } uint256 startBit = 32 * j; uint256 price = (priceBits >> startBit) & BITMASK_32; address token = tokens[i * 8 + j]; uint256 tokenPrecision = tokenPrecisions[i * 8 + j]; uint256 adjustedPrice = price.mul(PRICE_PRECISION).div(tokenPrecision); _setPrice(token, adjustedPrice, _vaultPriceFeed, _fastPriceEvents); } } } } function setPricesWithBits(uint256 _priceBits, uint256 _timestamp) external onlyUpdater { _setPricesWithBits(_priceBits, _timestamp); } function setPricesWithBitsAndExecute( uint256 _priceBits, uint256 _timestamp, uint256 _endIndexForIncreasePositions, uint256 _endIndexForDecreasePositions, uint256 _maxIncreasePositions, uint256 _maxDecreasePositions ) external onlyUpdater { _setPricesWithBits(_priceBits, _timestamp); IPositionRouter _positionRouter = IPositionRouter(positionRouter); uint256 maxEndIndexForIncrease = _positionRouter.increasePositionRequestKeysStart().add(_maxIncreasePositions); uint256 maxEndIndexForDecrease = _positionRouter.decreasePositionRequestKeysStart().add(_maxDecreasePositions); if (_endIndexForIncreasePositions > maxEndIndexForIncrease) { _endIndexForIncreasePositions = maxEndIndexForIncrease; } if (_endIndexForDecreasePositions > maxEndIndexForDecrease) { _endIndexForDecreasePositions = maxEndIndexForDecrease; } _positionRouter.executeIncreasePositions(_endIndexForIncreasePositions, payable(msg.sender)); _positionRouter.executeDecreasePositions(_endIndexForDecreasePositions, payable(msg.sender)); } function disableFastPrice() external onlySigner { require(!disableFastPriceVotes[msg.sender], "FastPriceFeed: already voted"); disableFastPriceVotes[msg.sender] = true; disableFastPriceVoteCount = disableFastPriceVoteCount.add(1); emit DisableFastPrice(msg.sender); } function enableFastPrice() external onlySigner { require(disableFastPriceVotes[msg.sender], "FastPriceFeed: already enabled"); disableFastPriceVotes[msg.sender] = false; disableFastPriceVoteCount = disableFastPriceVoteCount.sub(1); emit EnableFastPrice(msg.sender); } // under regular operation, the fastPrice (prices[token]) is returned and there is no spread returned from this function, // though VaultPriceFeed might apply its own spread // // if the fastPrice has not been updated within priceDuration then it is ignored and only _refPrice with a spread is used (spread: spreadBasisPointsIfInactive) // in case the fastPrice has not been updated for maxPriceUpdateDelay then the _refPrice with a larger spread is used (spread: spreadBasisPointsIfChainError) // // there will be a spread from the _refPrice to the fastPrice in the following cases: // - in case isSpreadEnabled is set to true // - in case the maxDeviationBasisPoints between _refPrice and fastPrice is exceeded // - in case watchers flag an issue // - in case the cumulativeFastDelta exceeds the cumulativeRefDelta by the maxCumulativeDeltaDiff function getPrice(address _token, uint256 _refPrice, bool _maximise) external override view returns (uint256) { if (block.timestamp > lastUpdatedAt.add(maxPriceUpdateDelay)) { if (_maximise) { return _refPrice.mul(BASIS_POINTS_DIVISOR.add(spreadBasisPointsIfChainError)).div(BASIS_POINTS_DIVISOR); } return _refPrice.mul(BASIS_POINTS_DIVISOR.sub(spreadBasisPointsIfChainError)).div(BASIS_POINTS_DIVISOR); } if (block.timestamp > lastUpdatedAt.add(priceDuration)) { if (_maximise) { return _refPrice.mul(BASIS_POINTS_DIVISOR.add(spreadBasisPointsIfInactive)).div(BASIS_POINTS_DIVISOR); } return _refPrice.mul(BASIS_POINTS_DIVISOR.sub(spreadBasisPointsIfInactive)).div(BASIS_POINTS_DIVISOR); } uint256 fastPrice = prices[_token]; if (fastPrice == 0) { return _refPrice; } uint256 diffBasisPoints = _refPrice > fastPrice ? _refPrice.sub(fastPrice) : fastPrice.sub(_refPrice); diffBasisPoints = diffBasisPoints.mul(BASIS_POINTS_DIVISOR).div(_refPrice); // create a spread between the _refPrice and the fastPrice if the maxDeviationBasisPoints is exceeded // or if watchers have flagged an issue with the fast price bool hasSpread = !favorFastPrice(_token) || diffBasisPoints > maxDeviationBasisPoints; if (hasSpread) { // return the higher of the two prices if (_maximise) { return _refPrice > fastPrice ? _refPrice : fastPrice; } // return the lower of the two prices return _refPrice < fastPrice ? _refPrice : fastPrice; } return fastPrice; } function favorFastPrice(address _token) public view returns (bool) { if (isSpreadEnabled) { return false; } if (disableFastPriceVoteCount >= minAuthorizations) { // force a spread if watchers have flagged an issue with the fast price return false; } (/* uint256 prevRefPrice */, /* uint256 refTime */, uint256 cumulativeRefDelta, uint256 cumulativeFastDelta) = getPriceData(_token); if (cumulativeFastDelta > cumulativeRefDelta && cumulativeFastDelta.sub(cumulativeRefDelta) > maxCumulativeDeltaDiffs[_token]) { // force a spread if the cumulative delta for the fast price feed exceeds the cumulative delta // for the Chainlink price feed by the maxCumulativeDeltaDiff allowed return false; } return true; } function getPriceData(address _token) public view returns (uint256, uint256, uint256, uint256) { PriceDataItem memory data = priceData[_token]; return (uint256(data.refPrice), uint256(data.refTime), uint256(data.cumulativeRefDelta), uint256(data.cumulativeFastDelta)); } function _setPricesWithBits(uint256 _priceBits, uint256 _timestamp) private { bool shouldUpdate = _setLastUpdatedValues(_timestamp); if (shouldUpdate) { address _fastPriceEvents = fastPriceEvents; address _vaultPriceFeed = vaultPriceFeed; for (uint256 j = 0; j < 8; j++) { uint256 index = j; if (index >= tokens.length) { return; } uint256 startBit = 32 * j; uint256 price = (_priceBits >> startBit) & BITMASK_32; address token = tokens[j]; uint256 tokenPrecision = tokenPrecisions[j]; uint256 adjustedPrice = price.mul(PRICE_PRECISION).div(tokenPrecision); _setPrice(token, adjustedPrice, _vaultPriceFeed, _fastPriceEvents); } } } function _setPrice(address _token, uint256 _price, address _vaultPriceFeed, address _fastPriceEvents) private { if (_vaultPriceFeed != address(0)) { uint256 refPrice = IVaultPriceFeed(_vaultPriceFeed).getLatestPrimaryPrice(_token); uint256 fastPrice = prices[_token]; (uint256 prevRefPrice, uint256 refTime, uint256 cumulativeRefDelta, uint256 cumulativeFastDelta) = getPriceData(_token); if (prevRefPrice > 0) { uint256 refDeltaAmount = refPrice > prevRefPrice ? refPrice.sub(prevRefPrice) : prevRefPrice.sub(refPrice); uint256 fastDeltaAmount = fastPrice > _price ? fastPrice.sub(_price) : _price.sub(fastPrice); // reset cumulative delta values if it is a new time window if (refTime.div(priceDataInterval) != block.timestamp.div(priceDataInterval)) { cumulativeRefDelta = 0; cumulativeFastDelta = 0; } cumulativeRefDelta = cumulativeRefDelta.add(refDeltaAmount.mul(CUMULATIVE_DELTA_PRECISION).div(prevRefPrice)); cumulativeFastDelta = cumulativeFastDelta.add(fastDeltaAmount.mul(CUMULATIVE_DELTA_PRECISION).div(fastPrice)); } if (cumulativeFastDelta > cumulativeRefDelta && cumulativeFastDelta.sub(cumulativeRefDelta) > maxCumulativeDeltaDiffs[_token]) { emit MaxCumulativeDeltaDiffExceeded(_token, refPrice, fastPrice, cumulativeRefDelta, cumulativeFastDelta); } _setPriceData(_token, refPrice, cumulativeRefDelta, cumulativeFastDelta); emit PriceData(_token, refPrice, fastPrice, cumulativeRefDelta, cumulativeFastDelta); } prices[_token] = _price; _emitPriceEvent(_fastPriceEvents, _token, _price); } function _setPriceData(address _token, uint256 _refPrice, uint256 _cumulativeRefDelta, uint256 _cumulativeFastDelta) private { require(_refPrice < MAX_REF_PRICE, "FastPriceFeed: invalid refPrice"); // skip validation of block.timestamp, it should only be out of range after the year 2100 require(_cumulativeRefDelta < MAX_CUMULATIVE_REF_DELTA, "FastPriceFeed: invalid cumulativeRefDelta"); require(_cumulativeFastDelta < MAX_CUMULATIVE_FAST_DELTA, "FastPriceFeed: invalid cumulativeFastDelta"); priceData[_token] = PriceDataItem( uint160(_refPrice), uint32(block.timestamp), uint32(_cumulativeRefDelta), uint32(_cumulativeFastDelta) ); } function _emitPriceEvent(address _fastPriceEvents, address _token, uint256 _price) private { if (_fastPriceEvents == address(0)) { return; } IFastPriceEvents(_fastPriceEvents).emitPriceEvent(_token, _price); } function _setLastUpdatedValues(uint256 _timestamp) private returns (bool) { if (minBlockInterval > 0) { require(block.number.sub(lastUpdatedBlock) >= minBlockInterval, "FastPriceFeed: minBlockInterval not yet passed"); } uint256 _maxTimeDeviation = maxTimeDeviation; require(_timestamp > block.timestamp.sub(_maxTimeDeviation), "FastPriceFeed: _timestamp below allowed range"); require(_timestamp < block.timestamp.add(_maxTimeDeviation), "FastPriceFeed: _timestamp exceeds allowed range"); // do not update prices if _timestamp is before the current lastUpdatedAt value if (_timestamp < lastUpdatedAt) { return false; } lastUpdatedAt = _timestamp; lastUpdatedBlock = block.number; return true; } }
contracts/oracle/interfaces/ISecondaryPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface ISecondaryPriceFeed { function getPrice(address _token, uint256 _referencePrice, bool _maximise) external view returns (uint256); }
contracts/oracle/interfaces/ISecondaryPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface ISecondaryPriceFeed { function getPrice(address _token, uint256 _referencePrice, bool _maximise) external view returns (uint256); }
contracts/access/Governable.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; contract Governable { address public gov; constructor() public { gov = msg.sender; } modifier onlyGov() { require(msg.sender == gov, "Governable: forbidden"); _; } function setGov(address _gov) external onlyGov { gov = _gov; } }
contracts/core/interfaces/IPositionRouter.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IPositionRouter { function increasePositionRequestKeysStart() external returns (uint256); function decreasePositionRequestKeysStart() external returns (uint256); function executeIncreasePositions(uint256 _count, address payable _executionFeeReceiver) external; function executeDecreasePositions(uint256 _count, address payable _executionFeeReceiver) external; }
contracts/oracle/interfaces/IFastPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IFastPriceFeed { function lastUpdatedAt() external view returns (uint256); function lastUpdatedBlock() external view returns (uint256); function setSigner(address _account, bool _isActive) external; function setUpdater(address _account, bool _isActive) external; function setPriceDuration(uint256 _priceDuration) external; function setMaxPriceUpdateDelay(uint256 _maxPriceUpdateDelay) external; function setSpreadBasisPointsIfInactive(uint256 _spreadBasisPointsIfInactive) external; function setSpreadBasisPointsIfChainError(uint256 _spreadBasisPointsIfChainError) external; function setMinBlockInterval(uint256 _minBlockInterval) external; function setIsSpreadEnabled(bool _isSpreadEnabled) external; function setMaxDeviationBasisPoints(uint256 _maxDeviationBasisPoints) external; function setMaxCumulativeDeltaDiffs(address[] memory _tokens, uint256[] memory _maxCumulativeDeltaDiffs) external; function setPriceDataInterval(uint256 _priceDataInterval) external; function setVaultPriceFeed(address _vaultPriceFeed) external; }
contracts/core/interfaces/IVaultPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface IVaultPriceFeed { function adjustmentBasisPoints(address _token) external view returns (uint256); function isAdjustmentAdditive(address _token) external view returns (bool); function setAdjustment(address _token, bool _isAdditive, uint256 _adjustmentBps) external; function setIsSecondaryPriceEnabled(bool _isEnabled) external; function setSpreadBasisPoints(address _token, uint256 _spreadBasisPoints) external; function setSpreadThresholdBasisPoints(uint256 _spreadThresholdBasisPoints) external; function setFavorPrimaryPrice(bool _favorPrimaryPrice) external; function setMaxStrictPriceDeviation(uint256 _maxStrictPriceDeviation) external; function getPrice(address _token, bool _maximise, bool _includeAmmPrice, bool _useSwapPricing) external view returns (uint256); function getLatestPrimaryPrice(address _token) external view returns (uint256); function getPrimaryPrice(address _token, bool _maximise) external view returns (uint256); function setTokenConfig( address _token, bool _isStrictStable, bytes32 _oraclePriceId ) external; function setOracleNetwork( address _oracleNetwork ) external; }
contracts/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/oracle/interfaces/IFastPriceEvents.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IFastPriceEvents { function emitPriceEvent(address _token, uint256 _price) external; }
contracts/access/Governable.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; contract Governable { address public gov; constructor() public { gov = msg.sender; } modifier onlyGov() { require(msg.sender == gov, "Governable: forbidden"); _; } function setGov(address _gov) external onlyGov { gov = _gov; } }
contracts/core/interfaces/IPositionRouter.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IPositionRouter { function increasePositionRequestKeysStart() external returns (uint256); function decreasePositionRequestKeysStart() external returns (uint256); function executeIncreasePositions(uint256 _count, address payable _executionFeeReceiver) external; function executeDecreasePositions(uint256 _count, address payable _executionFeeReceiver) external; }
contracts/oracle/interfaces/IFastPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IFastPriceFeed { function lastUpdatedAt() external view returns (uint256); function lastUpdatedBlock() external view returns (uint256); function setSigner(address _account, bool _isActive) external; function setUpdater(address _account, bool _isActive) external; function setPriceDuration(uint256 _priceDuration) external; function setMaxPriceUpdateDelay(uint256 _maxPriceUpdateDelay) external; function setSpreadBasisPointsIfInactive(uint256 _spreadBasisPointsIfInactive) external; function setSpreadBasisPointsIfChainError(uint256 _spreadBasisPointsIfChainError) external; function setMinBlockInterval(uint256 _minBlockInterval) external; function setIsSpreadEnabled(bool _isSpreadEnabled) external; function setMaxDeviationBasisPoints(uint256 _maxDeviationBasisPoints) external; function setMaxCumulativeDeltaDiffs(address[] memory _tokens, uint256[] memory _maxCumulativeDeltaDiffs) external; function setPriceDataInterval(uint256 _priceDataInterval) external; function setVaultPriceFeed(address _vaultPriceFeed) external; }
contracts/core/interfaces/IVaultPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface IVaultPriceFeed { function adjustmentBasisPoints(address _token) external view returns (uint256); function isAdjustmentAdditive(address _token) external view returns (bool); function setAdjustment(address _token, bool _isAdditive, uint256 _adjustmentBps) external; function setIsSecondaryPriceEnabled(bool _isEnabled) external; function setSpreadBasisPoints(address _token, uint256 _spreadBasisPoints) external; function setSpreadThresholdBasisPoints(uint256 _spreadThresholdBasisPoints) external; function setFavorPrimaryPrice(bool _favorPrimaryPrice) external; function setMaxStrictPriceDeviation(uint256 _maxStrictPriceDeviation) external; function getPrice(address _token, bool _maximise, bool _includeAmmPrice, bool _useSwapPricing) external view returns (uint256); function getLatestPrimaryPrice(address _token) external view returns (uint256); function getPrimaryPrice(address _token, bool _maximise) external view returns (uint256); function setTokenConfig( address _token, bool _isStrictStable, bytes32 _oraclePriceId ) external; function setOracleNetwork( address _oracleNetwork ) external; }
contracts/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/oracle/interfaces/IFastPriceEvents.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IFastPriceEvents { function emitPriceEvent(address _token, uint256 _price) external; }
contracts/access/Governable.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; contract Governable { address public gov; constructor() public { gov = msg.sender; } modifier onlyGov() { require(msg.sender == gov, "Governable: forbidden"); _; } function setGov(address _gov) external onlyGov { gov = _gov; } }
contracts/core/interfaces/IPositionRouter.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IPositionRouter { function increasePositionRequestKeysStart() external returns (uint256); function decreasePositionRequestKeysStart() external returns (uint256); function executeIncreasePositions(uint256 _count, address payable _executionFeeReceiver) external; function executeDecreasePositions(uint256 _count, address payable _executionFeeReceiver) external; }
contracts/core/interfaces/IVaultPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface IVaultPriceFeed { function adjustmentBasisPoints(address _token) external view returns (uint256); function isAdjustmentAdditive(address _token) external view returns (bool); function setAdjustment(address _token, bool _isAdditive, uint256 _adjustmentBps) external; function setIsSecondaryPriceEnabled(bool _isEnabled) external; function setSpreadBasisPoints(address _token, uint256 _spreadBasisPoints) external; function setSpreadThresholdBasisPoints(uint256 _spreadThresholdBasisPoints) external; function setFavorPrimaryPrice(bool _favorPrimaryPrice) external; function setMaxStrictPriceDeviation(uint256 _maxStrictPriceDeviation) external; function getPrice(address _token, bool _maximise, bool _includeAmmPrice, bool _useSwapPricing) external view returns (uint256); function getLatestPrimaryPrice(address _token) external view returns (uint256); function getPrimaryPrice(address _token, bool _maximise) external view returns (uint256); function setTokenConfig( address _token, bool _isStrictStable, bytes32 _oraclePriceId ) external; function setOracleNetwork( address _oracleNetwork ) external; }
contracts/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/oracle/interfaces/IFastPriceEvents.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IFastPriceEvents { function emitPriceEvent(address _token, uint256 _price) external; }
contracts/oracle/interfaces/IFastPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IFastPriceFeed { function lastUpdatedAt() external view returns (uint256); function lastUpdatedBlock() external view returns (uint256); function setSigner(address _account, bool _isActive) external; function setUpdater(address _account, bool _isActive) external; function setPriceDuration(uint256 _priceDuration) external; function setMaxPriceUpdateDelay(uint256 _maxPriceUpdateDelay) external; function setSpreadBasisPointsIfInactive(uint256 _spreadBasisPointsIfInactive) external; function setSpreadBasisPointsIfChainError(uint256 _spreadBasisPointsIfChainError) external; function setMinBlockInterval(uint256 _minBlockInterval) external; function setIsSpreadEnabled(bool _isSpreadEnabled) external; function setMaxDeviationBasisPoints(uint256 _maxDeviationBasisPoints) external; function setMaxCumulativeDeltaDiffs(address[] memory _tokens, uint256[] memory _maxCumulativeDeltaDiffs) external; function setPriceDataInterval(uint256 _priceDataInterval) external; function setVaultPriceFeed(address _vaultPriceFeed) external; }
contracts/oracle/interfaces/ISecondaryPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface ISecondaryPriceFeed { function getPrice(address _token, uint256 _referencePrice, bool _maximise) external view returns (uint256); }
contracts/oracle/interfaces/ISecondaryPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface ISecondaryPriceFeed { function getPrice(address _token, uint256 _referencePrice, bool _maximise) external view returns (uint256); }
contracts/oracle/interfaces/ISecondaryPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface ISecondaryPriceFeed { function getPrice(address _token, uint256 _referencePrice, bool _maximise) external view returns (uint256); }
contracts/access/Governable.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; contract Governable { address public gov; constructor() public { gov = msg.sender; } modifier onlyGov() { require(msg.sender == gov, "Governable: forbidden"); _; } function setGov(address _gov) external onlyGov { gov = _gov; } }
contracts/core/interfaces/IPositionRouter.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IPositionRouter { function increasePositionRequestKeysStart() external returns (uint256); function decreasePositionRequestKeysStart() external returns (uint256); function executeIncreasePositions(uint256 _count, address payable _executionFeeReceiver) external; function executeDecreasePositions(uint256 _count, address payable _executionFeeReceiver) external; }
contracts/oracle/interfaces/IFastPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IFastPriceFeed { function lastUpdatedAt() external view returns (uint256); function lastUpdatedBlock() external view returns (uint256); function setSigner(address _account, bool _isActive) external; function setUpdater(address _account, bool _isActive) external; function setPriceDuration(uint256 _priceDuration) external; function setMaxPriceUpdateDelay(uint256 _maxPriceUpdateDelay) external; function setSpreadBasisPointsIfInactive(uint256 _spreadBasisPointsIfInactive) external; function setSpreadBasisPointsIfChainError(uint256 _spreadBasisPointsIfChainError) external; function setMinBlockInterval(uint256 _minBlockInterval) external; function setIsSpreadEnabled(bool _isSpreadEnabled) external; function setMaxDeviationBasisPoints(uint256 _maxDeviationBasisPoints) external; function setMaxCumulativeDeltaDiffs(address[] memory _tokens, uint256[] memory _maxCumulativeDeltaDiffs) external; function setPriceDataInterval(uint256 _priceDataInterval) external; function setVaultPriceFeed(address _vaultPriceFeed) external; }
contracts/core/interfaces/IVaultPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface IVaultPriceFeed { function adjustmentBasisPoints(address _token) external view returns (uint256); function isAdjustmentAdditive(address _token) external view returns (bool); function setAdjustment(address _token, bool _isAdditive, uint256 _adjustmentBps) external; function setIsSecondaryPriceEnabled(bool _isEnabled) external; function setSpreadBasisPoints(address _token, uint256 _spreadBasisPoints) external; function setSpreadThresholdBasisPoints(uint256 _spreadThresholdBasisPoints) external; function setFavorPrimaryPrice(bool _favorPrimaryPrice) external; function setMaxStrictPriceDeviation(uint256 _maxStrictPriceDeviation) external; function getPrice(address _token, bool _maximise, bool _includeAmmPrice, bool _useSwapPricing) external view returns (uint256); function getLatestPrimaryPrice(address _token) external view returns (uint256); function getPrimaryPrice(address _token, bool _maximise) external view returns (uint256); function setTokenConfig( address _token, bool _isStrictStable, bytes32 _oraclePriceId ) external; function setOracleNetwork( address _oracleNetwork ) external; }
contracts/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/oracle/interfaces/IFastPriceEvents.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IFastPriceEvents { function emitPriceEvent(address _token, uint256 _price) external; }
contracts/access/Governable.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; contract Governable { address public gov; constructor() public { gov = msg.sender; } modifier onlyGov() { require(msg.sender == gov, "Governable: forbidden"); _; } function setGov(address _gov) external onlyGov { gov = _gov; } }
contracts/core/interfaces/IPositionRouter.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IPositionRouter { function increasePositionRequestKeysStart() external returns (uint256); function decreasePositionRequestKeysStart() external returns (uint256); function executeIncreasePositions(uint256 _count, address payable _executionFeeReceiver) external; function executeDecreasePositions(uint256 _count, address payable _executionFeeReceiver) external; }
contracts/oracle/interfaces/IFastPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IFastPriceFeed { function lastUpdatedAt() external view returns (uint256); function lastUpdatedBlock() external view returns (uint256); function setSigner(address _account, bool _isActive) external; function setUpdater(address _account, bool _isActive) external; function setPriceDuration(uint256 _priceDuration) external; function setMaxPriceUpdateDelay(uint256 _maxPriceUpdateDelay) external; function setSpreadBasisPointsIfInactive(uint256 _spreadBasisPointsIfInactive) external; function setSpreadBasisPointsIfChainError(uint256 _spreadBasisPointsIfChainError) external; function setMinBlockInterval(uint256 _minBlockInterval) external; function setIsSpreadEnabled(bool _isSpreadEnabled) external; function setMaxDeviationBasisPoints(uint256 _maxDeviationBasisPoints) external; function setMaxCumulativeDeltaDiffs(address[] memory _tokens, uint256[] memory _maxCumulativeDeltaDiffs) external; function setPriceDataInterval(uint256 _priceDataInterval) external; function setVaultPriceFeed(address _vaultPriceFeed) external; }
contracts/core/interfaces/IVaultPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface IVaultPriceFeed { function adjustmentBasisPoints(address _token) external view returns (uint256); function isAdjustmentAdditive(address _token) external view returns (bool); function setAdjustment(address _token, bool _isAdditive, uint256 _adjustmentBps) external; function setIsSecondaryPriceEnabled(bool _isEnabled) external; function setSpreadBasisPoints(address _token, uint256 _spreadBasisPoints) external; function setSpreadThresholdBasisPoints(uint256 _spreadThresholdBasisPoints) external; function setFavorPrimaryPrice(bool _favorPrimaryPrice) external; function setMaxStrictPriceDeviation(uint256 _maxStrictPriceDeviation) external; function getPrice(address _token, bool _maximise, bool _includeAmmPrice, bool _useSwapPricing) external view returns (uint256); function getLatestPrimaryPrice(address _token) external view returns (uint256); function getPrimaryPrice(address _token, bool _maximise) external view returns (uint256); function setTokenConfig( address _token, bool _isStrictStable, bytes32 _oraclePriceId ) external; function setOracleNetwork( address _oracleNetwork ) external; }
contracts/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/oracle/interfaces/IFastPriceEvents.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IFastPriceEvents { function emitPriceEvent(address _token, uint256 _price) external; }
contracts/access/Governable.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; contract Governable { address public gov; constructor() public { gov = msg.sender; } modifier onlyGov() { require(msg.sender == gov, "Governable: forbidden"); _; } function setGov(address _gov) external onlyGov { gov = _gov; } }
contracts/core/interfaces/IPositionRouter.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IPositionRouter { function increasePositionRequestKeysStart() external returns (uint256); function decreasePositionRequestKeysStart() external returns (uint256); function executeIncreasePositions(uint256 _count, address payable _executionFeeReceiver) external; function executeDecreasePositions(uint256 _count, address payable _executionFeeReceiver) external; }
contracts/core/interfaces/IVaultPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface IVaultPriceFeed { function adjustmentBasisPoints(address _token) external view returns (uint256); function isAdjustmentAdditive(address _token) external view returns (bool); function setAdjustment(address _token, bool _isAdditive, uint256 _adjustmentBps) external; function setIsSecondaryPriceEnabled(bool _isEnabled) external; function setSpreadBasisPoints(address _token, uint256 _spreadBasisPoints) external; function setSpreadThresholdBasisPoints(uint256 _spreadThresholdBasisPoints) external; function setFavorPrimaryPrice(bool _favorPrimaryPrice) external; function setMaxStrictPriceDeviation(uint256 _maxStrictPriceDeviation) external; function getPrice(address _token, bool _maximise, bool _includeAmmPrice, bool _useSwapPricing) external view returns (uint256); function getLatestPrimaryPrice(address _token) external view returns (uint256); function getPrimaryPrice(address _token, bool _maximise) external view returns (uint256); function setTokenConfig( address _token, bool _isStrictStable, bytes32 _oraclePriceId ) external; function setOracleNetwork( address _oracleNetwork ) external; }
contracts/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/oracle/interfaces/IFastPriceEvents.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IFastPriceEvents { function emitPriceEvent(address _token, uint256 _price) external; }
contracts/oracle/interfaces/IFastPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IFastPriceFeed { function lastUpdatedAt() external view returns (uint256); function lastUpdatedBlock() external view returns (uint256); function setSigner(address _account, bool _isActive) external; function setUpdater(address _account, bool _isActive) external; function setPriceDuration(uint256 _priceDuration) external; function setMaxPriceUpdateDelay(uint256 _maxPriceUpdateDelay) external; function setSpreadBasisPointsIfInactive(uint256 _spreadBasisPointsIfInactive) external; function setSpreadBasisPointsIfChainError(uint256 _spreadBasisPointsIfChainError) external; function setMinBlockInterval(uint256 _minBlockInterval) external; function setIsSpreadEnabled(bool _isSpreadEnabled) external; function setMaxDeviationBasisPoints(uint256 _maxDeviationBasisPoints) external; function setMaxCumulativeDeltaDiffs(address[] memory _tokens, uint256[] memory _maxCumulativeDeltaDiffs) external; function setPriceDataInterval(uint256 _priceDataInterval) external; function setVaultPriceFeed(address _vaultPriceFeed) external; }
contracts/oracle/interfaces/ISecondaryPriceFeed.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface ISecondaryPriceFeed { function getPrice(address _token, uint256 _referencePrice, bool _maximise) external view returns (uint256); }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"uint256","name":"_priceDuration","internalType":"uint256"},{"type":"uint256","name":"_maxPriceUpdateDelay","internalType":"uint256"},{"type":"uint256","name":"_minBlockInterval","internalType":"uint256"},{"type":"uint256","name":"_maxDeviationBasisPoints","internalType":"uint256"},{"type":"address","name":"_fastPriceEvents","internalType":"address"},{"type":"address","name":"_tokenManager","internalType":"address"},{"type":"address","name":"_positionRouter","internalType":"address"}]},{"type":"event","name":"DisableFastPrice","inputs":[{"type":"address","name":"signer","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"EnableFastPrice","inputs":[{"type":"address","name":"signer","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"MaxCumulativeDeltaDiffExceeded","inputs":[{"type":"address","name":"token","internalType":"address","indexed":false},{"type":"uint256","name":"refPrice","internalType":"uint256","indexed":false},{"type":"uint256","name":"fastPrice","internalType":"uint256","indexed":false},{"type":"uint256","name":"cumulativeRefDelta","internalType":"uint256","indexed":false},{"type":"uint256","name":"cumulativeFastDelta","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"PriceData","inputs":[{"type":"address","name":"token","internalType":"address","indexed":false},{"type":"uint256","name":"refPrice","internalType":"uint256","indexed":false},{"type":"uint256","name":"fastPrice","internalType":"uint256","indexed":false},{"type":"uint256","name":"cumulativeRefDelta","internalType":"uint256","indexed":false},{"type":"uint256","name":"cumulativeFastDelta","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"BASIS_POINTS_DIVISOR","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"BITMASK_32","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"CUMULATIVE_DELTA_PRECISION","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_CUMULATIVE_FAST_DELTA","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_CUMULATIVE_REF_DELTA","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_PRICE_DURATION","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_REF_PRICE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"PRICE_PRECISION","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"disableFastPrice","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"disableFastPriceVoteCount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"disableFastPriceVotes","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"enableFastPrice","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"fastPriceEvents","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"favorFastPrice","inputs":[{"type":"address","name":"_token","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getPrice","inputs":[{"type":"address","name":"_token","internalType":"address"},{"type":"uint256","name":"_refPrice","internalType":"uint256"},{"type":"bool","name":"_maximise","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getPriceData","inputs":[{"type":"address","name":"_token","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"gov","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"uint256","name":"_minAuthorizations","internalType":"uint256"},{"type":"address[]","name":"_signers","internalType":"address[]"},{"type":"address[]","name":"_updaters","internalType":"address[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isInitialized","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isSigner","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isSpreadEnabled","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isUpdater","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastUpdatedAt","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastUpdatedBlock","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxCumulativeDeltaDiffs","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxDeviationBasisPoints","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxPriceUpdateDelay","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxTimeDeviation","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minAuthorizations","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minBlockInterval","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"positionRouter","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint160","name":"refPrice","internalType":"uint160"},{"type":"uint32","name":"refTime","internalType":"uint32"},{"type":"uint32","name":"cumulativeRefDelta","internalType":"uint32"},{"type":"uint32","name":"cumulativeFastDelta","internalType":"uint32"}],"name":"priceData","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"priceDataInterval","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"priceDuration","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"prices","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setCompactedPrices","inputs":[{"type":"uint256[]","name":"_priceBitArray","internalType":"uint256[]"},{"type":"uint256","name":"_timestamp","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFastPriceEvents","inputs":[{"type":"address","name":"_fastPriceEvents","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setGov","inputs":[{"type":"address","name":"_gov","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setIsSpreadEnabled","inputs":[{"type":"bool","name":"_isSpreadEnabled","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setLastUpdatedAt","inputs":[{"type":"uint256","name":"_lastUpdatedAt","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxCumulativeDeltaDiffs","inputs":[{"type":"address[]","name":"_tokens","internalType":"address[]"},{"type":"uint256[]","name":"_maxCumulativeDeltaDiffs","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxDeviationBasisPoints","inputs":[{"type":"uint256","name":"_maxDeviationBasisPoints","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxPriceUpdateDelay","inputs":[{"type":"uint256","name":"_maxPriceUpdateDelay","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxTimeDeviation","inputs":[{"type":"uint256","name":"_maxTimeDeviation","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMinAuthorizations","inputs":[{"type":"uint256","name":"_minAuthorizations","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMinBlockInterval","inputs":[{"type":"uint256","name":"_minBlockInterval","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPriceDataInterval","inputs":[{"type":"uint256","name":"_priceDataInterval","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPriceDuration","inputs":[{"type":"uint256","name":"_priceDuration","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPrices","inputs":[{"type":"address[]","name":"_tokens","internalType":"address[]"},{"type":"uint256[]","name":"_prices","internalType":"uint256[]"},{"type":"uint256","name":"_timestamp","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPricesWithBits","inputs":[{"type":"uint256","name":"_priceBits","internalType":"uint256"},{"type":"uint256","name":"_timestamp","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPricesWithBitsAndExecute","inputs":[{"type":"uint256","name":"_priceBits","internalType":"uint256"},{"type":"uint256","name":"_timestamp","internalType":"uint256"},{"type":"uint256","name":"_endIndexForIncreasePositions","internalType":"uint256"},{"type":"uint256","name":"_endIndexForDecreasePositions","internalType":"uint256"},{"type":"uint256","name":"_maxIncreasePositions","internalType":"uint256"},{"type":"uint256","name":"_maxDecreasePositions","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setSigner","inputs":[{"type":"address","name":"_account","internalType":"address"},{"type":"bool","name":"_isActive","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setSpreadBasisPointsIfChainError","inputs":[{"type":"uint256","name":"_spreadBasisPointsIfChainError","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setSpreadBasisPointsIfInactive","inputs":[{"type":"uint256","name":"_spreadBasisPointsIfInactive","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTokenManager","inputs":[{"type":"address","name":"_tokenManager","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTokens","inputs":[{"type":"address[]","name":"_tokens","internalType":"address[]"},{"type":"uint256[]","name":"_tokenPrecisions","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setUpdater","inputs":[{"type":"address","name":"_account","internalType":"address"},{"type":"bool","name":"_isActive","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setVaultPriceFeed","inputs":[{"type":"address","name":"_vaultPriceFeed","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"spreadBasisPointsIfChainError","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"spreadBasisPointsIfInactive","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"tokenManager","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenPrecisions","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"tokens","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"vaultPriceFeed","inputs":[]}]
Contract Creation Code
0x60806040526000805460ff60a81b1916815560105534801561002057600080fd5b5060405162002f3c38038062002f3c833981810160405260e081101561004557600080fd5b508051602082015160408301516060840151608085015160a086015160c090960151600080546001600160a01b0319163317905594959394929391929091906107088711156100c65760405162461bcd60e51b815260040180806020018281038252602581526020018062002f176025913960400191505060405180910390fd5b600796909655600894909455600b92909255600e55600280546001600160a01b039283166001600160a01b031991821617909155600380549383169382169390931790925560048054919093169116179055612def80620001286000396000f3fe608060405234801561001057600080fd5b50600436106102f05760003560e01c806372279ba11161018f57806372279ba11461078057806374bfed89146107cc578063776d16c1146107d4578063782661bc146107f15780637cb2b79c146109165780637df73e271461093c5780637fbc79c6146109625780637fece36814610a8c578063807c9782146103ee57806382553aad14610ac05780638b7677f414610add57806395082d2514610afa578063a2b47c1614610b02578063a374242514610b0a578063a6eca89614610b30578063b0a2566614610b38578063b3606b5614610b40578063b70c7b7014610b48578063c8390a4814610b65578063c84a912414610c88578063cab44b7614610c90578063ce98dfa814610cee578063cfad57a214610d0d578063cfed246b14610d33578063d6a153f114610d59578063d925351a14610d76578063de0d1b9414610d93578063dfb481c914610db0578063e64559ad14610db8578063e68a22c014610dc0578063eeaa783a14610dc8578063f90ce5ba14610dd0576102f0565b806303b04936146102f557806303cd25711461032f57806303f4d7dc146103495780630604ddea146103ee5780630e9272ea146103f6578063126082cf1461041a57806312d43a511461042257806314dd2dce1461042a578063162ac4e01461044757806317835d1c1461046d5780631a15339114610490578063238aafb7146104be578063287800c9146104e45780632a709b14146104ec5780632e9cd94b146104f457806331cb610514610511578063392e53cd1461053f5780633aa08f861461054757806344c231931461054f5780634bd66c1c146103ee5780634c0e31c81461056c5780634d11fb4a1461068f5780634f64b2be146106ac5780634fdfb086146106c957806354aea127146106ef578063574ec1be146106f757806361ef161f14610732578063668d3d651461073a578063695d4184146107425780636c56fd051461074a5780636ccd47c414610770578063715c753614610778575b600080fd5b61031b6004803603602081101561030b57600080fd5b50356001600160a01b0316610dd8565b604080519115158252519081900360200190f35b610337610ded565b60408051918252519081900360200190f35b6103ec6004803603604081101561035f57600080fd5b810190602081018135600160201b81111561037957600080fd5b82018360208201111561038b57600080fd5b803590602001918460208302840111600160201b831117156103ac57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505091359250610df3915050565b005b610337610f6a565b6103fe610f72565b604080516001600160a01b039092168252519081900360200190f35b610337610f81565b6103fe610f87565b6103ec6004803603602081101561044057600080fd5b5035610f96565b6103ec6004803603602081101561045d57600080fd5b50356001600160a01b0316610fe8565b6103ec6004803603604081101561048357600080fd5b5080359060200135611057565b6103ec600480360360408110156104a657600080fd5b506001600160a01b03813516906020013515156110b3565b6103ec600480360360208110156104d457600080fd5b50356001600160a01b031661112b565b61033761119a565b6103fe6111a0565b6103ec6004803603602081101561050a57600080fd5b50356111af565b6103ec6004803603604081101561052757600080fd5b506001600160a01b0381351690602001351515611201565b61031b611279565b610337611289565b6103ec6004803603602081101561056557600080fd5b503561128f565b6103ec6004803603604081101561058257600080fd5b810190602081018135600160201b81111561059c57600080fd5b8201836020820111156105ae57600080fd5b803590602001918460208302840111600160201b831117156105cf57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561061e57600080fd5b82018360208201111561063057600080fd5b803590602001918460208302840111600160201b8311171561065157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611322945050505050565b610337600480360360208110156106a557600080fd5b50356113cd565b6103fe600480360360208110156106c257600080fd5b50356113eb565b61031b600480360360208110156106df57600080fd5b50356001600160a01b0316611412565b610337611427565b6103ec600480360360c081101561070d57600080fd5b5080359060208101359060408101359060608101359060808101359060a0013561142d565b6103fe61163c565b61033761164b565b61031b611651565b61031b6004803603602081101561076057600080fd5b50356001600160a01b0316611661565b6103ec6116ec565b6103376117ff565b6107a66004803603602081101561079657600080fd5b50356001600160a01b0316611805565b604080519485526020850193909352838301919091526060830152519081900360800190f35b610337611883565b6103ec600480360360208110156107ea57600080fd5b5035611889565b6103ec6004803603606081101561080757600080fd5b810190602081018135600160201b81111561082157600080fd5b82018360208201111561083357600080fd5b803590602001918460208302840111600160201b8311171561085457600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156108a357600080fd5b8201836020820111156108b557600080fd5b803590602001918460208302840111600160201b831117156108d657600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050913592506118db915050565b6103ec6004803603602081101561092c57600080fd5b50356001600160a01b03166119a9565b61031b6004803603602081101561095257600080fd5b50356001600160a01b0316611a18565b6103ec6004803603606081101561097857600080fd5b81359190810190604081016020820135600160201b81111561099957600080fd5b8201836020820111156109ab57600080fd5b803590602001918460208302840111600160201b831117156109cc57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610a1b57600080fd5b820183602082011115610a2d57600080fd5b803590602001918460208302840111600160201b83111715610a4e57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611a2d945050505050565b61033760048036036060811015610aa257600080fd5b506001600160a01b0381351690602081013590604001351515611b86565b6103ec60048036036020811015610ad657600080fd5b5035611d0c565b6103ec60048036036020811015610af357600080fd5b5035611d5e565b610337611db0565b610337611dc0565b61033760048036036020811015610b2057600080fd5b50356001600160a01b0316611dc7565b610337611dd9565b610337611ddf565b610337611de5565b6103ec60048036036020811015610b5e57600080fd5b5035611deb565b6103ec60048036036040811015610b7b57600080fd5b810190602081018135600160201b811115610b9557600080fd5b820183602082011115610ba757600080fd5b803590602001918460208302840111600160201b83111715610bc857600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610c1757600080fd5b820183602082011115610c2957600080fd5b803590602001918460208302840111600160201b83111715610c4a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611e3d945050505050565b6103ec611f07565b610cb660048036036020811015610ca657600080fd5b50356001600160a01b031661201e565b604080516001600160a01b03909516855263ffffffff9384166020860152918316848301529091166060830152519081900360800190f35b6103ec60048036036020811015610d0457600080fd5b5035151561205d565b6103ec60048036036020811015610d2357600080fd5b50356001600160a01b03166120c8565b61033760048036036020811015610d4957600080fd5b50356001600160a01b0316612137565b6103ec60048036036020811015610d6f57600080fd5b5035612149565b6103ec60048036036020811015610d8c57600080fd5b503561219b565b6103ec60048036036020811015610da957600080fd5b50356121ed565b61033761223f565b610337612245565b61033761224b565b6103fe612256565b610337612265565b60166020526000908152604090205460ff1681565b60075481565b3360009081526011602052604090205460ff16610e45576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b6000610e508261226b565b90508015610f64576002546001546001600160a01b03918216911660005b8551811015610f60576000868281518110610e8557fe5b6020026020010151905060005b6008811015610f5657601754600884028201908110610eb75750505050505050610f66565b60178054602084029185831c63ffffffff169160009190600889028701908110610edd57fe5b6000918252602082200154601880546001600160a01b0390921693509060088a028801908110610f0957fe5b60009182526020822001549150610f3682610f308668327cb2734119d3b7a9601e1b612377565b906123d9565b9050610f4483828c8e612418565b505060019094019350610e9292505050565b5050600101610e6e565b5050505b505b5050565b63ffffffff81565b6002546001600160a01b031681565b61271081565b6000546001600160a01b031681565b6000546001600160a01b03163314610fe3576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600555565b6000546001600160a01b03163314611035576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b3360009081526011602052604090205460ff166110a9576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b610f6682826126ad565b6000546001600160a01b03163314611100576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b6000546001600160a01b03163314611178576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600f5481565b6003546001600160a01b031681565b6003546001600160a01b031633146111fc576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b600d55565b6000546001600160a01b0316331461124e576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152601560205260409020805460ff1916911515919091179055565b600054600160a01b900460ff1681565b600c5481565b6000546001600160a01b031633146112dc576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b61070881111561131d5760405162461bcd60e51b8152600401808060200182810382526025815260200180612c356025913960400191505060405180910390fd5b600755565b6003546001600160a01b0316331461136f576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b60005b8251811015610f6457600083828151811061138957fe5b6020026020010151905082828151811061139f57fe5b6020908102919091018101516001600160a01b03909216600090815260149091526040902055600101611372565b601881815481106113da57fe5b600091825260209091200154905081565b601781815481106113f857fe5b6000918252602090912001546001600160a01b0316905081565b60116020526000908152604090205460ff1681565b60055481565b3360009081526011602052604090205460ff1661147f576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b61148986866126ad565b60048054604080516304dabc3160e51b815290516001600160a01b03909216926000926115099287928692639b57862092808301926020929182900301818987803b1580156114d757600080fd5b505af11580156114eb573d6000803e3d6000fd5b505050506040513d602081101561150157600080fd5b505190612783565b9050600061154c84846001600160a01b0316631bca8cf06040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156114d757600080fd5b90508187111561155a578196505b80861115611566578095505b60408051629a208160e81b81526004810189905233602482015290516001600160a01b03851691639a20810091604480830192600092919082900301818387803b1580156115b357600080fd5b505af11580156115c7573d6000803e3d6000fd5b50506040805163f3883d8b60e01b8152600481018a905233602482015290516001600160a01b038716935063f3883d8b9250604480830192600092919082900301818387803b15801561161957600080fd5b505af115801561162d573d6000803e3d6000fd5b50505050505050505050505050565b6004546001600160a01b031681565b61070881565b600054600160a81b900460ff1681565b60008054600160a81b900460ff161561167c575060006116e7565b600f546010541061168f575060006116e7565b60008061169b84611805565b93509350505081811180156116d057506001600160a01b0384166000908152601460205260409020546116ce82846127db565b115b156116e0576000925050506116e7565b6001925050505b919050565b3360009081526015602052604090205460ff1661173e576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b3360009081526016602052604090205460ff166117a2576040805162461bcd60e51b815260206004820152601e60248201527f466173745072696365466565643a20616c726561647920656e61626c65640000604482015290519081900360640190fd5b336000908152601660205260409020805460ff191690556010546117c79060016127db565b6010556040805133815290517f9fe0c305c33aa92757a537936872a60be0d91549a4303cc99fd8b7fce8a002759181900360200190a1565b600e5481565b600080600080611813612b2d565b505050506001600160a01b039182166000908152601360209081526040918290208251608081018452905494851680825263ffffffff600160a01b87048116938301849052600160c01b87048116948301859052600160e01b909604909516606090910181905293949093919250565b60095481565b6000546001600160a01b031633146118d6576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600c55565b3360009081526011602052604090205460ff1661192d576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b60006119388261226b565b905080156119a3576002546001546001600160a01b03918216911660005b865181101561199f57600087828151811061196d57fe5b602002602001015190506119968188848151811061198757fe5b60200260200101518587612418565b50600101611956565b5050505b50505050565b6003546001600160a01b031633146119f6576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60156020526000908152604090205460ff1681565b6000546001600160a01b03163314611a7a576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600054600160a01b900460ff1615611ac35760405162461bcd60e51b8152600401808060200182810382526022815260200180612d986022913960400191505060405180910390fd5b6000805460ff60a01b1916600160a01b178155600f8490555b8251811015611b2f576000838281518110611af357fe5b6020908102919091018101516001600160a01b03166000908152601590915260409020805460ff19166001908117909155919091019050611adc565b5060005b81518110156119a3576000828281518110611b4a57fe5b6020908102919091018101516001600160a01b03166000908152601190915260409020805460ff19166001908117909155919091019050611b33565b6000611b9f60085460055461278390919063ffffffff16565b421115611bfa578115611bda57611bd3612710610f30611bcc600a5461271061278390919063ffffffff16565b8690612377565b9050611d05565b611bd3612710610f30611bcc600a546127106127db90919063ffffffff16565b600754600554611c0991612783565b421115611c56578115611c3657611bd3612710610f30611bcc60095461271061278390919063ffffffff16565b611bd3612710610f30611bcc6009546127106127db90919063ffffffff16565b6001600160a01b03841660009081526012602052604090205480611c7d5783915050611d05565b6000818511611c9557611c9082866127db565b611c9f565b611c9f85836127db565b9050611cb185610f3083612710612377565b90506000611cbe87611661565b1580611ccb5750600e5482115b90508015611cff578415611cf257828611611ce65782611ce8565b855b9350505050611d05565b828610611ce65782611ce8565b50909150505b9392505050565b6003546001600160a01b03163314611d59576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b600e55565b6000546001600160a01b03163314611dab576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600855565b68327cb2734119d3b7a9601e1b81565b6298968081565b60146020526000908152604090205481565b600a5481565b60105481565b600b5481565b6000546001600160a01b03163314611e38576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600955565b6000546001600160a01b03163314611e8a576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b8051825114611ee0576040805162461bcd60e51b815260206004820152601e60248201527f466173745072696365466565643a20696e76616c6964206c656e677468730000604482015290519081900360640190fd5b8151611ef3906017906020850190612b54565b508051610f64906018906020840190612bb9565b3360009081526015602052604090205460ff16611f59576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b3360009081526016602052604090205460ff1615611fbd576040805162461bcd60e51b815260206004820152601c60248201527b11985cdd141c9a58d9519959590e88185b1c9958591e481d9bdd195960221b604482015290519081900360640190fd5b336000908152601660205260409020805460ff19166001908117909155601054611fe691612783565b6010556040805133815290517f4c0c5fabf50e808e3bc8d19577d305e3a7163eea7e8a74a50caa8896694cd44b9181900360200190a1565b6013602052600090815260409020546001600160a01b0381169063ffffffff600160a01b8204811691600160c01b8104821691600160e01b9091041684565b6000546001600160a01b031633146120aa576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b60008054911515600160a81b0260ff60a81b19909216919091179055565b6000546001600160a01b03163314612115576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60126020526000908152604090205481565b6000546001600160a01b03163314612196576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600b55565b6003546001600160a01b031633146121e8576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b600f55565b6000546001600160a01b0316331461223a576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600a55565b600d5481565b60085481565b6001600160a01b0381565b6001546001600160a01b031681565b60065481565b600b54600090156122c457600b546006546122879043906127db565b10156122c45760405162461bcd60e51b815260040180806020018281038252602e815260200180612d41602e913960400191505060405180910390fd5b600c546122d142826127db565b831161230e5760405162461bcd60e51b815260040180806020018281038252602d815260200180612d14602d913960400191505060405180910390fd5b6123184282612783565b83106123555760405162461bcd60e51b815260040180806020018281038252602f815260200180612cc4602f913960400191505060405180910390fd5b6005548310156123695760009150506116e7565b505060055543600655600190565b600082612386575060006123d3565b8282028284828161239357fe5b04146123d05760405162461bcd60e51b8152600401808060200182810382526021815260200180612cf36021913960400191505060405180910390fd5b90505b92915050565b60006123d083836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b81525061281d565b6001600160a01b03821615612687576000826001600160a01b03166356bf9de4866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561247657600080fd5b505afa15801561248a573d6000803e3d6000fd5b505050506040513d60208110156124a057600080fd5b50516001600160a01b0386166000908152601260205260408120549192508080806124ca8a611805565b935093509350935060008411156125915760008487116124f3576124ee85886127db565b6124fd565b6124fd87866127db565b905060008a8711612517576125128b886127db565b612521565b612521878c6127db565b9050612538600d54426123d990919063ffffffff16565b600d546125469087906123d9565b146125545760009350600092505b61256f61256887610f308562989680612377565b8590612783565b935061258c61258588610f308462989680612377565b8490612783565b925050505b81811180156125c057506001600160a01b038a166000908152601460205260409020546125be82846127db565b115b1561261d57604080516001600160a01b038c16815260208101889052808201879052606081018490526080810183905290517fe582322b389ad06b2bbf619cd6da3f16a288ec873ea0fa6df4d72f3d9480b4479181900360a00190a15b6126298a8784846128bf565b604080516001600160a01b038c16815260208101889052808201879052606081018490526080810183905290517f23b9387f81fca646aac1dc4487ede045c65f5f7445482906565f01e05afdb3a89181900360a00190a15050505050505b6001600160a01b03841660009081526012602052604090208390556119a3818585612a55565b60006126b88261226b565b90508015610f64576002546001546001600160a01b03918216911660005b6008811015610f6057601754819081106126f4575050505050610f66565b60178054602084029189831c63ffffffff1691600091908690811061271557fe5b6000918252602082200154601880546001600160a01b039092169350908790811061273c57fe5b6000918252602082200154915061276382610f308668327cb2734119d3b7a9601e1b612377565b905061277183828a8c612418565b5050600190940193506126d692505050565b6000828201838110156123d0576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b60006123d083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612ad3565b600081836128a95760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561286e578181015183820152602001612856565b50505050905090810190601f16801561289b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816128b557fe5b0495945050505050565b6001600160a01b03831061291a576040805162461bcd60e51b815260206004820152601f60248201527f466173745072696365466565643a20696e76616c696420726566507269636500604482015290519081900360640190fd5b63ffffffff821061295c5760405162461bcd60e51b8152600401808060200182810382526029815260200180612d6f6029913960400191505060405180910390fd5b63ffffffff811061299e5760405162461bcd60e51b815260040180806020018281038252602a815260200180612c5a602a913960400191505060405180910390fd5b604080516080810182526001600160a01b03948516815263ffffffff4281166020808401918252958216838501908152948216606084019081529787166000908152601390965292909420905181549251935196518516600160e01b026001600160e01b03978616600160c01b0263ffffffff60c01b1995909616600160a01b0263ffffffff60a01b19929097166001600160a01b0319909416939093171694909417919091169190911792909216919091179055565b6001600160a01b038316612a6857610f64565b826001600160a01b031663e0409c7183836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015612abf57600080fd5b505af115801561199f573d6000803e3d6000fd5b60008184841115612b255760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561286e578181015183820152602001612856565b505050900390565b60408051608081018252600080825260208201819052918101829052606081019190915290565b828054828255906000526020600020908101928215612ba9579160200282015b82811115612ba957825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612b74565b50612bb5929150612c00565b5090565b828054828255906000526020600020908101928215612bf4579160200282015b82811115612bf4578251825591602001919060010190612bd9565b50612bb5929150612c1f565b5b80821115612bb55780546001600160a01b0319168155600101612c01565b5b80821115612bb55760008155600101612c2056fe466173745072696365466565643a20696e76616c6964205f70726963654475726174696f6e466173745072696365466565643a20696e76616c69642063756d756c61746976654661737444656c7461476f7665726e61626c653a20666f7262696464656e0000000000000000000000466173745072696365466565643a20666f7262696464656e0000000000000000466173745072696365466565643a205f74696d657374616d70206578636565647320616c6c6f7765642072616e6765536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77466173745072696365466565643a205f74696d657374616d702062656c6f7720616c6c6f7765642072616e6765466173745072696365466565643a206d696e426c6f636b496e74657276616c206e6f742079657420706173736564466173745072696365466565643a20696e76616c69642063756d756c617469766552656644656c7461466173745072696365466565643a20616c726561647920696e697469616c697a6564a26469706673582212201e21199652ac032749c8dbe13b4e82de4d26d0b24d32573d0b699068e433524864736f6c634300060c0033466173745072696365466565643a20696e76616c6964205f70726963654475726174696f6e000000000000000000000000000000000000000000000000000000000000012c0000000000000000000000000000000000000000000000000000000000000e10000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000af0f3e675bb15f506cbd560dbbe18f67b16c8c510000000000000000000000002a079157d67d0057aa16f774049e18b02ee05fe1000000000000000000000000257901ce646a7a6aa6af13226b2a5bf6a634bb33
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106102f05760003560e01c806372279ba11161018f57806372279ba11461078057806374bfed89146107cc578063776d16c1146107d4578063782661bc146107f15780637cb2b79c146109165780637df73e271461093c5780637fbc79c6146109625780637fece36814610a8c578063807c9782146103ee57806382553aad14610ac05780638b7677f414610add57806395082d2514610afa578063a2b47c1614610b02578063a374242514610b0a578063a6eca89614610b30578063b0a2566614610b38578063b3606b5614610b40578063b70c7b7014610b48578063c8390a4814610b65578063c84a912414610c88578063cab44b7614610c90578063ce98dfa814610cee578063cfad57a214610d0d578063cfed246b14610d33578063d6a153f114610d59578063d925351a14610d76578063de0d1b9414610d93578063dfb481c914610db0578063e64559ad14610db8578063e68a22c014610dc0578063eeaa783a14610dc8578063f90ce5ba14610dd0576102f0565b806303b04936146102f557806303cd25711461032f57806303f4d7dc146103495780630604ddea146103ee5780630e9272ea146103f6578063126082cf1461041a57806312d43a511461042257806314dd2dce1461042a578063162ac4e01461044757806317835d1c1461046d5780631a15339114610490578063238aafb7146104be578063287800c9146104e45780632a709b14146104ec5780632e9cd94b146104f457806331cb610514610511578063392e53cd1461053f5780633aa08f861461054757806344c231931461054f5780634bd66c1c146103ee5780634c0e31c81461056c5780634d11fb4a1461068f5780634f64b2be146106ac5780634fdfb086146106c957806354aea127146106ef578063574ec1be146106f757806361ef161f14610732578063668d3d651461073a578063695d4184146107425780636c56fd051461074a5780636ccd47c414610770578063715c753614610778575b600080fd5b61031b6004803603602081101561030b57600080fd5b50356001600160a01b0316610dd8565b604080519115158252519081900360200190f35b610337610ded565b60408051918252519081900360200190f35b6103ec6004803603604081101561035f57600080fd5b810190602081018135600160201b81111561037957600080fd5b82018360208201111561038b57600080fd5b803590602001918460208302840111600160201b831117156103ac57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505091359250610df3915050565b005b610337610f6a565b6103fe610f72565b604080516001600160a01b039092168252519081900360200190f35b610337610f81565b6103fe610f87565b6103ec6004803603602081101561044057600080fd5b5035610f96565b6103ec6004803603602081101561045d57600080fd5b50356001600160a01b0316610fe8565b6103ec6004803603604081101561048357600080fd5b5080359060200135611057565b6103ec600480360360408110156104a657600080fd5b506001600160a01b03813516906020013515156110b3565b6103ec600480360360208110156104d457600080fd5b50356001600160a01b031661112b565b61033761119a565b6103fe6111a0565b6103ec6004803603602081101561050a57600080fd5b50356111af565b6103ec6004803603604081101561052757600080fd5b506001600160a01b0381351690602001351515611201565b61031b611279565b610337611289565b6103ec6004803603602081101561056557600080fd5b503561128f565b6103ec6004803603604081101561058257600080fd5b810190602081018135600160201b81111561059c57600080fd5b8201836020820111156105ae57600080fd5b803590602001918460208302840111600160201b831117156105cf57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561061e57600080fd5b82018360208201111561063057600080fd5b803590602001918460208302840111600160201b8311171561065157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611322945050505050565b610337600480360360208110156106a557600080fd5b50356113cd565b6103fe600480360360208110156106c257600080fd5b50356113eb565b61031b600480360360208110156106df57600080fd5b50356001600160a01b0316611412565b610337611427565b6103ec600480360360c081101561070d57600080fd5b5080359060208101359060408101359060608101359060808101359060a0013561142d565b6103fe61163c565b61033761164b565b61031b611651565b61031b6004803603602081101561076057600080fd5b50356001600160a01b0316611661565b6103ec6116ec565b6103376117ff565b6107a66004803603602081101561079657600080fd5b50356001600160a01b0316611805565b604080519485526020850193909352838301919091526060830152519081900360800190f35b610337611883565b6103ec600480360360208110156107ea57600080fd5b5035611889565b6103ec6004803603606081101561080757600080fd5b810190602081018135600160201b81111561082157600080fd5b82018360208201111561083357600080fd5b803590602001918460208302840111600160201b8311171561085457600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156108a357600080fd5b8201836020820111156108b557600080fd5b803590602001918460208302840111600160201b831117156108d657600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050913592506118db915050565b6103ec6004803603602081101561092c57600080fd5b50356001600160a01b03166119a9565b61031b6004803603602081101561095257600080fd5b50356001600160a01b0316611a18565b6103ec6004803603606081101561097857600080fd5b81359190810190604081016020820135600160201b81111561099957600080fd5b8201836020820111156109ab57600080fd5b803590602001918460208302840111600160201b831117156109cc57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610a1b57600080fd5b820183602082011115610a2d57600080fd5b803590602001918460208302840111600160201b83111715610a4e57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611a2d945050505050565b61033760048036036060811015610aa257600080fd5b506001600160a01b0381351690602081013590604001351515611b86565b6103ec60048036036020811015610ad657600080fd5b5035611d0c565b6103ec60048036036020811015610af357600080fd5b5035611d5e565b610337611db0565b610337611dc0565b61033760048036036020811015610b2057600080fd5b50356001600160a01b0316611dc7565b610337611dd9565b610337611ddf565b610337611de5565b6103ec60048036036020811015610b5e57600080fd5b5035611deb565b6103ec60048036036040811015610b7b57600080fd5b810190602081018135600160201b811115610b9557600080fd5b820183602082011115610ba757600080fd5b803590602001918460208302840111600160201b83111715610bc857600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610c1757600080fd5b820183602082011115610c2957600080fd5b803590602001918460208302840111600160201b83111715610c4a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611e3d945050505050565b6103ec611f07565b610cb660048036036020811015610ca657600080fd5b50356001600160a01b031661201e565b604080516001600160a01b03909516855263ffffffff9384166020860152918316848301529091166060830152519081900360800190f35b6103ec60048036036020811015610d0457600080fd5b5035151561205d565b6103ec60048036036020811015610d2357600080fd5b50356001600160a01b03166120c8565b61033760048036036020811015610d4957600080fd5b50356001600160a01b0316612137565b6103ec60048036036020811015610d6f57600080fd5b5035612149565b6103ec60048036036020811015610d8c57600080fd5b503561219b565b6103ec60048036036020811015610da957600080fd5b50356121ed565b61033761223f565b610337612245565b61033761224b565b6103fe612256565b610337612265565b60166020526000908152604090205460ff1681565b60075481565b3360009081526011602052604090205460ff16610e45576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b6000610e508261226b565b90508015610f64576002546001546001600160a01b03918216911660005b8551811015610f60576000868281518110610e8557fe5b6020026020010151905060005b6008811015610f5657601754600884028201908110610eb75750505050505050610f66565b60178054602084029185831c63ffffffff169160009190600889028701908110610edd57fe5b6000918252602082200154601880546001600160a01b0390921693509060088a028801908110610f0957fe5b60009182526020822001549150610f3682610f308668327cb2734119d3b7a9601e1b612377565b906123d9565b9050610f4483828c8e612418565b505060019094019350610e9292505050565b5050600101610e6e565b5050505b505b5050565b63ffffffff81565b6002546001600160a01b031681565b61271081565b6000546001600160a01b031681565b6000546001600160a01b03163314610fe3576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600555565b6000546001600160a01b03163314611035576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b3360009081526011602052604090205460ff166110a9576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b610f6682826126ad565b6000546001600160a01b03163314611100576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b6000546001600160a01b03163314611178576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600f5481565b6003546001600160a01b031681565b6003546001600160a01b031633146111fc576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b600d55565b6000546001600160a01b0316331461124e576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152601560205260409020805460ff1916911515919091179055565b600054600160a01b900460ff1681565b600c5481565b6000546001600160a01b031633146112dc576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b61070881111561131d5760405162461bcd60e51b8152600401808060200182810382526025815260200180612c356025913960400191505060405180910390fd5b600755565b6003546001600160a01b0316331461136f576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b60005b8251811015610f6457600083828151811061138957fe5b6020026020010151905082828151811061139f57fe5b6020908102919091018101516001600160a01b03909216600090815260149091526040902055600101611372565b601881815481106113da57fe5b600091825260209091200154905081565b601781815481106113f857fe5b6000918252602090912001546001600160a01b0316905081565b60116020526000908152604090205460ff1681565b60055481565b3360009081526011602052604090205460ff1661147f576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b61148986866126ad565b60048054604080516304dabc3160e51b815290516001600160a01b03909216926000926115099287928692639b57862092808301926020929182900301818987803b1580156114d757600080fd5b505af11580156114eb573d6000803e3d6000fd5b505050506040513d602081101561150157600080fd5b505190612783565b9050600061154c84846001600160a01b0316631bca8cf06040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156114d757600080fd5b90508187111561155a578196505b80861115611566578095505b60408051629a208160e81b81526004810189905233602482015290516001600160a01b03851691639a20810091604480830192600092919082900301818387803b1580156115b357600080fd5b505af11580156115c7573d6000803e3d6000fd5b50506040805163f3883d8b60e01b8152600481018a905233602482015290516001600160a01b038716935063f3883d8b9250604480830192600092919082900301818387803b15801561161957600080fd5b505af115801561162d573d6000803e3d6000fd5b50505050505050505050505050565b6004546001600160a01b031681565b61070881565b600054600160a81b900460ff1681565b60008054600160a81b900460ff161561167c575060006116e7565b600f546010541061168f575060006116e7565b60008061169b84611805565b93509350505081811180156116d057506001600160a01b0384166000908152601460205260409020546116ce82846127db565b115b156116e0576000925050506116e7565b6001925050505b919050565b3360009081526015602052604090205460ff1661173e576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b3360009081526016602052604090205460ff166117a2576040805162461bcd60e51b815260206004820152601e60248201527f466173745072696365466565643a20616c726561647920656e61626c65640000604482015290519081900360640190fd5b336000908152601660205260409020805460ff191690556010546117c79060016127db565b6010556040805133815290517f9fe0c305c33aa92757a537936872a60be0d91549a4303cc99fd8b7fce8a002759181900360200190a1565b600e5481565b600080600080611813612b2d565b505050506001600160a01b039182166000908152601360209081526040918290208251608081018452905494851680825263ffffffff600160a01b87048116938301849052600160c01b87048116948301859052600160e01b909604909516606090910181905293949093919250565b60095481565b6000546001600160a01b031633146118d6576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600c55565b3360009081526011602052604090205460ff1661192d576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b60006119388261226b565b905080156119a3576002546001546001600160a01b03918216911660005b865181101561199f57600087828151811061196d57fe5b602002602001015190506119968188848151811061198757fe5b60200260200101518587612418565b50600101611956565b5050505b50505050565b6003546001600160a01b031633146119f6576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60156020526000908152604090205460ff1681565b6000546001600160a01b03163314611a7a576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600054600160a01b900460ff1615611ac35760405162461bcd60e51b8152600401808060200182810382526022815260200180612d986022913960400191505060405180910390fd5b6000805460ff60a01b1916600160a01b178155600f8490555b8251811015611b2f576000838281518110611af357fe5b6020908102919091018101516001600160a01b03166000908152601590915260409020805460ff19166001908117909155919091019050611adc565b5060005b81518110156119a3576000828281518110611b4a57fe5b6020908102919091018101516001600160a01b03166000908152601190915260409020805460ff19166001908117909155919091019050611b33565b6000611b9f60085460055461278390919063ffffffff16565b421115611bfa578115611bda57611bd3612710610f30611bcc600a5461271061278390919063ffffffff16565b8690612377565b9050611d05565b611bd3612710610f30611bcc600a546127106127db90919063ffffffff16565b600754600554611c0991612783565b421115611c56578115611c3657611bd3612710610f30611bcc60095461271061278390919063ffffffff16565b611bd3612710610f30611bcc6009546127106127db90919063ffffffff16565b6001600160a01b03841660009081526012602052604090205480611c7d5783915050611d05565b6000818511611c9557611c9082866127db565b611c9f565b611c9f85836127db565b9050611cb185610f3083612710612377565b90506000611cbe87611661565b1580611ccb5750600e5482115b90508015611cff578415611cf257828611611ce65782611ce8565b855b9350505050611d05565b828610611ce65782611ce8565b50909150505b9392505050565b6003546001600160a01b03163314611d59576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b600e55565b6000546001600160a01b03163314611dab576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600855565b68327cb2734119d3b7a9601e1b81565b6298968081565b60146020526000908152604090205481565b600a5481565b60105481565b600b5481565b6000546001600160a01b03163314611e38576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600955565b6000546001600160a01b03163314611e8a576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b8051825114611ee0576040805162461bcd60e51b815260206004820152601e60248201527f466173745072696365466565643a20696e76616c6964206c656e677468730000604482015290519081900360640190fd5b8151611ef3906017906020850190612b54565b508051610f64906018906020840190612bb9565b3360009081526015602052604090205460ff16611f59576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b3360009081526016602052604090205460ff1615611fbd576040805162461bcd60e51b815260206004820152601c60248201527b11985cdd141c9a58d9519959590e88185b1c9958591e481d9bdd195960221b604482015290519081900360640190fd5b336000908152601660205260409020805460ff19166001908117909155601054611fe691612783565b6010556040805133815290517f4c0c5fabf50e808e3bc8d19577d305e3a7163eea7e8a74a50caa8896694cd44b9181900360200190a1565b6013602052600090815260409020546001600160a01b0381169063ffffffff600160a01b8204811691600160c01b8104821691600160e01b9091041684565b6000546001600160a01b031633146120aa576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b60008054911515600160a81b0260ff60a81b19909216919091179055565b6000546001600160a01b03163314612115576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60126020526000908152604090205481565b6000546001600160a01b03163314612196576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600b55565b6003546001600160a01b031633146121e8576040805162461bcd60e51b81526020600482015260186024820152600080516020612ca4833981519152604482015290519081900360640190fd5b600f55565b6000546001600160a01b0316331461223a576040805162461bcd60e51b81526020600482015260156024820152600080516020612c84833981519152604482015290519081900360640190fd5b600a55565b600d5481565b60085481565b6001600160a01b0381565b6001546001600160a01b031681565b60065481565b600b54600090156122c457600b546006546122879043906127db565b10156122c45760405162461bcd60e51b815260040180806020018281038252602e815260200180612d41602e913960400191505060405180910390fd5b600c546122d142826127db565b831161230e5760405162461bcd60e51b815260040180806020018281038252602d815260200180612d14602d913960400191505060405180910390fd5b6123184282612783565b83106123555760405162461bcd60e51b815260040180806020018281038252602f815260200180612cc4602f913960400191505060405180910390fd5b6005548310156123695760009150506116e7565b505060055543600655600190565b600082612386575060006123d3565b8282028284828161239357fe5b04146123d05760405162461bcd60e51b8152600401808060200182810382526021815260200180612cf36021913960400191505060405180910390fd5b90505b92915050565b60006123d083836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b81525061281d565b6001600160a01b03821615612687576000826001600160a01b03166356bf9de4866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561247657600080fd5b505afa15801561248a573d6000803e3d6000fd5b505050506040513d60208110156124a057600080fd5b50516001600160a01b0386166000908152601260205260408120549192508080806124ca8a611805565b935093509350935060008411156125915760008487116124f3576124ee85886127db565b6124fd565b6124fd87866127db565b905060008a8711612517576125128b886127db565b612521565b612521878c6127db565b9050612538600d54426123d990919063ffffffff16565b600d546125469087906123d9565b146125545760009350600092505b61256f61256887610f308562989680612377565b8590612783565b935061258c61258588610f308462989680612377565b8490612783565b925050505b81811180156125c057506001600160a01b038a166000908152601460205260409020546125be82846127db565b115b1561261d57604080516001600160a01b038c16815260208101889052808201879052606081018490526080810183905290517fe582322b389ad06b2bbf619cd6da3f16a288ec873ea0fa6df4d72f3d9480b4479181900360a00190a15b6126298a8784846128bf565b604080516001600160a01b038c16815260208101889052808201879052606081018490526080810183905290517f23b9387f81fca646aac1dc4487ede045c65f5f7445482906565f01e05afdb3a89181900360a00190a15050505050505b6001600160a01b03841660009081526012602052604090208390556119a3818585612a55565b60006126b88261226b565b90508015610f64576002546001546001600160a01b03918216911660005b6008811015610f6057601754819081106126f4575050505050610f66565b60178054602084029189831c63ffffffff1691600091908690811061271557fe5b6000918252602082200154601880546001600160a01b039092169350908790811061273c57fe5b6000918252602082200154915061276382610f308668327cb2734119d3b7a9601e1b612377565b905061277183828a8c612418565b5050600190940193506126d692505050565b6000828201838110156123d0576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b60006123d083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612ad3565b600081836128a95760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561286e578181015183820152602001612856565b50505050905090810190601f16801561289b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816128b557fe5b0495945050505050565b6001600160a01b03831061291a576040805162461bcd60e51b815260206004820152601f60248201527f466173745072696365466565643a20696e76616c696420726566507269636500604482015290519081900360640190fd5b63ffffffff821061295c5760405162461bcd60e51b8152600401808060200182810382526029815260200180612d6f6029913960400191505060405180910390fd5b63ffffffff811061299e5760405162461bcd60e51b815260040180806020018281038252602a815260200180612c5a602a913960400191505060405180910390fd5b604080516080810182526001600160a01b03948516815263ffffffff4281166020808401918252958216838501908152948216606084019081529787166000908152601390965292909420905181549251935196518516600160e01b026001600160e01b03978616600160c01b0263ffffffff60c01b1995909616600160a01b0263ffffffff60a01b19929097166001600160a01b0319909416939093171694909417919091169190911792909216919091179055565b6001600160a01b038316612a6857610f64565b826001600160a01b031663e0409c7183836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015612abf57600080fd5b505af115801561199f573d6000803e3d6000fd5b60008184841115612b255760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561286e578181015183820152602001612856565b505050900390565b60408051608081018252600080825260208201819052918101829052606081019190915290565b828054828255906000526020600020908101928215612ba9579160200282015b82811115612ba957825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612b74565b50612bb5929150612c00565b5090565b828054828255906000526020600020908101928215612bf4579160200282015b82811115612bf4578251825591602001919060010190612bd9565b50612bb5929150612c1f565b5b80821115612bb55780546001600160a01b0319168155600101612c01565b5b80821115612bb55760008155600101612c2056fe466173745072696365466565643a20696e76616c6964205f70726963654475726174696f6e466173745072696365466565643a20696e76616c69642063756d756c61746976654661737444656c7461476f7665726e61626c653a20666f7262696464656e0000000000000000000000466173745072696365466565643a20666f7262696464656e0000000000000000466173745072696365466565643a205f74696d657374616d70206578636565647320616c6c6f7765642072616e6765536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77466173745072696365466565643a205f74696d657374616d702062656c6f7720616c6c6f7765642072616e6765466173745072696365466565643a206d696e426c6f636b496e74657276616c206e6f742079657420706173736564466173745072696365466565643a20696e76616c69642063756d756c617469766552656644656c7461466173745072696365466565643a20616c726561647920696e697469616c697a6564a26469706673582212201e21199652ac032749c8dbe13b4e82de4d26d0b24d32573d0b699068e433524864736f6c634300060c0033