More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 209,404 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Exact Input Sing... | 10094735 | 5 mins ago | IN | 0 ETH | 0.00000327 | ||||
Exact Input Sing... | 10094735 | 5 mins ago | IN | 0 ETH | 0.0000041 | ||||
Exact Input Sing... | 10094731 | 5 mins ago | IN | 0 ETH | 0.00000312 | ||||
Exact Input Sing... | 10094731 | 5 mins ago | IN | 0 ETH | 0.0000036 | ||||
Exact Input Sing... | 10094633 | 8 mins ago | IN | 0 ETH | 0.00000327 | ||||
Exact Input Sing... | 10094633 | 8 mins ago | IN | 0 ETH | 0.00000342 | ||||
Multicall | 10094576 | 10 mins ago | IN | 0 ETH | 0.00000154 | ||||
Exact Input Sing... | 10094509 | 12 mins ago | IN | 0 ETH | 0.00000327 | ||||
Exact Input Sing... | 10094509 | 12 mins ago | IN | 0 ETH | 0.00000439 | ||||
Exact Input Sing... | 10094493 | 13 mins ago | IN | 0 ETH | 0.00000327 | ||||
Exact Input Sing... | 10094493 | 13 mins ago | IN | 0 ETH | 0.0000035 | ||||
Exact Input Sing... | 10094484 | 13 mins ago | IN | 0 ETH | 0.00000311 | ||||
Exact Input Sing... | 10094484 | 13 mins ago | IN | 0 ETH | 0.00000447 | ||||
Exact Input Sing... | 10094480 | 13 mins ago | IN | 0 ETH | 0.00000319 | ||||
Exact Input Sing... | 10094480 | 13 mins ago | IN | 0 ETH | 0.0000035 | ||||
Multicall | 10094077 | 27 mins ago | IN | 0 ETH | 0.00000143 | ||||
Exact Input Sing... | 10093798 | 36 mins ago | IN | 0 ETH | 0.00000319 | ||||
Exact Input Sing... | 10093798 | 36 mins ago | IN | 0 ETH | 0.00000343 | ||||
Exact Input Sing... | 10093796 | 36 mins ago | IN | 0 ETH | 0.00000327 | ||||
Exact Input Sing... | 10093796 | 36 mins ago | IN | 0 ETH | 0.00000344 | ||||
Exact Input Sing... | 10093776 | 37 mins ago | IN | 0 ETH | 0.00000327 | ||||
Exact Input Sing... | 10093776 | 37 mins ago | IN | 0 ETH | 0.00000463 | ||||
Multicall | 10093620 | 42 mins ago | IN | 0.00052 ETH | 0.00000128 | ||||
Multicall | 10093592 | 43 mins ago | IN | 0 ETH | 0.00000158 | ||||
Exact Input Sing... | 10093497 | 46 mins ago | IN | 0 ETH | 0.0000032 |
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
10094576 | 10 mins ago | 0.04992377 ETH | ||||
10094576 | 10 mins ago | 0.04992377 ETH | ||||
10093620 | 42 mins ago | 0.00052 ETH | ||||
10093592 | 43 mins ago | 0.03344091 ETH | ||||
10093592 | 43 mins ago | 0.03344091 ETH | ||||
10093411 | 49 mins ago | 0.00827587 ETH | ||||
10093411 | 49 mins ago | 0.00827587 ETH | ||||
10093220 | 55 mins ago | 0.0052594 ETH | ||||
10093220 | 55 mins ago | 0.52594092 ETH | ||||
10093145 | 58 mins ago | 0.02660419 ETH | ||||
10092308 | 1 hr ago | 0.30623621 ETH | ||||
10092308 | 1 hr ago | 0.30623621 ETH | ||||
10091977 | 1 hr ago | 0.0997077 ETH | ||||
10091977 | 1 hr ago | 0.0997077 ETH | ||||
10088614 | 3 hrs ago | 0.189 ETH | ||||
10086654 | 4 hrs ago | 0.01174714 ETH | ||||
10086654 | 4 hrs ago | 0.01174714 ETH | ||||
10085498 | 5 hrs ago | 0.13467641 ETH | ||||
10085498 | 5 hrs ago | 0.13467641 ETH | ||||
10085123 | 5 hrs ago | 0.00057346 ETH | ||||
10085123 | 5 hrs ago | 0.05734665 ETH | ||||
10084242 | 5 hrs ago | 0.01901849 ETH | ||||
10084242 | 5 hrs ago | 0.01901849 ETH | ||||
10083860 | 6 hrs ago | 0.07958369 ETH | ||||
10083860 | 6 hrs ago | 0.07958369 ETH |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xaa7402AD...52CED301c The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
SwapRouter
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 1000000 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.20; import '@cryptoalgebra/integral-core/contracts/libraries/SafeCast.sol'; import '@cryptoalgebra/integral-core/contracts/libraries/TickMath.sol'; import '@cryptoalgebra/integral-core/contracts/interfaces/IAlgebraPool.sol'; import './interfaces/ISwapRouter.sol'; import './base/PeripheryImmutableState.sol'; import './base/PeripheryValidation.sol'; import './base/PeripheryPaymentsWithFee.sol'; import './base/Multicall.sol'; import './base/SelfPermit.sol'; import './libraries/Path.sol'; import './libraries/PoolAddress.sol'; import './libraries/CallbackValidation.sol'; import './blast/Blast.sol'; /// @title Algebra Integral 1.0 Swap Router /// @notice Router for stateless execution of swaps against Algebra /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery contract SwapRouter is ISwapRouter, PeripheryImmutableState, PeripheryValidation, PeripheryPaymentsWithFee, Multicall, SelfPermit, Blast { using Path for bytes; using SafeCast for uint256; /// @dev Used as the placeholder value for amountInCached, because the computed amount in for an exact output swap /// can never actually be this value uint256 private constant DEFAULT_AMOUNT_IN_CACHED = type(uint256).max; /// @dev Transient storage variable used for returning the computed amount in for an exact output swap. uint256 private amountInCached = DEFAULT_AMOUNT_IN_CACHED; constructor( address _factory, address _WNativeToken, address _poolDeployer ) PeripheryImmutableState(_factory, _WNativeToken, _poolDeployer) Blast() {} /// @dev Returns the pool for the given token pair. The pool contract may or may not exist. function getPool(address tokenA, address tokenB) private view returns (IAlgebraPool) { return IAlgebraPool(PoolAddress.computeAddress(poolDeployer, PoolAddress.getPoolKey(tokenA, tokenB))); } struct SwapCallbackData { bytes path; address payer; } /// @inheritdoc IAlgebraSwapCallback function algebraSwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata _data) external override { require(amount0Delta > 0 || amount1Delta > 0, 'Zero liquidity swap'); // swaps entirely within 0-liquidity regions are not supported SwapCallbackData memory data = abi.decode(_data, (SwapCallbackData)); (address tokenIn, address tokenOut) = data.path.decodeFirstPool(); CallbackValidation.verifyCallback(poolDeployer, tokenIn, tokenOut); (bool isExactInput, uint256 amountToPay) = amount0Delta > 0 ? (tokenIn < tokenOut, uint256(amount0Delta)) : (tokenOut < tokenIn, uint256(amount1Delta)); if (isExactInput) { pay(tokenIn, data.payer, msg.sender, amountToPay); } else { // either initiate the next swap or pay if (data.path.hasMultiplePools()) { data.path = data.path.skipToken(); exactOutputInternal(amountToPay, msg.sender, 0, data); } else { amountInCached = amountToPay; tokenIn = tokenOut; // swap in/out because exact output swaps are reversed pay(tokenIn, data.payer, msg.sender, amountToPay); } } } /// @dev Performs a single exact input swap function exactInputInternal( uint256 amountIn, address recipient, uint160 limitSqrtPrice, SwapCallbackData memory data ) private returns (uint256 amountOut) { if (recipient == address(0)) recipient = address(this); // allow swapping to the router address with address 0 (address tokenIn, address tokenOut) = data.path.decodeFirstPool(); bool zeroToOne = tokenIn < tokenOut; (int256 amount0, int256 amount1) = getPool(tokenIn, tokenOut).swap( recipient, zeroToOne, amountIn.toInt256(), limitSqrtPrice == 0 ? (zeroToOne ? TickMath.MIN_SQRT_RATIO + 1 : TickMath.MAX_SQRT_RATIO - 1) : limitSqrtPrice, abi.encode(data) ); return uint256(-(zeroToOne ? amount1 : amount0)); } /// @inheritdoc ISwapRouter function exactInputSingle( ExactInputSingleParams calldata params ) external payable override checkDeadline(params.deadline) returns (uint256 amountOut) { amountOut = exactInputInternal( params.amountIn, params.recipient, params.limitSqrtPrice, SwapCallbackData({path: abi.encodePacked(params.tokenIn, params.tokenOut), payer: msg.sender}) ); require(amountOut >= params.amountOutMinimum, 'Too little received'); } /// @inheritdoc ISwapRouter function exactInput( ExactInputParams memory params ) external payable override checkDeadline(params.deadline) returns (uint256 amountOut) { address payer = msg.sender; // msg.sender pays for the first hop while (true) { bool hasMultiplePools = params.path.hasMultiplePools(); // the outputs of prior swaps become the inputs to subsequent ones params.amountIn = exactInputInternal( params.amountIn, hasMultiplePools ? address(this) : params.recipient, // for intermediate swaps, this contract custodies 0, SwapCallbackData({ path: params.path.getFirstPool(), // only the first pool in the path is necessary payer: payer }) ); // decide whether to continue or terminate if (hasMultiplePools) { payer = address(this); // at this point, the caller has paid params.path = params.path.skipToken(); } else { amountOut = params.amountIn; break; } } require(amountOut >= params.amountOutMinimum, 'Too little received'); } /// @inheritdoc ISwapRouter function exactInputSingleSupportingFeeOnTransferTokens( ExactInputSingleParams calldata params ) external payable override checkDeadline(params.deadline) returns (uint256 amountOut) { SwapCallbackData memory data = SwapCallbackData({ path: abi.encodePacked(params.tokenIn, params.tokenOut), payer: msg.sender }); address recipient = params.recipient == address(0) ? address(this) : params.recipient; bool zeroToOne = params.tokenIn < params.tokenOut; (int256 amount0, int256 amount1) = getPool(params.tokenIn, params.tokenOut).swapWithPaymentInAdvance( msg.sender, recipient, zeroToOne, params.amountIn.toInt256(), params.limitSqrtPrice == 0 ? (zeroToOne ? TickMath.MIN_SQRT_RATIO + 1 : TickMath.MAX_SQRT_RATIO - 1) : params.limitSqrtPrice, abi.encode(data) ); amountOut = uint256(-(zeroToOne ? amount1 : amount0)); require(amountOut >= params.amountOutMinimum, 'Too little received'); } /// @dev Performs a single exact output swap function exactOutputInternal( uint256 amountOut, address recipient, uint160 limitSqrtPrice, SwapCallbackData memory data ) private returns (uint256 amountIn) { if (recipient == address(0)) recipient = address(this); // allow swapping to the router address with address 0 (address tokenOut, address tokenIn) = data.path.decodeFirstPool(); bool zeroToOne = tokenIn < tokenOut; (int256 amount0Delta, int256 amount1Delta) = getPool(tokenIn, tokenOut).swap( recipient, zeroToOne, -amountOut.toInt256(), limitSqrtPrice == 0 ? (zeroToOne ? TickMath.MIN_SQRT_RATIO + 1 : TickMath.MAX_SQRT_RATIO - 1) : limitSqrtPrice, abi.encode(data) ); uint256 amountOutReceived; (amountIn, amountOutReceived) = zeroToOne ? (uint256(amount0Delta), uint256(-amount1Delta)) : (uint256(amount1Delta), uint256(-amount0Delta)); // it's technically possible to not receive the full output amount, // so if no price limit has been specified, require this possibility away if (limitSqrtPrice == 0) require(amountOutReceived == amountOut, 'Not received full amountOut'); } /// @inheritdoc ISwapRouter function exactOutputSingle( ExactOutputSingleParams calldata params ) external payable override checkDeadline(params.deadline) returns (uint256 amountIn) { // avoid an SLOAD by using the swap return data amountIn = exactOutputInternal( params.amountOut, params.recipient, params.limitSqrtPrice, SwapCallbackData({path: abi.encodePacked(params.tokenOut, params.tokenIn), payer: msg.sender}) ); require(amountIn <= params.amountInMaximum, 'Too much requested'); amountInCached = DEFAULT_AMOUNT_IN_CACHED; // has to be reset even though we don't use it in the single hop case } /// @inheritdoc ISwapRouter function exactOutput( ExactOutputParams calldata params ) external payable override checkDeadline(params.deadline) returns (uint256 amountIn) { // it's okay that the payer is fixed to msg.sender here, as they're only paying for the "final" exact output // swap, which happens first, and subsequent swaps are paid for within nested callback frames exactOutputInternal( params.amountOut, params.recipient, 0, SwapCallbackData({path: params.path, payer: msg.sender}) ); amountIn = amountInCached; require(amountIn <= params.amountInMaximum, 'Too much requested'); amountInCached = DEFAULT_AMOUNT_IN_CACHED; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Callback for IAlgebraPoolActions#swap /// @notice Any contract that calls IAlgebraPoolActions#swap must implement this interface /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces interface IAlgebraSwapCallback { /// @notice Called to `msg.sender` after executing a swap via IAlgebraPool#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// The caller of this method _must_ be checked to be a AlgebraPool deployed by the canonical AlgebraFactory. /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the IAlgebraPoolActions#swap call function algebraSwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.4; import './pool/IAlgebraPoolImmutables.sol'; import './pool/IAlgebraPoolState.sol'; import './pool/IAlgebraPoolActions.sol'; import './pool/IAlgebraPoolPermissionedActions.sol'; import './pool/IAlgebraPoolEvents.sol'; import './pool/IAlgebraPoolErrors.sol'; /// @title The interface for a Algebra Pool /// @dev The pool interface is broken up into many smaller pieces. /// This interface includes custom error definitions and cannot be used in older versions of Solidity. /// For older versions of Solidity use #IAlgebraPoolLegacy /// Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces interface IAlgebraPool is IAlgebraPoolImmutables, IAlgebraPoolState, IAlgebraPoolActions, IAlgebraPoolPermissionedActions, IAlgebraPoolEvents, IAlgebraPoolErrors { // used only for combining interfaces }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissionless pool actions /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces interface IAlgebraPoolActions { /// @notice Sets the initial price for the pool /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value /// @dev Initialization should be done in one transaction with pool creation to avoid front-running /// @param initialPrice The initial sqrt price of the pool as a Q64.96 function initialize(uint160 initialPrice) external; /// @notice Adds liquidity for the given recipient/bottomTick/topTick position /// @dev The caller of this method receives a callback in the form of IAlgebraMintCallback#algebraMintCallback /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends /// on bottomTick, topTick, the amount of liquidity, and the current price. /// @param leftoversRecipient The address which will receive potential surplus of paid tokens /// @param recipient The address for which the liquidity will be created /// @param bottomTick The lower tick of the position in which to add liquidity /// @param topTick The upper tick of the position in which to add liquidity /// @param liquidityDesired The desired 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 /// @return liquidityActual The actual minted amount of liquidity function mint( address leftoversRecipient, address recipient, int24 bottomTick, int24 topTick, uint128 liquidityDesired, bytes calldata data ) external returns (uint256 amount0, uint256 amount1, uint128 liquidityActual); /// @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 bottomTick The lower tick of the position for which to collect fees /// @param topTick 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 bottomTick, int24 topTick, 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 bottomTick The lower tick of the position for which to burn liquidity /// @param topTick The upper tick of the position for which to burn liquidity /// @param amount How much liquidity to burn /// @param data Any data that should be passed through to the plugin /// @return amount0 The amount of token0 sent to the recipient /// @return amount1 The amount of token1 sent to the recipient function burn(int24 bottomTick, int24 topTick, uint128 amount, bytes calldata data) 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 IAlgebraSwapCallback#algebraSwapCallback /// @param recipient The address to receive the output of the swap /// @param zeroToOne The direction of the swap, true for token0 to token1, false for token1 to token0 /// @param amountRequired The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative) /// @param limitSqrtPrice 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. If using the Router it should contain SwapRouter#SwapCallbackData /// @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 zeroToOne, int256 amountRequired, uint160 limitSqrtPrice, bytes calldata data ) external returns (int256 amount0, int256 amount1); /// @notice Swap token0 for token1, or token1 for token0 with prepayment /// @dev The caller of this method receives a callback in the form of IAlgebraSwapCallback#algebraSwapCallback /// caller must send tokens in callback before swap calculation /// the actually sent amount of tokens is used for further calculations /// @param leftoversRecipient The address which will receive potential surplus of paid tokens /// @param recipient The address to receive the output of the swap /// @param zeroToOne The direction of the swap, true for token0 to token1, false for token1 to token0 /// @param amountToSell The amount of the swap, only positive (exact input) amount allowed /// @param limitSqrtPrice 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. If using the Router it should contain SwapRouter#SwapCallbackData /// @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 swapWithPaymentInAdvance( address leftoversRecipient, address recipient, bool zeroToOne, int256 amountToSell, uint160 limitSqrtPrice, 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 IAlgebraFlashCallback#algebraFlashCallback /// @dev All excess tokens paid in the callback are distributed to currently in-range liquidity providers as an additional fee. /// If there are no in-range liquidity providers, the fee will be transferred to the first active provider in the future /// @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; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.4; /// @title Errors emitted by a pool /// @notice Contains custom errors emitted by the pool /// @dev Custom errors are separated from the common pool interface for compatibility with older versions of Solidity interface IAlgebraPoolErrors { // #### pool errors #### /// @notice Emitted by the reentrancy guard error locked(); /// @notice Emitted if arithmetic error occurred error arithmeticError(); /// @notice Emitted if an attempt is made to initialize the pool twice error alreadyInitialized(); /// @notice Emitted if an attempt is made to mint or swap in uninitialized pool error notInitialized(); /// @notice Emitted if 0 is passed as amountRequired to swap function error zeroAmountRequired(); /// @notice Emitted if invalid amount is passed as amountRequired to swap function error invalidAmountRequired(); /// @notice Emitted if the pool received fewer tokens than it should have error insufficientInputAmount(); /// @notice Emitted if there was an attempt to mint zero liquidity error zeroLiquidityDesired(); /// @notice Emitted if actual amount of liquidity is zero (due to insufficient amount of tokens received) error zeroLiquidityActual(); /// @notice Emitted if the pool received fewer tokens0 after flash than it should have error flashInsufficientPaid0(); /// @notice Emitted if the pool received fewer tokens1 after flash than it should have error flashInsufficientPaid1(); /// @notice Emitted if limitSqrtPrice param is incorrect error invalidLimitSqrtPrice(); /// @notice Tick must be divisible by tickspacing error tickIsNotSpaced(); /// @notice Emitted if a method is called that is accessible only to the factory owner or dedicated role error notAllowed(); /// @notice Emitted if new tick spacing exceeds max allowed value error invalidNewTickSpacing(); /// @notice Emitted if new community fee exceeds max allowed value error invalidNewCommunityFee(); /// @notice Emitted if an attempt is made to manually change the fee value, but dynamic fee is enabled error dynamicFeeActive(); /// @notice Emitted if an attempt is made by plugin to change the fee value, but dynamic fee is disabled error dynamicFeeDisabled(); /// @notice Emitted if an attempt is made to change the plugin configuration, but the plugin is not connected error pluginIsNotConnected(); /// @notice Emitted if a plugin returns invalid selector after hook call /// @param expectedSelector The expected selector error invalidHookResponse(bytes4 expectedSelector); // #### LiquidityMath errors #### /// @notice Emitted if liquidity underflows error liquiditySub(); /// @notice Emitted if liquidity overflows error liquidityAdd(); // #### TickManagement errors #### /// @notice Emitted if the topTick param not greater then the bottomTick param error topTickLowerOrEqBottomTick(); /// @notice Emitted if the bottomTick param is lower than min allowed value error bottomTickLowerThanMIN(); /// @notice Emitted if the topTick param is greater than max allowed value error topTickAboveMAX(); /// @notice Emitted if the liquidity value associated with the tick exceeds MAX_LIQUIDITY_PER_TICK error liquidityOverflow(); /// @notice Emitted if an attempt is made to interact with an uninitialized tick error tickIsNotInitialized(); /// @notice Emitted if there is an attempt to insert a new tick into the list of ticks with incorrect indexes of the previous and next ticks error tickInvalidLinks(); // #### SafeTransfer errors #### /// @notice Emitted if token transfer failed internally error transferFailed(); // #### TickMath errors #### /// @notice Emitted if tick is greater than the maximum or less than the minimum allowed value error tickOutOfRange(); /// @notice Emitted if price is greater than the maximum or less than the minimum allowed value error priceOutOfRange(); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Events emitted by a pool /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces interface IAlgebraPoolEvents { /// @notice Emitted exactly once by a pool when #initialize is first called on the pool /// @dev Mint/Burn/Swaps cannot be emitted by the pool before Initialize /// @param price 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 price, 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 bottomTick The lower tick of the position /// @param topTick The upper tick of the position /// @param liquidityAmount 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 bottomTick, int24 indexed topTick, uint128 liquidityAmount, uint256 amount0, uint256 amount1 ); /// @notice Emitted when fees are collected by the owner of a position /// @param owner The owner of the position for which fees are collected /// @param recipient The address that received fees /// @param bottomTick The lower tick of the position /// @param topTick 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 bottomTick, int24 indexed topTick, 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 bottomTick The lower tick of the position /// @param topTick The upper tick of the position /// @param liquidityAmount 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 bottomTick, int24 indexed topTick, uint128 liquidityAmount, 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 price 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 price, 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 when the community fee is changed by the pool /// @param communityFeeNew The updated value of the community fee in thousandths (1e-3) event CommunityFee(uint16 communityFeeNew); /// @notice Emitted when the tick spacing changes /// @param newTickSpacing The updated value of the new tick spacing event TickSpacing(int24 newTickSpacing); /// @notice Emitted when the plugin address changes /// @param newPluginAddress New plugin address event Plugin(address newPluginAddress); /// @notice Emitted when the plugin config changes /// @param newPluginConfig New plugin config event PluginConfig(uint8 newPluginConfig); /// @notice Emitted when the fee changes inside the pool /// @param fee The current fee in hundredths of a bip, i.e. 1e-6 event Fee(uint16 fee); event CommunityVault(address newCommunityVault); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that never changes /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces interface IAlgebraPoolImmutables { /// @notice The Algebra factory contract, which must adhere to the IAlgebraFactory 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 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 permissioned addresses /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces interface IAlgebraPoolPermissionedActions { /// @notice Set the community's % share of the fees. Only factory owner or POOLS_ADMINISTRATOR_ROLE role /// @param newCommunityFee The new community fee percent in thousandths (1e-3) function setCommunityFee(uint16 newCommunityFee) external; /// @notice Set the new tick spacing values. Only factory owner or POOLS_ADMINISTRATOR_ROLE role /// @param newTickSpacing The new tick spacing value function setTickSpacing(int24 newTickSpacing) external; /// @notice Set the new plugin address. Only factory owner or POOLS_ADMINISTRATOR_ROLE role /// @param newPluginAddress The new plugin address function setPlugin(address newPluginAddress) external; /// @notice Set new plugin config. Only factory owner or POOLS_ADMINISTRATOR_ROLE role /// @param newConfig In the new configuration of the plugin, /// each bit of which is responsible for a particular hook. function setPluginConfig(uint8 newConfig) external; /// @notice Set new community fee vault address. Only factory owner or POOLS_ADMINISTRATOR_ROLE role /// @dev Community fee vault receives collected community fees. /// **accumulated but not yet sent to the vault community fees once will be sent to the `newCommunityVault` address** /// @param newCommunityVault The address of new community fee vault function setCommunityVault(address newCommunityVault) external; /// @notice Set new pool fee. Can be called by owner if dynamic fee is disabled. /// Called by the plugin if dynamic fee is enabled /// @param newFee The new fee value function setFee(uint16 newFee) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that can change /// @dev Important security note: when using this data by external contracts, it is necessary to take into account the possibility /// of manipulation (including read-only reentrancy). /// This interface is based on the UniswapV3 interface, credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces interface IAlgebraPoolState { /// @notice Safely get most important state values of Algebra Integral AMM /// @dev Several values exposed as a single method to save gas when accessed externally. /// **Important security note: this method checks reentrancy lock and should be preferred in most cases**. /// @return sqrtPrice The current price of the pool as a sqrt(dToken1/dToken0) Q64.96 value /// @return tick The current global tick of the pool. May not always be equal to SqrtTickMath.getTickAtSqrtRatio(price) if the price is on a tick boundary /// @return lastFee The current (last known) pool fee value in hundredths of a bip, i.e. 1e-6 (so '100' is '0.01%'). May be obsolete if using dynamic fee plugin /// @return pluginConfig The current plugin config as bitmap. Each bit is responsible for enabling/disabling the hooks, the last bit turns on/off dynamic fees logic /// @return activeLiquidity The currently in-range liquidity available to the pool /// @return nextTick The next initialized tick after current global tick /// @return previousTick The previous initialized tick before (or at) current global tick function safelyGetStateOfAMM() external view returns (uint160 sqrtPrice, int24 tick, uint16 lastFee, uint8 pluginConfig, uint128 activeLiquidity, int24 nextTick, int24 previousTick); /// @notice Allows to easily get current reentrancy lock status /// @dev can be used to prevent read-only reentrancy. /// This method just returns `globalState.unlocked` value /// @return unlocked Reentrancy lock flag, true if the pool currently is unlocked, otherwise - false function isUnlocked() external view returns (bool unlocked); // ! IMPORTANT security note: the pool state can be manipulated. // ! The following methods do not check reentrancy lock themselves. /// @notice The globalState structure in the pool stores many values but requires only one slot /// and is exposed as a single method to save gas when accessed externally. /// @dev **important security note: caller should check `unlocked` flag to prevent read-only reentrancy** /// @return price The current price of the pool as a sqrt(dToken1/dToken0) 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(price) if the price is on a tick boundary /// @return lastFee The current (last known) pool fee value in hundredths of a bip, i.e. 1e-6 (so '100' is '0.01%'). May be obsolete if using dynamic fee plugin /// @return pluginConfig The current plugin config as bitmap. Each bit is responsible for enabling/disabling the hooks, the last bit turns on/off dynamic fees logic /// @return communityFee The community fee represented as a percent of all collected fee in thousandths, i.e. 1e-3 (so 100 is 10%) /// @return unlocked Reentrancy lock flag, true if the pool currently is unlocked, otherwise - false function globalState() external view returns (uint160 price, int24 tick, uint16 lastFee, uint8 pluginConfig, uint16 communityFee, bool unlocked); /// @notice Look up information about a specific tick in the pool /// @dev **important security note: caller should check reentrancy lock to prevent read-only reentrancy** /// @param tick The tick to look up /// @return liquidityTotal The total amount of position liquidity that uses the pool either as tick lower or tick upper /// @return liquidityDelta How much liquidity changes when the pool price crosses the tick /// @return prevTick The previous tick in tick list /// @return nextTick The next tick in tick list /// @return outerFeeGrowth0Token The fee growth on the other side of the tick from the current tick in token0 /// @return outerFeeGrowth1Token The fee growth on the other side of the tick from the current tick in token1 /// 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 ( uint256 liquidityTotal, int128 liquidityDelta, int24 prevTick, int24 nextTick, uint256 outerFeeGrowth0Token, uint256 outerFeeGrowth1Token ); /// @notice The timestamp of the last sending of tokens to community vault /// @return The timestamp truncated to 32 bits function communityFeeLastTimestamp() external view returns (uint32); /// @notice The amounts of token0 and token1 that will be sent to the vault /// @dev Will be sent COMMUNITY_FEE_TRANSFER_FREQUENCY after communityFeeLastTimestamp /// @return communityFeePending0 The amount of token0 that will be sent to the vault /// @return communityFeePending1 The amount of token1 that will be sent to the vault function getCommunityFeePending() external view returns (uint128 communityFeePending0, uint128 communityFeePending1); /// @notice Returns the address of currently used plugin /// @dev The plugin is subject to change /// @return pluginAddress The address of currently used plugin function plugin() external view returns (address pluginAddress); /// @notice The contract to which community fees are transferred /// @return communityVaultAddress The communityVault address function communityVault() external view returns (address communityVaultAddress); /// @notice Returns 256 packed tick initialized boolean values. See TickTree for more information /// @param wordPosition Index of 256-bits word with ticks /// @return The 256-bits word with packed ticks info function tickTable(int16 wordPosition) external view returns (uint256); /// @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 /// @return The fee growth accumulator for token0 function totalFeeGrowth0Token() 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 /// @return The fee growth accumulator for token1 function totalFeeGrowth1Token() external view returns (uint256); /// @notice The current pool fee value /// @dev In case dynamic fee is enabled in the pool, this method will call the plugin to get the current fee. /// If the plugin implements complex fee logic, this method may return an incorrect value or revert. /// In this case, see the plugin implementation and related documentation. /// @dev **important security note: caller should check reentrancy lock to prevent read-only reentrancy** /// @return currentFee The current pool fee value in hundredths of a bip, i.e. 1e-6 function fee() external view returns (uint16 currentFee); /// @notice The tracked token0 and token1 reserves of pool /// @dev If at any time the real balance is larger, the excess will be transferred to liquidity providers as additional fee. /// If the balance exceeds uint128, the excess will be sent to the communityVault. /// @return reserve0 The last known reserve of token0 /// @return reserve1 The last known reserve of token1 function getReserves() external view returns (uint128 reserve0, uint128 reserve1); /// @notice Returns the information about a position by the position's key /// @dev **important security note: caller should check reentrancy lock to prevent read-only reentrancy** /// @param key The position's key is a packed concatenation of the owner address, bottomTick and topTick indexes /// @return liquidity The amount of liquidity in the position /// @return innerFeeGrowth0Token Fee growth of token0 inside the tick range as of the last mint/burn/poke /// @return innerFeeGrowth1Token Fee growth of token1 inside the tick range as of the last mint/burn/poke /// @return fees0 The computed amount of token0 owed to the position as of the last mint/burn/poke /// @return fees1 The computed amount of token1 owed to the position as of the last mint/burn/poke function positions( bytes32 key ) external view returns (uint256 liquidity, uint256 innerFeeGrowth0Token, uint256 innerFeeGrowth1Token, uint128 fees0, uint128 fees1); /// @notice The currently in range liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks. /// Returned value cannot exceed type(uint128).max /// @dev **important security note: caller should check reentrancy lock to prevent read-only reentrancy** /// @return The current in range liquidity function liquidity() external view returns (uint128); /// @notice The current tick spacing /// @dev Ticks can only be initialized by new mints at multiples of this value /// e.g.: a tickSpacing of 60 means ticks can be initialized every 60th tick, i.e., ..., -120, -60, 0, 60, 120, ... /// However, tickspacing can be changed after the ticks have been initialized. /// This value is an int24 to avoid casting even though it is always positive. /// @return The current tick spacing function tickSpacing() external view returns (int24); /// @notice The previous initialized tick before (or at) current global tick /// @dev **important security note: caller should check reentrancy lock to prevent read-only reentrancy** /// @return The previous initialized tick function prevTickGlobal() external view returns (int24); /// @notice The next initialized tick after current global tick /// @dev **important security note: caller should check reentrancy lock to prevent read-only reentrancy** /// @return The next initialized tick function nextTickGlobal() external view returns (int24); /// @notice The root of tick search tree /// @dev Each bit corresponds to one node in the second layer of tick tree: '1' if node has at least one active bit. /// **important security note: caller should check reentrancy lock to prevent read-only reentrancy** /// @return The root of tick search tree as bitmap function tickTreeRoot() external view returns (uint32); /// @notice The second layer of tick search tree /// @dev Each bit in node corresponds to one node in the leafs layer (`tickTable`) of tick tree: '1' if leaf has at least one active bit. /// **important security note: caller should check reentrancy lock to prevent read-only reentrancy** /// @return The node of tick search tree second layer function tickTreeSecondLayer(int16) external view returns (uint256); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0 <0.9.0; /// @title Safe casting methods /// @notice Contains methods for safely casting between types /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-core/blob/main/contracts/libraries 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 uint256 to a uint128, revert on overflow /// @param y The uint256 to be downcasted /// @return z The downcasted integer, now type uint128 function toUint128(uint256 y) internal pure returns (uint128 z) { require((z = uint128(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 uint128 to a int128, revert on overflow /// @param y The uint128 to be downcasted /// @return z The downcasted integer, now type int128 function toInt128(uint128 y) internal pure returns (int128 z) { require((z = int128(y)) >= 0); } /// @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((z = int256(y)) >= 0); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.4 <0.9.0; import '../interfaces/pool/IAlgebraPoolErrors.sol'; /// @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 /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-core/blob/main/contracts/libraries library TickMath { /// @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 Calculates sqrt(1.0001^tick) * 2^96 /// @dev Throws if |tick| > max tick /// @param tick The input tick for the above formula /// @return price A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) /// at the given tick function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 price) { unchecked { // get abs value int24 absTickMask = tick >> (24 - 1); uint256 absTick = uint24((tick + absTickMask) ^ absTickMask); if (absTick > uint24(MAX_TICK)) revert IAlgebraPoolErrors.tickOutOfRange(); uint256 ratio = 0x100000000000000000000000000000000; if (absTick & 0x1 != 0) ratio = 0xfffcb933bd6fad37aa2d162d1a594001; 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) { if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128; if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128; } if (tick > 0) { assembly { ratio := div(not(0), 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 price = uint160((ratio + 0xFFFFFFFF) >> 32); } } /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio /// @dev Throws in case price < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may /// ever return. /// @param price 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 price) internal pure returns (int24 tick) { unchecked { // second inequality must be >= because the price can never reach the price at the max tick if (price < MIN_SQRT_RATIO || price >= MAX_SQRT_RATIO) revert IAlgebraPoolErrors.priceOutOfRange(); uint256 ratio = uint256(price) << 32; uint256 r = ratio; uint256 msb; 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) <= price ? tickHi : tickLow; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; // EIP-2612 is Final as of 2022-11-01. This file is deprecated. import "./IERC20Permit.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// 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: GPL-2.0-or-later pragma solidity =0.8.20; /// @title Function for getting block timestamp /// @dev Base contract that is overridden for tests abstract contract BlockTimestamp { /// @dev Method that exists purely to be overridden for tests /// @return The current block timestamp function _blockTimestamp() internal view virtual returns (uint256) { return block.timestamp; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity =0.8.20; import '../interfaces/IMulticall.sol'; /// @title Multicall /// @notice Enables calling multiple methods in a single call to the contract abstract contract Multicall is IMulticall { /// @inheritdoc IMulticall function multicall(bytes[] calldata data) external payable override returns (bytes[] memory results) { results = new bytes[](data.length); unchecked { for (uint256 i = 0; i < data.length; i++) { (bool success, bytes memory result) = address(this).delegatecall(data[i]); if (!success) { // Look for revert reason and bubble it up if present require(result.length > 0); // The easiest way to bubble the revert reason is using memory via assembly assembly ('memory-safe') { revert(add(32, result), mload(result)) } } results[i] = result; } } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity =0.8.20; import '../interfaces/IPeripheryImmutableState.sol'; /// @title Immutable state /// @notice Immutable state used by periphery contracts /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery abstract contract PeripheryImmutableState is IPeripheryImmutableState { /// @inheritdoc IPeripheryImmutableState address public immutable override factory; /// @inheritdoc IPeripheryImmutableState address public immutable override poolDeployer; /// @inheritdoc IPeripheryImmutableState address public immutable override WNativeToken; constructor(address _factory, address _WNativeToken, address _poolDeployer) { factory = _factory; poolDeployer = _poolDeployer; WNativeToken = _WNativeToken; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '../interfaces/IPeripheryPayments.sol'; import '../interfaces/external/IWNativeToken.sol'; import '../libraries/TransferHelper.sol'; import './PeripheryImmutableState.sol'; /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery abstract contract PeripheryPayments is IPeripheryPayments, PeripheryImmutableState { receive() external payable { require(msg.sender == WNativeToken, 'Not WNativeToken'); } function _balanceOfToken(address token) private view returns (uint256) { return (IERC20(token).balanceOf(address(this))); } /// @inheritdoc IPeripheryPayments function unwrapWNativeToken(uint256 amountMinimum, address recipient) external payable override { uint256 balanceWNativeToken = _balanceOfToken(WNativeToken); require(balanceWNativeToken >= amountMinimum, 'Insufficient WNativeToken'); if (balanceWNativeToken > 0) { IWNativeToken(WNativeToken).withdraw(balanceWNativeToken); TransferHelper.safeTransferNative(recipient, balanceWNativeToken); } } /// @inheritdoc IPeripheryPayments function sweepToken(address token, uint256 amountMinimum, address recipient) external payable override { uint256 balanceToken = _balanceOfToken(token); require(balanceToken >= amountMinimum, 'Insufficient token'); if (balanceToken > 0) { TransferHelper.safeTransfer(token, recipient, balanceToken); } } /// @inheritdoc IPeripheryPayments function refundNativeToken() external payable override { if (address(this).balance > 0) TransferHelper.safeTransferNative(msg.sender, address(this).balance); } /// @param token The token to pay /// @param payer The entity that must pay /// @param recipient The entity that will receive payment /// @param value The amount to pay function pay(address token, address payer, address recipient, uint256 value) internal { if (token == WNativeToken && address(this).balance >= value) { // pay with WNativeToken // "address(this).balance >= value" may unexpectedly become false (including due to frontrun) // so this function should be accompanied by a `refundNativeToken` in multicall to avoid potential loss of tokens IWNativeToken(WNativeToken).deposit{value: value}(); // wrap only what is needed to pay IWNativeToken(WNativeToken).transfer(recipient, value); } else if (payer == address(this)) { // pay with tokens already in the contract (for the exact input multihop case) TransferHelper.safeTransfer(token, recipient, value); } else { // pull payment TransferHelper.safeTransferFrom(token, payer, recipient, value); } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import './PeripheryPayments.sol'; import '../interfaces/IPeripheryPaymentsWithFee.sol'; import '../interfaces/external/IWNativeToken.sol'; import '../libraries/TransferHelper.sol'; /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery abstract contract PeripheryPaymentsWithFee is PeripheryPayments, IPeripheryPaymentsWithFee { /// @inheritdoc IPeripheryPaymentsWithFee function unwrapWNativeTokenWithFee( uint256 amountMinimum, address recipient, uint256 feeBips, address feeRecipient ) public payable override { require(feeBips > 0 && feeBips <= 100); uint256 balanceWNativeToken = IWNativeToken(WNativeToken).balanceOf(address(this)); require(balanceWNativeToken >= amountMinimum, 'Insufficient WNativeToken'); if (balanceWNativeToken > 0) { IWNativeToken(WNativeToken).withdraw(balanceWNativeToken); uint256 feeAmount = (balanceWNativeToken * feeBips) / 10_000; if (feeAmount > 0) TransferHelper.safeTransferNative(feeRecipient, feeAmount); TransferHelper.safeTransferNative(recipient, balanceWNativeToken - feeAmount); } } /// @inheritdoc IPeripheryPaymentsWithFee function sweepTokenWithFee( address token, uint256 amountMinimum, address recipient, uint256 feeBips, address feeRecipient ) public payable override { require(feeBips > 0 && feeBips <= 100); uint256 balanceToken = IERC20(token).balanceOf(address(this)); require(balanceToken >= amountMinimum, 'Insufficient token'); if (balanceToken > 0) { uint256 feeAmount = (balanceToken * feeBips) / 10_000; if (feeAmount > 0) TransferHelper.safeTransfer(token, feeRecipient, feeAmount); TransferHelper.safeTransfer(token, recipient, balanceToken - feeAmount); } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity =0.8.20; import './BlockTimestamp.sol'; /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery abstract contract PeripheryValidation is BlockTimestamp { modifier checkDeadline(uint256 deadline) { _checkDeadline(deadline); _; } function _checkDeadline(uint256 deadline) private view { require(_blockTimestamp() <= deadline, 'Transaction too old'); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol'; import '../interfaces/ISelfPermit.sol'; import '../interfaces/external/IERC20PermitAllowed.sol'; /// @title Self Permit /// @notice Functionality to call permit on any EIP-2612-compliant token for use in the route /// @dev These functions are expected to be embedded in multicalls to allow EOAs to approve a contract and call a function /// that requires an approval in a single transaction. abstract contract SelfPermit is ISelfPermit { /// @inheritdoc ISelfPermit function selfPermit( address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public payable override { IERC20Permit(token).permit(msg.sender, address(this), value, deadline, v, r, s); } /// @inheritdoc ISelfPermit function selfPermitIfNecessary( address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external payable override { if (_getAllowance(token) < value) selfPermit(token, value, deadline, v, r, s); } /// @inheritdoc ISelfPermit function selfPermitAllowed( address token, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) public payable override { IERC20PermitAllowed(token).permit(msg.sender, address(this), nonce, expiry, true, v, r, s); } /// @inheritdoc ISelfPermit function selfPermitAllowedIfNecessary( address token, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external payable override { if (_getAllowance(token) < type(uint256).max) selfPermitAllowed(token, nonce, expiry, v, r, s); } function _getAllowance(address token) private view returns (uint256) { return IERC20(token).allowance(msg.sender, address(this)); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import './interfaces/IBlast.sol'; import './interfaces/IERC20Rebasing.sol'; import './interfaces/IBlastPoints.sol'; contract Blast { address collector = 0x65432138ae74065Aeb3Bd71aEaC887CCAE0E32a4; // Blast Native Contracts IBlast public constant BLAST = IBlast(0x4300000000000000000000000000000000000002); IERC20Rebasing public constant USDBBLAST = IERC20Rebasing(0x4300000000000000000000000000000000000003); IERC20Rebasing public constant WETHBLAST = IERC20Rebasing(0x4300000000000000000000000000000000000004); constructor() { BLAST.configureClaimableYield(); // Configuring the yield for ETH deposits of this contract (if any) to be claimable BLAST.configureClaimableGas(); // Configuring the Gas Revenue collected by this contract to be claimable BLAST.configureGovernor(collector); // Setting Governor to manage the ETH yield and Gas Revenue. Initially set to the deployer WETHBLAST.configure(IERC20Rebasing.YieldMode.CLAIMABLE); // Configuring the yield for WETH deposits of this contract (if any) to be claimable USDBBLAST.configure(IERC20Rebasing.YieldMode.CLAIMABLE); // Configuring the yield for USDB deposits of this contract (if any) to be claimable IBlastPoints(0x2536FE9ab3F511540F2f9e2eC2A805005C3Dd800).configurePointsOperator(0x4617176b7c159CC87B0f9F422720979ADd1A5538); // Configure Blast Points } /***********************************************/ /****************** MODIFIERS ******************/ /***********************************************/ /** * @dev Check if caller is the collector */ modifier onlyCollector() { require(collector == msg.sender, 'Blast: caller is not the collector'); _; } /*******************************************************/ /****************** COLLECTOR FUNCTIONS ****************/ /*******************************************************/ /** * @dev Calls claim function of WETH and USDB deposits (if any) for this contract to transfer the yield to the recipient * * Must only be called by the collector */ function claimWethAndUsdbYield(address recipient) public onlyCollector { WETHBLAST.claim(recipient, WETHBLAST.getClaimableAmount(address(this))); USDBBLAST.claim(recipient, USDBBLAST.getClaimableAmount(address(this))); } function setCollector(address newCollector) public onlyCollector { collector = newCollector; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; // Blast Contract Interface interface IBlast { function configureClaimableYield() external; function configureClaimableGas() external; function configureGovernor(address _governor) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface IBlastPoints { function configurePointsOperator(address operator) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface IERC20Rebasing { enum YieldMode { AUTOMATIC, VOID, CLAIMABLE } // changes the yield mode of the caller and update the balance // to reflect the configuration function configure(YieldMode) external returns (uint256); // "claimable" yield mode accounts can call this this claim their yield // to another address function claim(address recipient, uint256 amount) external returns (uint256); // read the claimable amount for an account function getClaimableAmount(address account) external view returns (uint256); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Interface for permit /// @notice Interface used by DAI/CHAI for permit interface IERC20PermitAllowed { /// @notice Approve the spender to spend some tokens via the holder signature /// @dev This is the permit interface used by DAI and CHAI /// @param holder The address of the token holder, the token owner /// @param spender The address of the token spender /// @param nonce The holder's nonce, increases at each call to permit /// @param expiry The timestamp at which the permit is no longer valid /// @param allowed Boolean that sets approval amount, true for type(uint256).max and false for 0 /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` function permit( address holder, address spender, uint256 nonce, uint256 expiry, bool allowed, uint8 v, bytes32 r, bytes32 s ) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; /// @title Interface for WNativeToken interface IWNativeToken is IERC20 { /// @notice Deposit ether to get wrapped ether function deposit() external payable; /// @notice Withdraw wrapped ether to get ether function withdraw(uint256) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; /// @title Multicall interface /// @notice Enables calling multiple methods in a single call to the contract interface IMulticall { /// @notice Call multiple functions in the current contract and return the data from all of them if they all succeed /// @dev The `msg.value` should not be trusted for any method callable from multicall. /// @param data The encoded function data for each of the calls to make to this contract /// @return results The results from each of the calls passed in via data function multicall(bytes[] calldata data) external payable returns (bytes[] memory results); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Immutable state /// @notice Functions that return immutable state of the router /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery interface IPeripheryImmutableState { /// @return Returns the address of the Algebra factory function factory() external view returns (address); /// @return Returns the address of the pool Deployer function poolDeployer() external view returns (address); /// @return Returns the address of WNativeToken function WNativeToken() external view returns (address); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; /// @title Periphery Payments /// @notice Functions to ease deposits and withdrawals of NativeToken /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery interface IPeripheryPayments { /// @notice Unwraps the contract's WNativeToken balance and sends it to recipient as NativeToken. /// @dev The amountMinimum parameter prevents malicious contracts from stealing WNativeToken from users. /// @param amountMinimum The minimum amount of WNativeToken to unwrap /// @param recipient The address receiving NativeToken function unwrapWNativeToken(uint256 amountMinimum, address recipient) external payable; /// @notice Refunds any NativeToken balance held by this contract to the `msg.sender` /// @dev Useful for bundling with mint or increase liquidity that uses ether, or exact output swaps /// that use ether for the input amount function refundNativeToken() external payable; /// @notice Transfers the full amount of a token held by this contract to recipient /// @dev The amountMinimum parameter prevents malicious contracts from stealing the token from users /// @param token The contract address of the token which will be transferred to `recipient` /// @param amountMinimum The minimum amount of token required for a transfer /// @param recipient The destination address of the token function sweepToken( address token, uint256 amountMinimum, address recipient ) external payable; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; import './IPeripheryPayments.sol'; /// @title Periphery Payments /// @notice Functions to ease deposits and withdrawals of NativeToken /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery interface IPeripheryPaymentsWithFee is IPeripheryPayments { /// @notice Unwraps the contract's WNativeToken balance and sends it to recipient as NativeToken, with a percentage between /// 0 (exclusive), and 1 (inclusive) going to feeRecipient /// @dev The amountMinimum parameter prevents malicious contracts from stealing WNativeToken from users. function unwrapWNativeTokenWithFee( uint256 amountMinimum, address recipient, uint256 feeBips, address feeRecipient ) external payable; /// @notice Transfers the full amount of a token held by this contract to recipient, with a percentage between /// 0 (exclusive) and 1 (inclusive) going to feeRecipient /// @dev The amountMinimum parameter prevents malicious contracts from stealing the token from users function sweepTokenWithFee( address token, uint256 amountMinimum, address recipient, uint256 feeBips, address feeRecipient ) external payable; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; /// @title Self Permit /// @notice Functionality to call permit on any EIP-2612-compliant token for use in the route interface ISelfPermit { /// @notice Permits this contract to spend a given token from `msg.sender` /// @dev The `owner` is always msg.sender and the `spender` is always address(this). /// @param token The address of the token spent /// @param value The amount that can be spent of token /// @param deadline A timestamp, the current blocktime must be less than or equal to this timestamp /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` function selfPermit( address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external payable; /// @notice Permits this contract to spend a given token from `msg.sender` /// @dev The `owner` is always msg.sender and the `spender` is always address(this). /// Can be used instead of #selfPermit to prevent calls from failing due to a frontrun of a call to #selfPermit /// @param token The address of the token spent /// @param value The amount that can be spent of token /// @param deadline A timestamp, the current blocktime must be less than or equal to this timestamp /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` function selfPermitIfNecessary( address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external payable; /// @notice Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter /// @dev The `owner` is always msg.sender and the `spender` is always address(this) /// @param token The address of the token spent /// @param nonce The current nonce of the owner /// @param expiry The timestamp at which the permit is no longer valid /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` function selfPermitAllowed( address token, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external payable; /// @notice Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter /// @dev The `owner` is always msg.sender and the `spender` is always address(this) /// Can be used instead of #selfPermitAllowed to prevent calls from failing due to a frontrun of a call to #selfPermitAllowed. /// @param token The address of the token spent /// @param nonce The current nonce of the owner /// @param expiry The timestamp at which the permit is no longer valid /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` function selfPermitAllowedIfNecessary( address token, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external payable; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; import '@cryptoalgebra/integral-core/contracts/interfaces/callback/IAlgebraSwapCallback.sol'; /// @title Router token swapping functionality /// @notice Functions for swapping tokens via Algebra /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery interface ISwapRouter is IAlgebraSwapCallback { struct ExactInputSingleParams { address tokenIn; address tokenOut; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 limitSqrtPrice; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; } /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata /// @return amountOut The amount of the received token function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); struct ExactOutputSingleParams { address tokenIn; address tokenOut; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; uint160 limitSqrtPrice; } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @dev If native token is used as input, this function should be accompanied by a `refundNativeToken` in multicall to avoid potential loss of native tokens /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); struct ExactOutputParams { bytes path; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; } /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// @dev If native token is used as input, this function should be accompanied by a `refundNativeToken` in multicall to avoid potential loss of native tokens /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @dev Unlike standard swaps, handles transferring from user before the actual swap. /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingleSupportingFeeOnTransferTokens( ExactInputSingleParams calldata params ) external payable returns (uint256 amountOut); }
// SPDX-License-Identifier: GPL-2.0-or-later /** * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity >=0.8.0 <0.9.0; library BytesLib { function slice(bytes memory _bytes, uint256 _start, uint256 _length) internal pure returns (bytes memory) { unchecked { require(_length + 31 >= _length, 'slice_overflow'); require(_bytes.length >= _start + _length, 'slice_outOfBounds'); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { unchecked { require(_bytes.length >= _start + 20, 'toAddress_outOfBounds'); } address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) { unchecked { require(_start + 3 >= _start, 'toUint24_overflow'); require(_bytes.length >= _start + 3, 'toUint24_outOfBounds'); } uint24 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x3), _start)) } return tempUint; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import '@cryptoalgebra/integral-core/contracts/interfaces/IAlgebraPool.sol'; import './PoolAddress.sol'; /// @notice Provides validation for callbacks from Algebra Pools /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery library CallbackValidation { /// @notice Returns the address of a valid Algebra Pool /// @param poolDeployer The contract address of the Algebra pool deployer /// @param tokenA The contract address of either token0 or token1 /// @param tokenB The contract address of the other token /// @return pool The Algebra pool contract address function verifyCallback( address poolDeployer, address tokenA, address tokenB ) internal view returns (IAlgebraPool pool) { return verifyCallback(poolDeployer, PoolAddress.getPoolKey(tokenA, tokenB)); } /// @notice Returns the address of a valid Algebra Pool /// @param poolDeployer The contract address of the Algebra pool deployer /// @param poolKey The identifying key of the ALgebra pool /// @return pool The Algebra pool contract address function verifyCallback( address poolDeployer, PoolAddress.PoolKey memory poolKey ) internal view returns (IAlgebraPool pool) { pool = IAlgebraPool(PoolAddress.computeAddress(poolDeployer, poolKey)); require(msg.sender == address(pool), 'Invalid caller of callback'); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.6.0; import './BytesLib.sol'; /// @title Functions for manipulating path data for multihop swaps /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery library Path { using BytesLib for bytes; /// @dev The length of the bytes encoded address uint256 private constant ADDR_SIZE = 20; /// @dev The offset of a single token address uint256 private constant NEXT_OFFSET = ADDR_SIZE; /// @dev The offset of an encoded pool key uint256 private constant POP_OFFSET = NEXT_OFFSET + ADDR_SIZE; /// @dev The minimum length of an encoding that contains 2 or more pools uint256 private constant MULTIPLE_POOLS_MIN_LENGTH = POP_OFFSET + NEXT_OFFSET; /// @notice Returns true if the path contains two or more pools /// @param path The encoded swap path /// @return True if path contains two or more pools, otherwise false function hasMultiplePools(bytes memory path) internal pure returns (bool) { return path.length >= MULTIPLE_POOLS_MIN_LENGTH; } /// @notice Returns the number of pools in the path /// @param path The encoded swap path /// @return The number of pools in the path function numPools(bytes memory path) internal pure returns (uint256) { // Ignore the first token address. From then on every token offset indicates a pool. return ((path.length - ADDR_SIZE) / NEXT_OFFSET); } /// @notice Decodes the first pool in path /// @param path The bytes encoded swap path /// @return tokenA The first token of the given pool /// @return tokenB The second token of the given pool function decodeFirstPool(bytes memory path) internal pure returns (address tokenA, address tokenB) { tokenA = path.toAddress(0); tokenB = path.toAddress(NEXT_OFFSET); } /// @notice Gets the segment corresponding to the first pool in the path /// @param path The bytes encoded swap path /// @return The segment containing all data necessary to target the first pool in the path function getFirstPool(bytes memory path) internal pure returns (bytes memory) { return path.slice(0, POP_OFFSET); } /// @notice Skips a token element from the buffer and returns the remainder /// @param path The swap path /// @return The remaining token elements in the path function skipToken(bytes memory path) internal pure returns (bytes memory) { return path.slice(NEXT_OFFSET, path.length - NEXT_OFFSET); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Provides functions for deriving a pool address from the poolDeployer and tokens /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery library PoolAddress { bytes32 internal constant POOL_INIT_CODE_HASH = 0xa9df2657ce5872e94bdc9525588fd983b0aa5db2f3c7a83d7e6b6a99cd2003a1; /// @notice The identifying key of the pool struct PoolKey { address token0; address token1; } /// @notice Returns PoolKey: the ordered tokens /// @param tokenA The first token of a pool, unsorted /// @param tokenB The second token of a pool, unsorted /// @return Poolkey The pool details with ordered token0 and token1 assignments function getPoolKey(address tokenA, address tokenB) internal pure returns (PoolKey memory) { if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA); return PoolKey({token0: tokenA, token1: tokenB}); } /// @notice Deterministically computes the pool address given the poolDeployer and PoolKey /// @param poolDeployer The Algebra poolDeployer contract address /// @param key The PoolKey /// @return pool The contract address of the Algebra pool function computeAddress(address poolDeployer, PoolKey memory key) internal pure returns (address pool) { require(key.token0 < key.token1, 'Invalid order of tokens'); pool = address( uint160( uint256( keccak256( abi.encodePacked( hex'ff', poolDeployer, keccak256(abi.encode(key.token0, key.token1)), POOL_INIT_CODE_HASH ) ) ) ) ); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.6.0; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery library TransferHelper { /// @notice Transfers tokens from the targeted address to the given destination /// @notice Errors with 'STF' if transfer fails /// @param token The contract address of the token to be transferred /// @param from The originating address from which the tokens will be transferred /// @param to The destination address of the transfer /// @param value The amount to be transferred function safeTransferFrom( address token, address from, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call( abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value) ); require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF'); } /// @notice Transfers tokens from msg.sender to a recipient /// @dev Errors with ST if transfer fails /// @param token The contract address of the token which will be transferred /// @param to The recipient of the transfer /// @param value The value of the transfer function safeTransfer( address token, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST'); } /// @notice Approves the stipulated contract to spend the given allowance in the given token /// @dev Errors with 'SA' if transfer fails /// @param token The contract address of the token to be approved /// @param to The target of the approval /// @param value The amount of the given token the target will be allowed to spend function safeApprove( address token, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA'); } /// @notice Transfers NativeToken to the recipient address /// @dev Fails with `STE` /// @param to The destination of the transfer /// @param value The value to be transferred function safeTransferNative(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'STE'); } }
{ "evmVersion": "paris", "optimizer": { "enabled": true, "runs": 1000000 }, "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":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WNativeToken","type":"address"},{"internalType":"address","name":"_poolDeployer","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BLAST","outputs":[{"internalType":"contract IBlast","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDBBLAST","outputs":[{"internalType":"contract IERC20Rebasing","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETHBLAST","outputs":[{"internalType":"contract IERC20Rebasing","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WNativeToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"algebraSwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"claimWethAndUsdbYield","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct ISwapRouter.ExactInputParams","name":"params","type":"tuple"}],"name":"exactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint160","name":"limitSqrtPrice","type":"uint160"}],"internalType":"struct ISwapRouter.ExactInputSingleParams","name":"params","type":"tuple"}],"name":"exactInputSingle","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint160","name":"limitSqrtPrice","type":"uint160"}],"internalType":"struct ISwapRouter.ExactInputSingleParams","name":"params","type":"tuple"}],"name":"exactInputSingleSupportingFeeOnTransferTokens","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"}],"internalType":"struct ISwapRouter.ExactOutputParams","name":"params","type":"tuple"}],"name":"exactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"},{"internalType":"uint160","name":"limitSqrtPrice","type":"uint160"}],"internalType":"struct ISwapRouter.ExactOutputSingleParams","name":"params","type":"tuple"}],"name":"exactOutputSingle","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"poolDeployer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"refundNativeToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowed","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowedIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newCollector","type":"address"}],"name":"setCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"sweepTokenWithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"unwrapWNativeToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"unwrapWNativeTokenWithFee","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Deployed Bytecode
0x60806040526004361061018f5760003560e01c8063b10c8fb9116100d6578063c60696ec1161007f578063f28c049811610059578063f28c0498146104c4578063f3995c67146104d7578063fb5b82d0146104ea57600080fd5b8063c60696ec1461048b578063df2ab5bb1461049e578063e0e189a0146104b157600080fd5b8063c04b8d59116100b0578063c04b8d5914610431578063c2e3140a14610444578063c45a01551461045757600080fd5b8063b10c8fb9146103e3578063b87d25241461040b578063bc6511881461041e57600080fd5b806361d4d5b31161013857806397d757761161011257806397d7577614610388578063a4a78f0c146103b0578063ac9650d8146103c357600080fd5b806361d4d5b31461032057806369bc35b2146103415780638af3ac851461035457600080fd5b8063418652701161016957806341865270146102dd5780634659a494146102e557806360cfe755146102f857600080fd5b80631557d4c81461023f5780632c8958f61461025f5780633119049a1461027f57600080fd5b3661023a573373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000043000000000000000000000000000000000000041614610238576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4e6f7420574e6174697665546f6b656e0000000000000000000000000000000060448201526064015b60405180910390fd5b005b600080fd5b34801561024b57600080fd5b5061023861025a366004612b63565b61050a565b34801561026b57600080fd5b5061023861027a366004612b80565b61080a565b34801561028b57600080fd5b506102b37f000000000000000000000000ffeecb1fe0eaaefee69d122f6b7a0368637cb59381565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6102386109b4565b6102386102f3366004612c00565b6109c6565b34801561030457600080fd5b506102b373430000000000000000000000000000000000000481565b61033361032e366004612c74565b610a81565b6040519081526020016102d4565b61023861034f366004612c90565b610bee565b34801561036057600080fd5b506102b37f000000000000000000000000430000000000000000000000000000000000000481565b34801561039457600080fd5b506102b373430000000000000000000000000000000000000281565b6102386103be366004612c00565b610d3a565b6103d66103d1366004612cc0565b610d80565b6040516102d49190612da3565b3480156103ef57600080fd5b506102b373430000000000000000000000000000000000000381565b610333610419366004612c74565b610ea1565b61033361042c366004612c74565b6111dc565b61033361043f366004612f26565b611322565b610238610452366004612c00565b611444565b34801561046357600080fd5b506102b37f000000000000000000000000a87dbf5082af26c9a6ab2b854e378f704638cca581565b610238610499366004612fca565b611462565b6102386104ac366004613014565b611686565b6102386104bf366004613056565b611714565b6103336104d23660046130b5565b61187a565b6102386104e5366004612c00565b611971565b3480156104f657600080fd5b50610238610505366004612b63565b6119ee565b60005473ffffffffffffffffffffffffffffffffffffffff1633146105b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f426c6173743a2063616c6c6572206973206e6f742074686520636f6c6c65637460448201527f6f72000000000000000000000000000000000000000000000000000000000000606482015260840161022f565b6040517fe12f3a610000000000000000000000000000000000000000000000000000000081523060048201527343000000000000000000000000000000000000049063aad3ec96908390839063e12f3a6190602401602060405180830381865afa158015610623573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064791906130f0565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af11580156106b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106db91906130f0565b506040517fe12f3a610000000000000000000000000000000000000000000000000000000081523060048201527343000000000000000000000000000000000000039063aad3ec96908390839063e12f3a6190602401602060405180830381865afa15801561074e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077291906130f0565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af11580156107e2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080691906130f0565b5050565b60008413806108195750600083135b61087f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5a65726f206c6971756964697479207377617000000000000000000000000000604482015260640161022f565b600061088d82840184613109565b905060008061089f8360000151611adc565b915091506108ce7f000000000000000000000000ffeecb1fe0eaaefee69d122f6b7a0368637cb5938383611afd565b506000806000891361090f578373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161088610940565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610895b91509150811561095f5761095a8486602001513384611b1a565b6109a9565b845161096a90611cf4565b1561098f57845161097a90611d17565b85526109898133600088611d39565b506109a9565b806001819055508293506109a98486602001513384611b1a565b505050505050505050565b47156109c4576109c43347611f62565b565b6040517f8fcbaf0c00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101869052606481018590526001608482015260ff841660a482015260c4810183905260e4810182905273ffffffffffffffffffffffffffffffffffffffff871690638fcbaf0c90610104015b600060405180830381600087803b158015610a6157600080fd5b505af1158015610a75573d6000803e3d6000fd5b50505050505050505050565b60008160600135610a9181612046565b610b546080840135610aa96060860160408701612b63565b610ab960e0870160c08801612b63565b6040518060400160405280886020016020810190610ad79190612b63565b610ae460208b018b612b63565b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606093841b811660208301529190921b16603482015260480160405160208183030381529060405281526020013373ffffffffffffffffffffffffffffffffffffffff16815250611d39565b91508260a00135821115610bc4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f546f6f206d756368207265717565737465640000000000000000000000000000604482015260640161022f565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600155919050565b6000610c197f00000000000000000000000043000000000000000000000000000000000000046120b3565b905082811015610c85576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f496e73756666696369656e7420574e6174697665546f6b656e00000000000000604482015260640161022f565b8015610d35576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000430000000000000000000000000000000000000473ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b158015610d1357600080fd5b505af1158015610d27573d6000803e3d6000fd5b50505050610d358282611f62565b505050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610d6487612145565b1015610d7857610d788686868686866109c6565b505050505050565b60608167ffffffffffffffff811115610d9b57610d9b612e23565b604051908082528060200260200182016040528015610dce57816020015b6060815260200190600190039081610db95790505b50905060005b82811015610e9a5760008030868685818110610df257610df26131a3565b9050602002810190610e0491906131d2565b604051610e1292919061323e565b600060405180830381855af49150503d8060008114610e4d576040519150601f19603f3d011682016040523d82523d6000602084013e610e52565b606091505b509150915081610e72576000815111610e6a57600080fd5b805181602001fd5b80848481518110610e8557610e856131a3565b60209081029190910101525050600101610dd4565b5092915050565b60008160600135610eb181612046565b6040805180820190915260009080610ecc6020870187612b63565b610edc6040880160208901612b63565b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606093841b811660208301529190921b16603482015260480160405160208183030381529060405281526020013373ffffffffffffffffffffffffffffffffffffffff16815250905060008073ffffffffffffffffffffffffffffffffffffffff16856040016020810190610f759190612b63565b73ffffffffffffffffffffffffffffffffffffffff1614610fa557610fa06060860160408701612b63565b610fa7565b305b90506000610fbb6040870160208801612b63565b73ffffffffffffffffffffffffffffffffffffffff16610fde6020880188612b63565b73ffffffffffffffffffffffffffffffffffffffff1610905060008061101f61100a60208a018a612b63565b61101a60408b0160208c01612b63565b6121a0565b73ffffffffffffffffffffffffffffffffffffffff16639e4e022733868661104a8d608001356121dc565b8d60c001602081019061105d9190612b63565b73ffffffffffffffffffffffffffffffffffffffff1615611090578d60c001602081019061108b9190612b63565b6110c4565b886110b45761108b600173fffd8963efd1fc6a506488495d951d5263988d2661327d565b6110c46401000276a360016132aa565b8b6040516020016110d591906132d7565b6040516020818303038152906040526040518763ffffffff1660e01b81526004016111059695949392919061331f565b60408051808303816000875af1158015611123573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611147919061337a565b91509150826111565781611158565b805b6111619061339e565b96508760a001358710156111d1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f546f6f206c6974746c6520726563656976656400000000000000000000000000604482015260640161022f565b505050505050919050565b600081606001356111ec81612046565b6112ac60808401356112046060860160408701612b63565b61121460e0870160c08801612b63565b604080518082019091528061122c60208a018a612b63565b61123c60408b0160208c01612b63565b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606093841b811660208301529190921b16603482015260480160405160208183030381529060405281526020013373ffffffffffffffffffffffffffffffffffffffff168152506121f0565b91508260a0013582101561131c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f546f6f206c6974746c6520726563656976656400000000000000000000000000604482015260640161022f565b50919050565b6000816040015161133281612046565b335b60006113438560000151611cf4565b905061139c85606001518261135c57866020015161135e565b305b600060405180604001604052806113788b6000015161237a565b81526020018773ffffffffffffffffffffffffffffffffffffffff168152506121f0565b606086015280156113bc5784513092506113b590611d17565b85526113c9565b84606001519350506113cf565b50611334565b836080015183101561143d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f546f6f206c6974746c6520726563656976656400000000000000000000000000604482015260640161022f565b5050919050565b8461144e87612145565b1015610d7857610d78868686868686611971565b600082118015611473575060648211155b61147c57600080fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000430000000000000000000000000000000000000473ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015611509573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152d91906130f0565b905084811015611599576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f496e73756666696369656e7420574e6174697665546f6b656e00000000000000604482015260640161022f565b801561167f576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000430000000000000000000000000000000000000473ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b15801561162757600080fd5b505af115801561163b573d6000803e3d6000fd5b505050506000612710848361165091906133d6565b61165a91906133ed565b9050801561166c5761166c8382611f62565b610d788561167a8385613428565b611f62565b5050505050565b6000611691846120b3565b9050828110156116fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e7420746f6b656e0000000000000000000000000000604482015260640161022f565b801561170e5761170e84838361238c565b50505050565b600082118015611725575060648211155b61172e57600080fd5b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8716906370a0823190602401602060405180830381865afa15801561179b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117bf91906130f0565b90508481101561182b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e7420746f6b656e0000000000000000000000000000604482015260640161022f565b8015610d7857600061271061184085846133d6565b61184a91906133ed565b9050801561185d5761185d87848361238c565b611871878661186c8486613428565b61238c565b50505050505050565b6000816040013561188a81612046565b6118fd60608401356118a26040860160208701612b63565b60408051808201909152600090806118ba89806131d2565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525033602090910152611d39565b5060015491508260800135821115610bc4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f546f6f206d756368207265717565737465640000000000000000000000000000604482015260640161022f565b6040517fd505accf000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018690526064810185905260ff8416608482015260a4810183905260c4810182905273ffffffffffffffffffffffffffffffffffffffff87169063d505accf9060e401610a47565b60005473ffffffffffffffffffffffffffffffffffffffff163314611a95576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f426c6173743a2063616c6c6572206973206e6f742074686520636f6c6c65637460448201527f6f72000000000000000000000000000000000000000000000000000000000000606482015260840161022f565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600080611ae983826124f5565b9150611af68360146124f5565b9050915091565b6000611b1284611b0d858561257e565b6125f9565b949350505050565b7f000000000000000000000000430000000000000000000000000000000000000473ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611b755750804710155b15611cbb577f000000000000000000000000430000000000000000000000000000000000000473ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015611be257600080fd5b505af1158015611bf6573d6000803e3d6000fd5b50506040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152602482018690527f000000000000000000000000430000000000000000000000000000000000000416935063a9059cbb925060440190506020604051808303816000875af1158015611c91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb5919061343b565b5061170e565b3073ffffffffffffffffffffffffffffffffffffffff841603611ce857611ce384838361238c565b61170e565b61170e84848484612686565b60006014611d02818061345d565b611d0c919061345d565b825110159050919050565b6060611d336014808451611d2b9190613428565b8491906127f7565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff8416611d5a573093505b600080611d6a8460000151611adc565b909250905073ffffffffffffffffffffffffffffffffffffffff80831690821610600080611d9884866121a0565b73ffffffffffffffffffffffffffffffffffffffff1663128acb088a85611dbe8e6121dc565b611dc79061339e565b73ffffffffffffffffffffffffffffffffffffffff8d1615611de9578c611e22565b87611e1257611e0d600173fffd8963efd1fc6a506488495d951d5263988d2661327d565b611e22565b611e226401000276a360016132aa565b8c604051602001611e3391906132d7565b6040516020818303038152906040526040518663ffffffff1660e01b8152600401611e62959493929190613470565b60408051808303816000875af1158015611e80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea4919061337a565b91509150600083611ebe5781611eb98461339e565b611ec8565b82611ec88361339e565b909750905073ffffffffffffffffffffffffffffffffffffffff8916600003611f54578a8114611f54576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4e6f742072656365697665642066756c6c20616d6f756e744f75740000000000604482015260640161022f565b505050505050949350505050565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff8416908390604051611f9991906134c2565b60006040518083038185875af1925050503d8060008114611fd6576040519150601f19603f3d011682016040523d82523d6000602084013e611fdb565b606091505b5050905080610d35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f5354450000000000000000000000000000000000000000000000000000000000604482015260640161022f565b804211156120b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015260640161022f565b50565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a08231906024015b602060405180830381865afa158015612121573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d3391906130f0565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815233600482015230602482015260009073ffffffffffffffffffffffffffffffffffffffff83169063dd62ed3e90604401612104565b60006121d57f000000000000000000000000ffeecb1fe0eaaefee69d122f6b7a0368637cb5936121d0858561257e565b612963565b9392505050565b8060008112156121eb57600080fd5b919050565b600073ffffffffffffffffffffffffffffffffffffffff8416612211573093505b6000806122218460000151611adc565b909250905073ffffffffffffffffffffffffffffffffffffffff8082169083161060008061224f85856121a0565b73ffffffffffffffffffffffffffffffffffffffff1663128acb088a856122758e6121dc565b73ffffffffffffffffffffffffffffffffffffffff8d1615612297578c6122d0565b876122c0576122bb600173fffd8963efd1fc6a506488495d951d5263988d2661327d565b6122d0565b6122d06401000276a360016132aa565b8c6040516020016122e191906132d7565b6040516020818303038152906040526040518663ffffffff1660e01b8152600401612310959493929190613470565b60408051808303816000875af115801561232e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612352919061337a565b91509150826123615781612363565b805b61236c9061339e565b9a9950505050505050505050565b6060611d336000611d2b60148061345d565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052915160009283929087169161242391906134c2565b6000604051808303816000865af19150503d8060008114612460576040519150601f19603f3d011682016040523d82523d6000602084013e612465565b606091505b509150915081801561248f57508051158061248f57508080602001905181019061248f919061343b565b61167f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f5354000000000000000000000000000000000000000000000000000000000000604482015260640161022f565b60008160140183511015612565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e64730000000000000000000000604482015260640161022f565b5001602001516c01000000000000000000000000900490565b60408051808201909152600080825260208201528173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1611156125ca579091905b506040805180820190915273ffffffffffffffffffffffffffffffffffffffff92831681529116602082015290565b60006126058383612963565b90503373ffffffffffffffffffffffffffffffffffffffff821614611d33576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f496e76616c69642063616c6c6572206f662063616c6c6261636b000000000000604482015260640161022f565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052915160009283929088169161272591906134c2565b6000604051808303816000865af19150503d8060008114612762576040519150601f19603f3d011682016040523d82523d6000602084013e612767565b606091505b5091509150818015612791575080511580612791575080806020019051810190612791919061343b565b610d78576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f5354460000000000000000000000000000000000000000000000000000000000604482015260640161022f565b60608182601f011015612866576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015260640161022f565b818301845110156128d3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e6473000000000000000000000000000000604482015260640161022f565b6060821580156128f2576040519150600082526020820160405261295a565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561292b578051835260209283019201612913565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b6000816020015173ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff1610612a02576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f496e76616c6964206f72646572206f6620746f6b656e73000000000000000000604482015260640161022f565b8282600001518360200151604051602001612a4092919073ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290528051602091820120612b04939290917fa9df2657ce5872e94bdc9525588fd983b0aa5db2f3c7a83d7e6b6a99cd2003a191017fff00000000000000000000000000000000000000000000000000000000000000815260609390931b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830191909152603582015260550190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101209392505050565b73ffffffffffffffffffffffffffffffffffffffff811681146120b057600080fd5b600060208284031215612b7557600080fd5b81356121d581612b41565b60008060008060608587031215612b9657600080fd5b8435935060208501359250604085013567ffffffffffffffff80821115612bbc57600080fd5b818701915087601f830112612bd057600080fd5b813581811115612bdf57600080fd5b886020828501011115612bf157600080fd5b95989497505060200194505050565b60008060008060008060c08789031215612c1957600080fd5b8635612c2481612b41565b95506020870135945060408701359350606087013560ff81168114612c4857600080fd5b9598949750929560808101359460a0909101359350915050565b600060e0828403121561131c57600080fd5b600060e08284031215612c8657600080fd5b6121d58383612c62565b60008060408385031215612ca357600080fd5b823591506020830135612cb581612b41565b809150509250929050565b60008060208385031215612cd357600080fd5b823567ffffffffffffffff80821115612ceb57600080fd5b818501915085601f830112612cff57600080fd5b813581811115612d0e57600080fd5b8660208260051b8501011115612d2357600080fd5b60209290920196919550909350505050565b60005b83811015612d50578181015183820152602001612d38565b50506000910152565b60008151808452612d71816020860160208601612d35565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612e16577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452612e04858351612d59565b94509285019290850190600101612dca565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160a0810167ffffffffffffffff81118282101715612e7557612e75612e23565b60405290565b600082601f830112612e8c57600080fd5b813567ffffffffffffffff80821115612ea757612ea7612e23565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715612eed57612eed612e23565b81604052838152866020858801011115612f0657600080fd5b836020870160208301376000602085830101528094505050505092915050565b600060208284031215612f3857600080fd5b813567ffffffffffffffff80821115612f5057600080fd5b9083019060a08286031215612f6457600080fd5b612f6c612e52565b823582811115612f7b57600080fd5b612f8787828601612e7b565b82525060208301359150612f9a82612b41565b81602082015260408301356040820152606083013560608201526080830135608082015280935050505092915050565b60008060008060808587031215612fe057600080fd5b843593506020850135612ff281612b41565b925060408501359150606085013561300981612b41565b939692955090935050565b60008060006060848603121561302957600080fd5b833561303481612b41565b925060208401359150604084013561304b81612b41565b809150509250925092565b600080600080600060a0868803121561306e57600080fd5b853561307981612b41565b945060208601359350604086013561309081612b41565b92506060860135915060808601356130a781612b41565b809150509295509295909350565b6000602082840312156130c757600080fd5b813567ffffffffffffffff8111156130de57600080fd5b820160a081850312156121d557600080fd5b60006020828403121561310257600080fd5b5051919050565b60006020828403121561311b57600080fd5b813567ffffffffffffffff8082111561313357600080fd5b908301906040828603121561314757600080fd5b60405160408101818110838211171561316257613162612e23565b60405282358281111561317457600080fd5b61318087828601612e7b565b8252506020830135925061319383612b41565b6020810192909252509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261320757600080fd5b83018035915067ffffffffffffffff82111561322257600080fd5b60200191503681900382131561323757600080fd5b9250929050565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff828116828216039080821115610e9a57610e9a61324e565b73ffffffffffffffffffffffffffffffffffffffff818116838216019080821115610e9a57610e9a61324e565b6020815260008251604060208401526132f36060840182612d59565b905073ffffffffffffffffffffffffffffffffffffffff60208501511660408401528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff80891683528088166020840152861515604084015285606084015280851660808401525060c060a083015261336e60c0830184612d59565b98975050505050505050565b6000806040838503121561338d57600080fd5b505080516020909101519092909150565b60007f800000000000000000000000000000000000000000000000000000000000000082036133cf576133cf61324e565b5060000390565b8082028115828204841417611d3357611d3361324e565b600082613423577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d3357611d3361324e565b60006020828403121561344d57600080fd5b815180151581146121d557600080fd5b80820180821115611d3357611d3361324e565b600073ffffffffffffffffffffffffffffffffffffffff8088168352861515602084015285604084015280851660608401525060a060808301526134b760a0830184612d59565b979650505050505050565b600082516134d4818460208701612d35565b919091019291505056fea164736f6c6343000814000a
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
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.