Overview
S Balance
0 S
S Value
-More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
LightQuoterV3
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 999 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.23; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/ILightQuoterV3.sol"; import { IUniswapV3Pool } from "./interfaces/IUniswapV3Pool.sol"; import { SafeCast } from "./vendor0.8/uniswap/SafeCast.sol"; import { TickMath } from "./vendor0.8/uniswap/TickMath.sol"; import { SwapMath } from "./vendor0.8/uniswap/SwapMath.sol"; import { BitMath } from "./vendor0.8/uniswap/BitMath.sol"; import { AmountsLiquidity } from "./libraries/AmountsLiquidity.sol"; // import "hardhat/console.sol"; contract LightQuoterV3 is ILightQuoterV3 { using SafeCast for uint256; uint256 public constant MAX_ITER = 15; struct SwapCache { bool zeroForOne; uint8 feeProtocol; uint128 liquidityStart; uint24 fee; int24 tickSpacing; int24 tick; uint160 sqrtPriceX96; uint160 sqrtPriceX96Limit; address swapPool; } // the top level state of the swap, the results of which are recorded in storage at the end struct SwapState { // the amount remaining to be swapped in/out of the input/output asset int256 amountSpecifiedRemaining; // the amount already swapped out/in of the output/input asset int256 amountCalculated; // current sqrt(price) uint160 sqrtPriceX96; // the tick associated with the current price int24 tick; // the current liquidity in range uint128 liquidity; } struct StepComputations { // the price at the beginning of the step uint160 sqrtPriceStartX96; // the next tick to swap to from the current tick in the swap direction int24 tickNext; // whether tickNext is initialized or not bool initialized; // sqrt(price) for the next tick (1/0) uint160 sqrtPriceNextX96; // how much is being swapped in in this step uint256 amountIn; // how much is being swapped out uint256 amountOut; // how much fee is being paid in uint256 feeAmount; } error LtQV3ZapInFailed( uint256 amountInNext, uint256 calcAmountIn, uint256 calcAmountOut, uint256 tokenInBalance, uint256 tokenOutBalance ); function quoteExactInputSingle( bool zeroForIn, address swapPool, uint256 amountIn ) external view returns (uint160 sqrtPriceX96After, uint256 amountOut) { SwapCache memory cache; _prepareSwapCache(zeroForIn, swapPool, cache); (sqrtPriceX96After, , amountOut) = _simulateSwap(true, amountIn.toInt256(), cache); } function quoteExactOutputSingle( bool zeroForIn, address swapPool, uint256 amountOut ) external view returns (uint160 sqrtPriceX96After, uint256 amountIn) { SwapCache memory cache; _prepareSwapCache(zeroForIn, swapPool, cache); uint256 out; (sqrtPriceX96After, amountIn, out) = _simulateSwap(false, -amountOut.toInt256(), cache); require(out == amountOut, "LtQV3:IL"); } function getBalanceOf(address token, address target) internal view returns (uint256 balance) { bytes memory callData = abi.encodeWithSelector(IERC20.balanceOf.selector, target); (bool success, bytes memory data) = token.staticcall(callData); require(success && data.length >= 32); balance = abi.decode(data, (uint256)); } function calculateExactZapIn( CalculateExactZapInParams memory params ) external view returns (uint256 swapAmountIn, uint256 calcAmountIn, uint256 calcAmountOut) { uint160 sqrtPriceX96After; uint160 sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(params.tickLower); uint160 sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(params.tickUpper); SwapCache memory cache; _prepareSwapCache(params.zeroForIn, params.swapPool, cache); (calcAmountIn, calcAmountOut) = _calculateAmounts( params.zeroForIn, params.liquidityExactAmount, cache.sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96 ); uint256 amountInNext = params.tokenInBalance - calcAmountIn; if (params.tokenOutBalance < calcAmountOut) { require(amountInNext > 0, "LtQV3:IB"); uint256 amountOut; uint256 amountIn; (sqrtPriceX96After, amountIn, amountOut) = _simulateSwap( false, -calcAmountOut.toInt256(), cache ); if (amountIn > amountInNext) { amountIn = amountInNext; } for (uint256 i; i < MAX_ITER; ) { (sqrtPriceX96After, amountIn, amountOut) = _simulateSwap( true, amountIn.toInt256(), cache ); (calcAmountIn, calcAmountOut) = _calculateAmounts( params.zeroForIn, params.liquidityExactAmount, sqrtPriceX96After, sqrtRatioAX96, sqrtRatioBX96 ); if (calcAmountOut == 0 || calcAmountIn > params.tokenInBalance - amountIn) { amountInNext = (amountIn * 900) / 1000; } else { (, amountInNext, ) = _simulateSwap(false, -calcAmountOut.toInt256(), cache); } if ( amountIn > 0 && amountOut + params.tokenOutBalance >= calcAmountOut && calcAmountIn <= params.tokenInBalance - amountIn ) { swapAmountIn = amountIn; break; } amountIn = amountInNext; unchecked { ++i; } } if (swapAmountIn == 0) { (calcAmountIn, calcAmountOut) = _calculateAmounts( params.zeroForIn, params.liquidityExactAmount, cache.sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96 ); amountInNext = params.tokenInBalance - calcAmountIn; revert LtQV3ZapInFailed( amountInNext, calcAmountIn, calcAmountOut, params.tokenInBalance, params.tokenOutBalance ); } } // returns as token0, token1 if (!params.zeroForIn) { (calcAmountIn, calcAmountOut) = (calcAmountOut, calcAmountIn); } } function _calculateAmounts( bool zeroForIn, uint128 liquidityExactAmount, uint160 sqrtPriceX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96 ) private pure returns (uint256 calcAmountIn, uint256 calcAmountOut) { (uint256 amount0, uint256 amount1) = AmountsLiquidity.getAmountsRoundingUpForLiquidity( sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, liquidityExactAmount ); (calcAmountIn, calcAmountOut) = zeroForIn ? (amount0, amount1) : (amount1, amount0); } function _prepareSwapCache( bool zeroForOne, address swapPool, SwapCache memory cache ) private view { (uint160 sqrtPriceX96, int24 tick, , , , uint8 feeProtocol, ) = IUniswapV3Pool(swapPool) .slot0(); cache.zeroForOne = zeroForOne; cache.liquidityStart = IUniswapV3Pool(swapPool).liquidity(); cache.feeProtocol = zeroForOne ? (feeProtocol % 16) : (feeProtocol >> 4); cache.fee = IUniswapV3Pool(swapPool).fee(); cache.tickSpacing = IUniswapV3Pool(swapPool).tickSpacing(); cache.tick = tick; cache.sqrtPriceX96 = sqrtPriceX96; cache.sqrtPriceX96Limit = zeroForOne ? TickMath.MIN_SQRT_RATIO + 1 : TickMath.MAX_SQRT_RATIO - 1; cache.swapPool = swapPool; } function _simulateSwap( bool exactInput, int256 amountSpecified, SwapCache memory cache ) private view returns (uint160, uint256, uint256) { require(amountSpecified != 0, "LtQV3:AS"); SwapState memory state = SwapState({ amountSpecifiedRemaining: amountSpecified, amountCalculated: 0, sqrtPriceX96: cache.sqrtPriceX96, tick: cache.tick, liquidity: cache.liquidityStart }); // continue swapping as long as we haven't used the entire input/output and haven't reached the price limit while ( state.amountSpecifiedRemaining != 0 && state.sqrtPriceX96 != cache.sqrtPriceX96Limit ) { StepComputations memory step; step.sqrtPriceStartX96 = state.sqrtPriceX96; (step.tickNext, step.initialized) = _nextInitializedTickWithinOneWord( cache.swapPool, state.tick, cache.tickSpacing, cache.zeroForOne ); // ensure that we do not overshoot the min/max tick, as the tick bitmap is not aware of these bounds if (step.tickNext < TickMath.MIN_TICK) { step.tickNext = TickMath.MIN_TICK; } else if (step.tickNext > TickMath.MAX_TICK) { step.tickNext = TickMath.MAX_TICK; } // get the price for the next tick step.sqrtPriceNextX96 = TickMath.getSqrtRatioAtTick(step.tickNext); // compute values to swap to the target tick, price limit, or point where input/output amount is exhausted (state.sqrtPriceX96, step.amountIn, step.amountOut, step.feeAmount) = SwapMath .computeSwapStep( state.sqrtPriceX96, ( cache.zeroForOne ? step.sqrtPriceNextX96 < cache.sqrtPriceX96Limit : step.sqrtPriceNextX96 > cache.sqrtPriceX96Limit ) ? cache.sqrtPriceX96Limit : step.sqrtPriceNextX96, state.liquidity, state.amountSpecifiedRemaining, cache.fee ); if (exactInput) { // safe because we test that amountSpecified > amountIn + feeAmount in SwapMath unchecked { state.amountSpecifiedRemaining -= (step.amountIn + step.feeAmount).toInt256(); } state.amountCalculated -= step.amountOut.toInt256(); } else { unchecked { state.amountSpecifiedRemaining += step.amountOut.toInt256(); } state.amountCalculated += (step.amountIn + step.feeAmount).toInt256(); } // if the protocol fee is on, calculate how much is owed, decrement feeAmount, and increment protocolFee if (cache.feeProtocol > 0) { unchecked { uint256 delta = step.feeAmount / cache.feeProtocol; step.feeAmount -= delta; } } // shift tick if we reached the next price if (state.sqrtPriceX96 == step.sqrtPriceNextX96) { // if the tick is initialized, run the tick transition if (step.initialized) { // check for the placeholder value, which we replace with the actual value the first time the swap // crosses an initialized tick (, int128 liquidityNet, , , , , , ) = IUniswapV3Pool(cache.swapPool).ticks( step.tickNext ); // if we're moving leftward, we interpret liquidityNet as the opposite sign // safe because liquidityNet cannot be type(int128).min unchecked { if (cache.zeroForOne) liquidityNet = -liquidityNet; } state.liquidity = liquidityNet < 0 ? state.liquidity - uint128(-liquidityNet) : state.liquidity + uint128(liquidityNet); } unchecked { state.tick = cache.zeroForOne ? step.tickNext - 1 : step.tickNext; } } else if (state.sqrtPriceX96 != step.sqrtPriceStartX96) { // recompute unless we're on a lower tick boundary (i.e. already transitioned ticks), and haven't moved state.tick = TickMath.getTickAtSqrtRatio(state.sqrtPriceX96); } } unchecked { return exactInput ? ( state.sqrtPriceX96, uint256(amountSpecified - state.amountSpecifiedRemaining), uint256(-state.amountCalculated) ) : ( state.sqrtPriceX96, uint256(state.amountCalculated), uint256(-(amountSpecified - state.amountSpecifiedRemaining)) ); } } function _position(int24 tick) private pure returns (int16 wordPos, uint8 bitPos) { unchecked { wordPos = int16(tick >> 8); bitPos = uint8(int8(tick % 256)); } } function _nextInitializedTickWithinOneWord( address swapPool, int24 tick, int24 tickSpacing, bool lte ) private view returns (int24 next, bool initialized) { unchecked { int24 compressed = tick / tickSpacing; if (tick < 0 && tick % tickSpacing != 0) compressed--; // round towards negative infinity if (lte) { (int16 wordPos, uint8 bitPos) = _position(compressed); // all the 1s at or to the right of the current bitPos uint256 mask = (1 << bitPos) - 1 + (1 << bitPos); uint256 masked = IUniswapV3Pool(swapPool).tickBitmap(wordPos) & mask; // if there are no initialized ticks to the right of or at the current tick, return rightmost in the word initialized = masked != 0; // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick next = initialized ? (compressed - int24(uint24(bitPos - BitMath.mostSignificantBit(masked)))) * tickSpacing : (compressed - int24(uint24(bitPos))) * tickSpacing; } else { // start from the word of the next tick, since the current tick state doesn't matter (int16 wordPos, uint8 bitPos) = _position(compressed + 1); // all the 1s at or to the left of the bitPos uint256 mask = ~((1 << bitPos) - 1); uint256 masked = IUniswapV3Pool(swapPool).tickBitmap(wordPos) & mask; // if there are no initialized ticks to the left of the current tick, return leftmost in the word initialized = masked != 0; // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick next = initialized ? (compressed + 1 + int24(uint24(BitMath.leastSignificantBit(masked) - bitPos))) * tickSpacing : (compressed + 1 + int24(uint24(type(uint8).max - bitPos))) * tickSpacing; } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title Light Quoter Interface interface ILightQuoterV3 { /// @title Struct for "Zap In" Calculation Parameters /// @notice This struct encapsulates the various parameters required for calculating the exact amount of tokens to zap in. struct CalculateExactZapInParams { /// @notice The address of the swap pool where liquidity will be added. address swapPool; /// @notice A boolean determining which token will be used to add liquidity (true for token0 or false for token1). bool zeroForIn; /// @notice The lower bound of the tick range for the position within the pool. int24 tickLower; /// @notice The upper bound of the tick range for the position within the pool. int24 tickUpper; /// @notice The exact amount of liquidity to add to the pool. uint128 liquidityExactAmount; /// @notice The balance of the token that will be used to add liquidity. uint256 tokenInBalance; /// @notice The balance of the other token in the pool, not typically used for adding liquidity directly but necessary for calculations. uint256 tokenOutBalance; } /// @notice Calculates parameters related to "zapping in" to a position with an exact amount of liquidity. /// @dev Interacts with an on-chain liquidity pool to precisely estimate the amounts in/out to add liquidity. /// This calculation is performed using iterative methods to ensure the exactness of the resulting values. /// It uses the `getSqrtRatioAtTick` method within the loop to determine price bounds. /// This process is designed to avoid failure due to constraints such as limited input or other conditions. /// The number of iterations to reach an accurate result is bounded by a maximum value. /// @param params A `CalculateExactZapInParams` struct containing all necessary parameters to perform the calculations. /// This may include details about the liquidity pool, desired position, slippage tolerance, etc. /// @return swapAmountIn The exact total amount of input tokens required to complete the zap in operation. /// @return amount0 The exact amount of the token0 will be used for "zapping in" to a position. /// @return amount1 The exact amount of the token1 will be used for "zapping in" to a position. function calculateExactZapIn( CalculateExactZapInParams memory params ) external view returns (uint256 swapAmountIn, uint256 amount0, uint256 amount1); /** * @notice Quotes the output amount for a given input amount in a single token swap operation on Uniswap V3. * @dev This function simulates the swap and returns the estimated output amount. It does not execute the trade itself. * @param zeroForIn A boolean indicating the direction of the swap: * true for swapping the 0th token (token0) to the 1st token (token1), false for token1 to token0. * @param swapPool The address of the Uniswap V3 pool contract through which the swap will be simulated. * @param amountIn The amount of input tokens that one would like to swap. * @return sqrtPriceX96After The square root of the price after the swap, scaled by 2^96. This is the price between the two tokens in the pool post-simulation. * @return amountOut The amount of output tokens that can be expected to receive in the swap based on the current state of the pool. */ function quoteExactInputSingle( bool zeroForIn, address swapPool, uint256 amountIn ) external view returns (uint160 sqrtPriceX96After, uint256 amountOut); /** * @notice Quotes the amount of input tokens required to arrive at a specified output token amount for a single pool swap. * @dev This function performs a read-only operation to compute the necessary input amount and does not execute an actual swap. * It is useful for obtaining quotes prior to performing transactions. * @param zeroForIn A boolean that indicates the direction of the trade, true if swapping zero for in-token, false otherwise. * @param swapPool The address of the swap pool contract where the trade will take place. * @param amountOut The desired amount of output tokens. * @return sqrtPriceX96After The square root price (encoded as a 96-bit fixed point number) after the swap would occur. * @return amountIn The amount of input tokens required for the swap to achieve the desired `amountOut`. */ function quoteExactOutputSingle( bool zeroForIn, address swapPool, uint256 amountOut ) external view returns (uint160 sqrtPriceX96After, uint256 amountIn); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import {IUniswapV3PoolImmutables} from './pool/IUniswapV3PoolImmutables.sol'; import {IUniswapV3PoolState} from './pool/IUniswapV3PoolState.sol'; import {IUniswapV3PoolDerivedState} from './pool/IUniswapV3PoolDerivedState.sol'; import {IUniswapV3PoolActions} from './pool/IUniswapV3PoolActions.sol'; import {IUniswapV3PoolOwnerActions} from './pool/IUniswapV3PoolOwnerActions.sol'; import {IUniswapV3PoolErrors} from './pool/IUniswapV3PoolErrors.sol'; import {IUniswapV3PoolEvents} from './pool/IUniswapV3PoolEvents.sol'; /// @title The interface for a Uniswap V3 Pool /// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform /// to the ERC20 specification /// @dev The pool interface is broken up into many smaller pieces interface IUniswapV3Pool is IUniswapV3PoolImmutables, IUniswapV3PoolState, IUniswapV3PoolDerivedState, IUniswapV3PoolActions, IUniswapV3PoolOwnerActions, IUniswapV3PoolErrors, IUniswapV3PoolEvents { }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissionless pool actions /// @notice Contains pool methods that can be called by anyone interface IUniswapV3PoolActions { /// @notice Sets the initial price for the pool /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96 function initialize(uint160 sqrtPriceX96) external; /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends /// on tickLower, tickUpper, the amount of liquidity, and the current price. /// @param recipient The address for which the liquidity will be created /// @param tickLower The lower tick of the position in which to add liquidity /// @param tickUpper The upper tick of the position in which to add liquidity /// @param amount The amount of liquidity to mint /// @param data Any data that should be passed through to the callback /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback function mint( address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes calldata data ) external returns (uint256 amount0, uint256 amount1); /// @notice Collects tokens owed to a position /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity. /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity. /// @param recipient The address which should receive the fees collected /// @param tickLower The lower tick of the position for which to collect fees /// @param tickUpper The upper tick of the position for which to collect fees /// @param amount0Requested How much token0 should be withdrawn from the fees owed /// @param amount1Requested How much token1 should be withdrawn from the fees owed /// @return amount0 The amount of fees collected in token0 /// @return amount1 The amount of fees collected in token1 function collect( address recipient, int24 tickLower, int24 tickUpper, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0 /// @dev Fees must be collected separately via a call to #collect /// @param tickLower The lower tick of the position for which to burn liquidity /// @param tickUpper The upper tick of the position for which to burn liquidity /// @param amount How much liquidity to burn /// @return amount0 The amount of token0 sent to the recipient /// @return amount1 The amount of token1 sent to the recipient function burn( int24 tickLower, int24 tickUpper, uint128 amount ) external returns (uint256 amount0, uint256 amount1); /// @notice Swap token0 for token1, or token1 for token0 /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback /// @param recipient The address to receive the output of the swap /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0 /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative) /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this /// value after the swap. If one for zero, the price cannot be greater than this value after the swap /// @param data Any data to be passed through to the callback /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive function swap( address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes calldata data ) external returns (int256 amount0, int256 amount1); /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling /// with 0 amount{0,1} and sending the donation amount(s) from the callback /// @param recipient The address which will receive the token0 and token1 amounts /// @param amount0 The amount of token0 to send /// @param amount1 The amount of token1 to send /// @param data Any data to be passed through to the callback function flash( address recipient, uint256 amount0, uint256 amount1, bytes calldata data ) external; /// @notice Increase the maximum number of price and liquidity observations that this pool will store /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to /// the input observationCardinalityNext. /// @param observationCardinalityNext The desired minimum number of observations for the pool to store function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that is not stored /// @notice Contains view functions to provide information about the pool that is computed rather than stored on the /// blockchain. The functions here may have variable gas costs. interface IUniswapV3PoolDerivedState { /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick, /// you must call it with secondsAgos = [3600, 0]. /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio. /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block /// timestamp function observe(uint32[] calldata secondsAgos) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s); /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed. /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first /// snapshot is taken and the second snapshot is taken. /// @param tickLower The lower tick of the range /// @param tickUpper The upper tick of the range /// @return tickCumulativeInside The snapshot of the tick accumulator for the range /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range /// @return secondsInside The snapshot of seconds per liquidity for the range function snapshotCumulativesInside(int24 tickLower, int24 tickUpper) external view returns ( int56 tickCumulativeInside, uint160 secondsPerLiquidityInsideX128, uint32 secondsInside ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Errors emitted by a pool /// @notice Contains all events emitted by the pool interface IUniswapV3PoolErrors { error LOK(); error TLU(); error TLM(); error TUM(); error AI(); error M0(); error M1(); error AS(); error IIA(); error L(); error F0(); error F1(); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Events emitted by a pool /// @notice Contains all events emitted by the pool interface IUniswapV3PoolEvents { /// @notice Emitted exactly once by a pool when #initialize is first called on the pool /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96 /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool event Initialize(uint160 sqrtPriceX96, int24 tick); /// @notice Emitted when liquidity is minted for a given position /// @param sender The address that minted the liquidity /// @param owner The owner of the position and recipient of any minted liquidity /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity minted to the position range /// @param amount0 How much token0 was required for the minted liquidity /// @param amount1 How much token1 was required for the minted liquidity event Mint( address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted when fees are collected by the owner of a position /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees /// @param owner The owner of the position for which fees are collected /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount0 The amount of token0 fees collected /// @param amount1 The amount of token1 fees collected event Collect( address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1 ); /// @notice Emitted when a position's liquidity is removed /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect /// @param owner The owner of the position for which liquidity is removed /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity to remove /// @param amount0 The amount of token0 withdrawn /// @param amount1 The amount of token1 withdrawn event Burn( address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted by the pool for any swaps between token0 and token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the output of the swap /// @param amount0 The delta of the token0 balance of the pool /// @param amount1 The delta of the token1 balance of the pool /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96 /// @param liquidity The liquidity of the pool after the swap /// @param tick The log base 1.0001 of price of the pool after the swap event Swap( address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick ); /// @notice Emitted by the pool for any flashes of token0/token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the tokens from flash /// @param amount0 The amount of token0 that was flashed /// @param amount1 The amount of token1 that was flashed /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee event Flash( address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1 ); /// @notice Emitted by the pool for increases to the number of observations that can be stored /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index /// just before a mint/swap/burn. /// @param observationCardinalityNextOld The previous value of the next observation cardinality /// @param observationCardinalityNextNew The updated value of the next observation cardinality event IncreaseObservationCardinalityNext( uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew ); /// @notice Emitted when the protocol fee is changed by the pool /// @param feeProtocol0Old The previous value of the token0 protocol fee /// @param feeProtocol1Old The previous value of the token1 protocol fee /// @param feeProtocol0New The updated value of the token0 protocol fee /// @param feeProtocol1New The updated value of the token1 protocol fee event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New); /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner /// @param sender The address that collects the protocol fees /// @param recipient The address that receives the collected protocol fees /// @param amount0 The amount of token0 protocol fees that is withdrawn /// @param amount0 The amount of token1 protocol fees that is withdrawn event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that never changes /// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values interface IUniswapV3PoolImmutables { /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface /// @return The contract address function factory() external view returns (address); /// @notice The first of the two tokens of the pool, sorted by address /// @return The token contract address function token0() external view returns (address); /// @notice The second of the two tokens of the pool, sorted by address /// @return The token contract address function token1() external view returns (address); /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6 /// @return The fee function fee() external view returns (uint24); /// @notice The pool tick spacing /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ... /// This value is an int24 to avoid casting even though it is always positive. /// @return The tick spacing function tickSpacing() external view returns (int24); /// @notice The maximum amount of position liquidity that can use any tick in the range /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool /// @return The max amount of liquidity per tick function maxLiquidityPerTick() external view returns (uint128); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissioned pool actions /// @notice Contains pool methods that may only be called by the factory owner interface IUniswapV3PoolOwnerActions { /// @notice Set the denominator of the protocol's % share of the fees /// @param feeProtocol0 new protocol fee for token0 of the pool /// @param feeProtocol1 new protocol fee for token1 of the pool function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external; /// @notice Collect the protocol fee accrued to the pool /// @param recipient The address to which collected protocol fees should be sent /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1 /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0 /// @return amount0 The protocol fee collected in token0 /// @return amount1 The protocol fee collected in token1 function collectProtocol( address recipient, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that can change /// @notice These methods compose the pool's state, and can change with any frequency including multiple times /// per transaction interface IUniswapV3PoolState { /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas /// when accessed externally. /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value /// @return tick The current tick of the pool, i.e. according to the last tick transition that was run. /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick /// boundary. /// @return observationIndex The index of the last oracle observation that was written, /// @return observationCardinality The current maximum number of observations stored in the pool, /// @return observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// @return feeProtocol The protocol fee for both tokens of the pool. /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0 /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee. /// unlocked Whether the pool is currently locked to reentrancy function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked ); /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal0X128() external view returns (uint256); /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal1X128() external view returns (uint256); /// @notice The amounts of token0 and token1 that are owed to the protocol /// @dev Protocol fees will never exceed uint128 max in either token function protocolFees() external view returns (uint128 token0, uint128 token1); /// @notice The currently in range liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks /// @return The liquidity at the current price of the pool function liquidity() external view returns (uint128); /// @notice Look up information about a specific tick in the pool /// @param tick The tick to look up /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or /// tick upper /// @return liquidityNet how much liquidity changes when the pool price crosses the tick, /// @return feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0, /// @return feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1, /// @return tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick /// @return secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick, /// @return secondsOutside the seconds spent on the other side of the tick from the current tick, /// @return initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false. /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0. /// In addition, these values are only relative and must be used only in comparison to previous snapshots for /// a specific position. function ticks(int24 tick) external view returns ( uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized ); /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information function tickBitmap(int16 wordPosition) external view returns (uint256); /// @notice Returns the information about a position by the position's key /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper /// @return liquidity The amount of liquidity in the position, /// @return feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// @return feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// @return tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// @return tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke function positions(bytes32 key) external view returns ( uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); /// @notice Returns data about a specific observation index /// @param index The element of the observations array to fetch /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time /// ago, rather than at a specific index in the array. /// @return blockTimestamp The timestamp of the observation, /// @return tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, /// @return secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, /// @return initialized whether the observation has been initialized and the values are safe to use function observations(uint256 index) external view returns ( uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import { FullMath } from "../vendor0.8/uniswap/FullMath.sol"; import { FixedPoint96 } from "../vendor0.8/uniswap/FixedPoint96.sol"; library AmountsLiquidity { /// @notice Computes the amount of token0 for a given amount of liquidity and a price range /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param liquidity The liquidity being valued /// @return amount0 The amount of token0 function getAmount0RoundingUpForLiquidity( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount0) { unchecked { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96); return FullMath.mulDivRoundingUp(liquidity, sqrtRatioBX96 - sqrtRatioAX96, intermediate); } } /// @notice Computes the amount of token1 for a given amount of liquidity and a price range /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param liquidity The liquidity being valued /// @return amount1 The amount of token1 function getAmount1RoundingUpForLiquidity( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount1) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); unchecked { return FullMath.mulDivRoundingUp( liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96 ); } } /// @notice Computes the token0 and token1 value for a given amount of liquidity, the current /// pool prices and the prices at the tick boundaries /// @param sqrtRatioX96 A sqrt price representing the current pool prices /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param liquidity The liquidity being valued /// @return amount0 The amount of token0 /// @return amount1 The amount of token1 function getAmountsRoundingUpForLiquidity( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount0, uint256 amount1) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); if (sqrtRatioX96 <= sqrtRatioAX96) { amount0 = getAmount0RoundingUpForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity); } else if (sqrtRatioX96 < sqrtRatioBX96) { amount0 = getAmount0RoundingUpForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity); amount1 = getAmount1RoundingUpForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity); } else { amount1 = getAmount1RoundingUpForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity); } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; /// @title BitMath /// @dev This library provides functionality for computing bit properties of an unsigned integer library BitMath { /// @notice Returns the index of the most significant bit of the number, /// where the least significant bit is at index 0 and the most significant bit is at index 255 /// @dev The function satisfies the property: /// x >= 2**mostSignificantBit(x) and x < 2**(mostSignificantBit(x)+1) /// @param x the value for which to compute the most significant bit, must be greater than 0 /// @return r the index of the most significant bit function mostSignificantBit(uint256 x) internal pure returns (uint8 r) { require(x > 0); unchecked { if (x >= 0x100000000000000000000000000000000) { x >>= 128; r += 128; } if (x >= 0x10000000000000000) { x >>= 64; r += 64; } if (x >= 0x100000000) { x >>= 32; r += 32; } if (x >= 0x10000) { x >>= 16; r += 16; } if (x >= 0x100) { x >>= 8; r += 8; } if (x >= 0x10) { x >>= 4; r += 4; } if (x >= 0x4) { x >>= 2; r += 2; } if (x >= 0x2) r += 1; } } /// @notice Returns the index of the least significant bit of the number, /// where the least significant bit is at index 0 and the most significant bit is at index 255 /// @dev The function satisfies the property: /// (x & 2**leastSignificantBit(x)) != 0 and (x & (2**(leastSignificantBit(x)) - 1)) == 0) /// @param x the value for which to compute the least significant bit, must be greater than 0 /// @return r the index of the least significant bit function leastSignificantBit(uint256 x) internal pure returns (uint8 r) { require(x > 0); unchecked { r = 255; if (x & type(uint128).max > 0) { r -= 128; } else { x >>= 128; } if (x & type(uint64).max > 0) { r -= 64; } else { x >>= 64; } if (x & type(uint32).max > 0) { r -= 32; } else { x >>= 32; } if (x & type(uint16).max > 0) { r -= 16; } else { x >>= 16; } if (x & type(uint8).max > 0) { r -= 8; } else { x >>= 8; } if (x & 0xf > 0) { r -= 4; } else { x >>= 4; } if (x & 0x3 > 0) { r -= 2; } else { x >>= 2; } if (x & 0x1 > 0) r -= 1; } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.4.0; /// @title FixedPoint96 /// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format) /// @dev Used in SqrtPriceMath.sol library FixedPoint96 { uint8 internal constant RESOLUTION = 96; uint256 internal constant Q96 = 0x1000000000000000000000000; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; /// @title Contains 512-bit math functions /// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision /// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits library FullMath { /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv function mulDiv( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = a * b // Compute the product mod 2**256 and mod 2**256 - 1 // then use the Chinese Remainder Theorem to reconstruct // the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2**256 + prod0 uint256 prod0 = a * b; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(a, b, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Make sure the result is less than 2**256. // Also prevents denominator == 0 require(denominator > prod1); // Handle non-overflow cases, 256 by 256 division if (prod1 == 0) { assembly { result := div(prod0, denominator) } return result; } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0] // Compute remainder using mulmod uint256 remainder; assembly { remainder := mulmod(a, b, denominator) } // Subtract 256 bit number from 512 bit number assembly { prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator // Compute largest power of two divisor of denominator. // Always >= 1. uint256 twos = (0 - denominator) & denominator; // Divide denominator by power of two assembly { denominator := div(denominator, twos) } // Divide [prod1 prod0] by the factors of two assembly { prod0 := div(prod0, twos) } // Shift in bits from prod1 into prod0. For this we need // to flip `twos` such that it is 2**256 / twos. // If twos is zero, then it becomes one assembly { twos := add(div(sub(0, twos), twos), 1) } prod0 |= prod1 * twos; // Invert denominator mod 2**256 // Now that denominator is an odd number, it has an inverse // modulo 2**256 such that denominator * inv = 1 mod 2**256. // Compute the inverse by starting with a seed that is correct // correct for four bits. That is, denominator * inv = 1 mod 2**4 uint256 inv = (3 * denominator) ^ 2; // Now use Newton-Raphson iteration to improve the precision. // Thanks to Hensel's lifting lemma, this also works in modular // arithmetic, doubling the correct bits in each step. inv *= 2 - denominator * inv; // inverse mod 2**8 inv *= 2 - denominator * inv; // inverse mod 2**16 inv *= 2 - denominator * inv; // inverse mod 2**32 inv *= 2 - denominator * inv; // inverse mod 2**64 inv *= 2 - denominator * inv; // inverse mod 2**128 inv *= 2 - denominator * inv; // inverse mod 2**256 // Because the division is now exact we can divide by multiplying // with the modular inverse of denominator. This will give us the // correct result modulo 2**256. Since the preconditions guarantee // that the outcome is less than 2**256, this is the final result. // We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inv; return result; } } /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result function mulDivRoundingUp( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { unchecked { result = mulDiv(a, b, denominator); if (mulmod(a, b, denominator) > 0) { require(result < type(uint256).max); result++; } } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Safe casting methods /// @notice Contains methods for safely casting between types library SafeCast { /// @notice Cast a uint256 to a uint160, revert on overflow /// @param y The uint256 to be downcasted /// @return z The downcasted integer, now type uint160 function toUint160(uint256 y) internal pure returns (uint160 z) { require((z = uint160(y)) == y); } /// @notice Cast a int256 to a int128, revert on overflow or underflow /// @param y The int256 to be downcasted /// @return z The downcasted integer, now type int128 function toInt128(int256 y) internal pure returns (int128 z) { require((z = int128(y)) == y); } /// @notice Cast a uint256 to a int256, revert on overflow /// @param y The uint256 to be casted /// @return z The casted integer, now type int256 function toInt256(uint256 y) internal pure returns (int256 z) { require(y < 2 ** 255); z = int256(y); } /// @notice Downcasts uint256 to uint128 /// @param x The uint258 to be downcasted /// @return y The passed value, downcasted to uint128 function toUint128(uint256 x) internal pure returns (uint128 y) { require((y = uint128(x)) == x); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; import {SafeCast} from './SafeCast.sol'; import {FullMath} from './FullMath.sol'; import {UnsafeMath} from './UnsafeMath.sol'; import {FixedPoint96} from './FixedPoint96.sol'; /// @title Functions based on Q64.96 sqrt price and liquidity /// @notice Contains the math that uses square root of price as a Q64.96 and liquidity to compute deltas library SqrtPriceMath { using SafeCast for uint256; /// @notice Gets the next sqrt price given a delta of token0 /// @dev Always rounds up, because in the exact output case (increasing price) we need to move the price at least /// far enough to get the desired output amount, and in the exact input case (decreasing price) we need to move the /// price less in order to not send too much output. /// The most precise formula for this is liquidity * sqrtPX96 / (liquidity +- amount * sqrtPX96), /// if this is impossible because of overflow, we calculate liquidity / (liquidity / sqrtPX96 +- amount). /// @param sqrtPX96 The starting price, i.e. before accounting for the token0 delta /// @param liquidity The amount of usable liquidity /// @param amount How much of token0 to add or remove from virtual reserves /// @param add Whether to add or remove the amount of token0 /// @return The price after adding or removing amount, depending on add function getNextSqrtPriceFromAmount0RoundingUp( uint160 sqrtPX96, uint128 liquidity, uint256 amount, bool add ) internal pure returns (uint160) { // we short circuit amount == 0 because the result is otherwise not guaranteed to equal the input price if (amount == 0) return sqrtPX96; uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION; if (add) { unchecked { uint256 product; if ((product = amount * sqrtPX96) / amount == sqrtPX96) { uint256 denominator = numerator1 + product; if (denominator >= numerator1) // always fits in 160 bits return uint160(FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator)); } } // denominator is checked for overflow return uint160(UnsafeMath.divRoundingUp(numerator1, (numerator1 / sqrtPX96) + amount)); } else { unchecked { uint256 product; // if the product overflows, we know the denominator underflows // in addition, we must check that the denominator does not underflow require((product = amount * sqrtPX96) / amount == sqrtPX96 && numerator1 > product); uint256 denominator = numerator1 - product; return FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator).toUint160(); } } } /// @notice Gets the next sqrt price given a delta of token1 /// @dev Always rounds down, because in the exact output case (decreasing price) we need to move the price at least /// far enough to get the desired output amount, and in the exact input case (increasing price) we need to move the /// price less in order to not send too much output. /// The formula we compute is within <1 wei of the lossless version: sqrtPX96 +- amount / liquidity /// @param sqrtPX96 The starting price, i.e., before accounting for the token1 delta /// @param liquidity The amount of usable liquidity /// @param amount How much of token1 to add, or remove, from virtual reserves /// @param add Whether to add, or remove, the amount of token1 /// @return The price after adding or removing `amount` function getNextSqrtPriceFromAmount1RoundingDown( uint160 sqrtPX96, uint128 liquidity, uint256 amount, bool add ) internal pure returns (uint160) { // if we're adding (subtracting), rounding down requires rounding the quotient down (up) // in both cases, avoid a mulDiv for most inputs if (add) { uint256 quotient = ( amount <= type(uint160).max ? (amount << FixedPoint96.RESOLUTION) / liquidity : FullMath.mulDiv(amount, FixedPoint96.Q96, liquidity) ); return (uint256(sqrtPX96) + quotient).toUint160(); } else { uint256 quotient = ( amount <= type(uint160).max ? UnsafeMath.divRoundingUp(amount << FixedPoint96.RESOLUTION, liquidity) : FullMath.mulDivRoundingUp(amount, FixedPoint96.Q96, liquidity) ); require(sqrtPX96 > quotient); // always fits 160 bits unchecked { return uint160(sqrtPX96 - quotient); } } } /// @notice Gets the next sqrt price given an input amount of token0 or token1 /// @dev Throws if price or liquidity are 0, or if the next price is out of bounds /// @param sqrtPX96 The starting price, i.e., before accounting for the input amount /// @param liquidity The amount of usable liquidity /// @param amountIn How much of token0, or token1, is being swapped in /// @param zeroForOne Whether the amount in is token0 or token1 /// @return sqrtQX96 The price after adding the input amount to token0 or token1 function getNextSqrtPriceFromInput( uint160 sqrtPX96, uint128 liquidity, uint256 amountIn, bool zeroForOne ) internal pure returns (uint160 sqrtQX96) { require(sqrtPX96 > 0); require(liquidity > 0); // round to make sure that we don't pass the target price return zeroForOne ? getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountIn, true) : getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountIn, true); } /// @notice Gets the next sqrt price given an output amount of token0 or token1 /// @dev Throws if price or liquidity are 0 or the next price is out of bounds /// @param sqrtPX96 The starting price before accounting for the output amount /// @param liquidity The amount of usable liquidity /// @param amountOut How much of token0, or token1, is being swapped out /// @param zeroForOne Whether the amount out is token0 or token1 /// @return sqrtQX96 The price after removing the output amount of token0 or token1 function getNextSqrtPriceFromOutput( uint160 sqrtPX96, uint128 liquidity, uint256 amountOut, bool zeroForOne ) internal pure returns (uint160 sqrtQX96) { require(sqrtPX96 > 0); require(liquidity > 0); // round to make sure that we pass the target price return zeroForOne ? getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountOut, false) : getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountOut, false); } /// @notice Gets the amount0 delta between two prices /// @dev Calculates liquidity / sqrt(lower) - liquidity / sqrt(upper), /// i.e. liquidity * (sqrt(upper) - sqrt(lower)) / (sqrt(upper) * sqrt(lower)) /// @param sqrtRatioAX96 A sqrt price /// @param sqrtRatioBX96 Another sqrt price /// @param liquidity The amount of usable liquidity /// @param roundUp Whether to round the amount up or down /// @return amount0 Amount of token0 required to cover a position of size liquidity between the two passed prices function getAmount0Delta( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity, bool roundUp ) internal pure returns (uint256 amount0) { unchecked { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION; uint256 numerator2 = sqrtRatioBX96 - sqrtRatioAX96; require(sqrtRatioAX96 > 0); return roundUp ? UnsafeMath.divRoundingUp( FullMath.mulDivRoundingUp(numerator1, numerator2, sqrtRatioBX96), sqrtRatioAX96 ) : FullMath.mulDiv(numerator1, numerator2, sqrtRatioBX96) / sqrtRatioAX96; } } /// @notice Gets the amount1 delta between two prices /// @dev Calculates liquidity * (sqrt(upper) - sqrt(lower)) /// @param sqrtRatioAX96 A sqrt price /// @param sqrtRatioBX96 Another sqrt price /// @param liquidity The amount of usable liquidity /// @param roundUp Whether to round the amount up, or down /// @return amount1 Amount of token1 required to cover a position of size liquidity between the two passed prices function getAmount1Delta( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity, bool roundUp ) internal pure returns (uint256 amount1) { unchecked { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); return roundUp ? FullMath.mulDivRoundingUp(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96) : FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96); } } /// @notice Helper that gets signed token0 delta /// @param sqrtRatioAX96 A sqrt price /// @param sqrtRatioBX96 Another sqrt price /// @param liquidity The change in liquidity for which to compute the amount0 delta /// @return amount0 Amount of token0 corresponding to the passed liquidityDelta between the two prices function getAmount0Delta( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, int128 liquidity ) internal pure returns (int256 amount0) { unchecked { return liquidity < 0 ? -getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256() : getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256(); } } /// @notice Helper that gets signed token1 delta /// @param sqrtRatioAX96 A sqrt price /// @param sqrtRatioBX96 Another sqrt price /// @param liquidity The change in liquidity for which to compute the amount1 delta /// @return amount1 Amount of token1 corresponding to the passed liquidityDelta between the two prices function getAmount1Delta( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, int128 liquidity ) internal pure returns (int256 amount1) { unchecked { return liquidity < 0 ? -getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256() : getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256(); } } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; import {FullMath} from './FullMath.sol'; import {SqrtPriceMath} from './SqrtPriceMath.sol'; /// @title Computes the result of a swap within ticks /// @notice Contains methods for computing the result of a swap within a single tick price range, i.e., a single tick. library SwapMath { /// @notice Computes the result of swapping some amount in, or amount out, given the parameters of the swap /// @dev The fee, plus the amount in, will never exceed the amount remaining if the swap's `amountSpecified` is positive /// @param sqrtRatioCurrentX96 The current sqrt price of the pool /// @param sqrtRatioTargetX96 The price that cannot be exceeded, from which the direction of the swap is inferred /// @param liquidity The usable liquidity /// @param amountRemaining How much input or output amount is remaining to be swapped in/out /// @param feePips The fee taken from the input amount, expressed in hundredths of a bip /// @return sqrtRatioNextX96 The price after swapping the amount in/out, not to exceed the price target /// @return amountIn The amount to be swapped in, of either token0 or token1, based on the direction of the swap /// @return amountOut The amount to be received, of either token0 or token1, based on the direction of the swap /// @return feeAmount The amount of input that will be taken as a fee function computeSwapStep( uint160 sqrtRatioCurrentX96, uint160 sqrtRatioTargetX96, uint128 liquidity, int256 amountRemaining, uint24 feePips ) internal pure returns ( uint160 sqrtRatioNextX96, uint256 amountIn, uint256 amountOut, uint256 feeAmount ) { unchecked { bool zeroForOne = sqrtRatioCurrentX96 >= sqrtRatioTargetX96; bool exactIn = amountRemaining >= 0; if (exactIn) { uint256 amountRemainingLessFee = FullMath.mulDiv(uint256(amountRemaining), 1e6 - feePips, 1e6); amountIn = zeroForOne ? SqrtPriceMath.getAmount0Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, true) : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, true); if (amountRemainingLessFee >= amountIn) sqrtRatioNextX96 = sqrtRatioTargetX96; else sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromInput( sqrtRatioCurrentX96, liquidity, amountRemainingLessFee, zeroForOne ); } else { amountOut = zeroForOne ? SqrtPriceMath.getAmount1Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, false) : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, false); if (uint256(-amountRemaining) >= amountOut) sqrtRatioNextX96 = sqrtRatioTargetX96; else sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromOutput( sqrtRatioCurrentX96, liquidity, uint256(-amountRemaining), zeroForOne ); } bool max = sqrtRatioTargetX96 == sqrtRatioNextX96; // get the input/output amounts if (zeroForOne) { amountIn = max && exactIn ? amountIn : SqrtPriceMath.getAmount0Delta(sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, true); amountOut = max && !exactIn ? amountOut : SqrtPriceMath.getAmount1Delta(sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, false); } else { amountIn = max && exactIn ? amountIn : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioNextX96, liquidity, true); amountOut = max && !exactIn ? amountOut : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioNextX96, liquidity, false); } // cap the output amount to not exceed the remaining output amount if (!exactIn && amountOut > uint256(-amountRemaining)) { amountOut = uint256(-amountRemaining); } if (exactIn && sqrtRatioNextX96 != sqrtRatioTargetX96) { // we didn't reach the target, so take the remainder of the maximum input as fee feeAmount = uint256(amountRemaining) - amountIn; } else { feeAmount = FullMath.mulDivRoundingUp(amountIn, feePips, 1e6 - feePips); } } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.20; /// @title Math library for computing sqrt prices from ticks and vice versa /// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports /// prices between 2**-128 and 2**128 library TickMath { /// @notice Thrown when the tick passed to #getSqrtRatioAtTick is not between MIN_TICK and MAX_TICK error InvalidTick(); /// @notice Thrown when the ratio passed to #getTickAtSqrtRatio does not correspond to a price between MIN_TICK and MAX_TICK error InvalidSqrtRatio(); /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128 int24 internal constant MIN_TICK = -887272; /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128 int24 internal constant MAX_TICK = -MIN_TICK; /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK) uint160 internal constant MIN_SQRT_RATIO = 4295128739; /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK) uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342; /// @notice Given a tickSpacing, compute the maximum usable tick function maxUsableTick(int24 tickSpacing) internal pure returns (int24) { unchecked { return (MAX_TICK / tickSpacing) * tickSpacing; } } /// @notice Given a tickSpacing, compute the minimum usable tick function minUsableTick(int24 tickSpacing) internal pure returns (int24) { unchecked { return (MIN_TICK / tickSpacing) * tickSpacing; } } /// @notice Calculates sqrt(1.0001^tick) * 2^96 /// @dev Throws if |tick| > max tick /// @param tick The input tick for the above formula /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (currency1/currency0) /// at the given tick function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) { unchecked { uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); if (absTick > uint256(int256(MAX_TICK))) revert InvalidTick(); uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000; if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128; if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128; if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128; if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128; if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128; if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128; if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128; if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128; if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128; if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128; if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128; if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128; if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128; if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128; if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128; if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128; if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128; if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128; if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128; if (tick > 0) ratio = type(uint256).max / ratio; // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96. // we then downcast because we know the result always fits within 160 bits due to our tick input constraint // we round up in the division so getTickAtSqrtRatio of the output price is always consistent sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)); } } /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may /// ever return. /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96 /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) { unchecked { // second inequality must be < because the price can never reach the price at the max tick if (sqrtPriceX96 < MIN_SQRT_RATIO || sqrtPriceX96 >= MAX_SQRT_RATIO) revert InvalidSqrtRatio(); uint256 ratio = uint256(sqrtPriceX96) << 32; uint256 r = ratio; uint256 msb = 0; assembly { let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(5, gt(r, 0xFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(4, gt(r, 0xFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(3, gt(r, 0xFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(2, gt(r, 0xF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(1, gt(r, 0x3)) msb := or(msb, f) r := shr(f, r) } assembly { let f := gt(r, 0x1) msb := or(msb, f) } if (msb >= 128) r = ratio >> (msb - 127); else r = ratio << (127 - msb); int256 log_2 = (int256(msb) - 128) << 64; assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(63, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(62, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(61, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(60, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(59, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(58, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(57, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(56, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(55, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(54, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(53, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(52, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(51, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(50, f)) } int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128); int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128); tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow; } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Math functions that do not check inputs or outputs /// @notice Contains methods that perform common math functions but do not do any overflow or underflow checks library UnsafeMath { /// @notice Returns ceil(x / y) /// @dev division by 0 has unspecified behavior, and must be checked externally /// @param x The dividend /// @param y The divisor /// @return z The quotient, ceil(x / y) function divRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z) { assembly { z := add(div(x, y), gt(mod(x, y), 0)) } } }
{ "viaIR": true, "evmVersion": "paris", "optimizer": { "enabled": true, "runs": 999 }, "metadata": { "bytecodeHash": "none" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"name":"InvalidSqrtRatio","type":"error"},{"inputs":[],"name":"InvalidTick","type":"error"},{"inputs":[{"internalType":"uint256","name":"amountInNext","type":"uint256"},{"internalType":"uint256","name":"calcAmountIn","type":"uint256"},{"internalType":"uint256","name":"calcAmountOut","type":"uint256"},{"internalType":"uint256","name":"tokenInBalance","type":"uint256"},{"internalType":"uint256","name":"tokenOutBalance","type":"uint256"}],"name":"LtQV3ZapInFailed","type":"error"},{"inputs":[],"name":"MAX_ITER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"swapPool","type":"address"},{"internalType":"bool","name":"zeroForIn","type":"bool"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"liquidityExactAmount","type":"uint128"},{"internalType":"uint256","name":"tokenInBalance","type":"uint256"},{"internalType":"uint256","name":"tokenOutBalance","type":"uint256"}],"internalType":"struct ILightQuoterV3.CalculateExactZapInParams","name":"params","type":"tuple"}],"name":"calculateExactZapIn","outputs":[{"internalType":"uint256","name":"swapAmountIn","type":"uint256"},{"internalType":"uint256","name":"calcAmountIn","type":"uint256"},{"internalType":"uint256","name":"calcAmountOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"zeroForIn","type":"bool"},{"internalType":"address","name":"swapPool","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"quoteExactInputSingle","outputs":[{"internalType":"uint160","name":"sqrtPriceX96After","type":"uint160"},{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"zeroForIn","type":"bool"},{"internalType":"address","name":"swapPool","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"quoteExactOutputSingle","outputs":[{"internalType":"uint160","name":"sqrtPriceX96After","type":"uint160"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6080806040523461001757615d5890816200001d8239f35b600080fdfe610640604052600436101561001357600080fd5b60003560e01c80630b35df27146140705780630f6537481461310857806320dcf3cd1461006a5763e0387d951461004957600080fd5b34610065576000366003190112610065576020604051600f8152f35b600080fd5b346100655760e03660031901126100655760405161008781614f8e565b6004356001600160a01b038116810361006557815260243580151581036100655760208201526044358060020b8103610065578060408301526064358060020b81036100655760608301526084356001600160801b038116810361006557608083015260a43560a083015260c43560c083015261010860009160020b6153ef565b610118606084015160020b6153ef565b92610121614ffe565b61013d81602084015115156001600160a01b03855116906150dc565b61016b8584602085015115156001600160801b036080870151166001600160a01b0360c0870151169161578b565b9590938661017d8660a0870151615066565b908060c0870151106101b6575b5050505050906020606094920151156101b0575b60405192835260208301526040820152f35b9061019e565b81929396949791156130c457600160ff1b811015610065576101d790615055565b97881561300a576001600160a01b0360c08901511660a089015160020b6001600160801b0360408b015116916040519b6102108d614fc0565b8c52600060208d015260408c015260608b015260808a01525b88511515806130a0575b156110be5760405161024481614f8e565b6000815260006020820152600060408201526000606082015260006080820152600060a0820152600060c08201526001600160a01b0360408b01511681526001600160a01b036101008a01511660608b015160020b60808b015160020b908b51151582156110a8578282059183600082129182611092575b5050611084575b15610ea4576020926102e58260020b906101008260081d60010b920760ff1690565b949060246040518094819363299ce14b60e11b835260010b60048301525afa90811561078b57600091610e72575b50600160ff85161b80016000190181161580159490610e5c57600090600160ff82161b800160001901831680156100655760ff93600160801b60018487161b80016000190182161015610e40575b5080680100000000000000006002921015610e32575b640100000000811015610e24575b62010000811015610e16575b610100811015610e08575b6010811015610dfa575b6004811015610ded575b1015610de0575b031660020b900360020b0260020b5b905b1515604083015260020b60208201819052620d89e7199081811215610dc1575060208201525b888a6001600160a01b03610408602085015160020b6153ef565b168060608501526001600160a01b036040830151169083511515600014610dac576001600160a01b0360e08501511681105b15610da757506001600160a01b0360e0840151165b62ffffff60606001600160801b03608086015116945195015116936000906000916000821215600014610d22575061049162ffffff87620f4240031682615948565b956001600160a01b0384168510610d11576104ad868686615886565b925b838810610cd2576001600160a01b03975084965b858916888a168114959089908910610c7757508580610c6c575b15610c5b575b96879580610c51575b15610c415750505b935b6000831280610c35575b610c29575b60008312159081610c1a575b5015610bfc5750035b60c086015260a085015260808401521660408b015260a0810151600160ff1b811015610065578a51018a52610558608082015160c08301519061507d565b600160ff1b8110156100655760208b01518180820112600082129080158216911516176106af570160208b015260ff60208a01511680610bdd575b5060408a01516001600160a01b036060830151166001600160a01b03821614600014610797575060408101516105f4575b8851156105e857602060001991015160020b0160020b5b60020b60608a0152610229565b6020015160020b6105db565b6001600160a01b036101008a015116610100602083015160020b60246040518094819363f30dba9360e01b835260048301525afa90811561078b57600091610704575b50808a516106f6575b50600081600f0b126000146106c5576001600160801b0360808c0151166f7fffffffffffffffffffffffffffffff1982600f0b146106af576001600160801b038083600f0b600003168203116106af576001600160801b038092600f0b6000031690035b1660808b01526105c4565b634e487b7160e01b600052601160045260246000fd5b6001600160801b0360808c0151166001600160801b038083168201116106af576001600160801b03809216016106a4565b9050600003600f0b8b610640565b9050610100813d61010011610783575b816107226101009383614fdc565b8101031261006557610733816150c8565b5060208101519081600f0b82036100655760808101518060060b036100655761075e60a0820161508a565b5060c081015163ffffffff8116036100655760e061077c91016150bb565b508b610637565b3d9150610714565b6040513d6000823e3d90fd5b906001600160a01b039051166001600160a01b038216036107b9575b50610229565b6401000276a36001600160a01b038216108015610bb6575b610b8c57640100000000600160c01b038160201b16806001600160801b03821160071b82811c67ffffffffffffffff811160061b61030052610300511c63ffffffff811160051b61036052610360511c61ffff811160041b6103c0526103c0511c9260039360ff8111851b90811c90600f821160021b91821c946001968611871b9360808888871c118686866103c05161036051610300518d171717171717171015600014610b655750607e198787861c118585856103c05161036051610300518c17171717171717011c5b808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c91828002607f1c83800260ff1c1c93848002607f1c85800260ff1c1c95868002607f1c87800260ff1c1c6102c0526102c0516102c05102607f1c6102c0516102c0510260ff1c1c61032052610320516103205102607f1c61032051610320510260ff1c1c61038052610380516103805102607f1c61038051610380510260ff1c1c6103a0526103a0516103a05102607f1c6103a0516103a0510260ff1c1c61034052610340516103405102607f1c61034051610340510260ff1c1c6102e0526102e0516102e05102607f1c6102e0516102e0510260ff1c1c800260cd1c6604000000000000169c6102e0516102e0510260cc1c6608000000000000169c61034051610340510260cb1c6610000000000000169c6103a0516103a0510260ca1c6620000000000000169c61038051610380510260c91c6640000000000000169c61032051610320510260c81c6680000000000000169c6102c0516102c0510260c71c670100000000000000169c800260c61c670200000000000000169b800260c51c670400000000000000169a800260c41c6708000000000000001699800260c31c6710000000000000001698800260c21c6720000000000000001697800260c11c6740000000000000001696800260c01c6780000000000000001695607f1995841c11936103c05190610360519061030051171717171717170160401b1717171717171717171717171717693627a301d71055774c85026f028f6481ab7f045a5af012a19d003aa919810160801d60020b906fdb2df09e81959a81455e260799a0632f0160801d60020b91828214600014610b38575090505b60020b60608a0152896107b3565b6001600160a01b03166001600160a01b03610b52846153ef565b1611610b5e5750610b2a565b9050610b2a565b90508686851c118484846103c05161036051610300518b17171717171717607f031b61089d565b60046040517f02ad01b6000000000000000000000000000000000000000000000000000000008152fd5b5073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b03821610156107d1565b610beb9060c0830151615073565b60c08201510360c08201528a610593565b9050610c15915062ffffff81620f424003169084615b1b565b61051a565b88915016878716141538610511565b93508160000393610505565b50826000038511610500565b610c4c9250886158e4565b6104f4565b50600085126104ec565b50610c6781888a615886565b6104e3565b5060008512156104dd565b908680610cc7575b15610cb6575b97889680610cac575b15610c9d575050505b936104f6565b610ca7935061582b565b610c97565b5060008612610c8e565b50610cc282828a615916565b610c85565b506000861215610c7f565b8515610065578615610065576001600160a01b03978589168710610d0157610cfb908888615be6565b966104c3565b610d0c908888615cfe565b610cfb565b610d1c868587615916565b926104af565b91506001600160a01b0383168410610d9657610d3f8585856158e4565b955b60008290038711610d5c576001600160a01b039684966104c3565b8415610065578515610065576001600160a01b03968488168610610d8857610cfb836000038888615c5f565b610d0c836000038888615b79565b610da185848661582b565b95610d41565b61044f565b6001600160a01b0360e085015116811161043a565b9050620d89e8809113610dd5575b506103ee565b60208201528a610dcf565b90600183910116906103b7565b928101841692811c6103b0565b60049384018516931c6103a6565b60089384018516931c61039c565b60109384018516931c610391565b60209384018516931c610385565b60409384018516931c610377565b6080935060018584161b80016000190116831c90506002610361565b60ff91501660020b900360020b0260020b6103c6565b90506020813d602011610e9c575b81610e8d60209383614fdc565b8101031261006557518e610313565b3d9150610e80565b6020610ec66001830160020b60020b906101008260081d60010b920760ff1690565b919060246040518097819363299ce14b60e11b835260010b60048301525afa93841561078b57600094611050575b50600160ff82161b60001901198416158015949061103257600160ff83161b600019011981169182156100655760019260ff92839083821686901b600019011981166001600160801b03161561101c575050607f5b67ffffffffffffffff82161561101257603f190183165b63ffffffff82161561100857601f190183165b61ffff821615610ffe57600f190183165b81841615610ff4576007190183165b600f821615610fea576003190183165b6003821615610fdf5783859182190116915b16610fd4575b031660020b910160020b0160020b0260020b5b906103c8565b600019018216610fbb565b90849060021c610fb5565b9060041c90610fa3565b9060081c90610f93565b9060101c90610f84565b9060201c90610f73565b9060401c90610f60565b83851686901b60001901191660801c9150610f49565b5060ff60019181031660020b910160020b0160020b0260020b610fce565b9093506020813d60201161107c575b8161106c60209383614fdc565b810103126100655751928e610ef4565b3d915061105f565b906000190160020b906102c3565b61109c9250615819565b60020b151583386102bc565b634e487b7160e01b600052601260045260246000fd5b909192939495976020015192808411613098575b506000979197945b600f86101561308a575050600160ff1b82101561006557811561300a576001600160a01b0360c0870151169660a087015160020b6001600160801b03604089015116906040519961112a8b614fc0565b858b52600060208c015260408b015260608a015260808901525b8751151580613066575b15611f745760405161115f81614f8e565b6000815260006020820152600060408201526000606082015260006080820152600060a0820152600060c08201526001600160a01b0360408a01511681526001600160a01b036101008901511660608a015160020b60808a015160020b908a51151582156110a8578282059183600082129182611f5e575b5050611f50575b15611d70576020926112008260020b906101008260081d60010b920760ff1690565b949060246040518094819363299ce14b60e11b835260010b60048301525afa90811561078b57600091611d3e575b50600160ff85161b80016000190181161580159490611d2857600090600160ff82161b800160001901831680156100655760ff93600160801b60018487161b80016000190182161015611d0c575b5080680100000000000000006002921015611cfe575b640100000000811015611cf0575b62010000811015611ce2575b610100811015611cd4575b6010811015611cc6575b6004811015611cb9575b1015611cac575b031660020b900360020b0260020b5b905b1515604083015260020b60208201819052620d89e7199081811215611c8d575060208201525b6001600160a01b03611321602083015160020b6153ef565b168060608301526001600160a01b0360408b0151169089511515600014611c78576001600160a01b0360e08b01511681105b15611c7257506001600160a01b0360e08a015116905b6001600160801b0360808c015116908b519262ffffff60608d015116936000906000916000821215600014611bed57506113ad62ffffff87620f4240031682615948565b956001600160a01b0384168510611bdc576113c9868686615886565b925b838810611b9d576001600160a01b03975084965b858916888a168114959089908910611b4257508580611b37575b15611b26575b96879580611b1c575b15611b0c5750505b935b6000831280611b00575b611af4575b60008312159081611ae5575b5015611ac75750035b60c086015260a085015260808401521660408a0152608081015160c082015101600160ff1b81101561006557895103895260a0810151600160ff1b8110156100655760208a01516000821281838103128116908284810313901516176106af570360208a015260ff60208901511680611aa8575b5060408901516001600160a01b036060830151166001600160a01b0382161460001461168c5750604081015161150b575b8751156114ff57602060001991015160020b0160020b5b60020b6060890152611144565b6020015160020b6114f2565b6001600160a01b0361010089015116610100602083015160020b60246040518094819363f30dba9360e01b835260048301525afa90811561078b57600091611605575b508089516115f7575b50600081600f0b126000146115c6576001600160801b0360808b0151166f7fffffffffffffffffffffffffffffff1982600f0b146106af576001600160801b038083600f0b600003168203116106af576001600160801b038092600f0b6000031690035b1660808a01526114db565b6001600160801b0360808b0151166001600160801b038083168201116106af576001600160801b03809216016115bb565b9050600003600f0b8a611557565b9050610100813d61010011611684575b816116236101009383614fdc565b8101031261006557611634816150c8565b5060208101519081600f0b82036100655760808101518060060b036100655761165f60a0820161508a565b5060c081015163ffffffff8116036100655760e061167d91016150bb565b508a61154e565b3d9150611615565b906001600160a01b039051166001600160a01b038216036116ae575b50611144565b6401000276a36001600160a01b038216108015611a81575b610b8c57640100000000600160c01b038160201b16806001600160801b03821160071b82811c67ffffffffffffffff811160061b6101e0526101e0511c63ffffffff811160051b61024052610240511c61ffff811160041b6102a0526102a0511c9260039360ff8111851b90811c90600f821160021b91821c946001968611871b9360808888871c118686866102a051610240516101e0518d171717171717171015600014611a5a5750607e198787861c118585856102a051610240516101e0518c17171717171717011c5b808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c91828002607f1c83800260ff1c1c93848002607f1c85800260ff1c1c95868002607f1c87800260ff1c1c6101a0526101a0516101a05102607f1c6101a0516101a0510260ff1c1c61020052610200516102005102607f1c61020051610200510260ff1c1c61026052610260516102605102607f1c61026051610260510260ff1c1c61028052610280516102805102607f1c61028051610280510260ff1c1c61022052610220516102205102607f1c61022051610220510260ff1c1c6101c0526101c0516101c05102607f1c6101c0516101c0510260ff1c1c800260cd1c6604000000000000169c6101c0516101c0510260cc1c6608000000000000169c61022051610220510260cb1c6610000000000000169c61028051610280510260ca1c6620000000000000169c61026051610260510260c91c6640000000000000169c61020051610200510260c81c6680000000000000169c6101a0516101a0510260c71c670100000000000000169c800260c61c670200000000000000169b800260c51c670400000000000000169a800260c41c6708000000000000001699800260c31c6710000000000000001698800260c21c6720000000000000001697800260c11c6740000000000000001696800260c01c6780000000000000001695607f1995841c11936102a0519061024051906101e051171717171717170160401b1717171717171717171717171717693627a301d71055774c85026f028f6481ab7f045a5af012a19d003aa919810160801d60020b906fdb2df09e81959a81455e260799a0632f0160801d60020b91828214600014611a2d575090505b60020b6060890152886116a8565b6001600160a01b03166001600160a01b03611a47846153ef565b1611611a535750611a1f565b9050611a1f565b90508686851c118484846102a051610240516101e0518b17171717171717607f031b611792565b5073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b03821610156116c6565b611ab69060c0830151615073565b60c08201510360c0820152896114aa565b9050611ae0915062ffffff81620f424003169084615b1b565b611436565b8891501687871614153861142d565b93508160000393611421565b5082600003851161141c565b611b179250886158e4565b611410565b5060008512611408565b50611b3281888a615886565b6113ff565b5060008512156113f9565b908680611b92575b15611b81575b97889680611b77575b15611b68575050505b93611412565b611b72935061582b565b611b62565b5060008612611b59565b50611b8d82828a615916565b611b50565b506000861215611b4a565b8515610065578615610065576001600160a01b03978589168710611bcc57611bc6908888615be6565b966113df565b611bd7908888615cfe565b611bc6565b611be7868587615916565b926113cb565b91506001600160a01b0383168410611c6157611c0a8585856158e4565b955b60008290038711611c27576001600160a01b039684966113df565b8415610065578515610065576001600160a01b03968488168610611c5357611bc6836000038888615c5f565b611bd7836000038888615b79565b611c6c85848661582b565b95611c0c565b90611369565b6001600160a01b0360e08b0151168111611353565b9050620d89e8809113611ca1575b50611309565b602082015289611c9b565b90600183910116906112d2565b928101841692811c6112cb565b60049384018516931c6112c1565b60089384018516931c6112b7565b60109384018516931c6112ac565b60209384018516931c6112a0565b60409384018516931c611292565b6080935060018584161b80016000190116831c9050600261127c565b60ff91501660020b900360020b0260020b6112e1565b90506020813d602011611d68575b81611d5960209383614fdc565b8101031261006557518d61122e565b3d9150611d4c565b6020611d926001830160020b60020b906101008260081d60010b920760ff1690565b919060246040518097819363299ce14b60e11b835260010b60048301525afa93841561078b57600094611f1c575b50600160ff82161b600019011984161580159490611efe57600160ff83161b600019011981169182156100655760019260ff92839083821686901b600019011981166001600160801b031615611ee8575050607f5b67ffffffffffffffff821615611ede57603f190183165b63ffffffff821615611ed457601f190183165b61ffff821615611eca57600f190183165b81841615611ec0576007190183165b600f821615611eb6576003190183165b6003821615611eab5783859182190116915b16611ea0575b031660020b910160020b0160020b0260020b5b906112e3565b600019018216611e87565b90849060021c611e81565b9060041c90611e6f565b9060081c90611e5f565b9060101c90611e50565b9060201c90611e3f565b9060401c90611e2c565b83851686901b60001901191660801c9150611e15565b5060ff60019181031660020b910160020b0160020b0260020b611e9a565b9093506020813d602011611f48575b81611f3860209383614fdc565b810103126100655751928d611dc0565b3d9150611f2b565b906000190160020b906111de565b611f689250615819565b60020b1515838f6111d7565b90969391936001600160a01b0360408201511690611fb38986602084519401516000039460208b015115156001600160801b0360808d0151169061578b565b9190968293888415801561304e575b156120f25761038483851485850380830204821417156106af576103e8908585030204945b8484141592836120d6575b5050816120bc575b5061200f5750506001909301949791976110da565b92979995945092505003945b851561202c5780809794959761018a565b60a492879261205f9260208501511515906001600160a01b0360c06001600160801b03608089015116920151169161578b565b9161206e8260a0830151615066565b9260c060a083015192015192604051947fe6e8996d00000000000000000000000000000000000000000000000000000000865260048601526024850152604484015260648301526084820152fd5b90506120ce83830360a08c0151615066565b10158c611ffa565b6120e89192935060c08d01519061507d565b1015908d80611ff2565b919293909896999a9b95600160ff1b8299969910156100655761211482615055565b801561300a578d6001600160a01b0360c0820151166001600160801b03604060a084015160020b93015116926040516106205261215361062051614fc0565b6106205152600060206106205101526040610620510152606061062051015260806106205101525b6106205151151580612fe9575b15612fce5760405161219981614f8e565b6000815260006020820152600060408201526000606082015260006080820152600060a0820152600060c08201526001600160a01b0360406106205101511681528d6001600160a01b036101008201511690606061062051015160020b608082015160020b9151151582156110a8578282059183600082129182612fb8575b5050612faa575b15612dca576020926122418260020b906101008260081d60010b920760ff1690565b949060246040518094819363299ce14b60e11b835260010b60048301525afa90811561078b57600091612d98575b50600160ff85161b80016000190181161580159490612d8257600090600160ff82161b800160001901831680156100655760ff93600160801b60018487161b80016000190182161015612d66575b5080680100000000000000006002921015612d58575b640100000000811015612d4a575b62010000811015612d3c575b610100811015612d2e575b6010811015612d20575b6004811015612d13575b1015612d06575b031660020b900360020b0260020b5b905b1515604083015260020b60208201819052620d89e7199081811215612ce7575060208201525b8d6001600160a01b03612363602084015160020b6153ef565b168060608401526001600160a01b036040610620510151169082511515600014612cd2576001600160a01b0360e08401511681105b15612ccc57506001600160a01b0360e083015116905b6001600160801b036080610620510151169162ffffff6060610620515195015116936000906000916000821215600014612c4757506123f762ffffff87620f4240031682615948565b956001600160a01b0384168510612c3657612413868686615886565b925b838810612bf7576001600160a01b03975084965b858916888a168114959089908910612b9c57508580612b91575b15612b80575b96879580612b76575b15612b665750505b935b6000831280612b5a575b612b4e575b60008312159081612b3f575b5015612b215750035b60c086015260a0850152608084015216604061062051015260a0810151600160ff1b8110156100655761062051510161062051526124c7608082015160c08301519061507d565b600160ff1b8110156100655760206106205101518180820112600082129080158216911516176106af578f60ff92602092018261062051015201511680612b02575b5060406106205101516001600160a01b036060830151166001600160a01b038216146000146126fe57508d6040820151612570575b511561256457602060001991015160020b0160020b5b60020b606061062051015261217b565b6020015160020b612554565b6101006001600160a01b0391015116610100602083015160020b60246040518094819363f30dba9360e01b835260048301525afa801561078b578f91600091612675575b50809151612667575b50600081600f0b12600014612633576001600160801b036080610620510151166f7fffffffffffffffffffffffffffffff1982600f0b146106af576001600160801b038083600f0b600003168203116106af576001600160801b038092600f0b6000031690035b1660806106205101528d61253e565b6001600160801b036080610620510151166001600160801b038083168201116106af576001600160801b0380921601612624565b9050600003600f0b8f6125bd565b915050610100813d610100116126f6575b816126946101009383614fdc565b81010312610065576126a5816150c8565b50602081015180600f0b81036100655760808201518060060b03610065576126cf60a0830161508a565b5060c082015163ffffffff811603610065578f9160e06126ef91016150bb565b50386125b4565b3d9150612686565b906001600160a01b039051166001600160a01b03821603612720575b5061217b565b6401000276a36001600160a01b038216108015612adb575b610b8c57640100000000600160c01b038160201b16806001600160801b03821160071b82811c67ffffffffffffffff811160061b60c05260c0511c63ffffffff811160051b61012052610120511c61ffff811160041b61018052610180511c9260039360ff8111851b90811c90600f821160021b91821c946001968611871b9360808888871c11868686610180516101205160c0518d171717171717171015600014612ab55750607e198787861c11858585610180516101205160c0518c17171717171717011c5b808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c91828002607f1c83800260ff1c1c93848002607f1c85800260ff1c1c95868002607f1c87800260ff1c1c60805260805160805102607f1c6080516080510260ff1c1c60e05260e05160e05102607f1c60e05160e0510260ff1c1c61014052610140516101405102607f1c61014051610140510260ff1c1c61016052610160516101605102607f1c61016051610160510260ff1c1c61010052610100516101005102607f1c61010051610100510260ff1c1c60a05260a05160a05102607f1c60a05160a0510260ff1c1c800260cd1c6604000000000000169c60a05160a0510260cc1c6608000000000000169c61010051610100510260cb1c6610000000000000169c61016051610160510260ca1c6620000000000000169c61014051610140510260c91c6640000000000000169c60e05160e0510260c81c6680000000000000169c6080516080510260c71c670100000000000000169c800260c61c670200000000000000169b800260c51c670400000000000000169a800260c41c6708000000000000001699800260c31c6710000000000000001698800260c21c6720000000000000001697800260c11c6740000000000000001696800260c01c6780000000000000001695607f1995841c11936101805190610120519060c051171717171717170160401b1717171717171717171717171717693627a301d71055774c85026f028f6481ab7f045a5af012a19d003aa919810160801d60020b906fdb2df09e81959a81455e260799a0632f0160801d60020b91828214600014612a88575090505b60020b60606106205101528d61271a565b6001600160a01b03166001600160a01b03612aa2846153ef565b1611612aae5750612a77565b9050612a77565b90508686851c11848484610180516101205160c0518b17171717171717607f031b612800565b5073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b0382161015612738565b612b109060c0830151615073565b60c08201510360c08201528e612509565b9050612b3a915062ffffff81620f424003169084615b1b565b612480565b88915016878716141538612477565b9350816000039361246b565b50826000038511612466565b612b719250886158e4565b61245a565b5060008512612452565b50612b8c81888a615886565b612449565b506000851215612443565b908680612bec575b15612bdb575b97889680612bd1575b15612bc2575050505b9361245c565b612bcc935061582b565b612bbc565b5060008612612bb3565b50612be782828a615916565b612baa565b506000861215612ba4565b8515610065578615610065576001600160a01b03978589168710612c2657612c20908888615be6565b96612429565b612c31908888615cfe565b612c20565b612c41868587615916565b92612415565b91506001600160a01b0383168410612cbb57612c648585856158e4565b955b60008290038711612c81576001600160a01b03968496612429565b8415610065578515610065576001600160a01b03968488168610612cad57612c20836000038888615c5f565b612c31836000038888615b79565b612cc685848661582b565b95612c66565b906123ae565b6001600160a01b0360e0840151168111612398565b9050620d89e8809113612cfb575b5061234a565b60208201528e612cf5565b9060018391011690612313565b928101841692811c61230c565b60049384018516931c612302565b60089384018516931c6122f8565b60109384018516931c6122ed565b60209384018516931c6122e1565b60409384018516931c6122d3565b6080935060018584161b80016000190116831c905060026122bd565b60ff91501660020b900360020b0260020b612322565b90506020813d602011612dc2575b81612db360209383614fdc565b8101031261006557513861226f565b3d9150612da6565b6020612dec6001830160020b60020b906101008260081d60010b920760ff1690565b919060246040518097819363299ce14b60e11b835260010b60048301525afa93841561078b57600094612f76575b50600160ff82161b600019011984161580159490612f5857600160ff83161b600019011981169182156100655760019260ff92839083821686901b600019011981166001600160801b031615612f42575050607f5b67ffffffffffffffff821615612f3857603f190183165b63ffffffff821615612f2e57601f190183165b61ffff821615612f2457600f190183165b81841615612f1a576007190183165b600f821615612f10576003190183165b6003821615612f055783859182190116915b16612efa575b031660020b910160020b0160020b0260020b5b90612324565b600019018216612ee1565b90849060021c612edb565b9060041c90612ec9565b9060081c90612eb9565b9060101c90612eaa565b9060201c90612e99565b9060401c90612e86565b83851686901b60001901191660801c9150612e6f565b5060ff60019181031660020b910160020b0160020b0260020b612ef4565b9093506020813d602011612fa2575b81612f9260209383614fdc565b8101031261006557519238612e1a565b3d9150612f85565b906000190160020b9061221f565b612fc29250615819565b60020b15158338612218565b959b9a99969890939291979497602061062051015194611fe7565b508c6001600160a01b0360e081604061062051015116920151161415612188565b606460405162461bcd60e51b815260206004820152600860248201527f4c745156333a41530000000000000000000000000000000000000000000000006044820152fd5b5061305f84840360a08d0151615066565b8111611fc2565b506001600160a01b036040890151166001600160a01b0360e089015116141561114e565b94509496959092915061201b565b9250886110d2565b506001600160a01b0360408a0151166001600160a01b0360e08a0151161415610233565b606460405162461bcd60e51b815260206004820152600860248201527f4c745156333a49420000000000000000000000000000000000000000000000006044820152fd5b346100655761312c61311936614f5b565b929091613124614ffe565b9283916150dc565b600160ff1b8210156100655761314182615055565b801561300a576001600160a01b0360c0830151169260a08301516001600160801b03604085015116906040519561317787614fc0565b84875260006020880152604087015260020b606086015260808501525b835115158061404c575b15613fc9576040516131af81614f8e565b6000815260006020820152600060408201526000606082015260006080820152600060a0820152600060c08201526001600160a01b0360408601511681526001600160a01b0361010085015116606086015160020b608086015160020b908651151582156110a8578282059183600082129182613fb3575b5050613fa5575b15613dc5576020926132508260020b906101008260081d60010b920760ff1690565b949060246040518094819363299ce14b60e11b835260010b60048301525afa90811561078b57600091613d93575b50600160ff85161b80016000190181161580159490613d7d57600090600160ff82161b800160001901831680156100655760ff93600160801b60018487161b80016000190182161015613d61575b5080680100000000000000006002921015613d53575b640100000000811015613d45575b62010000811015613d37575b610100811015613d29575b6010811015613d1b575b6004811015613d0e575b1015613d01575b031660020b900360020b0260020b5b905b1515604083015260020b60208201819052620d89e7199081811215613ce2575060208201525b6001600160a01b03613371602083015160020b6153ef565b168060608301526001600160a01b036040870151169085511515600014613ccd576001600160a01b0360e08701511681105b15613cc757506001600160a01b0360e086015116905b6001600160801b036080880151169087519262ffffff606089015116936000906000916000821215600014613c4257506133fd62ffffff87620f4240031682615948565b956001600160a01b0384168510613c3157613419868686615886565b925b838810613bf2576001600160a01b03975084965b858916888a168114959089908910613b9757508580613b8c575b15613b7b575b96879580613b71575b15613b615750505b935b6000831280613b55575b613b49575b60008312159081613b3a575b5015613b1c5750035b60c086015260a0850152608084015216604086015260a0810151600160ff1b8110156100655785510185526134c4608082015160c08301519061507d565b600160ff1b8110156100655760208601518180820112600082129080158216911516176106af5701602086015260ff60208501511680613afd575b5060408501516001600160a01b036060830151166001600160a01b038216146000146136e157506040810151613560575b83511561355457602060001991015160020b0160020b5b60020b6060850152613194565b6020015160020b613547565b6001600160a01b0361010085015116610100602083015160020b60246040518094819363f30dba9360e01b835260048301525afa90811561078b5760009161365a575b5080855161364c575b50600081600f0b1260001461361b576001600160801b036080870151166f7fffffffffffffffffffffffffffffff1982600f0b146106af576001600160801b038083600f0b600003168203116106af576001600160801b038092600f0b6000031690035b166080860152613530565b6001600160801b036080870151166001600160801b038083168201116106af576001600160801b0380921601613610565b9050600003600f0b866135ac565b9050610100813d610100116136d9575b816136786101009383614fdc565b8101031261006557613689816150c8565b5060208101519081600f0b82036100655760808101518060060b03610065576136b460a0820161508a565b5060c081015163ffffffff8116036100655760e06136d291016150bb565b50866135a3565b3d915061366a565b906001600160a01b039051166001600160a01b03821603613703575b50613194565b6401000276a36001600160a01b038216108015613ad6575b610b8c57640100000000600160c01b038160201b16806001600160801b03821160071b82811c67ffffffffffffffff811160061b61042052610420511c63ffffffff811160051b61048052610480511c61ffff811160041b6104e0526104e0511c9260039360ff8111851b90811c90600f821160021b91821c946001968611871b9360808888871c118686866104e05161048051610420518d171717171717171015600014613aaf5750607e198787861c118585856104e05161048051610420518c17171717171717011c5b808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c91828002607f1c83800260ff1c1c93848002607f1c85800260ff1c1c95868002607f1c87800260ff1c1c6103e0526103e0516103e05102607f1c6103e0516103e0510260ff1c1c61044052610440516104405102607f1c61044051610440510260ff1c1c6104a0526104a0516104a05102607f1c6104a0516104a0510260ff1c1c6104c0526104c0516104c05102607f1c6104c0516104c0510260ff1c1c61046052610460516104605102607f1c61046051610460510260ff1c1c61040052610400516104005102607f1c61040051610400510260ff1c1c800260cd1c6604000000000000169c61040051610400510260cc1c6608000000000000169c61046051610460510260cb1c6610000000000000169c6104c0516104c0510260ca1c6620000000000000169c6104a0516104a0510260c91c6640000000000000169c61044051610440510260c81c6680000000000000169c6103e0516103e0510260c71c670100000000000000169c800260c61c670200000000000000169b800260c51c670400000000000000169a800260c41c6708000000000000001699800260c31c6710000000000000001698800260c21c6720000000000000001697800260c11c6740000000000000001696800260c01c6780000000000000001695607f1995841c11936104e05190610480519061042051171717171717170160401b1717171717171717171717171717693627a301d71055774c85026f028f6481ab7f045a5af012a19d003aa919810160801d60020b906fdb2df09e81959a81455e260799a0632f0160801d60020b91828214600014613a82575090505b60020b6060850152846136fd565b6001600160a01b03166001600160a01b03613a9c846153ef565b1611613aa85750613a74565b9050613a74565b90508686851c118484846104e05161048051610420518b17171717171717607f031b6137e7565b5073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038216101561371b565b613b0b9060c0830151615073565b60c08201510360c0820152856134ff565b9050613b35915062ffffff81620f424003169084615b1b565b613486565b8891501687871614158d61347d565b93508160000393613471565b5082600003851161346c565b613b6c9250886158e4565b613460565b5060008512613458565b50613b8781888a615886565b61344f565b506000851215613449565b908680613be7575b15613bd6575b97889680613bcc575b15613bbd575050505b93613462565b613bc7935061582b565b613bb7565b5060008612613bae565b50613be282828a615916565b613ba5565b506000861215613b9f565b8515610065578615610065576001600160a01b03978589168710613c2157613c1b908888615be6565b9661342f565b613c2c908888615cfe565b613c1b565b613c3c868587615916565b9261341b565b91506001600160a01b0383168410613cb657613c5f8585856158e4565b955b60008290038711613c7c576001600160a01b0396849661342f565b8415610065578515610065576001600160a01b03968488168610613ca857613c1b836000038888615c5f565b613c2c836000038888615b79565b613cc185848661582b565b95613c61565b906133b9565b6001600160a01b0360e08701511681116133a3565b9050620d89e8809113613cf6575b50613359565b602082015285613cf0565b9060018391011690613322565b928101841692811c61331b565b60049384018516931c613311565b60089384018516931c613307565b60109384018516931c6132fc565b60209384018516931c6132f0565b60409384018516931c6132e2565b6080935060018584161b80016000190116831c905060026132cc565b60ff91501660020b900360020b0260020b613331565b90506020813d602011613dbd575b81613dae60209383614fdc565b8101031261006557518961327e565b3d9150613da1565b6020613de76001830160020b60020b906101008260081d60010b920760ff1690565b919060246040518097819363299ce14b60e11b835260010b60048301525afa93841561078b57600094613f71575b50600160ff82161b600019011984161580159490613f5357600160ff83161b600019011981169182156100655760019260ff92839083821686901b600019011981166001600160801b031615613f3d575050607f5b67ffffffffffffffff821615613f3357603f190183165b63ffffffff821615613f2957601f190183165b61ffff821615613f1f57600f190183165b81841615613f15576007190183165b600f821615613f0b576003190183165b6003821615613f005783859182190116915b16613ef5575b031660020b910160020b0160020b0260020b5b90613333565b600019018216613edc565b90849060021c613ed6565b9060041c90613ec4565b9060081c90613eb4565b9060101c90613ea5565b9060201c90613e94565b9060401c90613e81565b83851686901b60001901191660801c9150613e6a565b5060ff60019181031660020b910160020b0160020b0260020b613eef565b9093506020813d602011613f9d575b81613f8d60209383614fdc565b8101031261006557519289613e15565b3d9150613f80565b906000190160020b9061322e565b613fbd9250615819565b60020b1515838b613227565b9091506001600160a01b03604084015116916020840151935190036000030361400857604080516001600160a01b039290921682526020820192909252f35b606460405162461bcd60e51b815260206004820152600860248201527f4c745156333a494c0000000000000000000000000000000000000000000000006044820152fd5b506001600160a01b036040850151166001600160a01b0360e085015116141561319e565b346100655761408161311936614f5b565b600160ff1b82101561006557811561300a576001600160a01b0360c08201511660a08201516001600160801b0360408401511691604051946140c286614fc0565b855260006020860152604085015260020b606084015260808301525b8151151580614f37575b15614f0e576040516140f981614f8e565b6000815260006020820152600060408201526000606082015260006080820152600060a0820152600060c08201526001600160a01b0360408401511681526001600160a01b0361010083015116606084015160020b608084015160020b908451151582156110a8578282059183600082129182614ef8575b5050614eea575b15614d0a5760209261419a8260020b906101008260081d60010b920760ff1690565b949060246040518094819363299ce14b60e11b835260010b60048301525afa90811561078b57600091614cd8575b50600160ff85161b80016000190181161580159490614cc257600090600160ff82161b800160001901831680156100655760ff93600160801b60018487161b80016000190182161015614ca6575b5080680100000000000000006002921015614c98575b640100000000811015614c8a575b62010000811015614c7c575b610100811015614c6e575b6010811015614c60575b6004811015614c53575b1015614c46575b031660020b900360020b0260020b5b905b1515604083015260020b60208201819052620d89e7199081811215614c27575060208201525b6001600160a01b036142bb602083015160020b6153ef565b168060608301526001600160a01b036040850151169083511515600014614c12576001600160a01b0360e08501511681105b15614c0c57506001600160a01b0360e084015116905b6001600160801b036080860151169085519262ffffff606087015116936000906000916000821215600014614b87575061434762ffffff87620f4240031682615948565b956001600160a01b0384168510614b7657614363868686615886565b925b838810614b37576001600160a01b03975084965b858916888a168114959089908910614adc57508580614ad1575b15614ac0575b96879580614ab6575b15614aa65750505b935b6000831280614a9a575b614a8e575b60008312159081614a7f575b5015614a615750035b60c086015260a08501526080840152166040840152608081015160c082015101600160ff1b81101561006557835103835260a0810151600160ff1b8110156100655760208401516000821281838103128116908284810313901516176106af5703602084015260ff60208301511680614a42575b5060408301516001600160a01b036060830151166001600160a01b03821614600014614626575060408101516144a5575b81511561449957602060001991015160020b0160020b5b60020b60608301526140de565b6020015160020b61448c565b6001600160a01b0361010083015116610100602083015160020b60246040518094819363f30dba9360e01b835260048301525afa90811561078b5760009161459f575b50808351614591575b50600081600f0b12600014614560576001600160801b036080850151166f7fffffffffffffffffffffffffffffff1982600f0b146106af576001600160801b038083600f0b600003168203116106af576001600160801b038092600f0b6000031690035b166080840152614475565b6001600160801b036080850151166001600160801b038083168201116106af576001600160801b0380921601614555565b9050600003600f0b846144f1565b9050610100813d6101001161461e575b816145bd6101009383614fdc565b81010312610065576145ce816150c8565b5060208101519081600f0b82036100655760808101518060060b03610065576145f960a0820161508a565b5060c081015163ffffffff8116036100655760e061461791016150bb565b50846144e8565b3d91506145af565b906001600160a01b039051166001600160a01b03821603614648575b506140de565b6401000276a36001600160a01b038216108015614a1b575b610b8c57640100000000600160c01b038160201b16806001600160801b03821160071b82811c67ffffffffffffffff811160061b61054052610540511c63ffffffff811160051b6105a0526105a0511c61ffff811160041b61060052610600511c9260039360ff8111851b90811c90600f821160021b91821c946001968611871b9360808888871c11868686610600516105a051610540518d1717171717171710156000146149f45750607e198787861c11858585610600516105a051610540518c17171717171717011c5b808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c91828002607f1c83800260ff1c1c93848002607f1c85800260ff1c1c95868002607f1c87800260ff1c1c61050052610500516105005102607f1c61050051610500510260ff1c1c61056052610560516105605102607f1c61056051610560510260ff1c1c6105c0526105c0516105c05102607f1c6105c0516105c0510260ff1c1c6105e0526105e0516105e05102607f1c6105e0516105e0510260ff1c1c61058052610580516105805102607f1c61058051610580510260ff1c1c61052052610520516105205102607f1c61052051610520510260ff1c1c800260cd1c6604000000000000169c61052051610520510260cc1c6608000000000000169c61058051610580510260cb1c6610000000000000169c6105e0516105e0510260ca1c6620000000000000169c6105c0516105c0510260c91c6640000000000000169c61056051610560510260c81c6680000000000000169c61050051610500510260c71c670100000000000000169c800260c61c670200000000000000169b800260c51c670400000000000000169a800260c41c6708000000000000001699800260c31c6710000000000000001698800260c21c6720000000000000001697800260c11c6740000000000000001696800260c01c6780000000000000001695607f1995841c119361060051906105a0519061054051171717171717170160401b1717171717171717171717171717693627a301d71055774c85026f028f6481ab7f045a5af012a19d003aa919810160801d60020b906fdb2df09e81959a81455e260799a0632f0160801d60020b918282146000146149c7575090505b60020b606083015282614642565b6001600160a01b03166001600160a01b036149e1846153ef565b16116149ed57506149b9565b90506149b9565b90508686851c11848484610600516105a051610540518b17171717171717607f031b61472c565b5073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b0382161015614660565b614a509060c0830151615073565b60c08201510360c082015283614444565b9050614a7a915062ffffff81620f424003169084615b1b565b6143d0565b8891501687871614158b6143c7565b935081600003936143bb565b508260000385116143b6565b614ab19250886158e4565b6143aa565b50600085126143a2565b50614acc81888a615886565b614399565b506000851215614393565b908680614b2c575b15614b1b575b97889680614b11575b15614b02575050505b936143ac565b614b0c935061582b565b614afc565b5060008612614af3565b50614b2782828a615916565b614aea565b506000861215614ae4565b8515610065578615610065576001600160a01b03978589168710614b6657614b60908888615be6565b96614379565b614b71908888615cfe565b614b60565b614b81868587615916565b92614365565b91506001600160a01b0383168410614bfb57614ba48585856158e4565b955b60008290038711614bc1576001600160a01b03968496614379565b8415610065578515610065576001600160a01b03968488168610614bed57614b60836000038888615c5f565b614b71836000038888615b79565b614c0685848661582b565b95614ba6565b90614303565b6001600160a01b0360e08501511681116142ed565b9050620d89e8809113614c3b575b506142a3565b602082015283614c35565b906001839101169061426c565b928101841692811c614265565b60049384018516931c61425b565b60089384018516931c614251565b60109384018516931c614246565b60209384018516931c61423a565b60409384018516931c61422c565b6080935060018584161b80016000190116831c90506002614216565b60ff91501660020b900360020b0260020b61427b565b90506020813d602011614d02575b81614cf360209383614fdc565b810103126100655751876141c8565b3d9150614ce6565b6020614d2c6001830160020b60020b906101008260081d60010b920760ff1690565b919060246040518097819363299ce14b60e11b835260010b60048301525afa93841561078b57600094614eb6575b50600160ff82161b600019011984161580159490614e9857600160ff83161b600019011981169182156100655760019260ff92839083821686901b600019011981166001600160801b031615614e82575050607f5b67ffffffffffffffff821615614e7857603f190183165b63ffffffff821615614e6e57601f190183165b61ffff821615614e6457600f190183165b81841615614e5a576007190183165b600f821615614e50576003190183165b6003821615614e455783859182190116915b16614e3a575b031660020b910160020b0160020b0260020b5b9061427d565b600019018216614e21565b90849060021c614e1b565b9060041c90614e09565b9060081c90614df9565b9060101c90614dea565b9060201c90614dd9565b9060401c90614dc6565b83851686901b60001901191660801c9150614daf565b5060ff60019181031660020b910160020b0160020b0260020b614e34565b9093506020813d602011614ee2575b81614ed260209383614fdc565b8101031261006557519287614d5a565b3d9150614ec5565b906000190160020b90614178565b614f029250615819565b60020b15158389614171565b5060408181015160209283015182516001600160a01b0390921682526000039281019290925290f35b506001600160a01b036040830151166001600160a01b0360e08301511614156140e8565b606090600319011261006557600435801515810361006557906024356001600160a01b0381168103610065579060443590565b60e0810190811067ffffffffffffffff821117614faa57604052565b634e487b7160e01b600052604160045260246000fd5b60a0810190811067ffffffffffffffff821117614faa57604052565b90601f8019910116810190811067ffffffffffffffff821117614faa57604052565b60405190610120820182811067ffffffffffffffff821117614faa57604052816101006000918281528260208201528260408201528260608201528260808201528260a08201528260c08201528260e08201520152565b600160ff1b81146106af5760000390565b919082039182116106af57565b81156110a8570490565b919082018092116106af57565b51906001600160a01b038216820361006557565b51908160020b820361006557565b519061ffff8216820361006557565b5190811515820361006557565b51906001600160801b038216820361006557565b90916001600160a01b03809316926040928351937f3850c7bd00000000000000000000000000000000000000000000000000000000855260e085600481895afa9081156152ab576000918296839161535c575b5083151586528151907f1a68650200000000000000000000000000000000000000000000000000000000825260209182816004818d5afa9081156153515760009161530c575b506001600160801b03168784015260ff90600f90861561530357165b168187015281517fddca3f4300000000000000000000000000000000000000000000000000000000815281816004818c5afa9081156152f8576000916152b5575b5062ffffff1660608701528151907fd0c93a7c00000000000000000000000000000000000000000000000000000000825280826004818c5afa9283156152ab575060009261526c575b50509061010095849260020b608087015260020b60a08601521660c0840152600014615252576401000276a45b1660e08201520152565b73fffd8963efd1fc6a506488495d951d5263988d25615248565b9080939250813d83116152a4575b6152848183614fdc565b81010312610065576101009561529a859361509e565b919281975061521b565b503d61527a565b513d6000823e3d90fd5b8281813d83116152f1575b6152ca8183614fdc565b810103126152ed57519062ffffff821682036152ea575062ffffff6151d2565b80fd5b5080fd5b503d6152c0565b83513d6000823e3d90fd5b60041c16615191565b90508281813d831161534a575b6153238183614fdc565b810103126100655760ff916001600160801b03615341600f936150c8565b92505091615175565b503d615319565b84513d6000823e3d90fd5b9296505060e0823d60e0116153e7575b8161537960e09383614fdc565b810103126153e35761538a8261508a565b6153966020840161509e565b926153a28382016150ac565b506153af606082016150ac565b506153bc608082016150ac565b5060a08101519760ff891689036152ea575060c06153da91016150bb565b5091953861512f565b8580fd5b3d915061536c565b60020b60008112156157855780600003905b620d89e8821161575b57600182161561573f5770ffffffffffffffffffffffffffffffffff6ffffcb933bd6fad37aa2d162d1a5940015b169160028116615723575b60048116615707575b600881166156eb575b601081166156cf575b602081166156b3575b60408116615697575b60809081811661567c575b6101008116615661575b6102008116615646575b610400811661562b575b6108008116615610575b61100081166155f5575b61200081166155da575b61400081166155bf575b61800081166155a4575b620100008116615589575b62020000811661556f575b620400008116615555575b620800001661553a575b5060001261552b575b6001600160a01b039063ffffffff81166155225760ff60005b169060201c011690565b60ff6001615518565b80156110a857600019046154ff565b6b048a170391f7dc42444e8fa26000929302901c91906154f6565b6d2216e584f5fa1ea926041bedfe98909302811c926154ec565b926e5d6af8dedb81196699c329225ee60402811c926154e1565b926f09aa508b5b7a84e1c677de54f3e99bc902811c926154d6565b926f31be135f97d08fd981231505542fcfa602811c926154cb565b926f70d869a156d2a1b890bb3df62baf32f702811c926154c1565b926fa9f746462d870fdf8a65dc1f90e061e502811c926154b7565b926fd097f3bdfd2022b8845ad8f792aa582502811c926154ad565b926fe7159475a2c29b7443b29c7fa6e889d902811c926154a3565b926ff3392b0822b70005940c7a398e4b70f302811c92615499565b926ff987a7253ac413176f2b074cf7815e5402811c9261548f565b926ffcbe86c7900a88aedcffc83b479aa3a402811c92615485565b926ffe5dee046a99a2a811c461f1969c305302811c9261547b565b916fff2ea16466c96a3843ec78b326b528610260801c91615470565b916fff973b41fa98c081472e6896dfb254c00260801c91615467565b916fffcb9843d60f6159c9db58835c9266440260801c9161545e565b916fffe5caca7e10e4e61c3624eaa0941cd00260801c91615455565b916ffff2e50f5f656932ef12357cf3c7fdcc0260801c9161544c565b916ffff97272373d413259a46990580e213a0260801c91615443565b70ffffffffffffffffffffffffffffffffff600160801b615438565b60046040517fce8ef7fc000000000000000000000000000000000000000000000000000000008152fd5b80615401565b6001600160a01b039460009491939091908583838982168a82161161580e575b505081881683891681116157d6575050506157c893949550615b37565b905b156157d25791565b9091565b9196509194968316116000146158035750926157f7826157fd949583615b37565b93615916565b916157ca565b93506157fd92615916565b9450925038806157ab565b9060020b9081156110a85760020b0790565b91906001600160a01b039081811682851611615880575b818416928315610065576fffffffffffffffffffffffffffffffff60601b8361587d966158789585169403169160601b16615a7a565b615073565b90565b92615842565b91906001600160a01b0391828216838516116158dc575b82841693841561006557836fffffffffffffffffffffffffffffffff60601b916158d09585169403169160601b16615b1b565b90808206151591040190565b92909261589d565b61587d92916001600160801b03916001600160a01b039182811683831611615910575b031691166159af565b90615907565b61587d92916001600160801b03916001600160a01b039182811683831611615942575b03169116615af0565b90615939565b9080820290600019818409908280831092039082820392620f4240928484111561006557146159a7577fde8f6cefed634549b62c77574f722e1ac57e23f24d8fd5cb790fb65668c26139940990828211900360fa1b910360061c170290565b509250500490565b8181029190600019828209918380841093039183830393600160601b938585111561006557146159ec570990828211900360a01b910360601c1790565b5050505060601c90565b908160601b90600160601b600019818509938380861095039480860395868511156100655714615a72579082910981806000031680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b505091500490565b9181830291600019818509938380861095039480860395868511156100655714615a72579082910981806000031680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b9190600160601b90615b0281856159af565b9309615b0a57565b906000198110156100655760010190565b929190615b29828286615a7a565b9382156110a85709615b0a57565b9161587d926001600160a01b039081841682821611615b73575b906001600160801b0391615b698286168383166159af565b9403169116615b1b565b92615b51565b91908115615be1576fffffffffffffffffffffffffffffffff60601b9060601b166001600160a01b0380931680615bb38185029485615073565b1480615bd8575b1561006557615bcb92820391615b1b565b9081169081036100655790565b50828211615bba565b505090565b91908115615be1576fffffffffffffffffffffffffffffffff60601b9060601b16906001600160a01b0380931680820281615c218483615073565b14615c47575b5090615c36615c3b9284615073565b61507d565b80820615159104011690565b8301838110615c27579150615c5b92615b1b565b1690565b6001600160a01b0392909183916000838211615c9c57506001600160801b039060601b91168082061515910401915b168181111561006557031690565b916001600160801b0391935016615cb381846159f6565b928115615cea5790600160601b8694939209615cd1575b5091615c8e565b9091506000198210156152ea5750600183910138615cca565b602483634e487b7160e01b81526012600452fd5b6001600160a01b0392615bcb928491828111615d32576001600160801b03615d2a92169060601b615073565b915b1661507d565b6001600160801b03615d459216906159f6565b91615d2c56fea164736f6c6343000817000a
Deployed Bytecode
0x610640604052600436101561001357600080fd5b60003560e01c80630b35df27146140705780630f6537481461310857806320dcf3cd1461006a5763e0387d951461004957600080fd5b34610065576000366003190112610065576020604051600f8152f35b600080fd5b346100655760e03660031901126100655760405161008781614f8e565b6004356001600160a01b038116810361006557815260243580151581036100655760208201526044358060020b8103610065578060408301526064358060020b81036100655760608301526084356001600160801b038116810361006557608083015260a43560a083015260c43560c083015261010860009160020b6153ef565b610118606084015160020b6153ef565b92610121614ffe565b61013d81602084015115156001600160a01b03855116906150dc565b61016b8584602085015115156001600160801b036080870151166001600160a01b0360c0870151169161578b565b9590938661017d8660a0870151615066565b908060c0870151106101b6575b5050505050906020606094920151156101b0575b60405192835260208301526040820152f35b9061019e565b81929396949791156130c457600160ff1b811015610065576101d790615055565b97881561300a576001600160a01b0360c08901511660a089015160020b6001600160801b0360408b015116916040519b6102108d614fc0565b8c52600060208d015260408c015260608b015260808a01525b88511515806130a0575b156110be5760405161024481614f8e565b6000815260006020820152600060408201526000606082015260006080820152600060a0820152600060c08201526001600160a01b0360408b01511681526001600160a01b036101008a01511660608b015160020b60808b015160020b908b51151582156110a8578282059183600082129182611092575b5050611084575b15610ea4576020926102e58260020b906101008260081d60010b920760ff1690565b949060246040518094819363299ce14b60e11b835260010b60048301525afa90811561078b57600091610e72575b50600160ff85161b80016000190181161580159490610e5c57600090600160ff82161b800160001901831680156100655760ff93600160801b60018487161b80016000190182161015610e40575b5080680100000000000000006002921015610e32575b640100000000811015610e24575b62010000811015610e16575b610100811015610e08575b6010811015610dfa575b6004811015610ded575b1015610de0575b031660020b900360020b0260020b5b905b1515604083015260020b60208201819052620d89e7199081811215610dc1575060208201525b888a6001600160a01b03610408602085015160020b6153ef565b168060608501526001600160a01b036040830151169083511515600014610dac576001600160a01b0360e08501511681105b15610da757506001600160a01b0360e0840151165b62ffffff60606001600160801b03608086015116945195015116936000906000916000821215600014610d22575061049162ffffff87620f4240031682615948565b956001600160a01b0384168510610d11576104ad868686615886565b925b838810610cd2576001600160a01b03975084965b858916888a168114959089908910610c7757508580610c6c575b15610c5b575b96879580610c51575b15610c415750505b935b6000831280610c35575b610c29575b60008312159081610c1a575b5015610bfc5750035b60c086015260a085015260808401521660408b015260a0810151600160ff1b811015610065578a51018a52610558608082015160c08301519061507d565b600160ff1b8110156100655760208b01518180820112600082129080158216911516176106af570160208b015260ff60208a01511680610bdd575b5060408a01516001600160a01b036060830151166001600160a01b03821614600014610797575060408101516105f4575b8851156105e857602060001991015160020b0160020b5b60020b60608a0152610229565b6020015160020b6105db565b6001600160a01b036101008a015116610100602083015160020b60246040518094819363f30dba9360e01b835260048301525afa90811561078b57600091610704575b50808a516106f6575b50600081600f0b126000146106c5576001600160801b0360808c0151166f7fffffffffffffffffffffffffffffff1982600f0b146106af576001600160801b038083600f0b600003168203116106af576001600160801b038092600f0b6000031690035b1660808b01526105c4565b634e487b7160e01b600052601160045260246000fd5b6001600160801b0360808c0151166001600160801b038083168201116106af576001600160801b03809216016106a4565b9050600003600f0b8b610640565b9050610100813d61010011610783575b816107226101009383614fdc565b8101031261006557610733816150c8565b5060208101519081600f0b82036100655760808101518060060b036100655761075e60a0820161508a565b5060c081015163ffffffff8116036100655760e061077c91016150bb565b508b610637565b3d9150610714565b6040513d6000823e3d90fd5b906001600160a01b039051166001600160a01b038216036107b9575b50610229565b6401000276a36001600160a01b038216108015610bb6575b610b8c57640100000000600160c01b038160201b16806001600160801b03821160071b82811c67ffffffffffffffff811160061b61030052610300511c63ffffffff811160051b61036052610360511c61ffff811160041b6103c0526103c0511c9260039360ff8111851b90811c90600f821160021b91821c946001968611871b9360808888871c118686866103c05161036051610300518d171717171717171015600014610b655750607e198787861c118585856103c05161036051610300518c17171717171717011c5b808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c91828002607f1c83800260ff1c1c93848002607f1c85800260ff1c1c95868002607f1c87800260ff1c1c6102c0526102c0516102c05102607f1c6102c0516102c0510260ff1c1c61032052610320516103205102607f1c61032051610320510260ff1c1c61038052610380516103805102607f1c61038051610380510260ff1c1c6103a0526103a0516103a05102607f1c6103a0516103a0510260ff1c1c61034052610340516103405102607f1c61034051610340510260ff1c1c6102e0526102e0516102e05102607f1c6102e0516102e0510260ff1c1c800260cd1c6604000000000000169c6102e0516102e0510260cc1c6608000000000000169c61034051610340510260cb1c6610000000000000169c6103a0516103a0510260ca1c6620000000000000169c61038051610380510260c91c6640000000000000169c61032051610320510260c81c6680000000000000169c6102c0516102c0510260c71c670100000000000000169c800260c61c670200000000000000169b800260c51c670400000000000000169a800260c41c6708000000000000001699800260c31c6710000000000000001698800260c21c6720000000000000001697800260c11c6740000000000000001696800260c01c6780000000000000001695607f1995841c11936103c05190610360519061030051171717171717170160401b1717171717171717171717171717693627a301d71055774c85026f028f6481ab7f045a5af012a19d003aa919810160801d60020b906fdb2df09e81959a81455e260799a0632f0160801d60020b91828214600014610b38575090505b60020b60608a0152896107b3565b6001600160a01b03166001600160a01b03610b52846153ef565b1611610b5e5750610b2a565b9050610b2a565b90508686851c118484846103c05161036051610300518b17171717171717607f031b61089d565b60046040517f02ad01b6000000000000000000000000000000000000000000000000000000008152fd5b5073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b03821610156107d1565b610beb9060c0830151615073565b60c08201510360c08201528a610593565b9050610c15915062ffffff81620f424003169084615b1b565b61051a565b88915016878716141538610511565b93508160000393610505565b50826000038511610500565b610c4c9250886158e4565b6104f4565b50600085126104ec565b50610c6781888a615886565b6104e3565b5060008512156104dd565b908680610cc7575b15610cb6575b97889680610cac575b15610c9d575050505b936104f6565b610ca7935061582b565b610c97565b5060008612610c8e565b50610cc282828a615916565b610c85565b506000861215610c7f565b8515610065578615610065576001600160a01b03978589168710610d0157610cfb908888615be6565b966104c3565b610d0c908888615cfe565b610cfb565b610d1c868587615916565b926104af565b91506001600160a01b0383168410610d9657610d3f8585856158e4565b955b60008290038711610d5c576001600160a01b039684966104c3565b8415610065578515610065576001600160a01b03968488168610610d8857610cfb836000038888615c5f565b610d0c836000038888615b79565b610da185848661582b565b95610d41565b61044f565b6001600160a01b0360e085015116811161043a565b9050620d89e8809113610dd5575b506103ee565b60208201528a610dcf565b90600183910116906103b7565b928101841692811c6103b0565b60049384018516931c6103a6565b60089384018516931c61039c565b60109384018516931c610391565b60209384018516931c610385565b60409384018516931c610377565b6080935060018584161b80016000190116831c90506002610361565b60ff91501660020b900360020b0260020b6103c6565b90506020813d602011610e9c575b81610e8d60209383614fdc565b8101031261006557518e610313565b3d9150610e80565b6020610ec66001830160020b60020b906101008260081d60010b920760ff1690565b919060246040518097819363299ce14b60e11b835260010b60048301525afa93841561078b57600094611050575b50600160ff82161b60001901198416158015949061103257600160ff83161b600019011981169182156100655760019260ff92839083821686901b600019011981166001600160801b03161561101c575050607f5b67ffffffffffffffff82161561101257603f190183165b63ffffffff82161561100857601f190183165b61ffff821615610ffe57600f190183165b81841615610ff4576007190183165b600f821615610fea576003190183165b6003821615610fdf5783859182190116915b16610fd4575b031660020b910160020b0160020b0260020b5b906103c8565b600019018216610fbb565b90849060021c610fb5565b9060041c90610fa3565b9060081c90610f93565b9060101c90610f84565b9060201c90610f73565b9060401c90610f60565b83851686901b60001901191660801c9150610f49565b5060ff60019181031660020b910160020b0160020b0260020b610fce565b9093506020813d60201161107c575b8161106c60209383614fdc565b810103126100655751928e610ef4565b3d915061105f565b906000190160020b906102c3565b61109c9250615819565b60020b151583386102bc565b634e487b7160e01b600052601260045260246000fd5b909192939495976020015192808411613098575b506000979197945b600f86101561308a575050600160ff1b82101561006557811561300a576001600160a01b0360c0870151169660a087015160020b6001600160801b03604089015116906040519961112a8b614fc0565b858b52600060208c015260408b015260608a015260808901525b8751151580613066575b15611f745760405161115f81614f8e565b6000815260006020820152600060408201526000606082015260006080820152600060a0820152600060c08201526001600160a01b0360408a01511681526001600160a01b036101008901511660608a015160020b60808a015160020b908a51151582156110a8578282059183600082129182611f5e575b5050611f50575b15611d70576020926112008260020b906101008260081d60010b920760ff1690565b949060246040518094819363299ce14b60e11b835260010b60048301525afa90811561078b57600091611d3e575b50600160ff85161b80016000190181161580159490611d2857600090600160ff82161b800160001901831680156100655760ff93600160801b60018487161b80016000190182161015611d0c575b5080680100000000000000006002921015611cfe575b640100000000811015611cf0575b62010000811015611ce2575b610100811015611cd4575b6010811015611cc6575b6004811015611cb9575b1015611cac575b031660020b900360020b0260020b5b905b1515604083015260020b60208201819052620d89e7199081811215611c8d575060208201525b6001600160a01b03611321602083015160020b6153ef565b168060608301526001600160a01b0360408b0151169089511515600014611c78576001600160a01b0360e08b01511681105b15611c7257506001600160a01b0360e08a015116905b6001600160801b0360808c015116908b519262ffffff60608d015116936000906000916000821215600014611bed57506113ad62ffffff87620f4240031682615948565b956001600160a01b0384168510611bdc576113c9868686615886565b925b838810611b9d576001600160a01b03975084965b858916888a168114959089908910611b4257508580611b37575b15611b26575b96879580611b1c575b15611b0c5750505b935b6000831280611b00575b611af4575b60008312159081611ae5575b5015611ac75750035b60c086015260a085015260808401521660408a0152608081015160c082015101600160ff1b81101561006557895103895260a0810151600160ff1b8110156100655760208a01516000821281838103128116908284810313901516176106af570360208a015260ff60208901511680611aa8575b5060408901516001600160a01b036060830151166001600160a01b0382161460001461168c5750604081015161150b575b8751156114ff57602060001991015160020b0160020b5b60020b6060890152611144565b6020015160020b6114f2565b6001600160a01b0361010089015116610100602083015160020b60246040518094819363f30dba9360e01b835260048301525afa90811561078b57600091611605575b508089516115f7575b50600081600f0b126000146115c6576001600160801b0360808b0151166f7fffffffffffffffffffffffffffffff1982600f0b146106af576001600160801b038083600f0b600003168203116106af576001600160801b038092600f0b6000031690035b1660808a01526114db565b6001600160801b0360808b0151166001600160801b038083168201116106af576001600160801b03809216016115bb565b9050600003600f0b8a611557565b9050610100813d61010011611684575b816116236101009383614fdc565b8101031261006557611634816150c8565b5060208101519081600f0b82036100655760808101518060060b036100655761165f60a0820161508a565b5060c081015163ffffffff8116036100655760e061167d91016150bb565b508a61154e565b3d9150611615565b906001600160a01b039051166001600160a01b038216036116ae575b50611144565b6401000276a36001600160a01b038216108015611a81575b610b8c57640100000000600160c01b038160201b16806001600160801b03821160071b82811c67ffffffffffffffff811160061b6101e0526101e0511c63ffffffff811160051b61024052610240511c61ffff811160041b6102a0526102a0511c9260039360ff8111851b90811c90600f821160021b91821c946001968611871b9360808888871c118686866102a051610240516101e0518d171717171717171015600014611a5a5750607e198787861c118585856102a051610240516101e0518c17171717171717011c5b808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c91828002607f1c83800260ff1c1c93848002607f1c85800260ff1c1c95868002607f1c87800260ff1c1c6101a0526101a0516101a05102607f1c6101a0516101a0510260ff1c1c61020052610200516102005102607f1c61020051610200510260ff1c1c61026052610260516102605102607f1c61026051610260510260ff1c1c61028052610280516102805102607f1c61028051610280510260ff1c1c61022052610220516102205102607f1c61022051610220510260ff1c1c6101c0526101c0516101c05102607f1c6101c0516101c0510260ff1c1c800260cd1c6604000000000000169c6101c0516101c0510260cc1c6608000000000000169c61022051610220510260cb1c6610000000000000169c61028051610280510260ca1c6620000000000000169c61026051610260510260c91c6640000000000000169c61020051610200510260c81c6680000000000000169c6101a0516101a0510260c71c670100000000000000169c800260c61c670200000000000000169b800260c51c670400000000000000169a800260c41c6708000000000000001699800260c31c6710000000000000001698800260c21c6720000000000000001697800260c11c6740000000000000001696800260c01c6780000000000000001695607f1995841c11936102a0519061024051906101e051171717171717170160401b1717171717171717171717171717693627a301d71055774c85026f028f6481ab7f045a5af012a19d003aa919810160801d60020b906fdb2df09e81959a81455e260799a0632f0160801d60020b91828214600014611a2d575090505b60020b6060890152886116a8565b6001600160a01b03166001600160a01b03611a47846153ef565b1611611a535750611a1f565b9050611a1f565b90508686851c118484846102a051610240516101e0518b17171717171717607f031b611792565b5073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b03821610156116c6565b611ab69060c0830151615073565b60c08201510360c0820152896114aa565b9050611ae0915062ffffff81620f424003169084615b1b565b611436565b8891501687871614153861142d565b93508160000393611421565b5082600003851161141c565b611b179250886158e4565b611410565b5060008512611408565b50611b3281888a615886565b6113ff565b5060008512156113f9565b908680611b92575b15611b81575b97889680611b77575b15611b68575050505b93611412565b611b72935061582b565b611b62565b5060008612611b59565b50611b8d82828a615916565b611b50565b506000861215611b4a565b8515610065578615610065576001600160a01b03978589168710611bcc57611bc6908888615be6565b966113df565b611bd7908888615cfe565b611bc6565b611be7868587615916565b926113cb565b91506001600160a01b0383168410611c6157611c0a8585856158e4565b955b60008290038711611c27576001600160a01b039684966113df565b8415610065578515610065576001600160a01b03968488168610611c5357611bc6836000038888615c5f565b611bd7836000038888615b79565b611c6c85848661582b565b95611c0c565b90611369565b6001600160a01b0360e08b0151168111611353565b9050620d89e8809113611ca1575b50611309565b602082015289611c9b565b90600183910116906112d2565b928101841692811c6112cb565b60049384018516931c6112c1565b60089384018516931c6112b7565b60109384018516931c6112ac565b60209384018516931c6112a0565b60409384018516931c611292565b6080935060018584161b80016000190116831c9050600261127c565b60ff91501660020b900360020b0260020b6112e1565b90506020813d602011611d68575b81611d5960209383614fdc565b8101031261006557518d61122e565b3d9150611d4c565b6020611d926001830160020b60020b906101008260081d60010b920760ff1690565b919060246040518097819363299ce14b60e11b835260010b60048301525afa93841561078b57600094611f1c575b50600160ff82161b600019011984161580159490611efe57600160ff83161b600019011981169182156100655760019260ff92839083821686901b600019011981166001600160801b031615611ee8575050607f5b67ffffffffffffffff821615611ede57603f190183165b63ffffffff821615611ed457601f190183165b61ffff821615611eca57600f190183165b81841615611ec0576007190183165b600f821615611eb6576003190183165b6003821615611eab5783859182190116915b16611ea0575b031660020b910160020b0160020b0260020b5b906112e3565b600019018216611e87565b90849060021c611e81565b9060041c90611e6f565b9060081c90611e5f565b9060101c90611e50565b9060201c90611e3f565b9060401c90611e2c565b83851686901b60001901191660801c9150611e15565b5060ff60019181031660020b910160020b0160020b0260020b611e9a565b9093506020813d602011611f48575b81611f3860209383614fdc565b810103126100655751928d611dc0565b3d9150611f2b565b906000190160020b906111de565b611f689250615819565b60020b1515838f6111d7565b90969391936001600160a01b0360408201511690611fb38986602084519401516000039460208b015115156001600160801b0360808d0151169061578b565b9190968293888415801561304e575b156120f25761038483851485850380830204821417156106af576103e8908585030204945b8484141592836120d6575b5050816120bc575b5061200f5750506001909301949791976110da565b92979995945092505003945b851561202c5780809794959761018a565b60a492879261205f9260208501511515906001600160a01b0360c06001600160801b03608089015116920151169161578b565b9161206e8260a0830151615066565b9260c060a083015192015192604051947fe6e8996d00000000000000000000000000000000000000000000000000000000865260048601526024850152604484015260648301526084820152fd5b90506120ce83830360a08c0151615066565b10158c611ffa565b6120e89192935060c08d01519061507d565b1015908d80611ff2565b919293909896999a9b95600160ff1b8299969910156100655761211482615055565b801561300a578d6001600160a01b0360c0820151166001600160801b03604060a084015160020b93015116926040516106205261215361062051614fc0565b6106205152600060206106205101526040610620510152606061062051015260806106205101525b6106205151151580612fe9575b15612fce5760405161219981614f8e565b6000815260006020820152600060408201526000606082015260006080820152600060a0820152600060c08201526001600160a01b0360406106205101511681528d6001600160a01b036101008201511690606061062051015160020b608082015160020b9151151582156110a8578282059183600082129182612fb8575b5050612faa575b15612dca576020926122418260020b906101008260081d60010b920760ff1690565b949060246040518094819363299ce14b60e11b835260010b60048301525afa90811561078b57600091612d98575b50600160ff85161b80016000190181161580159490612d8257600090600160ff82161b800160001901831680156100655760ff93600160801b60018487161b80016000190182161015612d66575b5080680100000000000000006002921015612d58575b640100000000811015612d4a575b62010000811015612d3c575b610100811015612d2e575b6010811015612d20575b6004811015612d13575b1015612d06575b031660020b900360020b0260020b5b905b1515604083015260020b60208201819052620d89e7199081811215612ce7575060208201525b8d6001600160a01b03612363602084015160020b6153ef565b168060608401526001600160a01b036040610620510151169082511515600014612cd2576001600160a01b0360e08401511681105b15612ccc57506001600160a01b0360e083015116905b6001600160801b036080610620510151169162ffffff6060610620515195015116936000906000916000821215600014612c4757506123f762ffffff87620f4240031682615948565b956001600160a01b0384168510612c3657612413868686615886565b925b838810612bf7576001600160a01b03975084965b858916888a168114959089908910612b9c57508580612b91575b15612b80575b96879580612b76575b15612b665750505b935b6000831280612b5a575b612b4e575b60008312159081612b3f575b5015612b215750035b60c086015260a0850152608084015216604061062051015260a0810151600160ff1b8110156100655761062051510161062051526124c7608082015160c08301519061507d565b600160ff1b8110156100655760206106205101518180820112600082129080158216911516176106af578f60ff92602092018261062051015201511680612b02575b5060406106205101516001600160a01b036060830151166001600160a01b038216146000146126fe57508d6040820151612570575b511561256457602060001991015160020b0160020b5b60020b606061062051015261217b565b6020015160020b612554565b6101006001600160a01b0391015116610100602083015160020b60246040518094819363f30dba9360e01b835260048301525afa801561078b578f91600091612675575b50809151612667575b50600081600f0b12600014612633576001600160801b036080610620510151166f7fffffffffffffffffffffffffffffff1982600f0b146106af576001600160801b038083600f0b600003168203116106af576001600160801b038092600f0b6000031690035b1660806106205101528d61253e565b6001600160801b036080610620510151166001600160801b038083168201116106af576001600160801b0380921601612624565b9050600003600f0b8f6125bd565b915050610100813d610100116126f6575b816126946101009383614fdc565b81010312610065576126a5816150c8565b50602081015180600f0b81036100655760808201518060060b03610065576126cf60a0830161508a565b5060c082015163ffffffff811603610065578f9160e06126ef91016150bb565b50386125b4565b3d9150612686565b906001600160a01b039051166001600160a01b03821603612720575b5061217b565b6401000276a36001600160a01b038216108015612adb575b610b8c57640100000000600160c01b038160201b16806001600160801b03821160071b82811c67ffffffffffffffff811160061b60c05260c0511c63ffffffff811160051b61012052610120511c61ffff811160041b61018052610180511c9260039360ff8111851b90811c90600f821160021b91821c946001968611871b9360808888871c11868686610180516101205160c0518d171717171717171015600014612ab55750607e198787861c11858585610180516101205160c0518c17171717171717011c5b808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c91828002607f1c83800260ff1c1c93848002607f1c85800260ff1c1c95868002607f1c87800260ff1c1c60805260805160805102607f1c6080516080510260ff1c1c60e05260e05160e05102607f1c60e05160e0510260ff1c1c61014052610140516101405102607f1c61014051610140510260ff1c1c61016052610160516101605102607f1c61016051610160510260ff1c1c61010052610100516101005102607f1c61010051610100510260ff1c1c60a05260a05160a05102607f1c60a05160a0510260ff1c1c800260cd1c6604000000000000169c60a05160a0510260cc1c6608000000000000169c61010051610100510260cb1c6610000000000000169c61016051610160510260ca1c6620000000000000169c61014051610140510260c91c6640000000000000169c60e05160e0510260c81c6680000000000000169c6080516080510260c71c670100000000000000169c800260c61c670200000000000000169b800260c51c670400000000000000169a800260c41c6708000000000000001699800260c31c6710000000000000001698800260c21c6720000000000000001697800260c11c6740000000000000001696800260c01c6780000000000000001695607f1995841c11936101805190610120519060c051171717171717170160401b1717171717171717171717171717693627a301d71055774c85026f028f6481ab7f045a5af012a19d003aa919810160801d60020b906fdb2df09e81959a81455e260799a0632f0160801d60020b91828214600014612a88575090505b60020b60606106205101528d61271a565b6001600160a01b03166001600160a01b03612aa2846153ef565b1611612aae5750612a77565b9050612a77565b90508686851c11848484610180516101205160c0518b17171717171717607f031b612800565b5073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b0382161015612738565b612b109060c0830151615073565b60c08201510360c08201528e612509565b9050612b3a915062ffffff81620f424003169084615b1b565b612480565b88915016878716141538612477565b9350816000039361246b565b50826000038511612466565b612b719250886158e4565b61245a565b5060008512612452565b50612b8c81888a615886565b612449565b506000851215612443565b908680612bec575b15612bdb575b97889680612bd1575b15612bc2575050505b9361245c565b612bcc935061582b565b612bbc565b5060008612612bb3565b50612be782828a615916565b612baa565b506000861215612ba4565b8515610065578615610065576001600160a01b03978589168710612c2657612c20908888615be6565b96612429565b612c31908888615cfe565b612c20565b612c41868587615916565b92612415565b91506001600160a01b0383168410612cbb57612c648585856158e4565b955b60008290038711612c81576001600160a01b03968496612429565b8415610065578515610065576001600160a01b03968488168610612cad57612c20836000038888615c5f565b612c31836000038888615b79565b612cc685848661582b565b95612c66565b906123ae565b6001600160a01b0360e0840151168111612398565b9050620d89e8809113612cfb575b5061234a565b60208201528e612cf5565b9060018391011690612313565b928101841692811c61230c565b60049384018516931c612302565b60089384018516931c6122f8565b60109384018516931c6122ed565b60209384018516931c6122e1565b60409384018516931c6122d3565b6080935060018584161b80016000190116831c905060026122bd565b60ff91501660020b900360020b0260020b612322565b90506020813d602011612dc2575b81612db360209383614fdc565b8101031261006557513861226f565b3d9150612da6565b6020612dec6001830160020b60020b906101008260081d60010b920760ff1690565b919060246040518097819363299ce14b60e11b835260010b60048301525afa93841561078b57600094612f76575b50600160ff82161b600019011984161580159490612f5857600160ff83161b600019011981169182156100655760019260ff92839083821686901b600019011981166001600160801b031615612f42575050607f5b67ffffffffffffffff821615612f3857603f190183165b63ffffffff821615612f2e57601f190183165b61ffff821615612f2457600f190183165b81841615612f1a576007190183165b600f821615612f10576003190183165b6003821615612f055783859182190116915b16612efa575b031660020b910160020b0160020b0260020b5b90612324565b600019018216612ee1565b90849060021c612edb565b9060041c90612ec9565b9060081c90612eb9565b9060101c90612eaa565b9060201c90612e99565b9060401c90612e86565b83851686901b60001901191660801c9150612e6f565b5060ff60019181031660020b910160020b0160020b0260020b612ef4565b9093506020813d602011612fa2575b81612f9260209383614fdc565b8101031261006557519238612e1a565b3d9150612f85565b906000190160020b9061221f565b612fc29250615819565b60020b15158338612218565b959b9a99969890939291979497602061062051015194611fe7565b508c6001600160a01b0360e081604061062051015116920151161415612188565b606460405162461bcd60e51b815260206004820152600860248201527f4c745156333a41530000000000000000000000000000000000000000000000006044820152fd5b5061305f84840360a08d0151615066565b8111611fc2565b506001600160a01b036040890151166001600160a01b0360e089015116141561114e565b94509496959092915061201b565b9250886110d2565b506001600160a01b0360408a0151166001600160a01b0360e08a0151161415610233565b606460405162461bcd60e51b815260206004820152600860248201527f4c745156333a49420000000000000000000000000000000000000000000000006044820152fd5b346100655761312c61311936614f5b565b929091613124614ffe565b9283916150dc565b600160ff1b8210156100655761314182615055565b801561300a576001600160a01b0360c0830151169260a08301516001600160801b03604085015116906040519561317787614fc0565b84875260006020880152604087015260020b606086015260808501525b835115158061404c575b15613fc9576040516131af81614f8e565b6000815260006020820152600060408201526000606082015260006080820152600060a0820152600060c08201526001600160a01b0360408601511681526001600160a01b0361010085015116606086015160020b608086015160020b908651151582156110a8578282059183600082129182613fb3575b5050613fa5575b15613dc5576020926132508260020b906101008260081d60010b920760ff1690565b949060246040518094819363299ce14b60e11b835260010b60048301525afa90811561078b57600091613d93575b50600160ff85161b80016000190181161580159490613d7d57600090600160ff82161b800160001901831680156100655760ff93600160801b60018487161b80016000190182161015613d61575b5080680100000000000000006002921015613d53575b640100000000811015613d45575b62010000811015613d37575b610100811015613d29575b6010811015613d1b575b6004811015613d0e575b1015613d01575b031660020b900360020b0260020b5b905b1515604083015260020b60208201819052620d89e7199081811215613ce2575060208201525b6001600160a01b03613371602083015160020b6153ef565b168060608301526001600160a01b036040870151169085511515600014613ccd576001600160a01b0360e08701511681105b15613cc757506001600160a01b0360e086015116905b6001600160801b036080880151169087519262ffffff606089015116936000906000916000821215600014613c4257506133fd62ffffff87620f4240031682615948565b956001600160a01b0384168510613c3157613419868686615886565b925b838810613bf2576001600160a01b03975084965b858916888a168114959089908910613b9757508580613b8c575b15613b7b575b96879580613b71575b15613b615750505b935b6000831280613b55575b613b49575b60008312159081613b3a575b5015613b1c5750035b60c086015260a0850152608084015216604086015260a0810151600160ff1b8110156100655785510185526134c4608082015160c08301519061507d565b600160ff1b8110156100655760208601518180820112600082129080158216911516176106af5701602086015260ff60208501511680613afd575b5060408501516001600160a01b036060830151166001600160a01b038216146000146136e157506040810151613560575b83511561355457602060001991015160020b0160020b5b60020b6060850152613194565b6020015160020b613547565b6001600160a01b0361010085015116610100602083015160020b60246040518094819363f30dba9360e01b835260048301525afa90811561078b5760009161365a575b5080855161364c575b50600081600f0b1260001461361b576001600160801b036080870151166f7fffffffffffffffffffffffffffffff1982600f0b146106af576001600160801b038083600f0b600003168203116106af576001600160801b038092600f0b6000031690035b166080860152613530565b6001600160801b036080870151166001600160801b038083168201116106af576001600160801b0380921601613610565b9050600003600f0b866135ac565b9050610100813d610100116136d9575b816136786101009383614fdc565b8101031261006557613689816150c8565b5060208101519081600f0b82036100655760808101518060060b03610065576136b460a0820161508a565b5060c081015163ffffffff8116036100655760e06136d291016150bb565b50866135a3565b3d915061366a565b906001600160a01b039051166001600160a01b03821603613703575b50613194565b6401000276a36001600160a01b038216108015613ad6575b610b8c57640100000000600160c01b038160201b16806001600160801b03821160071b82811c67ffffffffffffffff811160061b61042052610420511c63ffffffff811160051b61048052610480511c61ffff811160041b6104e0526104e0511c9260039360ff8111851b90811c90600f821160021b91821c946001968611871b9360808888871c118686866104e05161048051610420518d171717171717171015600014613aaf5750607e198787861c118585856104e05161048051610420518c17171717171717011c5b808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c91828002607f1c83800260ff1c1c93848002607f1c85800260ff1c1c95868002607f1c87800260ff1c1c6103e0526103e0516103e05102607f1c6103e0516103e0510260ff1c1c61044052610440516104405102607f1c61044051610440510260ff1c1c6104a0526104a0516104a05102607f1c6104a0516104a0510260ff1c1c6104c0526104c0516104c05102607f1c6104c0516104c0510260ff1c1c61046052610460516104605102607f1c61046051610460510260ff1c1c61040052610400516104005102607f1c61040051610400510260ff1c1c800260cd1c6604000000000000169c61040051610400510260cc1c6608000000000000169c61046051610460510260cb1c6610000000000000169c6104c0516104c0510260ca1c6620000000000000169c6104a0516104a0510260c91c6640000000000000169c61044051610440510260c81c6680000000000000169c6103e0516103e0510260c71c670100000000000000169c800260c61c670200000000000000169b800260c51c670400000000000000169a800260c41c6708000000000000001699800260c31c6710000000000000001698800260c21c6720000000000000001697800260c11c6740000000000000001696800260c01c6780000000000000001695607f1995841c11936104e05190610480519061042051171717171717170160401b1717171717171717171717171717693627a301d71055774c85026f028f6481ab7f045a5af012a19d003aa919810160801d60020b906fdb2df09e81959a81455e260799a0632f0160801d60020b91828214600014613a82575090505b60020b6060850152846136fd565b6001600160a01b03166001600160a01b03613a9c846153ef565b1611613aa85750613a74565b9050613a74565b90508686851c118484846104e05161048051610420518b17171717171717607f031b6137e7565b5073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038216101561371b565b613b0b9060c0830151615073565b60c08201510360c0820152856134ff565b9050613b35915062ffffff81620f424003169084615b1b565b613486565b8891501687871614158d61347d565b93508160000393613471565b5082600003851161346c565b613b6c9250886158e4565b613460565b5060008512613458565b50613b8781888a615886565b61344f565b506000851215613449565b908680613be7575b15613bd6575b97889680613bcc575b15613bbd575050505b93613462565b613bc7935061582b565b613bb7565b5060008612613bae565b50613be282828a615916565b613ba5565b506000861215613b9f565b8515610065578615610065576001600160a01b03978589168710613c2157613c1b908888615be6565b9661342f565b613c2c908888615cfe565b613c1b565b613c3c868587615916565b9261341b565b91506001600160a01b0383168410613cb657613c5f8585856158e4565b955b60008290038711613c7c576001600160a01b0396849661342f565b8415610065578515610065576001600160a01b03968488168610613ca857613c1b836000038888615c5f565b613c2c836000038888615b79565b613cc185848661582b565b95613c61565b906133b9565b6001600160a01b0360e08701511681116133a3565b9050620d89e8809113613cf6575b50613359565b602082015285613cf0565b9060018391011690613322565b928101841692811c61331b565b60049384018516931c613311565b60089384018516931c613307565b60109384018516931c6132fc565b60209384018516931c6132f0565b60409384018516931c6132e2565b6080935060018584161b80016000190116831c905060026132cc565b60ff91501660020b900360020b0260020b613331565b90506020813d602011613dbd575b81613dae60209383614fdc565b8101031261006557518961327e565b3d9150613da1565b6020613de76001830160020b60020b906101008260081d60010b920760ff1690565b919060246040518097819363299ce14b60e11b835260010b60048301525afa93841561078b57600094613f71575b50600160ff82161b600019011984161580159490613f5357600160ff83161b600019011981169182156100655760019260ff92839083821686901b600019011981166001600160801b031615613f3d575050607f5b67ffffffffffffffff821615613f3357603f190183165b63ffffffff821615613f2957601f190183165b61ffff821615613f1f57600f190183165b81841615613f15576007190183165b600f821615613f0b576003190183165b6003821615613f005783859182190116915b16613ef5575b031660020b910160020b0160020b0260020b5b90613333565b600019018216613edc565b90849060021c613ed6565b9060041c90613ec4565b9060081c90613eb4565b9060101c90613ea5565b9060201c90613e94565b9060401c90613e81565b83851686901b60001901191660801c9150613e6a565b5060ff60019181031660020b910160020b0160020b0260020b613eef565b9093506020813d602011613f9d575b81613f8d60209383614fdc565b8101031261006557519289613e15565b3d9150613f80565b906000190160020b9061322e565b613fbd9250615819565b60020b1515838b613227565b9091506001600160a01b03604084015116916020840151935190036000030361400857604080516001600160a01b039290921682526020820192909252f35b606460405162461bcd60e51b815260206004820152600860248201527f4c745156333a494c0000000000000000000000000000000000000000000000006044820152fd5b506001600160a01b036040850151166001600160a01b0360e085015116141561319e565b346100655761408161311936614f5b565b600160ff1b82101561006557811561300a576001600160a01b0360c08201511660a08201516001600160801b0360408401511691604051946140c286614fc0565b855260006020860152604085015260020b606084015260808301525b8151151580614f37575b15614f0e576040516140f981614f8e565b6000815260006020820152600060408201526000606082015260006080820152600060a0820152600060c08201526001600160a01b0360408401511681526001600160a01b0361010083015116606084015160020b608084015160020b908451151582156110a8578282059183600082129182614ef8575b5050614eea575b15614d0a5760209261419a8260020b906101008260081d60010b920760ff1690565b949060246040518094819363299ce14b60e11b835260010b60048301525afa90811561078b57600091614cd8575b50600160ff85161b80016000190181161580159490614cc257600090600160ff82161b800160001901831680156100655760ff93600160801b60018487161b80016000190182161015614ca6575b5080680100000000000000006002921015614c98575b640100000000811015614c8a575b62010000811015614c7c575b610100811015614c6e575b6010811015614c60575b6004811015614c53575b1015614c46575b031660020b900360020b0260020b5b905b1515604083015260020b60208201819052620d89e7199081811215614c27575060208201525b6001600160a01b036142bb602083015160020b6153ef565b168060608301526001600160a01b036040850151169083511515600014614c12576001600160a01b0360e08501511681105b15614c0c57506001600160a01b0360e084015116905b6001600160801b036080860151169085519262ffffff606087015116936000906000916000821215600014614b87575061434762ffffff87620f4240031682615948565b956001600160a01b0384168510614b7657614363868686615886565b925b838810614b37576001600160a01b03975084965b858916888a168114959089908910614adc57508580614ad1575b15614ac0575b96879580614ab6575b15614aa65750505b935b6000831280614a9a575b614a8e575b60008312159081614a7f575b5015614a615750035b60c086015260a08501526080840152166040840152608081015160c082015101600160ff1b81101561006557835103835260a0810151600160ff1b8110156100655760208401516000821281838103128116908284810313901516176106af5703602084015260ff60208301511680614a42575b5060408301516001600160a01b036060830151166001600160a01b03821614600014614626575060408101516144a5575b81511561449957602060001991015160020b0160020b5b60020b60608301526140de565b6020015160020b61448c565b6001600160a01b0361010083015116610100602083015160020b60246040518094819363f30dba9360e01b835260048301525afa90811561078b5760009161459f575b50808351614591575b50600081600f0b12600014614560576001600160801b036080850151166f7fffffffffffffffffffffffffffffff1982600f0b146106af576001600160801b038083600f0b600003168203116106af576001600160801b038092600f0b6000031690035b166080840152614475565b6001600160801b036080850151166001600160801b038083168201116106af576001600160801b0380921601614555565b9050600003600f0b846144f1565b9050610100813d6101001161461e575b816145bd6101009383614fdc565b81010312610065576145ce816150c8565b5060208101519081600f0b82036100655760808101518060060b03610065576145f960a0820161508a565b5060c081015163ffffffff8116036100655760e061461791016150bb565b50846144e8565b3d91506145af565b906001600160a01b039051166001600160a01b03821603614648575b506140de565b6401000276a36001600160a01b038216108015614a1b575b610b8c57640100000000600160c01b038160201b16806001600160801b03821160071b82811c67ffffffffffffffff811160061b61054052610540511c63ffffffff811160051b6105a0526105a0511c61ffff811160041b61060052610600511c9260039360ff8111851b90811c90600f821160021b91821c946001968611871b9360808888871c11868686610600516105a051610540518d1717171717171710156000146149f45750607e198787861c11858585610600516105a051610540518c17171717171717011c5b808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c808002607f1c81800260ff1c1c91828002607f1c83800260ff1c1c93848002607f1c85800260ff1c1c95868002607f1c87800260ff1c1c61050052610500516105005102607f1c61050051610500510260ff1c1c61056052610560516105605102607f1c61056051610560510260ff1c1c6105c0526105c0516105c05102607f1c6105c0516105c0510260ff1c1c6105e0526105e0516105e05102607f1c6105e0516105e0510260ff1c1c61058052610580516105805102607f1c61058051610580510260ff1c1c61052052610520516105205102607f1c61052051610520510260ff1c1c800260cd1c6604000000000000169c61052051610520510260cc1c6608000000000000169c61058051610580510260cb1c6610000000000000169c6105e0516105e0510260ca1c6620000000000000169c6105c0516105c0510260c91c6640000000000000169c61056051610560510260c81c6680000000000000169c61050051610500510260c71c670100000000000000169c800260c61c670200000000000000169b800260c51c670400000000000000169a800260c41c6708000000000000001699800260c31c6710000000000000001698800260c21c6720000000000000001697800260c11c6740000000000000001696800260c01c6780000000000000001695607f1995841c119361060051906105a0519061054051171717171717170160401b1717171717171717171717171717693627a301d71055774c85026f028f6481ab7f045a5af012a19d003aa919810160801d60020b906fdb2df09e81959a81455e260799a0632f0160801d60020b918282146000146149c7575090505b60020b606083015282614642565b6001600160a01b03166001600160a01b036149e1846153ef565b16116149ed57506149b9565b90506149b9565b90508686851c11848484610600516105a051610540518b17171717171717607f031b61472c565b5073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b0382161015614660565b614a509060c0830151615073565b60c08201510360c082015283614444565b9050614a7a915062ffffff81620f424003169084615b1b565b6143d0565b8891501687871614158b6143c7565b935081600003936143bb565b508260000385116143b6565b614ab19250886158e4565b6143aa565b50600085126143a2565b50614acc81888a615886565b614399565b506000851215614393565b908680614b2c575b15614b1b575b97889680614b11575b15614b02575050505b936143ac565b614b0c935061582b565b614afc565b5060008612614af3565b50614b2782828a615916565b614aea565b506000861215614ae4565b8515610065578615610065576001600160a01b03978589168710614b6657614b60908888615be6565b96614379565b614b71908888615cfe565b614b60565b614b81868587615916565b92614365565b91506001600160a01b0383168410614bfb57614ba48585856158e4565b955b60008290038711614bc1576001600160a01b03968496614379565b8415610065578515610065576001600160a01b03968488168610614bed57614b60836000038888615c5f565b614b71836000038888615b79565b614c0685848661582b565b95614ba6565b90614303565b6001600160a01b0360e08501511681116142ed565b9050620d89e8809113614c3b575b506142a3565b602082015283614c35565b906001839101169061426c565b928101841692811c614265565b60049384018516931c61425b565b60089384018516931c614251565b60109384018516931c614246565b60209384018516931c61423a565b60409384018516931c61422c565b6080935060018584161b80016000190116831c90506002614216565b60ff91501660020b900360020b0260020b61427b565b90506020813d602011614d02575b81614cf360209383614fdc565b810103126100655751876141c8565b3d9150614ce6565b6020614d2c6001830160020b60020b906101008260081d60010b920760ff1690565b919060246040518097819363299ce14b60e11b835260010b60048301525afa93841561078b57600094614eb6575b50600160ff82161b600019011984161580159490614e9857600160ff83161b600019011981169182156100655760019260ff92839083821686901b600019011981166001600160801b031615614e82575050607f5b67ffffffffffffffff821615614e7857603f190183165b63ffffffff821615614e6e57601f190183165b61ffff821615614e6457600f190183165b81841615614e5a576007190183165b600f821615614e50576003190183165b6003821615614e455783859182190116915b16614e3a575b031660020b910160020b0160020b0260020b5b9061427d565b600019018216614e21565b90849060021c614e1b565b9060041c90614e09565b9060081c90614df9565b9060101c90614dea565b9060201c90614dd9565b9060401c90614dc6565b83851686901b60001901191660801c9150614daf565b5060ff60019181031660020b910160020b0160020b0260020b614e34565b9093506020813d602011614ee2575b81614ed260209383614fdc565b8101031261006557519287614d5a565b3d9150614ec5565b906000190160020b90614178565b614f029250615819565b60020b15158389614171565b5060408181015160209283015182516001600160a01b0390921682526000039281019290925290f35b506001600160a01b036040830151166001600160a01b0360e08301511614156140e8565b606090600319011261006557600435801515810361006557906024356001600160a01b0381168103610065579060443590565b60e0810190811067ffffffffffffffff821117614faa57604052565b634e487b7160e01b600052604160045260246000fd5b60a0810190811067ffffffffffffffff821117614faa57604052565b90601f8019910116810190811067ffffffffffffffff821117614faa57604052565b60405190610120820182811067ffffffffffffffff821117614faa57604052816101006000918281528260208201528260408201528260608201528260808201528260a08201528260c08201528260e08201520152565b600160ff1b81146106af5760000390565b919082039182116106af57565b81156110a8570490565b919082018092116106af57565b51906001600160a01b038216820361006557565b51908160020b820361006557565b519061ffff8216820361006557565b5190811515820361006557565b51906001600160801b038216820361006557565b90916001600160a01b03809316926040928351937f3850c7bd00000000000000000000000000000000000000000000000000000000855260e085600481895afa9081156152ab576000918296839161535c575b5083151586528151907f1a68650200000000000000000000000000000000000000000000000000000000825260209182816004818d5afa9081156153515760009161530c575b506001600160801b03168784015260ff90600f90861561530357165b168187015281517fddca3f4300000000000000000000000000000000000000000000000000000000815281816004818c5afa9081156152f8576000916152b5575b5062ffffff1660608701528151907fd0c93a7c00000000000000000000000000000000000000000000000000000000825280826004818c5afa9283156152ab575060009261526c575b50509061010095849260020b608087015260020b60a08601521660c0840152600014615252576401000276a45b1660e08201520152565b73fffd8963efd1fc6a506488495d951d5263988d25615248565b9080939250813d83116152a4575b6152848183614fdc565b81010312610065576101009561529a859361509e565b919281975061521b565b503d61527a565b513d6000823e3d90fd5b8281813d83116152f1575b6152ca8183614fdc565b810103126152ed57519062ffffff821682036152ea575062ffffff6151d2565b80fd5b5080fd5b503d6152c0565b83513d6000823e3d90fd5b60041c16615191565b90508281813d831161534a575b6153238183614fdc565b810103126100655760ff916001600160801b03615341600f936150c8565b92505091615175565b503d615319565b84513d6000823e3d90fd5b9296505060e0823d60e0116153e7575b8161537960e09383614fdc565b810103126153e35761538a8261508a565b6153966020840161509e565b926153a28382016150ac565b506153af606082016150ac565b506153bc608082016150ac565b5060a08101519760ff891689036152ea575060c06153da91016150bb565b5091953861512f565b8580fd5b3d915061536c565b60020b60008112156157855780600003905b620d89e8821161575b57600182161561573f5770ffffffffffffffffffffffffffffffffff6ffffcb933bd6fad37aa2d162d1a5940015b169160028116615723575b60048116615707575b600881166156eb575b601081166156cf575b602081166156b3575b60408116615697575b60809081811661567c575b6101008116615661575b6102008116615646575b610400811661562b575b6108008116615610575b61100081166155f5575b61200081166155da575b61400081166155bf575b61800081166155a4575b620100008116615589575b62020000811661556f575b620400008116615555575b620800001661553a575b5060001261552b575b6001600160a01b039063ffffffff81166155225760ff60005b169060201c011690565b60ff6001615518565b80156110a857600019046154ff565b6b048a170391f7dc42444e8fa26000929302901c91906154f6565b6d2216e584f5fa1ea926041bedfe98909302811c926154ec565b926e5d6af8dedb81196699c329225ee60402811c926154e1565b926f09aa508b5b7a84e1c677de54f3e99bc902811c926154d6565b926f31be135f97d08fd981231505542fcfa602811c926154cb565b926f70d869a156d2a1b890bb3df62baf32f702811c926154c1565b926fa9f746462d870fdf8a65dc1f90e061e502811c926154b7565b926fd097f3bdfd2022b8845ad8f792aa582502811c926154ad565b926fe7159475a2c29b7443b29c7fa6e889d902811c926154a3565b926ff3392b0822b70005940c7a398e4b70f302811c92615499565b926ff987a7253ac413176f2b074cf7815e5402811c9261548f565b926ffcbe86c7900a88aedcffc83b479aa3a402811c92615485565b926ffe5dee046a99a2a811c461f1969c305302811c9261547b565b916fff2ea16466c96a3843ec78b326b528610260801c91615470565b916fff973b41fa98c081472e6896dfb254c00260801c91615467565b916fffcb9843d60f6159c9db58835c9266440260801c9161545e565b916fffe5caca7e10e4e61c3624eaa0941cd00260801c91615455565b916ffff2e50f5f656932ef12357cf3c7fdcc0260801c9161544c565b916ffff97272373d413259a46990580e213a0260801c91615443565b70ffffffffffffffffffffffffffffffffff600160801b615438565b60046040517fce8ef7fc000000000000000000000000000000000000000000000000000000008152fd5b80615401565b6001600160a01b039460009491939091908583838982168a82161161580e575b505081881683891681116157d6575050506157c893949550615b37565b905b156157d25791565b9091565b9196509194968316116000146158035750926157f7826157fd949583615b37565b93615916565b916157ca565b93506157fd92615916565b9450925038806157ab565b9060020b9081156110a85760020b0790565b91906001600160a01b039081811682851611615880575b818416928315610065576fffffffffffffffffffffffffffffffff60601b8361587d966158789585169403169160601b16615a7a565b615073565b90565b92615842565b91906001600160a01b0391828216838516116158dc575b82841693841561006557836fffffffffffffffffffffffffffffffff60601b916158d09585169403169160601b16615b1b565b90808206151591040190565b92909261589d565b61587d92916001600160801b03916001600160a01b039182811683831611615910575b031691166159af565b90615907565b61587d92916001600160801b03916001600160a01b039182811683831611615942575b03169116615af0565b90615939565b9080820290600019818409908280831092039082820392620f4240928484111561006557146159a7577fde8f6cefed634549b62c77574f722e1ac57e23f24d8fd5cb790fb65668c26139940990828211900360fa1b910360061c170290565b509250500490565b8181029190600019828209918380841093039183830393600160601b938585111561006557146159ec570990828211900360a01b910360601c1790565b5050505060601c90565b908160601b90600160601b600019818509938380861095039480860395868511156100655714615a72579082910981806000031680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b505091500490565b9181830291600019818509938380861095039480860395868511156100655714615a72579082910981806000031680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b9190600160601b90615b0281856159af565b9309615b0a57565b906000198110156100655760010190565b929190615b29828286615a7a565b9382156110a85709615b0a57565b9161587d926001600160a01b039081841682821611615b73575b906001600160801b0391615b698286168383166159af565b9403169116615b1b565b92615b51565b91908115615be1576fffffffffffffffffffffffffffffffff60601b9060601b166001600160a01b0380931680615bb38185029485615073565b1480615bd8575b1561006557615bcb92820391615b1b565b9081169081036100655790565b50828211615bba565b505090565b91908115615be1576fffffffffffffffffffffffffffffffff60601b9060601b16906001600160a01b0380931680820281615c218483615073565b14615c47575b5090615c36615c3b9284615073565b61507d565b80820615159104011690565b8301838110615c27579150615c5b92615b1b565b1690565b6001600160a01b0392909183916000838211615c9c57506001600160801b039060601b91168082061515910401915b168181111561006557031690565b916001600160801b0391935016615cb381846159f6565b928115615cea5790600160601b8694939209615cd1575b5091615c8e565b9091506000198210156152ea5750600183910138615cca565b602483634e487b7160e01b81526012600452fd5b6001600160a01b0392615bcb928491828111615d32576001600160801b03615d2a92169060601b615073565b915b1661507d565b6001600160801b03615d459216906159f6565b91615d2c56fea164736f6c6343000817000a
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.