Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00Latest 25 from a total of 5,658 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Swap Exact Token... | 24641635 | 12 hrs ago | IN | 0 ETH | 0.000024 | ||||
| Swap | 24618764 | 3 days ago | IN | 0 ETH | 0.00000746 | ||||
| Swap Exact Token... | 24601310 | 6 days ago | IN | 0 ETH | 0.00001082 | ||||
| Swap Exact Token... | 24601298 | 6 days ago | IN | 0 ETH | 0.00001204 | ||||
| Swap Exact Token... | 24578677 | 9 days ago | IN | 0 ETH | 0.00003977 | ||||
| Swap Exact Token... | 24577311 | 9 days ago | IN | 0 ETH | 0.0001794 | ||||
| Swap | 24576197 | 9 days ago | IN | 0 ETH | 0.00002106 | ||||
| Swap Exact Token... | 24575475 | 9 days ago | IN | 0.12521 ETH | 0.00019588 | ||||
| Swap Exact Token... | 24575356 | 9 days ago | IN | 0 ETH | 0.00001183 | ||||
| Swap Exact Token... | 24575351 | 9 days ago | IN | 0 ETH | 0.00001248 | ||||
| Swap Exact Token... | 24575344 | 9 days ago | IN | 0 ETH | 0.0000123 | ||||
| Swap Exact Token... | 24575340 | 9 days ago | IN | 0 ETH | 0.0000138 | ||||
| Swap Exact Token... | 24575332 | 9 days ago | IN | 0 ETH | 0.0000134 | ||||
| Swap Exact Token... | 24575327 | 9 days ago | IN | 0 ETH | 0.00001368 | ||||
| Swap Exact Token... | 24575319 | 9 days ago | IN | 0 ETH | 0.00001307 | ||||
| Swap Exact Token... | 24575314 | 9 days ago | IN | 0 ETH | 0.00001301 | ||||
| Swap Exact Token... | 24575307 | 9 days ago | IN | 0 ETH | 0.00001482 | ||||
| Swap Exact Token... | 24575301 | 9 days ago | IN | 0 ETH | 0.00001539 | ||||
| Swap Exact Token... | 24575297 | 9 days ago | IN | 0 ETH | 0.00001447 | ||||
| Swap Exact Token... | 24575294 | 9 days ago | IN | 0 ETH | 0.00001412 | ||||
| Swap Exact Token... | 24575281 | 9 days ago | IN | 0 ETH | 0.0000149 | ||||
| Swap Exact Token... | 24575273 | 9 days ago | IN | 0 ETH | 0.00001364 | ||||
| Swap Exact Token... | 24575259 | 9 days ago | IN | 0 ETH | 0.00001389 | ||||
| Swap Exact Token... | 24575254 | 9 days ago | IN | 0 ETH | 0.00001364 | ||||
| Swap Exact Token... | 24575248 | 9 days ago | IN | 0 ETH | 0.00001387 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer* | 24645189 | 48 mins ago | 0.01420927 ETH | ||||
| Swap Exact Token... | 24645189 | 48 mins ago | 0.01420927 ETH | ||||
| Transfer* | 24645186 | 49 mins ago | 0.01422902 ETH | ||||
| Swap Exact Token... | 24645186 | 49 mins ago | 0.01422902 ETH | ||||
| Transfer* | 24645089 | 1 hr ago | 0.0059509 ETH | ||||
| Swap Exact Token... | 24645089 | 1 hr ago | 0.0059509 ETH | ||||
| Transfer* | 24645079 | 1 hr ago | 0.00463884 ETH | ||||
| Swap Exact Token... | 24645079 | 1 hr ago | 0.00463884 ETH | ||||
| Transfer* | 24644334 | 3 hrs ago | 0.00174514 ETH | ||||
| Swap Exact Token... | 24644334 | 3 hrs ago | 0.00174514 ETH | ||||
| Transfer* | 24644329 | 3 hrs ago | 0.01069182 ETH | ||||
| Swap Exact Token... | 24644329 | 3 hrs ago | 0.01069182 ETH | ||||
| Transfer* | 24644326 | 3 hrs ago | 0.01374704 ETH | ||||
| Swap Exact Token... | 24644326 | 3 hrs ago | 0.01374704 ETH | ||||
| Transfer* | 24644319 | 3 hrs ago | 0.00754775 ETH | ||||
| Swap Exact Token... | 24644319 | 3 hrs ago | 0.00754775 ETH | ||||
| Transfer* | 24644096 | 4 hrs ago | 0.0065011 ETH | ||||
| Swap Exact Token... | 24644096 | 4 hrs ago | 0.0065011 ETH | ||||
| Transfer* | 24644086 | 4 hrs ago | 0.03743312 ETH | ||||
| Swap Exact Token... | 24644086 | 4 hrs ago | 0.03743312 ETH | ||||
| Transfer* | 24644081 | 4 hrs ago | 0.04048233 ETH | ||||
| Swap Exact Token... | 24644081 | 4 hrs ago | 0.04048233 ETH | ||||
| Transfer* | 24643938 | 5 hrs ago | 0.00203994 ETH | ||||
| Swap Exact Token... | 24643938 | 5 hrs ago | 0.00203994 ETH | ||||
| Transfer* | 24643863 | 5 hrs ago | 0.00406272 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x89110A5A...6c2D1C940 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
UniswapV4Router04
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 9999999 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;
import {
PathKey,
PoolKey,
Currency,
BalanceDelta,
ISignatureTransfer,
IUniswapV4Router04
} from "./interfaces/IUniswapV4Router04.sol";
import {LibZip} from "@solady/src/utils/LibZip.sol";
import {Locker} from "@v4-periphery/src/libraries/Locker.sol";
import {Multicallable} from "@solady/src/utils/Multicallable.sol";
import {IPoolManager, SwapFlags, BaseData, BaseSwapRouter} from "./base/BaseSwapRouter.sol";
/// @title Uniswap V4 Swap Router
contract UniswapV4Router04 is IUniswapV4Router04, BaseSwapRouter, Multicallable {
modifier setMsgSender() {
Locker.set(msg.sender);
_;
Locker.set(address(0));
}
constructor(IPoolManager manager, ISignatureTransfer _permit2)
payable
BaseSwapRouter(manager, _permit2)
{}
/// -----------------------
/// @inheritdoc IUniswapV4Router04
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
Currency startCurrency,
PathKey[] calldata path,
address receiver,
uint256 deadline
)
public
payable
virtual
override(IUniswapV4Router04)
checkDeadline(deadline)
setMsgSender
returns (BalanceDelta)
{
return _unlockAndDecode(
abi.encode(
BaseData({
amount: amountIn,
amountLimit: amountOutMin,
payer: msg.sender,
receiver: receiver,
flags: 0
}),
startCurrency,
path
)
);
}
/// @inheritdoc IUniswapV4Router04
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
Currency startCurrency,
PathKey[] calldata path,
address receiver,
uint256 deadline
)
public
payable
virtual
override(IUniswapV4Router04)
checkDeadline(deadline)
setMsgSender
returns (BalanceDelta)
{
return _unlockAndDecode(
abi.encode(
BaseData({
amount: amountOut,
amountLimit: amountInMax,
payer: msg.sender,
receiver: receiver,
flags: SwapFlags.EXACT_OUTPUT
}),
startCurrency,
path
)
);
}
/// @inheritdoc IUniswapV4Router04
function swap(
int256 amountSpecified,
uint256 amountLimit,
Currency startCurrency,
PathKey[] calldata path,
address receiver,
uint256 deadline
)
public
payable
virtual
override(IUniswapV4Router04)
checkDeadline(deadline)
setMsgSender
returns (BalanceDelta)
{
return _unlockAndDecode(
abi.encode(
BaseData({
amount: amountSpecified > 0 ? uint256(amountSpecified) : uint256(-amountSpecified),
amountLimit: amountLimit,
payer: msg.sender,
receiver: receiver,
flags: amountSpecified > 0 ? SwapFlags.EXACT_OUTPUT : 0
}),
startCurrency,
path
)
);
}
/// -----------------------
/// @inheritdoc IUniswapV4Router04
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
bool zeroForOne,
PoolKey calldata poolKey,
bytes calldata hookData,
address receiver,
uint256 deadline
)
public
payable
virtual
override(IUniswapV4Router04)
checkDeadline(deadline)
setMsgSender
returns (BalanceDelta)
{
return _unlockAndDecode(
abi.encode(
BaseData({
amount: amountIn,
amountLimit: amountOutMin,
payer: msg.sender,
receiver: receiver,
flags: SwapFlags.SINGLE_SWAP
}),
zeroForOne,
poolKey,
hookData
)
);
}
/// @inheritdoc IUniswapV4Router04
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
bool zeroForOne,
PoolKey calldata poolKey,
bytes calldata hookData,
address receiver,
uint256 deadline
)
public
payable
virtual
override(IUniswapV4Router04)
checkDeadline(deadline)
setMsgSender
returns (BalanceDelta)
{
return _unlockAndDecode(
abi.encode(
BaseData({
amount: amountOut,
amountLimit: amountInMax,
payer: msg.sender,
receiver: receiver,
flags: SwapFlags.SINGLE_SWAP | SwapFlags.EXACT_OUTPUT
}),
zeroForOne,
poolKey,
hookData
)
);
}
/// @inheritdoc IUniswapV4Router04
function swap(
int256 amountSpecified,
uint256 amountLimit,
bool zeroForOne,
PoolKey calldata poolKey,
bytes calldata hookData,
address receiver,
uint256 deadline
)
public
payable
virtual
override(IUniswapV4Router04)
checkDeadline(deadline)
setMsgSender
returns (BalanceDelta)
{
return _unlockAndDecode(
abi.encode(
BaseData({
amount: amountSpecified > 0 ? uint256(amountSpecified) : uint256(-amountSpecified),
amountLimit: amountLimit,
payer: msg.sender,
receiver: receiver,
flags: SwapFlags.SINGLE_SWAP | (amountSpecified > 0 ? SwapFlags.EXACT_OUTPUT : 0)
}),
zeroForOne,
poolKey,
hookData
)
);
}
/// -----------------------
/// @inheritdoc IUniswapV4Router04
function swap(bytes calldata data, uint256 deadline)
public
payable
virtual
override(IUniswapV4Router04)
checkDeadline(deadline)
setMsgSender
returns (BalanceDelta)
{
// equivalent to `require(abi.decode(data, (BaseData)).payer == msg.sender, Unauthorized())`
assembly ("memory-safe") {
if iszero(eq(calldataload(164), caller())) {
mstore(0x00, 0x82b42900) // `Unauthorized()`.
revert(0x1c, 0x04)
}
}
return _unlockAndDecode(data);
}
/// -----------------------
/// @inheritdoc IUniswapV4Router04
function msgSender() public view virtual returns (address) {
return Locker.get();
}
/// @inheritdoc IUniswapV4Router04
fallback() external payable virtual {
LibZip.cdFallback();
}
/// @inheritdoc IUniswapV4Router04
receive() external payable virtual {
IPoolManager _poolManager = poolManager;
assembly ("memory-safe") {
if iszero(eq(caller(), _poolManager)) {
mstore(0x00, 0x82b42900) // `Unauthorized()`
revert(0x1c, 0x04)
}
}
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;
import {PathKey} from "../libraries/PathKey.sol";
import {PoolKey} from "@v4/src/types/PoolKey.sol";
import {Currency} from "@v4/src/types/Currency.sol";
import {BalanceDelta} from "@v4/src/types/BalanceDelta.sol";
import {ISignatureTransfer} from "@permit2/interfaces/ISignatureTransfer.sol";
/// @title Uniswap V4 Swap Router
/// @notice A simple, stateless router for execution of swaps against Uniswap v4 Pools
/// @dev ABI inspired by UniswapV2Router02
interface IUniswapV4Router04 {
/// ================ MULTI POOL SWAPS ================= ///
/// @notice Exact Input Swap; swap the specified amount of input tokens for as many output tokens as possible, along the path
/// @param amountIn the amount of input tokens to swap
/// @param amountOutMin the minimum amount of output tokens that must be received for the transaction not to revert. reverts on equals to
/// @param startCurrency the currency to start the swap from
/// @param path the path of v4 Pools to swap through
/// @param receiver the address to send the output tokens to
/// @param deadline block.timestamp must be before this value, otherwise the transaction will revert
/// @return Delta the balance changes from the swap
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
Currency startCurrency,
PathKey[] calldata path,
address receiver,
uint256 deadline
) external payable returns (BalanceDelta);
/// @notice Exact Output Swap; swap as few input tokens as possible for the specified amount of output tokens, along the path
/// @param amountOut the amount of output tokens to receive
/// @param amountInMax the maximum amount of input tokens that can be spent for the transaction not to revert. reverts on equal to
/// @param startCurrency the currency to start the swap from
/// @param path the path of v4 Pools to swap through
/// @param receiver the address to send the output tokens to
/// @param deadline block.timestamp must be before this value, otherwise the transaction will revert
/// @return Delta the balance changes from the swap
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
Currency startCurrency,
PathKey[] calldata path,
address receiver,
uint256 deadline
) external payable returns (BalanceDelta);
/// @notice General-purpose swap interface for Uniswap v4 that handles all types of swaps
/// @param amountSpecified the amount of tokens to be swapped, negative for exact input swaps and positive for exact output swaps
/// @param amountLimit the minimum amount of output tokens for exact input swaps, the maximum amount of input tokens for exact output swaps
/// @param startCurrency the currency to start the swap from
/// @param path the path of v4 Pools to swap through
/// @param receiver the address to send the output tokens to
/// @param deadline block.timestamp must be before this value, otherwise the transaction will revert
/// @return Delta the balance changes from the swap
function swap(
int256 amountSpecified,
uint256 amountLimit,
Currency startCurrency,
PathKey[] calldata path,
address receiver,
uint256 deadline
) external payable returns (BalanceDelta);
/// ================ SINGLE POOL SWAPS ================ ///
/// @notice Single pool, exact input swap - swap the specified amount of input tokens for as many output tokens as possible, on a single pool
/// @param amountIn the amount of input tokens to swap
/// @param amountOutMin the minimum amount of output tokens that must be received for the transaction not to revert
/// @param zeroForOne the direction of the swap, true if currency0 is being swapped for currency1
/// @param poolKey the pool to swap through
/// @param hookData the data to be passed to the hook
/// @param receiver the address to send the output tokens to
/// @param deadline block.timestamp must be before this value, otherwise the transaction will revert
/// @return Delta the balance changes from the swap
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
bool zeroForOne,
PoolKey calldata poolKey,
bytes calldata hookData,
address receiver,
uint256 deadline
) external payable returns (BalanceDelta);
/// @notice Singe pool, exact output swap; swap as few input tokens as possible for the specified amount of output tokens, on a single pool
/// @param amountOut the amount of output tokens to receive
/// @param amountInMax the maximum amount of input tokens that can be spent for the transaction not to revert
/// @param zeroForOne the direction of the swap, true if currency0 is being swapped for currency1
/// @param poolKey the pool to swap through
/// @param hookData the data to be passed to the hook
/// @param receiver the address to send the output tokens to
/// @param deadline block.timestamp must be before this value, otherwise the transaction will revert
/// @return Delta the balance changes from the swap
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
bool zeroForOne,
PoolKey calldata poolKey,
bytes calldata hookData,
address receiver,
uint256 deadline
) external payable returns (BalanceDelta);
/// @notice General-purpose single-pool swap interface
/// @param amountSpecified the amount of tokens to be swapped, negative for exact input swaps and positive for exact output swaps
/// @param amountLimit the minimum amount of output tokens for exact input swaps, the maximum amount of input tokens for exact output swaps
/// @param zeroForOne the direction of the swap, true if currency0 is being swapped for currency1
/// @param poolKey the pool to swap through
/// @param hookData the data to be passed to the hook
/// @param receiver the address to send the output tokens to
/// @param deadline block.timestamp must be before this value, otherwise the transaction will revert
/// @return Delta the balance changes from the swap
function swap(
int256 amountSpecified,
uint256 amountLimit,
bool zeroForOne,
PoolKey calldata poolKey,
bytes calldata hookData,
address receiver,
uint256 deadline
) external payable returns (BalanceDelta);
/// ================ OPTIMIZED ================ ///
/// @notice Generic multi-pool swap function that accepts pre-encoded calldata
/// @dev Minor optimization to reduce the number of onchain abi.encode calls
/// @param data Pre-encoded swap data in one of the following formats:
/// 1. For single-pool swaps: abi.encode(
/// BaseData baseData, // struct containing swap parameters
/// bool zeroForOne, // direction of swap
/// PoolKey poolKey, // key of the pool to swap through
/// bytes hookData // data to pass to hooks
/// )
/// 2. For multi-pool swaps: abi.encode(
/// BaseData baseData, // struct containing swap parameters
/// Currency startCurrency, // initial currency in the swap
/// PathKey[] path // array of path keys defining the route
/// )
///
/// PERMIT2 EXTENSION:
/// 1. For single pool swaps: abi.encode(
/// BaseData baseData, // struct containing swap parameters
/// bool zeroForOne, // direction of swap
/// PoolKey poolKey, // key of the pool to swap through
/// bytes hookData, // data to pass to hooks
/// PermitPayload permitPayload // permit2 signature payload
/// )
/// 2. For multi-pool swaps: abi.encode(
/// BaseData baseData, // struct containing swap parameters
/// Currency startCurrency, // initial currency in the swap
/// PathKey[] path, // array of path keys defining the route
/// PermitPayload permitPayload // permit2 signature payload
/// )
/// Where BaseData.flags contains permit2 flag, and PermitPayload contains:
/// - permit: ISignatureTransfer.PermitTransferFrom
/// - signature: bytes
///
/// @param deadline block.timestamp must be before this value, otherwise the transaction will revert
/// @return Delta the balance changes from the swap
function swap(bytes calldata data, uint256 deadline) external payable returns (BalanceDelta);
/// @notice Provides calldata compression fallback
fallback() external payable;
/// @notice Provides ETH receipts locked to Pool Manager
receive() external payable;
/// ================ GETTERS ================ ///
/// @notice Public view function to be used instead of msg.sender, as the contract performs self-reentrancy and at
/// times msg.sender == address(this). Instead msgSender() returns the initiator of the lock
function msgSender() external view returns (address);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Library for compressing and decompressing bytes.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibZip.sol)
/// @author Calldata compression by clabby (https://github.com/clabby/op-kompressor)
/// @author FastLZ by ariya (https://github.com/ariya/FastLZ)
///
/// @dev Note:
/// The accompanying solady.js library includes implementations of
/// FastLZ and calldata operations for convenience.
library LibZip {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* FAST LZ OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
// LZ77 implementation based on FastLZ.
// Equivalent to level 1 compression and decompression at the following commit:
// https://github.com/ariya/FastLZ/commit/344eb4025f9ae866ebf7a2ec48850f7113a97a42
// Decompression is backwards compatible.
/// @dev Returns the compressed `data`.
function flzCompress(bytes memory data) internal pure returns (bytes memory result) {
/// @solidity memory-safe-assembly
assembly {
function ms8(d_, v_) -> _d {
mstore8(d_, v_)
_d := add(d_, 1)
}
function u24(p_) -> _u {
_u := mload(p_)
_u := or(shl(16, byte(2, _u)), or(shl(8, byte(1, _u)), byte(0, _u)))
}
function cmp(p_, q_, e_) -> _l {
for { e_ := sub(e_, q_) } lt(_l, e_) { _l := add(_l, 1) } {
e_ := mul(iszero(byte(0, xor(mload(add(p_, _l)), mload(add(q_, _l))))), e_)
}
}
function literals(runs_, src_, dest_) -> _o {
for { _o := dest_ } iszero(lt(runs_, 0x20)) { runs_ := sub(runs_, 0x20) } {
mstore(ms8(_o, 31), mload(src_))
_o := add(_o, 0x21)
src_ := add(src_, 0x20)
}
if iszero(runs_) { leave }
mstore(ms8(_o, sub(runs_, 1)), mload(src_))
_o := add(1, add(_o, runs_))
}
function mt(l_, d_, o_) -> _o {
for { d_ := sub(d_, 1) } iszero(lt(l_, 263)) { l_ := sub(l_, 262) } {
o_ := ms8(ms8(ms8(o_, add(224, shr(8, d_))), 253), and(0xff, d_))
}
if iszero(lt(l_, 7)) {
_o := ms8(ms8(ms8(o_, add(224, shr(8, d_))), sub(l_, 7)), and(0xff, d_))
leave
}
_o := ms8(ms8(o_, add(shl(5, l_), shr(8, d_))), and(0xff, d_))
}
function setHash(i_, v_) {
let p_ := add(mload(0x40), shl(2, i_))
mstore(p_, xor(mload(p_), shl(224, xor(shr(224, mload(p_)), v_))))
}
function getHash(i_) -> _h {
_h := shr(224, mload(add(mload(0x40), shl(2, i_))))
}
function hash(v_) -> _r {
_r := and(shr(19, mul(2654435769, v_)), 0x1fff)
}
function setNextHash(ip_, ipStart_) -> _ip {
setHash(hash(u24(ip_)), sub(ip_, ipStart_))
_ip := add(ip_, 1)
}
result := mload(0x40)
calldatacopy(result, calldatasize(), 0x8000) // Zeroize the hashmap.
let op := add(result, 0x8000)
let a := add(data, 0x20)
let ipStart := a
let ipLimit := sub(add(ipStart, mload(data)), 13)
for { let ip := add(2, a) } lt(ip, ipLimit) {} {
let r := 0
let d := 0
for {} 1 {} {
let s := u24(ip)
let h := hash(s)
r := add(ipStart, getHash(h))
setHash(h, sub(ip, ipStart))
d := sub(ip, r)
if iszero(lt(ip, ipLimit)) { break }
ip := add(ip, 1)
if iszero(gt(d, 0x1fff)) { if eq(s, u24(r)) { break } }
}
if iszero(lt(ip, ipLimit)) { break }
ip := sub(ip, 1)
if gt(ip, a) { op := literals(sub(ip, a), a, op) }
let l := cmp(add(r, 3), add(ip, 3), add(ipLimit, 9))
op := mt(l, d, op)
ip := setNextHash(setNextHash(add(ip, l), ipStart), ipStart)
a := ip
}
// Copy the result to compact the memory, overwriting the hashmap.
let end := sub(literals(sub(add(ipStart, mload(data)), a), a, op), 0x7fe0)
let o := add(result, 0x20)
mstore(result, sub(end, o)) // Store the length.
for {} iszero(gt(o, end)) { o := add(o, 0x20) } { mstore(o, mload(add(o, 0x7fe0))) }
mstore(end, 0) // Zeroize the slot after the string.
mstore(0x40, add(end, 0x20)) // Allocate the memory.
}
}
/// @dev Returns the decompressed `data`.
function flzDecompress(bytes memory data) internal pure returns (bytes memory result) {
/// @solidity memory-safe-assembly
assembly {
result := mload(0x40)
let op := add(result, 0x20)
let end := add(add(data, 0x20), mload(data))
for { data := add(data, 0x20) } lt(data, end) {} {
let w := mload(data)
let c := byte(0, w)
let t := shr(5, c)
if iszero(t) {
mstore(op, mload(add(data, 1)))
data := add(data, add(2, c))
op := add(op, add(1, c))
continue
}
for {
let g := eq(t, 7)
let l := add(2, xor(t, mul(g, xor(t, add(7, byte(1, w)))))) // M
let s := add(add(shl(8, and(0x1f, c)), byte(add(1, g), w)), 1) // R
let r := sub(op, s)
let f := xor(s, mul(gt(s, 0x20), xor(s, 0x20)))
let j := 0
} 1 {} {
mstore(add(op, j), mload(add(r, j)))
j := add(j, f)
if lt(j, l) { continue }
data := add(data, add(2, g))
op := add(op, l)
break
}
}
mstore(result, sub(op, add(result, 0x20))) // Store the length.
mstore(op, 0) // Zeroize the slot after the string.
mstore(0x40, add(op, 0x20)) // Allocate the memory.
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CALLDATA OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
// Calldata compression and decompression using selective run length encoding:
// - Sequences of 0x00 (up to 128 consecutive).
// - Sequences of 0xff (up to 32 consecutive).
//
// A run length encoded block consists of two bytes:
// (0) 0x00
// (1) A control byte with the following bit layout:
// - [7] `0: 0x00, 1: 0xff`.
// - [0..6] `runLength - 1`.
//
// The first 4 bytes are bitwise negated so that the compressed calldata
// can be dispatched into the `fallback` and `receive` functions.
/// @dev Returns the compressed `data`.
function cdCompress(bytes memory data) internal pure returns (bytes memory result) {
/// @solidity memory-safe-assembly
assembly {
function rle(v_, o_, d_) -> _o, _d {
mstore(o_, shl(240, or(and(0xff, add(d_, 0xff)), and(0x80, v_))))
_o := add(o_, 2)
}
result := mload(0x40)
let o := add(result, 0x20)
let z := 0 // Number of consecutive 0x00.
let y := 0 // Number of consecutive 0xff.
for { let end := add(data, mload(data)) } iszero(eq(data, end)) {} {
data := add(data, 1)
let c := byte(31, mload(data))
if iszero(c) {
if y { o, y := rle(0xff, o, y) }
z := add(z, 1)
if eq(z, 0x80) { o, z := rle(0x00, o, 0x80) }
continue
}
if eq(c, 0xff) {
if z { o, z := rle(0x00, o, z) }
y := add(y, 1)
if eq(y, 0x20) { o, y := rle(0xff, o, 0x20) }
continue
}
if y { o, y := rle(0xff, o, y) }
if z { o, z := rle(0x00, o, z) }
mstore8(o, c)
o := add(o, 1)
}
if y { o, y := rle(0xff, o, y) }
if z { o, z := rle(0x00, o, z) }
// Bitwise negate the first 4 bytes.
mstore(add(result, 4), not(mload(add(result, 4))))
mstore(result, sub(o, add(result, 0x20))) // Store the length.
mstore(o, 0) // Zeroize the slot after the string.
mstore(0x40, add(o, 0x20)) // Allocate the memory.
}
}
/// @dev Returns the decompressed `data`.
function cdDecompress(bytes memory data) internal pure returns (bytes memory result) {
/// @solidity memory-safe-assembly
assembly {
if mload(data) {
result := mload(0x40)
let o := add(result, 0x20)
let s := add(data, 4)
let v := mload(s)
let end := add(data, mload(data))
mstore(s, not(v)) // Bitwise negate the first 4 bytes.
for {} lt(data, end) {} {
data := add(data, 1)
let c := byte(31, mload(data))
if iszero(c) {
data := add(data, 1)
let d := byte(31, mload(data))
// Fill with either 0xff or 0x00.
mstore(o, not(0))
if iszero(gt(d, 0x7f)) { calldatacopy(o, calldatasize(), add(d, 1)) }
o := add(o, add(and(d, 0x7f), 1))
continue
}
mstore8(o, c)
o := add(o, 1)
}
mstore(s, v) // Restore the first 4 bytes.
mstore(result, sub(o, add(result, 0x20))) // Store the length.
mstore(o, 0) // Zeroize the slot after the string.
mstore(0x40, add(o, 0x20)) // Allocate the memory.
}
}
}
/// @dev To be called in the `fallback` function.
/// ```
/// fallback() external payable { LibZip.cdFallback(); }
/// receive() external payable {} // Silence compiler warning to add a `receive` function.
/// ```
/// For efficiency, this function will directly return the results, terminating the context.
/// If called internally, it must be called at the end of the function.
function cdFallback() internal {
/// @solidity memory-safe-assembly
assembly {
if iszero(calldatasize()) { return(calldatasize(), calldatasize()) }
let o := 0
let f := not(3) // For negating the first 4 bytes.
for { let i := 0 } lt(i, calldatasize()) {} {
let c := byte(0, xor(add(i, f), calldataload(i)))
i := add(i, 1)
if iszero(c) {
let d := byte(0, xor(add(i, f), calldataload(i)))
i := add(i, 1)
// Fill with either 0xff or 0x00.
mstore(o, not(0))
if iszero(gt(d, 0x7f)) { calldatacopy(o, calldatasize(), add(d, 1)) }
o := add(o, add(and(d, 0x7f), 1))
continue
}
mstore8(o, c)
o := add(o, 1)
}
let success := delegatecall(gas(), address(), 0x00, o, codesize(), 0x00)
returndatacopy(0x00, 0x00, returndatasize())
if iszero(success) { revert(0x00, returndatasize()) }
return(0x00, returndatasize())
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/// @notice This is a temporary library that allows us to use transient storage (tstore/tload)
/// TODO: This library can be deleted when we have the transient keyword support in solidity.
library Locker {
// The slot holding the locker state, transiently. bytes32(uint256(keccak256("LockedBy")) - 1)
bytes32 constant LOCKED_BY_SLOT = 0x0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a;
function set(address locker) internal {
assembly {
tstore(LOCKED_BY_SLOT, locker)
}
}
function get() internal view returns (address locker) {
assembly {
locker := tload(LOCKED_BY_SLOT)
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Contract that enables a single call to call multiple methods on itself.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/Multicallable.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/Multicallable.sol)
///
/// WARNING:
/// This implementation is NOT to be used with ERC2771 out-of-the-box.
/// https://blog.openzeppelin.com/arbitrary-address-spoofing-vulnerability-erc2771context-multicall-public-disclosure
/// This also applies to potentially other ERCs / patterns appending to the back of calldata.
///
/// We do NOT have a check for ERC2771, as we do not inherit from OpenZeppelin's context.
/// Moreover, it is infeasible and inefficient for us to add checks and mitigations
/// for all possible ERC / patterns appending to the back of calldata.
///
/// We would highly recommend using an alternative pattern such as
/// https://github.com/Vectorized/multicaller
/// which is more flexible, futureproof, and safer by default.
abstract contract Multicallable {
/// @dev Apply `delegatecall` with the current contract to each calldata in `data`,
/// and store the `abi.encode` formatted results of each `delegatecall` into `results`.
/// If any of the `delegatecall`s reverts, the entire context is reverted,
/// and the error is bubbled up.
///
/// By default, this function directly returns the results and terminates the call context.
/// If you need to add before and after actions to the multicall, please override this function.
function multicall(bytes[] calldata data) public payable virtual returns (bytes[] memory) {
// Revert if `msg.value` is non-zero by default to guard against double-spending.
// (See: https://www.paradigm.xyz/2021/08/two-rights-might-make-a-wrong)
//
// If you really need to pass in a `msg.value`, then you will have to
// override this function and add in any relevant before and after checks.
if (msg.value != 0) revert();
// `_multicallDirectReturn` returns the results directly and terminates the call context.
_multicallDirectReturn(_multicall(data));
}
/// @dev The inner logic of `multicall`.
/// This function is included so that you can override `multicall`
/// to add before and after actions, and use the `_multicallDirectReturn` function.
function _multicall(bytes[] calldata data) internal virtual returns (bytes32 results) {
/// @solidity memory-safe-assembly
assembly {
results := mload(0x40)
mstore(results, 0x20)
mstore(add(0x20, results), data.length)
let c := add(0x40, results)
let s := c
let end := shl(5, data.length)
calldatacopy(c, data.offset, end)
end := add(c, end)
let m := end
if data.length {
for {} 1 {} {
let o := add(data.offset, mload(c))
calldatacopy(m, add(o, 0x20), calldataload(o))
// forgefmt: disable-next-item
if iszero(delegatecall(gas(), address(), m, calldataload(o), codesize(), 0x00)) {
// Bubble up the revert if the delegatecall reverts.
returndatacopy(results, 0x00, returndatasize())
revert(results, returndatasize())
}
mstore(c, sub(m, s))
c := add(0x20, c)
// Append the `returndatasize()`, and the return data.
mstore(m, returndatasize())
let b := add(m, 0x20)
returndatacopy(b, 0x00, returndatasize())
// Advance `m` by `returndatasize() + 0x20`,
// rounded up to the next multiple of 32.
m := and(add(add(b, returndatasize()), 0x1f), 0xffffffffffffffe0)
mstore(add(b, returndatasize()), 0) // Zeroize the slot after the returndata.
if iszero(lt(c, end)) { break }
}
}
mstore(0x40, m) // Allocate memory.
results := or(shl(64, sub(m, results)), results) // Pack the bytes length into `results`.
}
}
/// @dev Decodes the `results` into an array of bytes.
/// This can be useful if you need to access the results or re-encode it.
function _multicallResultsToBytesArray(bytes32 results)
internal
pure
virtual
returns (bytes[] memory decoded)
{
/// @solidity memory-safe-assembly
assembly {
decoded := mload(0x40)
let c := and(0xffffffffffffffff, results) // Extract the offset.
mstore(decoded, mload(add(c, 0x20))) // Store the length.
let o := add(decoded, 0x20) // Start of elements in `decoded`.
let end := add(o, shl(5, mload(decoded)))
mstore(0x40, end) // Allocate memory.
let s := add(c, 0x40) // Start of elements in `results`.
let d := sub(s, o) // Difference between input and output pointers.
for {} iszero(eq(o, end)) { o := add(o, 0x20) } { mstore(o, add(mload(add(d, o)), s)) }
}
}
/// @dev Directly returns the `results` and terminates the current call context.
/// `results` must be from `_multicall`, else behavior is undefined.
function _multicallDirectReturn(bytes32 results) internal pure virtual {
/// @solidity memory-safe-assembly
assembly {
return(and(0xffffffffffffffff, results), shr(64, results))
}
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;
import {SwapFlags} from "../libraries/SwapFlags.sol";
import {SafeCast} from "@v4/src/libraries/SafeCast.sol";
import {TickMath} from "@v4/src/libraries/TickMath.sol";
import {CurrencySettler} from "@v4/test/utils/CurrencySettler.sol";
import {BalanceDelta, toBalanceDelta} from "@v4/src/types/BalanceDelta.sol";
import {ISignatureTransfer} from "@permit2/interfaces/ISignatureTransfer.sol";
import {IPoolManager, SafeCallback} from "@v4-periphery/src/base/SafeCallback.sol";
import {
Currency, CurrencyLibrary, PoolKey, PathKey, PathKeyLibrary
} from "../libraries/PathKey.sol";
struct BaseData {
uint256 amount;
uint256 amountLimit;
address payer;
address receiver;
uint8 flags;
}
struct PermitPayload {
ISignatureTransfer.PermitTransferFrom permit;
bytes signature;
}
/// @title Base Swap Router
/// @notice Template for data parsing and callback swap handling in Uniswap V4
/// @dev Fee-on-transfer tokens are not supported - these swaps might not pass
abstract contract BaseSwapRouter is SafeCallback {
using CurrencySettler for Currency;
using PathKeyLibrary for PathKey;
using SafeCast for uint256;
using SafeCast for int256;
ISignatureTransfer public immutable permit2;
/// ======================= CUSTOM ERRORS ======================= ///
/// @dev No path.
error EmptyPath();
/// @dev Auth check.
error Unauthorized();
/// @dev Slippage check.
error SlippageExceeded();
/// @dev ETH refund fail.
error ETHTransferFailed();
/// @dev Swap `block.timestamp` check.
error DeadlinePassed(uint256 deadline);
/// ========================= CONSTANTS ========================= ///
/// @dev The minimum sqrt price limit for the swap.
uint160 internal constant MIN = TickMath.MIN_SQRT_PRICE + 1;
/// @dev The maximum sqrt price limit for the swap.
uint160 internal constant MAX = TickMath.MAX_SQRT_PRICE - 1;
/// ======================== CONSTRUCTOR ======================== ///
constructor(IPoolManager manager, ISignatureTransfer _permit2) SafeCallback(manager) {
permit2 = _permit2;
}
/// ===================== SWAP EXECUTION ===================== ///
function _unlockCallback(bytes calldata callbackData)
internal
virtual
override(SafeCallback)
returns (bytes memory)
{
unchecked {
BaseData memory data = abi.decode(callbackData, (BaseData));
(bool singleSwap, bool exactOutput, bool input6909, bool output6909, bool _permit2) =
SwapFlags.unpackFlags(data.flags);
(Currency inputCurrency, Currency outputCurrency, BalanceDelta delta) =
_parseAndSwap(singleSwap, exactOutput, data.amount, callbackData);
uint256 inputAmount = inputCurrency < outputCurrency
? uint256(int256(-delta.amount0()))
: uint256(int256(-delta.amount1()));
uint256 outputAmount = inputCurrency < outputCurrency
? uint256(int256(delta.amount1()))
: uint256(int256(delta.amount0()));
if (exactOutput ? inputAmount > data.amountLimit : outputAmount < data.amountLimit) {
revert SlippageExceeded();
}
// handle ERC20 with permit2...
if (_permit2) {
PermitPayload memory permitPayload;
if (singleSwap) {
(,,,, permitPayload) =
abi.decode(callbackData, (BaseData, bool, PoolKey, bytes, PermitPayload));
} else {
(,,, permitPayload) =
abi.decode(callbackData, (BaseData, Currency, PathKey[], PermitPayload));
}
poolManager.sync(inputCurrency);
permit2.permitTransferFrom(
permitPayload.permit,
ISignatureTransfer.SignatureTransferDetails({
to: address(poolManager),
requestedAmount: inputAmount
}),
data.payer,
permitPayload.signature
);
poolManager.settle();
} else {
if (inputCurrency.isAddressZero()) poolManager.sync(inputCurrency);
inputCurrency.settle(poolManager, data.payer, inputAmount, input6909);
}
outputCurrency.take(poolManager, data.receiver, outputAmount, output6909);
// trigger refund of ETH if any left over after swap
if (inputCurrency == CurrencyLibrary.ADDRESS_ZERO) {
if ((outputAmount = address(this).balance) != 0) {
_refundETH(data.payer, outputAmount);
}
}
return abi.encode(delta);
}
}
function _parseAndSwap(
bool singleSwap,
bool exactOutput,
uint256 amount,
bytes calldata callbackData
)
internal
virtual
returns (Currency inputCurrency, Currency outputCurrency, BalanceDelta delta)
{
unchecked {
if (singleSwap) {
bool zeroForOne;
PoolKey memory key;
bytes memory hookData;
(, zeroForOne, key, hookData) =
abi.decode(callbackData, (BaseData, bool, PoolKey, bytes));
(inputCurrency, outputCurrency) =
zeroForOne ? (key.currency0, key.currency1) : (key.currency1, key.currency0);
delta = _swap(
key,
zeroForOne,
exactOutput ? amount.toInt256() : -(amount.toInt256()),
hookData
);
} else {
PathKey[] memory path;
(, inputCurrency, path) = abi.decode(callbackData, (BaseData, Currency, PathKey[]));
if (path.length == 0) revert EmptyPath();
outputCurrency = path[path.length - 1].intermediateCurrency;
delta = exactOutput
? _exactOutputMultiSwap(inputCurrency, path, amount)
: _exactInputMultiSwap(inputCurrency, path, amount);
}
}
}
function _exactInputMultiSwap(Currency inputCurrency, PathKey[] memory path, uint256 amount)
internal
virtual
returns (BalanceDelta delta)
{
unchecked {
PoolKey memory poolKey;
bool zeroForOne;
int256 amountSpecified = -(amount.toInt256());
uint256 len = path.length;
Currency originalInputCurrency = inputCurrency;
// cache first path key
PathKey memory pathKey = path[0];
for (uint256 i; i != len;) {
(poolKey, zeroForOne) = pathKey.getPoolAndSwapDirection(inputCurrency);
delta = _swap(poolKey, zeroForOne, amountSpecified, pathKey.hookData);
inputCurrency = pathKey.intermediateCurrency;
amountSpecified = zeroForOne ? -delta.amount1() : -delta.amount0();
// load next path key
if (++i < len) pathKey = path[i];
}
// create the final delta based on original input and final output
if (originalInputCurrency < inputCurrency) {
delta = toBalanceDelta(
-int128(uint128(amount)), int128(uint128(uint256(-amountSpecified)))
);
} else {
delta = toBalanceDelta(
int128(uint128(uint256(-amountSpecified))), -int128(uint128(amount))
);
}
}
}
function _exactOutputMultiSwap(Currency startCurrency, PathKey[] memory path, uint256 amount)
internal
virtual
returns (BalanceDelta delta)
{
unchecked {
PoolKey memory poolKey;
bool zeroForOne;
int256 amountSpecified = amount.toInt256();
uint256 pos = path.length - 1;
// cache last path key for first iteration
PathKey memory pathKey = path[pos];
// handle all but the final swap
for (uint256 i = pos; i != 0;) {
(poolKey, zeroForOne) =
pathKey.getPoolAndSwapDirection(path[--i].intermediateCurrency);
delta = _swap(poolKey, zeroForOne, amountSpecified, pathKey.hookData);
amountSpecified = zeroForOne ? -delta.amount0() : -delta.amount1();
// load next pathKey for next iteration
pathKey = path[i];
}
// final swap
(poolKey, zeroForOne) = path[0].getPoolAndSwapDirection(startCurrency);
delta = _swap(poolKey, zeroForOne, amountSpecified, path[0].hookData);
// create the final delta based on original input and final output
if (startCurrency < path[pos].intermediateCurrency) {
delta = toBalanceDelta(
zeroForOne ? delta.amount0() : delta.amount1(), int128(uint128(amount))
);
} else {
delta = toBalanceDelta(
int128(uint128(amount)), zeroForOne ? delta.amount0() : delta.amount1()
);
}
}
}
function _swap(
PoolKey memory poolKey,
bool zeroForOne,
int256 amountSpecified,
bytes memory hookData
) internal virtual returns (BalanceDelta) {
return poolManager.swap(
poolKey,
IPoolManager.SwapParams({
zeroForOne: zeroForOne,
amountSpecified: amountSpecified,
sqrtPriceLimitX96: zeroForOne ? MIN : MAX
}),
hookData
);
}
function _unlockAndDecode(bytes memory data) internal virtual returns (BalanceDelta) {
return abi.decode(poolManager.unlock(data), (BalanceDelta));
}
modifier checkDeadline(uint256 deadline) virtual {
if (block.timestamp > deadline) revert DeadlinePassed(deadline);
_;
}
/// @dev Note: This function forwards all remaining gas to the receiver.
/// If the receiver is contract, it could maliciously consume excess gas
/// in its fallback function, significantly increasing transaction costs.
function _refundETH(address receiver, uint256 amount) internal virtual {
assembly ("memory-safe") {
if iszero(call(gas(), receiver, amount, codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`
revert(0x1c, 0x04)
}
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
import {PoolKey} from "@v4/src/types/PoolKey.sol";
import {IHooks} from "@v4/src/interfaces/IHooks.sol";
import {Currency, CurrencyLibrary} from "@v4/src/types/Currency.sol";
struct PathKey {
Currency intermediateCurrency;
uint24 fee;
int24 tickSpacing;
IHooks hooks;
bytes hookData;
}
using PathKeyLibrary for PathKey global;
/// @title PathKey Library
/// @notice Memory-oriented version of v4-periphery/src/libraries/PathKeyLibrary.sol
/// @dev Handles PathKey operations in memory rather than calldata for router operations
library PathKeyLibrary {
/// @notice Get the pool and swap direction for a given PathKey
/// @param params the given PathKey
/// @param currencyIn the input currency
/// @return poolKey the pool key of the swap
/// @return zeroForOne the direction of the swap, true if currency0 is being swapped for currency1
function getPoolAndSwapDirection(PathKey memory params, Currency currencyIn)
internal
pure
returns (PoolKey memory poolKey, bool zeroForOne)
{
Currency currencyOut = params.intermediateCurrency;
(Currency currency0, Currency currency1) =
currencyIn < currencyOut ? (currencyIn, currencyOut) : (currencyOut, currencyIn);
zeroForOne = currencyIn == currency0;
poolKey = PoolKey(currency0, currency1, params.fee, params.tickSpacing, params.hooks);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Currency} from "./Currency.sol";
import {IHooks} from "../interfaces/IHooks.sol";
import {PoolIdLibrary} from "./PoolId.sol";
using PoolIdLibrary for PoolKey global;
/// @notice Returns the key for identifying a pool
struct PoolKey {
/// @notice The lower currency of the pool, sorted numerically
Currency currency0;
/// @notice The higher currency of the pool, sorted numerically
Currency currency1;
/// @notice The pool LP fee, capped at 1_000_000. If the highest bit is 1, the pool has a dynamic fee and must be exactly equal to 0x800000
uint24 fee;
/// @notice Ticks that involve positions must be a multiple of tick spacing
int24 tickSpacing;
/// @notice The hooks of the pool
IHooks hooks;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IERC20Minimal} from "../interfaces/external/IERC20Minimal.sol";
import {CustomRevert} from "../libraries/CustomRevert.sol";
type Currency is address;
using {greaterThan as >, lessThan as <, greaterThanOrEqualTo as >=, equals as ==} for Currency global;
using CurrencyLibrary for Currency global;
function equals(Currency currency, Currency other) pure returns (bool) {
return Currency.unwrap(currency) == Currency.unwrap(other);
}
function greaterThan(Currency currency, Currency other) pure returns (bool) {
return Currency.unwrap(currency) > Currency.unwrap(other);
}
function lessThan(Currency currency, Currency other) pure returns (bool) {
return Currency.unwrap(currency) < Currency.unwrap(other);
}
function greaterThanOrEqualTo(Currency currency, Currency other) pure returns (bool) {
return Currency.unwrap(currency) >= Currency.unwrap(other);
}
/// @title CurrencyLibrary
/// @dev This library allows for transferring and holding native tokens and ERC20 tokens
library CurrencyLibrary {
/// @notice Additional context for ERC-7751 wrapped error when a native transfer fails
error NativeTransferFailed();
/// @notice Additional context for ERC-7751 wrapped error when an ERC20 transfer fails
error ERC20TransferFailed();
/// @notice A constant to represent the native currency
Currency public constant ADDRESS_ZERO = Currency.wrap(address(0));
function transfer(Currency currency, address to, uint256 amount) internal {
// altered from https://github.com/transmissions11/solmate/blob/44a9963d4c78111f77caa0e65d677b8b46d6f2e6/src/utils/SafeTransferLib.sol
// modified custom error selectors
bool success;
if (currency.isAddressZero()) {
assembly ("memory-safe") {
// Transfer the ETH and revert if it fails.
success := call(gas(), to, amount, 0, 0, 0, 0)
}
// revert with NativeTransferFailed, containing the bubbled up error as an argument
if (!success) {
CustomRevert.bubbleUpAndRevertWith(to, bytes4(0), NativeTransferFailed.selector);
}
} else {
assembly ("memory-safe") {
// Get a pointer to some free memory.
let fmp := mload(0x40)
// Write the abi-encoded calldata into memory, beginning with the function selector.
mstore(fmp, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
mstore(add(fmp, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
mstore(add(fmp, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.
success :=
and(
// Set success to whether the call reverted, if not we check it either
// returned exactly 1 (can't just be non-zero data), or had no return data.
or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
// We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
// We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
// Counterintuitively, this call must be positioned second to the or() call in the
// surrounding and() call or else returndatasize() will be zero during the computation.
call(gas(), currency, 0, fmp, 68, 0, 32)
)
// Now clean the memory we used
mstore(fmp, 0) // 4 byte `selector` and 28 bytes of `to` were stored here
mstore(add(fmp, 0x20), 0) // 4 bytes of `to` and 28 bytes of `amount` were stored here
mstore(add(fmp, 0x40), 0) // 4 bytes of `amount` were stored here
}
// revert with ERC20TransferFailed, containing the bubbled up error as an argument
if (!success) {
CustomRevert.bubbleUpAndRevertWith(
Currency.unwrap(currency), IERC20Minimal.transfer.selector, ERC20TransferFailed.selector
);
}
}
}
function balanceOfSelf(Currency currency) internal view returns (uint256) {
if (currency.isAddressZero()) {
return address(this).balance;
} else {
return IERC20Minimal(Currency.unwrap(currency)).balanceOf(address(this));
}
}
function balanceOf(Currency currency, address owner) internal view returns (uint256) {
if (currency.isAddressZero()) {
return owner.balance;
} else {
return IERC20Minimal(Currency.unwrap(currency)).balanceOf(owner);
}
}
function isAddressZero(Currency currency) internal pure returns (bool) {
return Currency.unwrap(currency) == Currency.unwrap(ADDRESS_ZERO);
}
function toId(Currency currency) internal pure returns (uint256) {
return uint160(Currency.unwrap(currency));
}
// If the upper 12 bytes are non-zero, they will be zero-ed out
// Therefore, fromId() and toId() are not inverses of each other
function fromId(uint256 id) internal pure returns (Currency) {
return Currency.wrap(address(uint160(id)));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {SafeCast} from "../libraries/SafeCast.sol";
/// @dev Two `int128` values packed into a single `int256` where the upper 128 bits represent the amount0
/// and the lower 128 bits represent the amount1.
type BalanceDelta is int256;
using {add as +, sub as -, eq as ==, neq as !=} for BalanceDelta global;
using BalanceDeltaLibrary for BalanceDelta global;
using SafeCast for int256;
function toBalanceDelta(int128 _amount0, int128 _amount1) pure returns (BalanceDelta balanceDelta) {
assembly ("memory-safe") {
balanceDelta := or(shl(128, _amount0), and(sub(shl(128, 1), 1), _amount1))
}
}
function add(BalanceDelta a, BalanceDelta b) pure returns (BalanceDelta) {
int256 res0;
int256 res1;
assembly ("memory-safe") {
let a0 := sar(128, a)
let a1 := signextend(15, a)
let b0 := sar(128, b)
let b1 := signextend(15, b)
res0 := add(a0, b0)
res1 := add(a1, b1)
}
return toBalanceDelta(res0.toInt128(), res1.toInt128());
}
function sub(BalanceDelta a, BalanceDelta b) pure returns (BalanceDelta) {
int256 res0;
int256 res1;
assembly ("memory-safe") {
let a0 := sar(128, a)
let a1 := signextend(15, a)
let b0 := sar(128, b)
let b1 := signextend(15, b)
res0 := sub(a0, b0)
res1 := sub(a1, b1)
}
return toBalanceDelta(res0.toInt128(), res1.toInt128());
}
function eq(BalanceDelta a, BalanceDelta b) pure returns (bool) {
return BalanceDelta.unwrap(a) == BalanceDelta.unwrap(b);
}
function neq(BalanceDelta a, BalanceDelta b) pure returns (bool) {
return BalanceDelta.unwrap(a) != BalanceDelta.unwrap(b);
}
/// @notice Library for getting the amount0 and amount1 deltas from the BalanceDelta type
library BalanceDeltaLibrary {
/// @notice A BalanceDelta of 0
BalanceDelta public constant ZERO_DELTA = BalanceDelta.wrap(0);
function amount0(BalanceDelta balanceDelta) internal pure returns (int128 _amount0) {
assembly ("memory-safe") {
_amount0 := sar(128, balanceDelta)
}
}
function amount1(BalanceDelta balanceDelta) internal pure returns (int128 _amount1) {
assembly ("memory-safe") {
_amount1 := signextend(15, balanceDelta)
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IEIP712} from "./IEIP712.sol";
/// @title SignatureTransfer
/// @notice Handles ERC20 token transfers through signature based actions
/// @dev Requires user's token approval on the Permit2 contract
interface ISignatureTransfer is IEIP712 {
/// @notice Thrown when the requested amount for a transfer is larger than the permissioned amount
/// @param maxAmount The maximum amount a spender can request to transfer
error InvalidAmount(uint256 maxAmount);
/// @notice Thrown when the number of tokens permissioned to a spender does not match the number of tokens being transferred
/// @dev If the spender does not need to transfer the number of tokens permitted, the spender can request amount 0 to be transferred
error LengthMismatch();
/// @notice Emits an event when the owner successfully invalidates an unordered nonce.
event UnorderedNonceInvalidation(address indexed owner, uint256 word, uint256 mask);
/// @notice The token and amount details for a transfer signed in the permit transfer signature
struct TokenPermissions {
// ERC20 token address
address token;
// the maximum amount that can be spent
uint256 amount;
}
/// @notice The signed permit message for a single token transfer
struct PermitTransferFrom {
TokenPermissions permitted;
// a unique value for every token owner's signature to prevent signature replays
uint256 nonce;
// deadline on the permit signature
uint256 deadline;
}
/// @notice Specifies the recipient address and amount for batched transfers.
/// @dev Recipients and amounts correspond to the index of the signed token permissions array.
/// @dev Reverts if the requested amount is greater than the permitted signed amount.
struct SignatureTransferDetails {
// recipient address
address to;
// spender requested amount
uint256 requestedAmount;
}
/// @notice Used to reconstruct the signed permit message for multiple token transfers
/// @dev Do not need to pass in spender address as it is required that it is msg.sender
/// @dev Note that a user still signs over a spender address
struct PermitBatchTransferFrom {
// the tokens and corresponding amounts permitted for a transfer
TokenPermissions[] permitted;
// a unique value for every token owner's signature to prevent signature replays
uint256 nonce;
// deadline on the permit signature
uint256 deadline;
}
/// @notice A map from token owner address and a caller specified word index to a bitmap. Used to set bits in the bitmap to prevent against signature replay protection
/// @dev Uses unordered nonces so that permit messages do not need to be spent in a certain order
/// @dev The mapping is indexed first by the token owner, then by an index specified in the nonce
/// @dev It returns a uint256 bitmap
/// @dev The index, or wordPosition is capped at type(uint248).max
function nonceBitmap(address, uint256) external view returns (uint256);
/// @notice Transfers a token using a signed permit message
/// @dev Reverts if the requested amount is greater than the permitted signed amount
/// @param permit The permit data signed over by the owner
/// @param owner The owner of the tokens to transfer
/// @param transferDetails The spender's requested transfer details for the permitted token
/// @param signature The signature to verify
function permitTransferFrom(
PermitTransferFrom memory permit,
SignatureTransferDetails calldata transferDetails,
address owner,
bytes calldata signature
) external;
/// @notice Transfers a token using a signed permit message
/// @notice Includes extra data provided by the caller to verify signature over
/// @dev The witness type string must follow EIP712 ordering of nested structs and must include the TokenPermissions type definition
/// @dev Reverts if the requested amount is greater than the permitted signed amount
/// @param permit The permit data signed over by the owner
/// @param owner The owner of the tokens to transfer
/// @param transferDetails The spender's requested transfer details for the permitted token
/// @param witness Extra data to include when checking the user signature
/// @param witnessTypeString The EIP-712 type definition for remaining string stub of the typehash
/// @param signature The signature to verify
function permitWitnessTransferFrom(
PermitTransferFrom memory permit,
SignatureTransferDetails calldata transferDetails,
address owner,
bytes32 witness,
string calldata witnessTypeString,
bytes calldata signature
) external;
/// @notice Transfers multiple tokens using a signed permit message
/// @param permit The permit data signed over by the owner
/// @param owner The owner of the tokens to transfer
/// @param transferDetails Specifies the recipient and requested amount for the token transfer
/// @param signature The signature to verify
function permitTransferFrom(
PermitBatchTransferFrom memory permit,
SignatureTransferDetails[] calldata transferDetails,
address owner,
bytes calldata signature
) external;
/// @notice Transfers multiple tokens using a signed permit message
/// @dev The witness type string must follow EIP712 ordering of nested structs and must include the TokenPermissions type definition
/// @notice Includes extra data provided by the caller to verify signature over
/// @param permit The permit data signed over by the owner
/// @param owner The owner of the tokens to transfer
/// @param transferDetails Specifies the recipient and requested amount for the token transfer
/// @param witness Extra data to include when checking the user signature
/// @param witnessTypeString The EIP-712 type definition for remaining string stub of the typehash
/// @param signature The signature to verify
function permitWitnessTransferFrom(
PermitBatchTransferFrom memory permit,
SignatureTransferDetails[] calldata transferDetails,
address owner,
bytes32 witness,
string calldata witnessTypeString,
bytes calldata signature
) external;
/// @notice Invalidates the bits specified in mask for the bitmap at the word position
/// @dev The wordPos is maxed at type(uint248).max
/// @param wordPos A number to index the nonceBitmap at
/// @param mask A bitmap masked against msg.sender's current bitmap at the word position
function invalidateUnorderedNonces(uint256 wordPos, uint256 mask) external;
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;
/// @title SwapFlags Library
/// @notice Library for managing swap configuration flags using bitwise operations
/// @dev Provides constants and utilities for working with swap flags encoded as uint8
library SwapFlags {
/// @notice Flag indicating a single pool swap vs multi-hop swap
/// @dev Bit position 0 (0b00001)
uint8 constant SINGLE_SWAP = 1 << 0;
/// @notice Flag indicating exact output swap vs exact input swap
/// @dev Bit position 1 (0b00010)
uint8 constant EXACT_OUTPUT = 1 << 1;
/// @notice Flag indicating input token is ERC6909
/// @dev Bit position 2 (0b00100)
uint8 constant INPUT_6909 = 1 << 2;
/// @notice Flag indicating output token is ERC6909
/// @dev Bit position 3 (0b01000)
uint8 constant OUTPUT_6909 = 1 << 3;
/// @notice Flag indicating swap uses Permit2 for token approvals
/// @dev Bit position 4 (0b10000)
uint8 constant PERMIT2 = 1 << 4;
/// @notice Unpacks individual boolean flags from packed uint8
/// @param flags The packed uint8 containing all flag bits
/// @return singleSwap True if single pool swap
/// @return exactOutput True if exact output swap
/// @return input6909 True if input token is ERC6909
/// @return output6909 True if output token is ERC6909
/// @return permit2 True if using Permit2
function unpackFlags(uint8 flags)
internal
pure
returns (bool singleSwap, bool exactOutput, bool input6909, bool output6909, bool permit2)
{
singleSwap = flags & SINGLE_SWAP != 0;
exactOutput = flags & EXACT_OUTPUT != 0;
input6909 = flags & INPUT_6909 != 0;
output6909 = flags & OUTPUT_6909 != 0;
permit2 = flags & PERMIT2 != 0;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {CustomRevert} from "./CustomRevert.sol";
/// @title Safe casting methods
/// @notice Contains methods for safely casting between types
library SafeCast {
using CustomRevert for bytes4;
error SafeCastOverflow();
/// @notice Cast a uint256 to a uint160, revert on overflow
/// @param x The uint256 to be downcasted
/// @return y The downcasted integer, now type uint160
function toUint160(uint256 x) internal pure returns (uint160 y) {
y = uint160(x);
if (y != x) SafeCastOverflow.selector.revertWith();
}
/// @notice Cast a uint256 to a uint128, revert on overflow
/// @param x The uint256 to be downcasted
/// @return y The downcasted integer, now type uint128
function toUint128(uint256 x) internal pure returns (uint128 y) {
y = uint128(x);
if (x != y) SafeCastOverflow.selector.revertWith();
}
/// @notice Cast a int128 to a uint128, revert on overflow or underflow
/// @param x The int128 to be casted
/// @return y The casted integer, now type uint128
function toUint128(int128 x) internal pure returns (uint128 y) {
if (x < 0) SafeCastOverflow.selector.revertWith();
y = uint128(x);
}
/// @notice Cast a int256 to a int128, revert on overflow or underflow
/// @param x The int256 to be downcasted
/// @return y The downcasted integer, now type int128
function toInt128(int256 x) internal pure returns (int128 y) {
y = int128(x);
if (y != x) SafeCastOverflow.selector.revertWith();
}
/// @notice Cast a uint256 to a int256, revert on overflow
/// @param x The uint256 to be casted
/// @return y The casted integer, now type int256
function toInt256(uint256 x) internal pure returns (int256 y) {
y = int256(x);
if (y < 0) SafeCastOverflow.selector.revertWith();
}
/// @notice Cast a uint256 to a int128, revert on overflow
/// @param x The uint256 to be downcasted
/// @return The downcasted integer, now type int128
function toInt128(uint256 x) internal pure returns (int128) {
if (x >= 1 << 127) SafeCastOverflow.selector.revertWith();
return int128(int256(x));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {BitMath} from "./BitMath.sol";
import {CustomRevert} from "./CustomRevert.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
library TickMath {
using CustomRevert for bytes4;
/// @notice Thrown when the tick passed to #getSqrtPriceAtTick is not between MIN_TICK and MAX_TICK
error InvalidTick(int24 tick);
/// @notice Thrown when the price passed to #getTickAtSqrtPrice does not correspond to a price between MIN_TICK and MAX_TICK
error InvalidSqrtPrice(uint160 sqrtPriceX96);
/// @dev The minimum tick that may be passed to #getSqrtPriceAtTick computed from log base 1.0001 of 2**-128
/// @dev If ever MIN_TICK and MAX_TICK are not centered around 0, the absTick logic in getSqrtPriceAtTick cannot be used
int24 internal constant MIN_TICK = -887272;
/// @dev The maximum tick that may be passed to #getSqrtPriceAtTick computed from log base 1.0001 of 2**128
/// @dev If ever MIN_TICK and MAX_TICK are not centered around 0, the absTick logic in getSqrtPriceAtTick cannot be used
int24 internal constant MAX_TICK = 887272;
/// @dev The minimum tick spacing value drawn from the range of type int16 that is greater than 0, i.e. min from the range [1, 32767]
int24 internal constant MIN_TICK_SPACING = 1;
/// @dev The maximum tick spacing value drawn from the range of type int16, i.e. max from the range [1, 32767]
int24 internal constant MAX_TICK_SPACING = type(int16).max;
/// @dev The minimum value that can be returned from #getSqrtPriceAtTick. Equivalent to getSqrtPriceAtTick(MIN_TICK)
uint160 internal constant MIN_SQRT_PRICE = 4295128739;
/// @dev The maximum value that can be returned from #getSqrtPriceAtTick. Equivalent to getSqrtPriceAtTick(MAX_TICK)
uint160 internal constant MAX_SQRT_PRICE = 1461446703485210103287273052203988822378723970342;
/// @dev A threshold used for optimized bounds check, equals `MAX_SQRT_PRICE - MIN_SQRT_PRICE - 1`
uint160 internal constant MAX_SQRT_PRICE_MINUS_MIN_SQRT_PRICE_MINUS_ONE =
1461446703485210103287273052203988822378723970342 - 4295128739 - 1;
/// @notice Given a tickSpacing, compute the maximum usable tick
function maxUsableTick(int24 tickSpacing) internal pure returns (int24) {
unchecked {
return (MAX_TICK / tickSpacing) * tickSpacing;
}
}
/// @notice Given a tickSpacing, compute the minimum usable tick
function minUsableTick(int24 tickSpacing) internal pure returns (int24) {
unchecked {
return (MIN_TICK / tickSpacing) * tickSpacing;
}
}
/// @notice Calculates sqrt(1.0001^tick) * 2^96
/// @dev Throws if |tick| > max tick
/// @param tick The input tick for the above formula
/// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the price of the two assets (currency1/currency0)
/// at the given tick
function getSqrtPriceAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
unchecked {
uint256 absTick;
assembly ("memory-safe") {
tick := signextend(2, tick)
// mask = 0 if tick >= 0 else -1 (all 1s)
let mask := sar(255, tick)
// if tick >= 0, |tick| = tick = 0 ^ tick
// if tick < 0, |tick| = ~~|tick| = ~(-|tick| - 1) = ~(tick - 1) = (-1) ^ (tick - 1)
// either way, |tick| = mask ^ (tick + mask)
absTick := xor(mask, add(mask, tick))
}
if (absTick > uint256(int256(MAX_TICK))) InvalidTick.selector.revertWith(tick);
// The tick is decomposed into bits, and for each bit with index i that is set, the product of 1/sqrt(1.0001^(2^i))
// is calculated (using Q128.128). The constants used for this calculation are rounded to the nearest integer
// Equivalent to:
// price = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;
// or price = int(2**128 / sqrt(1.0001)) if (absTick & 0x1) else 1 << 128
uint256 price;
assembly ("memory-safe") {
price := xor(shl(128, 1), mul(xor(shl(128, 1), 0xfffcb933bd6fad37aa2d162d1a594001), and(absTick, 0x1)))
}
if (absTick & 0x2 != 0) price = (price * 0xfff97272373d413259a46990580e213a) >> 128;
if (absTick & 0x4 != 0) price = (price * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
if (absTick & 0x8 != 0) price = (price * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
if (absTick & 0x10 != 0) price = (price * 0xffcb9843d60f6159c9db58835c926644) >> 128;
if (absTick & 0x20 != 0) price = (price * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
if (absTick & 0x40 != 0) price = (price * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
if (absTick & 0x80 != 0) price = (price * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
if (absTick & 0x100 != 0) price = (price * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
if (absTick & 0x200 != 0) price = (price * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
if (absTick & 0x400 != 0) price = (price * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
if (absTick & 0x800 != 0) price = (price * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
if (absTick & 0x1000 != 0) price = (price * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
if (absTick & 0x2000 != 0) price = (price * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
if (absTick & 0x4000 != 0) price = (price * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
if (absTick & 0x8000 != 0) price = (price * 0x31be135f97d08fd981231505542fcfa6) >> 128;
if (absTick & 0x10000 != 0) price = (price * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
if (absTick & 0x20000 != 0) price = (price * 0x5d6af8dedb81196699c329225ee604) >> 128;
if (absTick & 0x40000 != 0) price = (price * 0x2216e584f5fa1ea926041bedfe98) >> 128;
if (absTick & 0x80000 != 0) price = (price * 0x48a170391f7dc42444e8fa2) >> 128;
assembly ("memory-safe") {
// if (tick > 0) price = type(uint256).max / price;
if sgt(tick, 0) { price := div(not(0), price) }
// 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 getTickAtSqrtPrice of the output price is always consistent
// `sub(shl(32, 1), 1)` is `type(uint32).max`
// `price + type(uint32).max` will not overflow because `price` fits in 192 bits
sqrtPriceX96 := shr(32, add(price, sub(shl(32, 1), 1)))
}
}
}
/// @notice Calculates the greatest tick value such that getSqrtPriceAtTick(tick) <= sqrtPriceX96
/// @dev Throws in case sqrtPriceX96 < MIN_SQRT_PRICE, as MIN_SQRT_PRICE is the lowest value getSqrtPriceAtTick may
/// ever return.
/// @param sqrtPriceX96 The sqrt price for which to compute the tick as a Q64.96
/// @return tick The greatest tick for which the getSqrtPriceAtTick(tick) is less than or equal to the input sqrtPriceX96
function getTickAtSqrtPrice(uint160 sqrtPriceX96) internal pure returns (int24 tick) {
unchecked {
// Equivalent: if (sqrtPriceX96 < MIN_SQRT_PRICE || sqrtPriceX96 >= MAX_SQRT_PRICE) revert InvalidSqrtPrice();
// second inequality must be >= because the price can never reach the price at the max tick
// if sqrtPriceX96 < MIN_SQRT_PRICE, the `sub` underflows and `gt` is true
// if sqrtPriceX96 >= MAX_SQRT_PRICE, sqrtPriceX96 - MIN_SQRT_PRICE > MAX_SQRT_PRICE - MIN_SQRT_PRICE - 1
if ((sqrtPriceX96 - MIN_SQRT_PRICE) > MAX_SQRT_PRICE_MINUS_MIN_SQRT_PRICE_MINUS_ONE) {
InvalidSqrtPrice.selector.revertWith(sqrtPriceX96);
}
uint256 price = uint256(sqrtPriceX96) << 32;
uint256 r = price;
uint256 msb = BitMath.mostSignificantBit(r);
if (msb >= 128) r = price >> (msb - 127);
else r = price << (127 - msb);
int256 log_2 = (int256(msb) - 128) << 64;
assembly ("memory-safe") {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(63, f))
r := shr(f, r)
}
assembly ("memory-safe") {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(62, f))
r := shr(f, r)
}
assembly ("memory-safe") {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(61, f))
r := shr(f, r)
}
assembly ("memory-safe") {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(60, f))
r := shr(f, r)
}
assembly ("memory-safe") {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(59, f))
r := shr(f, r)
}
assembly ("memory-safe") {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(58, f))
r := shr(f, r)
}
assembly ("memory-safe") {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(57, f))
r := shr(f, r)
}
assembly ("memory-safe") {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(56, f))
r := shr(f, r)
}
assembly ("memory-safe") {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(55, f))
r := shr(f, r)
}
assembly ("memory-safe") {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(54, f))
r := shr(f, r)
}
assembly ("memory-safe") {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(53, f))
r := shr(f, r)
}
assembly ("memory-safe") {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(52, f))
r := shr(f, r)
}
assembly ("memory-safe") {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(51, f))
r := shr(f, r)
}
assembly ("memory-safe") {
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; // Q22.128 number
// Magic number represents the ceiling of the maximum value of the error when approximating log_sqrt10001(x)
int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);
// Magic number represents the minimum value of the error when approximating log_sqrt10001(x), when
// sqrtPrice is from the range (2^-64, 2^64). This is safe as MIN_SQRT_PRICE is more than 2^-64. If MIN_SQRT_PRICE
// is changed, this may need to be changed too
int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);
tick = tickLow == tickHi ? tickLow : getSqrtPriceAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Currency} from "../../src/types/Currency.sol";
import {IERC20Minimal} from "../../src/interfaces/external/IERC20Minimal.sol";
import {IPoolManager} from "../../src/interfaces/IPoolManager.sol";
/// @notice Library used to interact with PoolManager.sol to settle any open deltas.
/// To settle a positive delta (a credit to the user), a user may take or mint.
/// To settle a negative delta (a debt on the user), a user make transfer or burn to pay off a debt.
/// @dev Note that sync() is called before any erc-20 transfer in `settle`.
library CurrencySettler {
/// @notice Settle (pay) a currency to the PoolManager
/// @param currency Currency to settle
/// @param manager IPoolManager to settle to
/// @param payer Address of the payer, the token sender
/// @param amount Amount to send
/// @param burn If true, burn the ERC-6909 token, otherwise ERC20-transfer to the PoolManager
function settle(Currency currency, IPoolManager manager, address payer, uint256 amount, bool burn) internal {
// for native currencies or burns, calling sync is not required
// short circuit for ERC-6909 burns to support ERC-6909-wrapped native tokens
if (burn) {
manager.burn(payer, currency.toId(), amount);
} else if (currency.isAddressZero()) {
manager.settle{value: amount}();
} else {
manager.sync(currency);
if (payer != address(this)) {
IERC20Minimal(Currency.unwrap(currency)).transferFrom(payer, address(manager), amount);
} else {
IERC20Minimal(Currency.unwrap(currency)).transfer(address(manager), amount);
}
manager.settle();
}
}
/// @notice Take (receive) a currency from the PoolManager
/// @param currency Currency to take
/// @param manager IPoolManager to take from
/// @param recipient Address of the recipient, the token receiver
/// @param amount Amount to receive
/// @param claims If true, mint the ERC-6909 token, otherwise ERC20-transfer from the PoolManager to recipient
function take(Currency currency, IPoolManager manager, address recipient, uint256 amount, bool claims) internal {
claims ? manager.mint(recipient, currency.toId(), amount) : manager.take(currency, recipient, amount);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IUnlockCallback} from "@uniswap/v4-core/src/interfaces/callback/IUnlockCallback.sol";
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
import {ImmutableState} from "./ImmutableState.sol";
/// @title Safe Callback
/// @notice A contract that only allows the Uniswap v4 PoolManager to call the unlockCallback
abstract contract SafeCallback is ImmutableState, IUnlockCallback {
/// @notice Thrown when calling unlockCallback where the caller is not PoolManager
error NotPoolManager();
constructor(IPoolManager _poolManager) ImmutableState(_poolManager) {}
/// @notice Only allow calls from the PoolManager contract
modifier onlyPoolManager() {
if (msg.sender != address(poolManager)) revert NotPoolManager();
_;
}
/// @inheritdoc IUnlockCallback
/// @dev We force the onlyPoolManager modifier by exposing a virtual function after the onlyPoolManager check.
function unlockCallback(bytes calldata data) external onlyPoolManager returns (bytes memory) {
return _unlockCallback(data);
}
/// @dev to be implemented by the child contract, to safely guarantee the logic is only executed by the PoolManager
function _unlockCallback(bytes calldata data) internal virtual returns (bytes memory);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {PoolKey} from "../types/PoolKey.sol";
import {BalanceDelta} from "../types/BalanceDelta.sol";
import {IPoolManager} from "./IPoolManager.sol";
import {BeforeSwapDelta} from "../types/BeforeSwapDelta.sol";
/// @notice V4 decides whether to invoke specific hooks by inspecting the least significant bits
/// of the address that the hooks contract is deployed to.
/// For example, a hooks contract deployed to address: 0x0000000000000000000000000000000000002400
/// has the lowest bits '10 0100 0000 0000' which would cause the 'before initialize' and 'after add liquidity' hooks to be used.
/// See the Hooks library for the full spec.
/// @dev Should only be callable by the v4 PoolManager.
interface IHooks {
/// @notice The hook called before the state of a pool is initialized
/// @param sender The initial msg.sender for the initialize call
/// @param key The key for the pool being initialized
/// @param sqrtPriceX96 The sqrt(price) of the pool as a Q64.96
/// @return bytes4 The function selector for the hook
function beforeInitialize(address sender, PoolKey calldata key, uint160 sqrtPriceX96) external returns (bytes4);
/// @notice The hook called after the state of a pool is initialized
/// @param sender The initial msg.sender for the initialize call
/// @param key The key for the pool being initialized
/// @param sqrtPriceX96 The sqrt(price) of the pool as a Q64.96
/// @param tick The current tick after the state of a pool is initialized
/// @return bytes4 The function selector for the hook
function afterInitialize(address sender, PoolKey calldata key, uint160 sqrtPriceX96, int24 tick)
external
returns (bytes4);
/// @notice The hook called before liquidity is added
/// @param sender The initial msg.sender for the add liquidity call
/// @param key The key for the pool
/// @param params The parameters for adding liquidity
/// @param hookData Arbitrary data handed into the PoolManager by the liquidity provider to be passed on to the hook
/// @return bytes4 The function selector for the hook
function beforeAddLiquidity(
address sender,
PoolKey calldata key,
IPoolManager.ModifyLiquidityParams calldata params,
bytes calldata hookData
) external returns (bytes4);
/// @notice The hook called after liquidity is added
/// @param sender The initial msg.sender for the add liquidity call
/// @param key The key for the pool
/// @param params The parameters for adding liquidity
/// @param delta The caller's balance delta after adding liquidity; the sum of principal delta, fees accrued, and hook delta
/// @param feesAccrued The fees accrued since the last time fees were collected from this position
/// @param hookData Arbitrary data handed into the PoolManager by the liquidity provider to be passed on to the hook
/// @return bytes4 The function selector for the hook
/// @return BalanceDelta The hook's delta in token0 and token1. Positive: the hook is owed/took currency, negative: the hook owes/sent currency
function afterAddLiquidity(
address sender,
PoolKey calldata key,
IPoolManager.ModifyLiquidityParams calldata params,
BalanceDelta delta,
BalanceDelta feesAccrued,
bytes calldata hookData
) external returns (bytes4, BalanceDelta);
/// @notice The hook called before liquidity is removed
/// @param sender The initial msg.sender for the remove liquidity call
/// @param key The key for the pool
/// @param params The parameters for removing liquidity
/// @param hookData Arbitrary data handed into the PoolManager by the liquidity provider to be be passed on to the hook
/// @return bytes4 The function selector for the hook
function beforeRemoveLiquidity(
address sender,
PoolKey calldata key,
IPoolManager.ModifyLiquidityParams calldata params,
bytes calldata hookData
) external returns (bytes4);
/// @notice The hook called after liquidity is removed
/// @param sender The initial msg.sender for the remove liquidity call
/// @param key The key for the pool
/// @param params The parameters for removing liquidity
/// @param delta The caller's balance delta after removing liquidity; the sum of principal delta, fees accrued, and hook delta
/// @param feesAccrued The fees accrued since the last time fees were collected from this position
/// @param hookData Arbitrary data handed into the PoolManager by the liquidity provider to be be passed on to the hook
/// @return bytes4 The function selector for the hook
/// @return BalanceDelta The hook's delta in token0 and token1. Positive: the hook is owed/took currency, negative: the hook owes/sent currency
function afterRemoveLiquidity(
address sender,
PoolKey calldata key,
IPoolManager.ModifyLiquidityParams calldata params,
BalanceDelta delta,
BalanceDelta feesAccrued,
bytes calldata hookData
) external returns (bytes4, BalanceDelta);
/// @notice The hook called before a swap
/// @param sender The initial msg.sender for the swap call
/// @param key The key for the pool
/// @param params The parameters for the swap
/// @param hookData Arbitrary data handed into the PoolManager by the swapper to be be passed on to the hook
/// @return bytes4 The function selector for the hook
/// @return BeforeSwapDelta The hook's delta in specified and unspecified currencies. Positive: the hook is owed/took currency, negative: the hook owes/sent currency
/// @return uint24 Optionally override the lp fee, only used if three conditions are met: 1. the Pool has a dynamic fee, 2. the value's 2nd highest bit is set (23rd bit, 0x400000), and 3. the value is less than or equal to the maximum fee (1 million)
function beforeSwap(
address sender,
PoolKey calldata key,
IPoolManager.SwapParams calldata params,
bytes calldata hookData
) external returns (bytes4, BeforeSwapDelta, uint24);
/// @notice The hook called after a swap
/// @param sender The initial msg.sender for the swap call
/// @param key The key for the pool
/// @param params The parameters for the swap
/// @param delta The amount owed to the caller (positive) or owed to the pool (negative)
/// @param hookData Arbitrary data handed into the PoolManager by the swapper to be be passed on to the hook
/// @return bytes4 The function selector for the hook
/// @return int128 The hook's delta in unspecified currency. Positive: the hook is owed/took currency, negative: the hook owes/sent currency
function afterSwap(
address sender,
PoolKey calldata key,
IPoolManager.SwapParams calldata params,
BalanceDelta delta,
bytes calldata hookData
) external returns (bytes4, int128);
/// @notice The hook called before donate
/// @param sender The initial msg.sender for the donate call
/// @param key The key for the pool
/// @param amount0 The amount of token0 being donated
/// @param amount1 The amount of token1 being donated
/// @param hookData Arbitrary data handed into the PoolManager by the donor to be be passed on to the hook
/// @return bytes4 The function selector for the hook
function beforeDonate(
address sender,
PoolKey calldata key,
uint256 amount0,
uint256 amount1,
bytes calldata hookData
) external returns (bytes4);
/// @notice The hook called after donate
/// @param sender The initial msg.sender for the donate call
/// @param key The key for the pool
/// @param amount0 The amount of token0 being donated
/// @param amount1 The amount of token1 being donated
/// @param hookData Arbitrary data handed into the PoolManager by the donor to be be passed on to the hook
/// @return bytes4 The function selector for the hook
function afterDonate(
address sender,
PoolKey calldata key,
uint256 amount0,
uint256 amount1,
bytes calldata hookData
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {PoolKey} from "./PoolKey.sol";
type PoolId is bytes32;
/// @notice Library for computing the ID of a pool
library PoolIdLibrary {
/// @notice Returns value equal to keccak256(abi.encode(poolKey))
function toId(PoolKey memory poolKey) internal pure returns (PoolId poolId) {
assembly ("memory-safe") {
// 0xa0 represents the total size of the poolKey struct (5 slots of 32 bytes)
poolId := keccak256(poolKey, 0xa0)
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title Minimal ERC20 interface for Uniswap
/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3
interface IERC20Minimal {
/// @notice Returns an account's balance in the token
/// @param account The account for which to look up the number of tokens it has, i.e. its balance
/// @return The number of tokens held by the account
function balanceOf(address account) external view returns (uint256);
/// @notice Transfers the amount of token from the `msg.sender` to the recipient
/// @param recipient The account that will receive the amount transferred
/// @param amount The number of tokens to send from the sender to the recipient
/// @return Returns true for a successful transfer, false for an unsuccessful transfer
function transfer(address recipient, uint256 amount) external returns (bool);
/// @notice Returns the current allowance given to a spender by an owner
/// @param owner The account of the token owner
/// @param spender The account of the token spender
/// @return The current allowance granted by `owner` to `spender`
function allowance(address owner, address spender) external view returns (uint256);
/// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`
/// @param spender The account which will be allowed to spend a given amount of the owners tokens
/// @param amount The amount of tokens allowed to be used by `spender`
/// @return Returns true for a successful approval, false for unsuccessful
function approve(address spender, uint256 amount) external returns (bool);
/// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`
/// @param sender The account from which the transfer will be initiated
/// @param recipient The recipient of the transfer
/// @param amount The amount of the transfer
/// @return Returns true for a successful transfer, false for unsuccessful
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.
/// @param from The account from which the tokens were sent, i.e. the balance decreased
/// @param to The account to which the tokens were sent, i.e. the balance increased
/// @param value The amount of tokens that were transferred
event Transfer(address indexed from, address indexed to, uint256 value);
/// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.
/// @param owner The account that approved spending of its tokens
/// @param spender The account for which the spending allowance was modified
/// @param value The new allowance from the owner to the spender
event Approval(address indexed owner, address indexed spender, uint256 value);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title Library for reverting with custom errors efficiently
/// @notice Contains functions for reverting with custom errors with different argument types efficiently
/// @dev To use this library, declare `using CustomRevert for bytes4;` and replace `revert CustomError()` with
/// `CustomError.selector.revertWith()`
/// @dev The functions may tamper with the free memory pointer but it is fine since the call context is exited immediately
library CustomRevert {
/// @dev ERC-7751 error for wrapping bubbled up reverts
error WrappedError(address target, bytes4 selector, bytes reason, bytes details);
/// @dev Reverts with the selector of a custom error in the scratch space
function revertWith(bytes4 selector) internal pure {
assembly ("memory-safe") {
mstore(0, selector)
revert(0, 0x04)
}
}
/// @dev Reverts with a custom error with an address argument in the scratch space
function revertWith(bytes4 selector, address addr) internal pure {
assembly ("memory-safe") {
mstore(0, selector)
mstore(0x04, and(addr, 0xffffffffffffffffffffffffffffffffffffffff))
revert(0, 0x24)
}
}
/// @dev Reverts with a custom error with an int24 argument in the scratch space
function revertWith(bytes4 selector, int24 value) internal pure {
assembly ("memory-safe") {
mstore(0, selector)
mstore(0x04, signextend(2, value))
revert(0, 0x24)
}
}
/// @dev Reverts with a custom error with a uint160 argument in the scratch space
function revertWith(bytes4 selector, uint160 value) internal pure {
assembly ("memory-safe") {
mstore(0, selector)
mstore(0x04, and(value, 0xffffffffffffffffffffffffffffffffffffffff))
revert(0, 0x24)
}
}
/// @dev Reverts with a custom error with two int24 arguments
function revertWith(bytes4 selector, int24 value1, int24 value2) internal pure {
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(fmp, selector)
mstore(add(fmp, 0x04), signextend(2, value1))
mstore(add(fmp, 0x24), signextend(2, value2))
revert(fmp, 0x44)
}
}
/// @dev Reverts with a custom error with two uint160 arguments
function revertWith(bytes4 selector, uint160 value1, uint160 value2) internal pure {
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(fmp, selector)
mstore(add(fmp, 0x04), and(value1, 0xffffffffffffffffffffffffffffffffffffffff))
mstore(add(fmp, 0x24), and(value2, 0xffffffffffffffffffffffffffffffffffffffff))
revert(fmp, 0x44)
}
}
/// @dev Reverts with a custom error with two address arguments
function revertWith(bytes4 selector, address value1, address value2) internal pure {
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(fmp, selector)
mstore(add(fmp, 0x04), and(value1, 0xffffffffffffffffffffffffffffffffffffffff))
mstore(add(fmp, 0x24), and(value2, 0xffffffffffffffffffffffffffffffffffffffff))
revert(fmp, 0x44)
}
}
/// @notice bubble up the revert message returned by a call and revert with a wrapped ERC-7751 error
/// @dev this method can be vulnerable to revert data bombs
function bubbleUpAndRevertWith(
address revertingContract,
bytes4 revertingFunctionSelector,
bytes4 additionalContext
) internal pure {
bytes4 wrappedErrorSelector = WrappedError.selector;
assembly ("memory-safe") {
// Ensure the size of the revert data is a multiple of 32 bytes
let encodedDataSize := mul(div(add(returndatasize(), 31), 32), 32)
let fmp := mload(0x40)
// Encode wrapped error selector, address, function selector, offset, additional context, size, revert reason
mstore(fmp, wrappedErrorSelector)
mstore(add(fmp, 0x04), and(revertingContract, 0xffffffffffffffffffffffffffffffffffffffff))
mstore(
add(fmp, 0x24),
and(revertingFunctionSelector, 0xffffffff00000000000000000000000000000000000000000000000000000000)
)
// offset revert reason
mstore(add(fmp, 0x44), 0x80)
// offset additional context
mstore(add(fmp, 0x64), add(0xa0, encodedDataSize))
// size revert reason
mstore(add(fmp, 0x84), returndatasize())
// revert reason
returndatacopy(add(fmp, 0xa4), 0, returndatasize())
// size additional context
mstore(add(fmp, add(0xa4, encodedDataSize)), 0x04)
// additional context
mstore(
add(fmp, add(0xc4, encodedDataSize)),
and(additionalContext, 0xffffffff00000000000000000000000000000000000000000000000000000000)
)
revert(fmp, add(0xe4, encodedDataSize))
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IEIP712 {
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title BitMath
/// @dev This library provides functionality for computing bit properties of an unsigned integer
/// @author Solady (https://github.com/Vectorized/solady/blob/8200a70e8dc2a77ecb074fc2e99a2a0d36547522/src/utils/LibBit.sol)
library BitMath {
/// @notice Returns the index of the most significant bit of the number,
/// where the least significant bit is at index 0 and the most significant bit is at index 255
/// @param x the value for which to compute the most significant bit, must be greater than 0
/// @return r the index of the most significant bit
function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0);
assembly ("memory-safe") {
r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))
r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))
r := or(r, shl(5, lt(0xffffffff, shr(r, x))))
r := or(r, shl(4, lt(0xffff, shr(r, x))))
r := or(r, shl(3, lt(0xff, shr(r, x))))
// forgefmt: disable-next-item
r := or(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)),
0x0706060506020500060203020504000106050205030304010505030400000000))
}
}
/// @notice Returns the index of the least significant bit of the number,
/// where the least significant bit is at index 0 and the most significant bit is at index 255
/// @param x the value for which to compute the least significant bit, must be greater than 0
/// @return r the index of the least significant bit
function leastSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0);
assembly ("memory-safe") {
// Isolate the least significant bit.
x := and(x, sub(0, x))
// For the upper 3 bits of the result, use a De Bruijn-like lookup.
// Credit to adhusson: https://blog.adhusson.com/cheap-find-first-set-evm/
// forgefmt: disable-next-item
r := shl(5, shr(252, shl(shl(2, shr(250, mul(x,
0xb6db6db6ddddddddd34d34d349249249210842108c6318c639ce739cffffffff))),
0x8040405543005266443200005020610674053026020000107506200176117077)))
// For the lower 5 bits of the result, use a De Bruijn lookup.
// forgefmt: disable-next-item
r := or(r, byte(and(div(0xd76453e0, shr(r, x)), 0x1f),
0x001f0d1e100c1d070f090b19131c1706010e11080a1a141802121b1503160405))
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {Currency} from "../types/Currency.sol";
import {PoolKey} from "../types/PoolKey.sol";
import {IHooks} from "./IHooks.sol";
import {IERC6909Claims} from "./external/IERC6909Claims.sol";
import {IProtocolFees} from "./IProtocolFees.sol";
import {BalanceDelta} from "../types/BalanceDelta.sol";
import {PoolId} from "../types/PoolId.sol";
import {IExtsload} from "./IExtsload.sol";
import {IExttload} from "./IExttload.sol";
/// @notice Interface for the PoolManager
interface IPoolManager is IProtocolFees, IERC6909Claims, IExtsload, IExttload {
/// @notice Thrown when a currency is not netted out after the contract is unlocked
error CurrencyNotSettled();
/// @notice Thrown when trying to interact with a non-initialized pool
error PoolNotInitialized();
/// @notice Thrown when unlock is called, but the contract is already unlocked
error AlreadyUnlocked();
/// @notice Thrown when a function is called that requires the contract to be unlocked, but it is not
error ManagerLocked();
/// @notice Pools are limited to type(int16).max tickSpacing in #initialize, to prevent overflow
error TickSpacingTooLarge(int24 tickSpacing);
/// @notice Pools must have a positive non-zero tickSpacing passed to #initialize
error TickSpacingTooSmall(int24 tickSpacing);
/// @notice PoolKey must have currencies where address(currency0) < address(currency1)
error CurrenciesOutOfOrderOrEqual(address currency0, address currency1);
/// @notice Thrown when a call to updateDynamicLPFee is made by an address that is not the hook,
/// or on a pool that does not have a dynamic swap fee.
error UnauthorizedDynamicLPFeeUpdate();
/// @notice Thrown when trying to swap amount of 0
error SwapAmountCannotBeZero();
///@notice Thrown when native currency is passed to a non native settlement
error NonzeroNativeValue();
/// @notice Thrown when `clear` is called with an amount that is not exactly equal to the open currency delta.
error MustClearExactPositiveDelta();
/// @notice Emitted when a new pool is initialized
/// @param id The abi encoded hash of the pool key struct for the new pool
/// @param currency0 The first currency of the pool by address sort order
/// @param currency1 The second currency of the pool by address sort order
/// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
/// @param tickSpacing The minimum number of ticks between initialized ticks
/// @param hooks The hooks contract address for the pool, or address(0) if none
/// @param sqrtPriceX96 The price of the pool on initialization
/// @param tick The initial tick of the pool corresponding to the initialized price
event Initialize(
PoolId indexed id,
Currency indexed currency0,
Currency indexed currency1,
uint24 fee,
int24 tickSpacing,
IHooks hooks,
uint160 sqrtPriceX96,
int24 tick
);
/// @notice Emitted when a liquidity position is modified
/// @param id The abi encoded hash of the pool key struct for the pool that was modified
/// @param sender The address that modified the pool
/// @param tickLower The lower tick of the position
/// @param tickUpper The upper tick of the position
/// @param liquidityDelta The amount of liquidity that was added or removed
/// @param salt The extra data to make positions unique
event ModifyLiquidity(
PoolId indexed id, address indexed sender, int24 tickLower, int24 tickUpper, int256 liquidityDelta, bytes32 salt
);
/// @notice Emitted for swaps between currency0 and currency1
/// @param id The abi encoded hash of the pool key struct for the pool that was modified
/// @param sender The address that initiated the swap call, and that received the callback
/// @param amount0 The delta of the currency0 balance of the pool
/// @param amount1 The delta of the currency1 balance of the pool
/// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
/// @param liquidity The liquidity of the pool after the swap
/// @param tick The log base 1.0001 of the price of the pool after the swap
/// @param fee The swap fee in hundredths of a bip
event Swap(
PoolId indexed id,
address indexed sender,
int128 amount0,
int128 amount1,
uint160 sqrtPriceX96,
uint128 liquidity,
int24 tick,
uint24 fee
);
/// @notice Emitted for donations
/// @param id The abi encoded hash of the pool key struct for the pool that was donated to
/// @param sender The address that initiated the donate call
/// @param amount0 The amount donated in currency0
/// @param amount1 The amount donated in currency1
event Donate(PoolId indexed id, address indexed sender, uint256 amount0, uint256 amount1);
/// @notice All interactions on the contract that account deltas require unlocking. A caller that calls `unlock` must implement
/// `IUnlockCallback(msg.sender).unlockCallback(data)`, where they interact with the remaining functions on this contract.
/// @dev The only functions callable without an unlocking are `initialize` and `updateDynamicLPFee`
/// @param data Any data to pass to the callback, via `IUnlockCallback(msg.sender).unlockCallback(data)`
/// @return The data returned by the call to `IUnlockCallback(msg.sender).unlockCallback(data)`
function unlock(bytes calldata data) external returns (bytes memory);
/// @notice Initialize the state for a given pool ID
/// @dev A swap fee totaling MAX_SWAP_FEE (100%) makes exact output swaps impossible since the input is entirely consumed by the fee
/// @param key The pool key for the pool to initialize
/// @param sqrtPriceX96 The initial square root price
/// @return tick The initial tick of the pool
function initialize(PoolKey memory key, uint160 sqrtPriceX96) external returns (int24 tick);
struct ModifyLiquidityParams {
// the lower and upper tick of the position
int24 tickLower;
int24 tickUpper;
// how to modify the liquidity
int256 liquidityDelta;
// a value to set if you want unique liquidity positions at the same range
bytes32 salt;
}
/// @notice Modify the liquidity for the given pool
/// @dev Poke by calling with a zero liquidityDelta
/// @param key The pool to modify liquidity in
/// @param params The parameters for modifying the liquidity
/// @param hookData The data to pass through to the add/removeLiquidity hooks
/// @return callerDelta The balance delta of the caller of modifyLiquidity. This is the total of both principal, fee deltas, and hook deltas if applicable
/// @return feesAccrued The balance delta of the fees generated in the liquidity range. Returned for informational purposes
/// @dev Note that feesAccrued can be artificially inflated by a malicious actor and integrators should be careful using the value
/// For pools with a single liquidity position, actors can donate to themselves to inflate feeGrowthGlobal (and consequently feesAccrued)
/// atomically donating and collecting fees in the same unlockCallback may make the inflated value more extreme
function modifyLiquidity(PoolKey memory key, ModifyLiquidityParams memory params, bytes calldata hookData)
external
returns (BalanceDelta callerDelta, BalanceDelta feesAccrued);
struct SwapParams {
/// Whether to swap token0 for token1 or vice versa
bool zeroForOne;
/// The desired input amount if negative (exactIn), or the desired output amount if positive (exactOut)
int256 amountSpecified;
/// The sqrt price at which, if reached, the swap will stop executing
uint160 sqrtPriceLimitX96;
}
/// @notice Swap against the given pool
/// @param key The pool to swap in
/// @param params The parameters for swapping
/// @param hookData The data to pass through to the swap hooks
/// @return swapDelta The balance delta of the address swapping
/// @dev Swapping on low liquidity pools may cause unexpected swap amounts when liquidity available is less than amountSpecified.
/// Additionally note that if interacting with hooks that have the BEFORE_SWAP_RETURNS_DELTA_FLAG or AFTER_SWAP_RETURNS_DELTA_FLAG
/// the hook may alter the swap input/output. Integrators should perform checks on the returned swapDelta.
function swap(PoolKey memory key, SwapParams memory params, bytes calldata hookData)
external
returns (BalanceDelta swapDelta);
/// @notice Donate the given currency amounts to the in-range liquidity providers of a pool
/// @dev Calls to donate can be frontrun adding just-in-time liquidity, with the aim of receiving a portion donated funds.
/// Donors should keep this in mind when designing donation mechanisms.
/// @dev This function donates to in-range LPs at slot0.tick. In certain edge-cases of the swap algorithm, the `sqrtPrice` of
/// a pool can be at the lower boundary of tick `n`, but the `slot0.tick` of the pool is already `n - 1`. In this case a call to
/// `donate` would donate to tick `n - 1` (slot0.tick) not tick `n` (getTickAtSqrtPrice(slot0.sqrtPriceX96)).
/// Read the comments in `Pool.swap()` for more information about this.
/// @param key The key of the pool to donate to
/// @param amount0 The amount of currency0 to donate
/// @param amount1 The amount of currency1 to donate
/// @param hookData The data to pass through to the donate hooks
/// @return BalanceDelta The delta of the caller after the donate
function donate(PoolKey memory key, uint256 amount0, uint256 amount1, bytes calldata hookData)
external
returns (BalanceDelta);
/// @notice Writes the current ERC20 balance of the specified currency to transient storage
/// This is used to checkpoint balances for the manager and derive deltas for the caller.
/// @dev This MUST be called before any ERC20 tokens are sent into the contract, but can be skipped
/// for native tokens because the amount to settle is determined by the sent value.
/// However, if an ERC20 token has been synced and not settled, and the caller instead wants to settle
/// native funds, this function can be called with the native currency to then be able to settle the native currency
function sync(Currency currency) external;
/// @notice Called by the user to net out some value owed to the user
/// @dev Will revert if the requested amount is not available, consider using `mint` instead
/// @dev Can also be used as a mechanism for free flash loans
/// @param currency The currency to withdraw from the pool manager
/// @param to The address to withdraw to
/// @param amount The amount of currency to withdraw
function take(Currency currency, address to, uint256 amount) external;
/// @notice Called by the user to pay what is owed
/// @return paid The amount of currency settled
function settle() external payable returns (uint256 paid);
/// @notice Called by the user to pay on behalf of another address
/// @param recipient The address to credit for the payment
/// @return paid The amount of currency settled
function settleFor(address recipient) external payable returns (uint256 paid);
/// @notice WARNING - Any currency that is cleared, will be non-retrievable, and locked in the contract permanently.
/// A call to clear will zero out a positive balance WITHOUT a corresponding transfer.
/// @dev This could be used to clear a balance that is considered dust.
/// Additionally, the amount must be the exact positive balance. This is to enforce that the caller is aware of the amount being cleared.
function clear(Currency currency, uint256 amount) external;
/// @notice Called by the user to move value into ERC6909 balance
/// @param to The address to mint the tokens to
/// @param id The currency address to mint to ERC6909s, as a uint256
/// @param amount The amount of currency to mint
/// @dev The id is converted to a uint160 to correspond to a currency address
/// If the upper 12 bytes are not 0, they will be 0-ed out
function mint(address to, uint256 id, uint256 amount) external;
/// @notice Called by the user to move value from ERC6909 balance
/// @param from The address to burn the tokens from
/// @param id The currency address to burn from ERC6909s, as a uint256
/// @param amount The amount of currency to burn
/// @dev The id is converted to a uint160 to correspond to a currency address
/// If the upper 12 bytes are not 0, they will be 0-ed out
function burn(address from, uint256 id, uint256 amount) external;
/// @notice Updates the pools lp fees for the a pool that has enabled dynamic lp fees.
/// @dev A swap fee totaling MAX_SWAP_FEE (100%) makes exact output swaps impossible since the input is entirely consumed by the fee
/// @param key The key of the pool to update dynamic LP fees for
/// @param newDynamicLPFee The new dynamic pool LP fee
function updateDynamicLPFee(PoolKey memory key, uint24 newDynamicLPFee) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @notice Interface for the callback executed when an address unlocks the pool manager
interface IUnlockCallback {
/// @notice Called by the pool manager on `msg.sender` when the manager is unlocked
/// @param data The data that was passed to the call to unlock
/// @return Any data that you want to be returned from the unlock call
function unlockCallback(bytes calldata data) external returns (bytes memory);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
import {IImmutableState} from "../interfaces/IImmutableState.sol";
/// @title Immutable State
/// @notice A collection of immutable state variables, commonly used across multiple contracts
contract ImmutableState is IImmutableState {
/// @inheritdoc IImmutableState
IPoolManager public immutable poolManager;
constructor(IPoolManager _poolManager) {
poolManager = _poolManager;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Return type of the beforeSwap hook.
// Upper 128 bits is the delta in specified tokens. Lower 128 bits is delta in unspecified tokens (to match the afterSwap hook)
type BeforeSwapDelta is int256;
// Creates a BeforeSwapDelta from specified and unspecified
function toBeforeSwapDelta(int128 deltaSpecified, int128 deltaUnspecified)
pure
returns (BeforeSwapDelta beforeSwapDelta)
{
assembly ("memory-safe") {
beforeSwapDelta := or(shl(128, deltaSpecified), and(sub(shl(128, 1), 1), deltaUnspecified))
}
}
/// @notice Library for getting the specified and unspecified deltas from the BeforeSwapDelta type
library BeforeSwapDeltaLibrary {
/// @notice A BeforeSwapDelta of 0
BeforeSwapDelta public constant ZERO_DELTA = BeforeSwapDelta.wrap(0);
/// extracts int128 from the upper 128 bits of the BeforeSwapDelta
/// returned by beforeSwap
function getSpecifiedDelta(BeforeSwapDelta delta) internal pure returns (int128 deltaSpecified) {
assembly ("memory-safe") {
deltaSpecified := sar(128, delta)
}
}
/// extracts int128 from the lower 128 bits of the BeforeSwapDelta
/// returned by beforeSwap and afterSwap
function getUnspecifiedDelta(BeforeSwapDelta delta) internal pure returns (int128 deltaUnspecified) {
assembly ("memory-safe") {
deltaUnspecified := signextend(15, delta)
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @notice Interface for claims over a contract balance, wrapped as a ERC6909
interface IERC6909Claims {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event OperatorSet(address indexed owner, address indexed operator, bool approved);
event Approval(address indexed owner, address indexed spender, uint256 indexed id, uint256 amount);
event Transfer(address caller, address indexed from, address indexed to, uint256 indexed id, uint256 amount);
/*//////////////////////////////////////////////////////////////
FUNCTIONS
//////////////////////////////////////////////////////////////*/
/// @notice Owner balance of an id.
/// @param owner The address of the owner.
/// @param id The id of the token.
/// @return amount The balance of the token.
function balanceOf(address owner, uint256 id) external view returns (uint256 amount);
/// @notice Spender allowance of an id.
/// @param owner The address of the owner.
/// @param spender The address of the spender.
/// @param id The id of the token.
/// @return amount The allowance of the token.
function allowance(address owner, address spender, uint256 id) external view returns (uint256 amount);
/// @notice Checks if a spender is approved by an owner as an operator
/// @param owner The address of the owner.
/// @param spender The address of the spender.
/// @return approved The approval status.
function isOperator(address owner, address spender) external view returns (bool approved);
/// @notice Transfers an amount of an id from the caller to a receiver.
/// @param receiver The address of the receiver.
/// @param id The id of the token.
/// @param amount The amount of the token.
/// @return bool True, always, unless the function reverts
function transfer(address receiver, uint256 id, uint256 amount) external returns (bool);
/// @notice Transfers an amount of an id from a sender to a receiver.
/// @param sender The address of the sender.
/// @param receiver The address of the receiver.
/// @param id The id of the token.
/// @param amount The amount of the token.
/// @return bool True, always, unless the function reverts
function transferFrom(address sender, address receiver, uint256 id, uint256 amount) external returns (bool);
/// @notice Approves an amount of an id to a spender.
/// @param spender The address of the spender.
/// @param id The id of the token.
/// @param amount The amount of the token.
/// @return bool True, always
function approve(address spender, uint256 id, uint256 amount) external returns (bool);
/// @notice Sets or removes an operator for the caller.
/// @param operator The address of the operator.
/// @param approved The approval status.
/// @return bool True, always
function setOperator(address operator, bool approved) external returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Currency} from "../types/Currency.sol";
import {PoolId} from "../types/PoolId.sol";
import {PoolKey} from "../types/PoolKey.sol";
/// @notice Interface for all protocol-fee related functions in the pool manager
interface IProtocolFees {
/// @notice Thrown when protocol fee is set too high
error ProtocolFeeTooLarge(uint24 fee);
/// @notice Thrown when collectProtocolFees or setProtocolFee is not called by the controller.
error InvalidCaller();
/// @notice Thrown when collectProtocolFees is attempted on a token that is synced.
error ProtocolFeeCurrencySynced();
/// @notice Emitted when the protocol fee controller address is updated in setProtocolFeeController.
event ProtocolFeeControllerUpdated(address indexed protocolFeeController);
/// @notice Emitted when the protocol fee is updated for a pool.
event ProtocolFeeUpdated(PoolId indexed id, uint24 protocolFee);
/// @notice Given a currency address, returns the protocol fees accrued in that currency
/// @param currency The currency to check
/// @return amount The amount of protocol fees accrued in the currency
function protocolFeesAccrued(Currency currency) external view returns (uint256 amount);
/// @notice Sets the protocol fee for the given pool
/// @param key The key of the pool to set a protocol fee for
/// @param newProtocolFee The fee to set
function setProtocolFee(PoolKey memory key, uint24 newProtocolFee) external;
/// @notice Sets the protocol fee controller
/// @param controller The new protocol fee controller
function setProtocolFeeController(address controller) external;
/// @notice Collects the protocol fees for a given recipient and currency, returning the amount collected
/// @dev This will revert if the contract is unlocked
/// @param recipient The address to receive the protocol fees
/// @param currency The currency to withdraw
/// @param amount The amount of currency to withdraw
/// @return amountCollected The amount of currency successfully withdrawn
function collectProtocolFees(address recipient, Currency currency, uint256 amount)
external
returns (uint256 amountCollected);
/// @notice Returns the current protocol fee controller address
/// @return address The current protocol fee controller address
function protocolFeeController() external view returns (address);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @notice Interface for functions to access any storage slot in a contract
interface IExtsload {
/// @notice Called by external contracts to access granular pool state
/// @param slot Key of slot to sload
/// @return value The value of the slot as bytes32
function extsload(bytes32 slot) external view returns (bytes32 value);
/// @notice Called by external contracts to access granular pool state
/// @param startSlot Key of slot to start sloading from
/// @param nSlots Number of slots to load into return value
/// @return values List of loaded values.
function extsload(bytes32 startSlot, uint256 nSlots) external view returns (bytes32[] memory values);
/// @notice Called by external contracts to access sparse pool state
/// @param slots List of slots to SLOAD from.
/// @return values List of loaded values.
function extsload(bytes32[] calldata slots) external view returns (bytes32[] memory values);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/// @notice Interface for functions to access any transient storage slot in a contract
interface IExttload {
/// @notice Called by external contracts to access transient storage of the contract
/// @param slot Key of slot to tload
/// @return value The value of the slot as bytes32
function exttload(bytes32 slot) external view returns (bytes32 value);
/// @notice Called by external contracts to access sparse transient pool state
/// @param slots List of slots to tload
/// @return values List of loaded values
function exttload(bytes32[] calldata slots) external view returns (bytes32[] memory values);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
/// @title IImmutableState
/// @notice Interface for the ImmutableState contract
interface IImmutableState {
/// @notice The Uniswap v4 PoolManager contract
function poolManager() external view returns (IPoolManager);
}{
"remappings": [
"@v4/=lib/v4-core/",
"@solady/=lib/solady/",
"v4-core/=lib/v4-core/",
"@permit2/=lib/permit2/src/",
"@forge/=lib/forge-std/src/",
"@uniswap/v4-core/=lib/v4-core/",
"@v4-periphery/=lib/v4-periphery/",
"@v4-template/=lib/v4-template/",
"forge-std/=lib/v4-core/lib/forge-std/src/",
"@ensdomains/=lib/v4-core/node_modules/@ensdomains/",
"@openzeppelin/=lib/v4-core/lib/openzeppelin-contracts/",
"@openzeppelin/contracts/=lib/v4-core/lib/openzeppelin-contracts/contracts/",
"@openzeppelin/uniswap-hooks/=lib/v4-template/lib/uniswap-hooks/",
"ds-test/=lib/v4-core/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-gas-snapshot/=lib/forge-gas-snapshot/src/",
"hardhat/=lib/v4-core/node_modules/hardhat/",
"permit2/=lib/permit2/",
"solady/=lib/solady/src/",
"solmate/=lib/v4-core/lib/solmate/",
"uniswap-hooks/=lib/v4-template/lib/uniswap-hooks/src/",
"v4-periphery/=lib/v4-periphery/",
"v4-template/=lib/v4-template/",
"lib/permit2/test:openzeppelin-contracts/contracts/=lib/permit2/lib/openzeppelin-contracts/contracts/",
"@v4/=lib/v4-core/",
"@solady/=lib/solady/",
"@permit2/=lib/permit2/src/",
"@forge/=lib/forge-std/src/",
"@universal-router/=lib/universal-router/contracts/",
"@uniswap/v2-core/=lib/universal-router/node_modules/@uniswap/v2-core/",
"@uniswap/v3-core/=lib/universal-router/node_modules/@uniswap/v3-core/",
"@uniswap/v3-periphery/=lib/universal-router/lib/v3-periphery/",
"@uniswap/v4-periphery/=lib/universal-router/lib/v4-periphery/",
"openzeppelin-contracts/=lib/v4-core/lib/openzeppelin-contracts/",
"openzeppelin/=lib/v4-template/lib/uniswap-hooks/lib/v4-core/lib/openzeppelin-contracts/contracts/",
"universal-router/=lib/universal-router/",
"v3-periphery/=lib/universal-router/lib/v3-periphery/contracts/"
],
"optimizer": {
"enabled": true,
"runs": 9999999
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": true,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract IPoolManager","name":"manager","type":"address"},{"internalType":"contract ISignatureTransfer","name":"_permit2","type":"address"}],"stateMutability":"payable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"DeadlinePassed","type":"error"},{"inputs":[],"name":"ETHTransferFailed","type":"error"},{"inputs":[],"name":"EmptyPath","type":"error"},{"inputs":[],"name":"NotPoolManager","type":"error"},{"inputs":[],"name":"SlippageExceeded","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"msgSender","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"permit2","outputs":[{"internalType":"contract ISignatureTransfer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolManager","outputs":[{"internalType":"contract IPoolManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256","name":"amountSpecified","type":"int256"},{"internalType":"uint256","name":"amountLimit","type":"uint256"},{"internalType":"bool","name":"zeroForOne","type":"bool"},{"components":[{"internalType":"Currency","name":"currency0","type":"address"},{"internalType":"Currency","name":"currency1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"},{"internalType":"contract IHooks","name":"hooks","type":"address"}],"internalType":"struct PoolKey","name":"poolKey","type":"tuple"},{"internalType":"bytes","name":"hookData","type":"bytes"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swap","outputs":[{"internalType":"BalanceDelta","name":"","type":"int256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swap","outputs":[{"internalType":"BalanceDelta","name":"","type":"int256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int256","name":"amountSpecified","type":"int256"},{"internalType":"uint256","name":"amountLimit","type":"uint256"},{"internalType":"Currency","name":"startCurrency","type":"address"},{"components":[{"internalType":"Currency","name":"intermediateCurrency","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"},{"internalType":"contract IHooks","name":"hooks","type":"address"},{"internalType":"bytes","name":"hookData","type":"bytes"}],"internalType":"struct PathKey[]","name":"path","type":"tuple[]"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swap","outputs":[{"internalType":"BalanceDelta","name":"","type":"int256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"Currency","name":"startCurrency","type":"address"},{"components":[{"internalType":"Currency","name":"intermediateCurrency","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"},{"internalType":"contract IHooks","name":"hooks","type":"address"},{"internalType":"bytes","name":"hookData","type":"bytes"}],"internalType":"struct PathKey[]","name":"path","type":"tuple[]"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForTokens","outputs":[{"internalType":"BalanceDelta","name":"","type":"int256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"bool","name":"zeroForOne","type":"bool"},{"components":[{"internalType":"Currency","name":"currency0","type":"address"},{"internalType":"Currency","name":"currency1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"},{"internalType":"contract IHooks","name":"hooks","type":"address"}],"internalType":"struct PoolKey","name":"poolKey","type":"tuple"},{"internalType":"bytes","name":"hookData","type":"bytes"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForTokens","outputs":[{"internalType":"BalanceDelta","name":"","type":"int256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"Currency","name":"startCurrency","type":"address"},{"components":[{"internalType":"Currency","name":"intermediateCurrency","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"},{"internalType":"contract IHooks","name":"hooks","type":"address"},{"internalType":"bytes","name":"hookData","type":"bytes"}],"internalType":"struct PathKey[]","name":"path","type":"tuple[]"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapTokensForExactTokens","outputs":[{"internalType":"BalanceDelta","name":"","type":"int256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"bool","name":"zeroForOne","type":"bool"},{"components":[{"internalType":"Currency","name":"currency0","type":"address"},{"internalType":"Currency","name":"currency1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"},{"internalType":"contract IHooks","name":"hooks","type":"address"}],"internalType":"struct PoolKey","name":"poolKey","type":"tuple"},{"internalType":"bytes","name":"hookData","type":"bytes"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapTokensForExactTokens","outputs":[{"internalType":"BalanceDelta","name":"","type":"int256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"unlockCallback","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
0x60c0601f6129a838819003918201601f19168301916001600160401b0383118484101760a957808492604094855283398101031260a5578051906001600160a01b038216820360a55760200151906001600160a01b038216820360a55760805260a0526040516128ea90816100be823960805181818160f1015281816103c2015281816108dd015281816122880152612765015260a051818181610b5f0152611af90152f35b5f80fd5b634e487b7160e01b5f52604160045260245ffdfe6080806040526004361015610125575b5036156100ef575f805b8091368210156100d657600182357ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc8401185f1a92019180156100655760019293508153015b90610019565b50607f6002600193357ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd8601185f1a9401937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8352818111156100cb575b16010161005f565b8381013684376100c3565b5f90389082305af43d5f803e156100eb573d5ff35b3d5ffd5b7f0000000000000000000000000000000000000000000000000000000000000000330361011857005b6382b429005f526004601cfd5b5f905f3560e01c90816312261ee714611ab1575080631f03952f14611a1e57806371d9e3dc1461176857806391dd73461461087357806398377a6c146107b3578063aacdd80f14610719578063ac9650d8146105ea578063af2b4aba1461051c578063b1a0d57114610457578063d737d0c7146103e6578063dc4c90d3146103775763e729a0be0361000f5760c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610374576044359060043573ffffffffffffffffffffffffffffffffffffffff831683036103705760643567ffffffffffffffff811161036c5761021f903690600401611b3e565b9060843573ffffffffffffffffffffffffffffffffffffffff81168091036103685760a43580421161033d5750926102cb602096936102f79360ff6102fc97337f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d89861395861561032e57955b15610327576002905b604051966102a388611d41565b87526024358c88015233604088015260608701521660808501526040519586948a8601611e5f565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282611dc2565b61222e565b907f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d604051908152f35b8990610296565b6103379061205d565b9561028d565b7fbfb22adf000000000000000000000000000000000000000000000000000000008652600452602485fd5b8480fd5b8280fd5b5080fd5b80fd5b503461037457807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261037457602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b503461037457807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103745760207f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5c73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b5061046136611c89565b809897969192959894939442116104f15750936102f7936102fc969373ffffffffffffffffffffffffffffffffffffffff6102cb9460209b98337f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d604051976104ca89611d41565b88528c880152336040880152166060860152600160808601526040519687958b87016120b6565b7fbfb22adf000000000000000000000000000000000000000000000000000000008852600452602487fd5b5060407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103745760043567ffffffffffffffff811161037057610567903690600401611c18565b6024929192358042116105bf5750337f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d3360a435036105b2576102f76020936102fc9236916121e9565b6382b4290082526004601cfd5b7fbfb22adf000000000000000000000000000000000000000000000000000000008352600452602482fd5b5060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103745760043567ffffffffffffffff811161037057610635903690600401611b3e565b9091346103745760405192839260208452808460200152836040019260408260051b80858737860101938492610684575b50505050806040520360401b178060401c9067ffffffffffffffff16f35b92945090925b8092826020825188018035918291018537389084305af41561071057602067ffffffffffffffe0603f85937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08b87030181528301943d81523d858583013e3d010116943d010152858482101561070157509161068a565b9450505090505f808080610666565b863d84823e3d90fd5b5061072336611c89565b809897969192959894939442116104f15750936102f7936102fc969373ffffffffffffffffffffffffffffffffffffffff6102cb9460209b98337f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d6040519761078c89611d41565b88528c880152336040880152166060860152600360808601526040519687958b87016120b6565b506107bd36611b6f565b809796959192949742116108485750602096936102f79373ffffffffffffffffffffffffffffffffffffffff6102fc97946102cb94337f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d6040519661082288611d41565b87528b8701523360408701521660608501528760808501526040519586948a8601611e5f565b7fbfb22adf000000000000000000000000000000000000000000000000000000008752600452602486fd5b50346112935760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126112935760043567ffffffffffffffff8111611293576108c3903690600401611c18565b73ffffffffffffffffffffffffffffffffffffffff9291927f0000000000000000000000000000000000000000000000000000000000000000169081330361174057830183810360a081126112935761091c828661234b565b926080840151916001831615159260028116151593865195815f146113735761094361262e565b50610180841261129357610957818b61234b565b5061096460a08b01611c0b565b996109728260c0830161257c565b61016082013567ffffffffffffffff811161129357836109939184016123aa565b9b801561133a5773ffffffffffffffffffffffffffffffffffffffff8251169973ffffffffffffffffffffffffffffffffffffffff6020840151165b9a9d8a1561130f575f82126112e75773ffffffffffffffffffffffffffffffffffffffff938493610a009391612670565b9c5b169816948589109384156112d8578c60801d5f03600f0b945b156112cb578c600f0b985b156112bf5760208b015185115b611297576010861615610f6b57604051610a4c81611d8a565b604051610a5881611da6565b6040518e610a6582611d8a565b808252602082015281528d60208201528d6040820152815260606020820152505f14610f05576101a013610f0157610a9d828261234b565b50610aaa60a08201611c0b565b50610ab88260c0830161257c565b5061016081013567ffffffffffffffff8111610efd5782610ada9183016123aa565b506101808101359067ffffffffffffffff8211610efd57610afc9291016124e5565b843b15610eee576040517fa58411940000000000000000000000000000000000000000000000000000000081528760048201528981602481838a5af18015610ef257908a91610ed9575b505073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169080519060405193610b9085611d8a565b8785526020850152602073ffffffffffffffffffffffffffffffffffffffff60408c01511691015190833b15610ed5578b610c629593610c7a8296946040948551998a98899788967f30f28b7a000000000000000000000000000000000000000000000000000000008852610c296004890182516020809173ffffffffffffffffffffffffffffffffffffffff81511684520151910152565b60208181015160448a01529101516064880152815173ffffffffffffffffffffffffffffffffffffffff166084880152015160a4860152565b60c484015261010060e4840152610104830190611c46565b03925af18015610eb557908891610ec0575b50506040517f11da60b40000000000000000000000000000000000000000000000000000000081526020816004818b885af18015610eb557610e86575b505b606086015173ffffffffffffffffffffffffffffffffffffffff169060081615610e1157823b15610e0d576040517f156e29f600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9190911660048201526024810191909152604481019290925284908290606490829084905af18015610e0257908491610ded575b50505b15610da2575b610d9e8360405190602082015260208152610d8a604082611dc2565b604051918291602083526020830190611c46565b0390f35b479081610db0575b50610d6e565b90828073ffffffffffffffffffffffffffffffffffffffff604082950151169238935af115610de0578080610daa565b63b12d13eb90526004601cfd5b81610df791611dc2565b61036c57825f610d65565b6040513d86823e3d90fd5b8680fd5b91803b15610e0d578692918360649260405196879586947f0b0d9c090000000000000000000000000000000000000000000000000000000086526004860152602485015260448401525af18015610e0257908491610e71575b5050610d68565b81610e7b91611dc2565b61036c57825f610e6a565b610ea79060203d602011610eae575b610e9f8183611dc2565b81019061221f565b505f610cc9565b503d610e95565b6040513d8a823e3d90fd5b81610eca91611dc2565b610e0d57865f610c8c565b8b80fd5b81610ee391611dc2565b610eee57885f610b46565b8880fd5b6040513d8c823e3d90fd5b8a80fd5b8980fd5b61010013610f0157610f17828261234b565b50610f2460a08201611b1d565b5060c081013567ffffffffffffffff8111610efd5782610f459183016123c5565b5060e08101359067ffffffffffffffff8211610efd57610f669291016124e5565b610afc565b50505050851580611226575b604088015173ffffffffffffffffffffffffffffffffffffffff1690600484161561102a5750843b15610eee576040517ff5298aca00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff919091166004820152602481018790526044810191909152878160648183885af18015610eb557908891611015575b5050610ccb565b8161101f91611dc2565b610e0d57865f61100e565b1561109257506020600491604051928380927f11da60b4000000000000000000000000000000000000000000000000000000008252885af18015610eb557611073575b50610ccb565b61108b9060203d602011610eae57610e9f8183611dc2565b505f61106d565b90843b15610eee576040517fa58411940000000000000000000000000000000000000000000000000000000081528760048201528981602481838a5af18015610ef257908a91611211575b50503082146111a357604051917f23b872dd000000000000000000000000000000000000000000000000000000008352600483015284602483015260448201526020816064818b8a5af18015610eb557611174575b505b6040517f11da60b40000000000000000000000000000000000000000000000000000000081526020816004818b885af18015610eb5576110735750610ccb565b6111959060203d60201161119c575b61118d8183611dc2565b810190612658565b505f611132565b503d611183565b9050604051907fa9059cbb00000000000000000000000000000000000000000000000000000000825284600483015260248201526020816044818b8a5af18015610eb5576111f2575b50611134565b61120a9060203d60201161119c5761118d8183611dc2565b505f6111ec565b8161121b91611dc2565b610eee57885f6110dd565b843b15611293576040517fa58411940000000000000000000000000000000000000000000000000000000081528760048201525f81602481838a5af1801561128857611273575b50610f77565b6112809199505f90611dc2565b5f975f61126d565b6040513d5f823e3d90fd5b5f80fd5b7f8199f5f3000000000000000000000000000000000000000000000000000000005f5260045ffd5b60208b01518910610a33565b8c60801d600f0b98610a26565b8c600f0b5f03600f0b94610a1b565b7f93dafdf1000000000000000000000000000000000000000000000000000000005f5260045ffd5b5f82126112e75773ffffffffffffffffffffffffffffffffffffffff938493610a00935f0391612670565b73ffffffffffffffffffffffffffffffffffffffff6020830151169973ffffffffffffffffffffffffffffffffffffffff8351166109cf565b60e0841261129357611385818b61234b565b5061139260a08b01611b1d565b9960c081013567ffffffffffffffff811161129357826113b39183016123c5565b978b8951156117185773ffffffffffffffffffffffffffffffffffffffff6113fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8c51018c61261a565b5151169989156115c45761141061262e565b505f83126112e75782917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff825101611448818461261a565b5181805b611531575050918173ffffffffffffffffffffffffffffffffffffffff806114a481989661149e611488849a98611482896125e0565b516127e2565b988960806114958b6125e0565b51015192612670565b9561261a565b515116911610156114e1576fffffffffffffffffffffffffffffffff91156114d85760801d915b169060801b175b9c610a02565b600f0b916114cb565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000091156115295760801d5b6fffffffffffffffffffffffffffffffff169160801b16176114d2565b600f0b61150c565b6080917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61159292019661158673ffffffffffffffffffffffffffffffffffffffff61157d8a8a61261a565b515116836127e2565b94859193015192612670565b90156115b75760801d5f03600f0b5b600f0b93806115b0818661261a565b519161144c565b600f0b5f03600f0b6115a1565b90806115ce61262e565b505f84126112e757835f03928051906115e6816125e0565b51915f925b81840361169b57505050509173ffffffffffffffffffffffffffffffffffffffff939184808095169116105f14611642576fffffffffffffffffffffffffffffffff80915f03169116600f0b5f0360801b176114d2565b906fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff000000000000000000000000000000009116600f0b5f036fffffffffffffffffffffffffffffffff16915f0360801b16176114d2565b90919295936116bc6116af600192846127e2565b9687608086015192612670565b825173ffffffffffffffffffffffffffffffffffffffff16951561170b57600f0b5f03600f0b5b600f0b9601908282106116fa575b929190926115eb565b50611705818461261a565b516116f1565b60801d5f03600f0b6116e3565b7f20a2d33d000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fae18210a000000000000000000000000000000000000000000000000000000005f5260045ffd5b6101607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112611293576004356044358015158091036112935760a07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9c360112611293576101043567ffffffffffffffff8111611293576117ee903690600401611c18565b9290916101243573ffffffffffffffffffffffffffffffffffffffff811680910361129357610144358042116119f3575060ff90337f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d5f84139384156119e457935b156119dd576002905b6040519461186786611d41565b8552602435602086015233604086015260608501526001171660808301526118ed60405192602084019060ff60808092805185526020810151602086015273ffffffffffffffffffffffffffffffffffffffff604082015116604086015273ffffffffffffffffffffffffffffffffffffffff6060820151166060860152015116910152565b60c082015260643573ffffffffffffffffffffffffffffffffffffffff81168091036112935760e082015260843573ffffffffffffffffffffffffffffffffffffffff81168091036112935761010082015260a43562ffffff81168091036112935761012082015260c4358060020b8091036112935761014082015260e4359173ffffffffffffffffffffffffffffffffffffffff831680930361129357816102cb6102f7926020966119b296610160850152610180808501526101a0840191611e21565b5f7f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d604051908152f35b5f9061185a565b6119ed9061205d565b93611851565b7fbfb22adf000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b611a2736611b6f565b8096959192949642116119f35760206119b2886102f7896102cb8a8a73ffffffffffffffffffffffffffffffffffffffff8b8b337f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d60405196611a8a88611d41565b87528a87015233604087015216606085015260026080850152604051958694898601611e5f565b34611293575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126112935760209073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b359073ffffffffffffffffffffffffffffffffffffffff8216820361129357565b9181601f840112156112935782359167ffffffffffffffff8311611293576020808501948460051b01011161129357565b9060c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc83011261129357600435916024359160443573ffffffffffffffffffffffffffffffffffffffff8116810361129357916064359067ffffffffffffffff821161129357611be291600401611b3e565b909160843573ffffffffffffffffffffffffffffffffffffffff81168103611293579060a43590565b3590811515820361129357565b9181601f840112156112935782359167ffffffffffffffff8311611293576020838186019501011161129357565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602080948051918291828752018686015e5f8582860101520116010190565b6101607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc8201126112935760043591602435916044358015158103611293579160a07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9c83011261129357606491610104359067ffffffffffffffff821161129357611d1691600401611c18565b90916101243573ffffffffffffffffffffffffffffffffffffffff8116810361129357906101443590565b60a0810190811067ffffffffffffffff821117611d5d57604052565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6040810190811067ffffffffffffffff821117611d5d57604052565b6060810190811067ffffffffffffffff821117611d5d57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117611d5d57604052565b359062ffffff8216820361129357565b35908160020b820361129357565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe093818652868601375f8582860101520116010190565b93919073ffffffffffffffffffffffffffffffffffffffff8392611ede8760e081019460ff60808092805185526020810151602086015273ffffffffffffffffffffffffffffffffffffffff604082015116604086015273ffffffffffffffffffffffffffffffffffffffff6060820151166060860152015116910152565b1660a086015260e060c08601525261010083016101008260051b85010193835f917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6182360301905b858410611f37575050505050505090565b909192939495967fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0082820301865287358381121561129357840173ffffffffffffffffffffffffffffffffffffffff611f8f82611b1d565b16825262ffffff611fa260208301611e03565b166020830152611fb460408201611e13565b60020b604083015273ffffffffffffffffffffffffffffffffffffffff611fdd60608301611b1d565b16606083015260808101357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18236030181121561129357016020813591019067ffffffffffffffff81116112935780360382136112935761204e602092839260a08681608060019901520191611e21565b99019796019401929190611f26565b7f80000000000000000000000000000000000000000000000000000000000000008114612089575f0390565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b9061219760806121ac97956101809561213b8673ffffffffffffffffffffffffffffffffffffffff9660ff60808092805185526020810151602086015273ffffffffffffffffffffffffffffffffffffffff604082015116604086015273ffffffffffffffffffffffffffffffffffffffff6060820151166060860152015116910152565b151560a08601528361214c82611b1d565b1660c08601528361215f60208301611b1d565b1660e086015262ffffff61217560408301611e03565b1661010086015261218860608201611e13565b60020b61012086015201611b1d565b16610140820152816101608201520191611e21565b90565b67ffffffffffffffff8111611d5d57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b9291926121f5826121af565b916122036040519384611dc2565b829481845281830111611293578281602093845f960137010152565b90816020910312611293575190565b5f61226e91604051809381927f48c89491000000000000000000000000000000000000000000000000000000008352602060048401526024830190611c46565b03818373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af1908115611288575f916122d1575b5060208151918180820193849201010312611293575190565b90503d805f833e6122e28183611dc2565b8101906020818303126112935780519067ffffffffffffffff8211611293570181601f8201121561129357805190612319826121af565b926123276040519485611dc2565b8284526020838301011161129357815f9260208093018386015e830101525f6122b8565b91908260a09103126112935760405161236381611d41565b60808193803583526020810135602084015261238160408201611b1d565b604084015261239260608201611b1d565b606084015201359060ff821682036112935760800152565b9080601f83011215611293578160206121ac933591016121e9565b9080601f830112156112935781359167ffffffffffffffff8311611d5d578260051b604051936123f86020830186611dc2565b8452602080850191830101918383116112935760208101915b83831061242057505050505090565b823567ffffffffffffffff81116112935782019060a07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08388030112611293576040519061246d82611d41565b61247960208401611b1d565b825261248760408401611e03565b602083015261249860608401611e13565b60408301526124a960808401611b1d565b606083015260a08301359167ffffffffffffffff8311611293576124d5886020809695819601016123aa565b6080820152815201920191612411565b808203929160a0841261129357604051916124ff83611d8a565b82946080811261129357604080519161251783611da6565b126112935760405161252881611d8a565b61253183611b1d565b81526020830135602082015281526040820135602082015260608201356040820152835260808101359167ffffffffffffffff83116112935760209261257792016123aa565b910152565b91908260a09103126112935760405161259481611d41565b60806125778183956125a581611b1d565b85526125b360208201611b1d565b60208601526125c460408201611e03565b60408601526125d560608201611e13565b606086015201611b1d565b8051156125ed5760200190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b80518210156125ed5760209160051b010190565b6040519061263b82611d41565b5f6080838281528260208201528260408201528260608201520152565b90816020910312611293575180151581036112935790565b61274b73ffffffffffffffffffffffffffffffffffffffff9485608094602096815f146127c7576401000276a4915b604051906126ac82611da6565b15158152888101918252836040820193168352604051998a9889987ff3cd914c000000000000000000000000000000000000000000000000000000008a528281511660048b0152828c8201511660248b015262ffffff60408201511660448b0152606081015160020b60648b0152015116608488015251151560a48701525160c4860152511660e4840152610120610104840152610124830190611c46565b03815f73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af1908115611288575f91612798575090565b90506020813d6020116127bf575b816127b360209383611dc2565b81010312611293575190565b3d91506127a6565b73fffd8963efd1fc6a506488495d951d5263988d259161269f565b906127eb61262e565b5073ffffffffffffffffffffffffffffffffffffffff82511673ffffffffffffffffffffffffffffffffffffffff8216918183105f146128975773ffffffffffffffffffffffffffffffffffffffff905b168092149262ffffff60208201511673ffffffffffffffffffffffffffffffffffffffff806060604085015160020b94015116936040519561287d87611d41565b865216602085015260408401526060830152608082015291565b5073ffffffffffffffffffffffffffffffffffffffff829161283c56fea26469706673582212202c9a62991b4fb36e5c1f3ce9f73aead57db3aeba8a0887efd8b817bc3e3775fc64736f6c634300081a0033000000000000000000000000000000000004444c5dc75cb358380d2e3de08a90000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3
Deployed Bytecode
0x6080806040526004361015610125575b5036156100ef575f805b8091368210156100d657600182357ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc8401185f1a92019180156100655760019293508153015b90610019565b50607f6002600193357ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd8601185f1a9401937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8352818111156100cb575b16010161005f565b8381013684376100c3565b5f90389082305af43d5f803e156100eb573d5ff35b3d5ffd5b7f000000000000000000000000000000000004444c5dc75cb358380d2e3de08a90330361011857005b6382b429005f526004601cfd5b5f905f3560e01c90816312261ee714611ab1575080631f03952f14611a1e57806371d9e3dc1461176857806391dd73461461087357806398377a6c146107b3578063aacdd80f14610719578063ac9650d8146105ea578063af2b4aba1461051c578063b1a0d57114610457578063d737d0c7146103e6578063dc4c90d3146103775763e729a0be0361000f5760c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610374576044359060043573ffffffffffffffffffffffffffffffffffffffff831683036103705760643567ffffffffffffffff811161036c5761021f903690600401611b3e565b9060843573ffffffffffffffffffffffffffffffffffffffff81168091036103685760a43580421161033d5750926102cb602096936102f79360ff6102fc97337f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d89861395861561032e57955b15610327576002905b604051966102a388611d41565b87526024358c88015233604088015260608701521660808501526040519586948a8601611e5f565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282611dc2565b61222e565b907f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d604051908152f35b8990610296565b6103379061205d565b9561028d565b7fbfb22adf000000000000000000000000000000000000000000000000000000008652600452602485fd5b8480fd5b8280fd5b5080fd5b80fd5b503461037457807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261037457602060405173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000004444c5dc75cb358380d2e3de08a90168152f35b503461037457807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103745760207f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5c73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b5061046136611c89565b809897969192959894939442116104f15750936102f7936102fc969373ffffffffffffffffffffffffffffffffffffffff6102cb9460209b98337f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d604051976104ca89611d41565b88528c880152336040880152166060860152600160808601526040519687958b87016120b6565b7fbfb22adf000000000000000000000000000000000000000000000000000000008852600452602487fd5b5060407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103745760043567ffffffffffffffff811161037057610567903690600401611c18565b6024929192358042116105bf5750337f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d3360a435036105b2576102f76020936102fc9236916121e9565b6382b4290082526004601cfd5b7fbfb22adf000000000000000000000000000000000000000000000000000000008352600452602482fd5b5060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103745760043567ffffffffffffffff811161037057610635903690600401611b3e565b9091346103745760405192839260208452808460200152836040019260408260051b80858737860101938492610684575b50505050806040520360401b178060401c9067ffffffffffffffff16f35b92945090925b8092826020825188018035918291018537389084305af41561071057602067ffffffffffffffe0603f85937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08b87030181528301943d81523d858583013e3d010116943d010152858482101561070157509161068a565b9450505090505f808080610666565b863d84823e3d90fd5b5061072336611c89565b809897969192959894939442116104f15750936102f7936102fc969373ffffffffffffffffffffffffffffffffffffffff6102cb9460209b98337f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d6040519761078c89611d41565b88528c880152336040880152166060860152600360808601526040519687958b87016120b6565b506107bd36611b6f565b809796959192949742116108485750602096936102f79373ffffffffffffffffffffffffffffffffffffffff6102fc97946102cb94337f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d6040519661082288611d41565b87528b8701523360408701521660608501528760808501526040519586948a8601611e5f565b7fbfb22adf000000000000000000000000000000000000000000000000000000008752600452602486fd5b50346112935760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126112935760043567ffffffffffffffff8111611293576108c3903690600401611c18565b73ffffffffffffffffffffffffffffffffffffffff9291927f000000000000000000000000000000000004444c5dc75cb358380d2e3de08a90169081330361174057830183810360a081126112935761091c828661234b565b926080840151916001831615159260028116151593865195815f146113735761094361262e565b50610180841261129357610957818b61234b565b5061096460a08b01611c0b565b996109728260c0830161257c565b61016082013567ffffffffffffffff811161129357836109939184016123aa565b9b801561133a5773ffffffffffffffffffffffffffffffffffffffff8251169973ffffffffffffffffffffffffffffffffffffffff6020840151165b9a9d8a1561130f575f82126112e75773ffffffffffffffffffffffffffffffffffffffff938493610a009391612670565b9c5b169816948589109384156112d8578c60801d5f03600f0b945b156112cb578c600f0b985b156112bf5760208b015185115b611297576010861615610f6b57604051610a4c81611d8a565b604051610a5881611da6565b6040518e610a6582611d8a565b808252602082015281528d60208201528d6040820152815260606020820152505f14610f05576101a013610f0157610a9d828261234b565b50610aaa60a08201611c0b565b50610ab88260c0830161257c565b5061016081013567ffffffffffffffff8111610efd5782610ada9183016123aa565b506101808101359067ffffffffffffffff8211610efd57610afc9291016124e5565b843b15610eee576040517fa58411940000000000000000000000000000000000000000000000000000000081528760048201528981602481838a5af18015610ef257908a91610ed9575b505073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3169080519060405193610b9085611d8a565b8785526020850152602073ffffffffffffffffffffffffffffffffffffffff60408c01511691015190833b15610ed5578b610c629593610c7a8296946040948551998a98899788967f30f28b7a000000000000000000000000000000000000000000000000000000008852610c296004890182516020809173ffffffffffffffffffffffffffffffffffffffff81511684520151910152565b60208181015160448a01529101516064880152815173ffffffffffffffffffffffffffffffffffffffff166084880152015160a4860152565b60c484015261010060e4840152610104830190611c46565b03925af18015610eb557908891610ec0575b50506040517f11da60b40000000000000000000000000000000000000000000000000000000081526020816004818b885af18015610eb557610e86575b505b606086015173ffffffffffffffffffffffffffffffffffffffff169060081615610e1157823b15610e0d576040517f156e29f600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9190911660048201526024810191909152604481019290925284908290606490829084905af18015610e0257908491610ded575b50505b15610da2575b610d9e8360405190602082015260208152610d8a604082611dc2565b604051918291602083526020830190611c46565b0390f35b479081610db0575b50610d6e565b90828073ffffffffffffffffffffffffffffffffffffffff604082950151169238935af115610de0578080610daa565b63b12d13eb90526004601cfd5b81610df791611dc2565b61036c57825f610d65565b6040513d86823e3d90fd5b8680fd5b91803b15610e0d578692918360649260405196879586947f0b0d9c090000000000000000000000000000000000000000000000000000000086526004860152602485015260448401525af18015610e0257908491610e71575b5050610d68565b81610e7b91611dc2565b61036c57825f610e6a565b610ea79060203d602011610eae575b610e9f8183611dc2565b81019061221f565b505f610cc9565b503d610e95565b6040513d8a823e3d90fd5b81610eca91611dc2565b610e0d57865f610c8c565b8b80fd5b81610ee391611dc2565b610eee57885f610b46565b8880fd5b6040513d8c823e3d90fd5b8a80fd5b8980fd5b61010013610f0157610f17828261234b565b50610f2460a08201611b1d565b5060c081013567ffffffffffffffff8111610efd5782610f459183016123c5565b5060e08101359067ffffffffffffffff8211610efd57610f669291016124e5565b610afc565b50505050851580611226575b604088015173ffffffffffffffffffffffffffffffffffffffff1690600484161561102a5750843b15610eee576040517ff5298aca00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff919091166004820152602481018790526044810191909152878160648183885af18015610eb557908891611015575b5050610ccb565b8161101f91611dc2565b610e0d57865f61100e565b1561109257506020600491604051928380927f11da60b4000000000000000000000000000000000000000000000000000000008252885af18015610eb557611073575b50610ccb565b61108b9060203d602011610eae57610e9f8183611dc2565b505f61106d565b90843b15610eee576040517fa58411940000000000000000000000000000000000000000000000000000000081528760048201528981602481838a5af18015610ef257908a91611211575b50503082146111a357604051917f23b872dd000000000000000000000000000000000000000000000000000000008352600483015284602483015260448201526020816064818b8a5af18015610eb557611174575b505b6040517f11da60b40000000000000000000000000000000000000000000000000000000081526020816004818b885af18015610eb5576110735750610ccb565b6111959060203d60201161119c575b61118d8183611dc2565b810190612658565b505f611132565b503d611183565b9050604051907fa9059cbb00000000000000000000000000000000000000000000000000000000825284600483015260248201526020816044818b8a5af18015610eb5576111f2575b50611134565b61120a9060203d60201161119c5761118d8183611dc2565b505f6111ec565b8161121b91611dc2565b610eee57885f6110dd565b843b15611293576040517fa58411940000000000000000000000000000000000000000000000000000000081528760048201525f81602481838a5af1801561128857611273575b50610f77565b6112809199505f90611dc2565b5f975f61126d565b6040513d5f823e3d90fd5b5f80fd5b7f8199f5f3000000000000000000000000000000000000000000000000000000005f5260045ffd5b60208b01518910610a33565b8c60801d600f0b98610a26565b8c600f0b5f03600f0b94610a1b565b7f93dafdf1000000000000000000000000000000000000000000000000000000005f5260045ffd5b5f82126112e75773ffffffffffffffffffffffffffffffffffffffff938493610a00935f0391612670565b73ffffffffffffffffffffffffffffffffffffffff6020830151169973ffffffffffffffffffffffffffffffffffffffff8351166109cf565b60e0841261129357611385818b61234b565b5061139260a08b01611b1d565b9960c081013567ffffffffffffffff811161129357826113b39183016123c5565b978b8951156117185773ffffffffffffffffffffffffffffffffffffffff6113fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8c51018c61261a565b5151169989156115c45761141061262e565b505f83126112e75782917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff825101611448818461261a565b5181805b611531575050918173ffffffffffffffffffffffffffffffffffffffff806114a481989661149e611488849a98611482896125e0565b516127e2565b988960806114958b6125e0565b51015192612670565b9561261a565b515116911610156114e1576fffffffffffffffffffffffffffffffff91156114d85760801d915b169060801b175b9c610a02565b600f0b916114cb565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000091156115295760801d5b6fffffffffffffffffffffffffffffffff169160801b16176114d2565b600f0b61150c565b6080917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61159292019661158673ffffffffffffffffffffffffffffffffffffffff61157d8a8a61261a565b515116836127e2565b94859193015192612670565b90156115b75760801d5f03600f0b5b600f0b93806115b0818661261a565b519161144c565b600f0b5f03600f0b6115a1565b90806115ce61262e565b505f84126112e757835f03928051906115e6816125e0565b51915f925b81840361169b57505050509173ffffffffffffffffffffffffffffffffffffffff939184808095169116105f14611642576fffffffffffffffffffffffffffffffff80915f03169116600f0b5f0360801b176114d2565b906fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff000000000000000000000000000000009116600f0b5f036fffffffffffffffffffffffffffffffff16915f0360801b16176114d2565b90919295936116bc6116af600192846127e2565b9687608086015192612670565b825173ffffffffffffffffffffffffffffffffffffffff16951561170b57600f0b5f03600f0b5b600f0b9601908282106116fa575b929190926115eb565b50611705818461261a565b516116f1565b60801d5f03600f0b6116e3565b7f20a2d33d000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fae18210a000000000000000000000000000000000000000000000000000000005f5260045ffd5b6101607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112611293576004356044358015158091036112935760a07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9c360112611293576101043567ffffffffffffffff8111611293576117ee903690600401611c18565b9290916101243573ffffffffffffffffffffffffffffffffffffffff811680910361129357610144358042116119f3575060ff90337f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d5f84139384156119e457935b156119dd576002905b6040519461186786611d41565b8552602435602086015233604086015260608501526001171660808301526118ed60405192602084019060ff60808092805185526020810151602086015273ffffffffffffffffffffffffffffffffffffffff604082015116604086015273ffffffffffffffffffffffffffffffffffffffff6060820151166060860152015116910152565b60c082015260643573ffffffffffffffffffffffffffffffffffffffff81168091036112935760e082015260843573ffffffffffffffffffffffffffffffffffffffff81168091036112935761010082015260a43562ffffff81168091036112935761012082015260c4358060020b8091036112935761014082015260e4359173ffffffffffffffffffffffffffffffffffffffff831680930361129357816102cb6102f7926020966119b296610160850152610180808501526101a0840191611e21565b5f7f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d604051908152f35b5f9061185a565b6119ed9061205d565b93611851565b7fbfb22adf000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b611a2736611b6f565b8096959192949642116119f35760206119b2886102f7896102cb8a8a73ffffffffffffffffffffffffffffffffffffffff8b8b337f0aedd6bde10e3aa2adec092b02a3e3e805795516cda41f27aa145b8f300af87a5d60405196611a8a88611d41565b87528a87015233604087015216606085015260026080850152604051958694898601611e5f565b34611293575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126112935760209073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3168152f35b359073ffffffffffffffffffffffffffffffffffffffff8216820361129357565b9181601f840112156112935782359167ffffffffffffffff8311611293576020808501948460051b01011161129357565b9060c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc83011261129357600435916024359160443573ffffffffffffffffffffffffffffffffffffffff8116810361129357916064359067ffffffffffffffff821161129357611be291600401611b3e565b909160843573ffffffffffffffffffffffffffffffffffffffff81168103611293579060a43590565b3590811515820361129357565b9181601f840112156112935782359167ffffffffffffffff8311611293576020838186019501011161129357565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602080948051918291828752018686015e5f8582860101520116010190565b6101607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc8201126112935760043591602435916044358015158103611293579160a07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9c83011261129357606491610104359067ffffffffffffffff821161129357611d1691600401611c18565b90916101243573ffffffffffffffffffffffffffffffffffffffff8116810361129357906101443590565b60a0810190811067ffffffffffffffff821117611d5d57604052565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6040810190811067ffffffffffffffff821117611d5d57604052565b6060810190811067ffffffffffffffff821117611d5d57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117611d5d57604052565b359062ffffff8216820361129357565b35908160020b820361129357565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe093818652868601375f8582860101520116010190565b93919073ffffffffffffffffffffffffffffffffffffffff8392611ede8760e081019460ff60808092805185526020810151602086015273ffffffffffffffffffffffffffffffffffffffff604082015116604086015273ffffffffffffffffffffffffffffffffffffffff6060820151166060860152015116910152565b1660a086015260e060c08601525261010083016101008260051b85010193835f917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6182360301905b858410611f37575050505050505090565b909192939495967fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0082820301865287358381121561129357840173ffffffffffffffffffffffffffffffffffffffff611f8f82611b1d565b16825262ffffff611fa260208301611e03565b166020830152611fb460408201611e13565b60020b604083015273ffffffffffffffffffffffffffffffffffffffff611fdd60608301611b1d565b16606083015260808101357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18236030181121561129357016020813591019067ffffffffffffffff81116112935780360382136112935761204e602092839260a08681608060019901520191611e21565b99019796019401929190611f26565b7f80000000000000000000000000000000000000000000000000000000000000008114612089575f0390565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b9061219760806121ac97956101809561213b8673ffffffffffffffffffffffffffffffffffffffff9660ff60808092805185526020810151602086015273ffffffffffffffffffffffffffffffffffffffff604082015116604086015273ffffffffffffffffffffffffffffffffffffffff6060820151166060860152015116910152565b151560a08601528361214c82611b1d565b1660c08601528361215f60208301611b1d565b1660e086015262ffffff61217560408301611e03565b1661010086015261218860608201611e13565b60020b61012086015201611b1d565b16610140820152816101608201520191611e21565b90565b67ffffffffffffffff8111611d5d57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b9291926121f5826121af565b916122036040519384611dc2565b829481845281830111611293578281602093845f960137010152565b90816020910312611293575190565b5f61226e91604051809381927f48c89491000000000000000000000000000000000000000000000000000000008352602060048401526024830190611c46565b03818373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000004444c5dc75cb358380d2e3de08a90165af1908115611288575f916122d1575b5060208151918180820193849201010312611293575190565b90503d805f833e6122e28183611dc2565b8101906020818303126112935780519067ffffffffffffffff8211611293570181601f8201121561129357805190612319826121af565b926123276040519485611dc2565b8284526020838301011161129357815f9260208093018386015e830101525f6122b8565b91908260a09103126112935760405161236381611d41565b60808193803583526020810135602084015261238160408201611b1d565b604084015261239260608201611b1d565b606084015201359060ff821682036112935760800152565b9080601f83011215611293578160206121ac933591016121e9565b9080601f830112156112935781359167ffffffffffffffff8311611d5d578260051b604051936123f86020830186611dc2565b8452602080850191830101918383116112935760208101915b83831061242057505050505090565b823567ffffffffffffffff81116112935782019060a07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08388030112611293576040519061246d82611d41565b61247960208401611b1d565b825261248760408401611e03565b602083015261249860608401611e13565b60408301526124a960808401611b1d565b606083015260a08301359167ffffffffffffffff8311611293576124d5886020809695819601016123aa565b6080820152815201920191612411565b808203929160a0841261129357604051916124ff83611d8a565b82946080811261129357604080519161251783611da6565b126112935760405161252881611d8a565b61253183611b1d565b81526020830135602082015281526040820135602082015260608201356040820152835260808101359167ffffffffffffffff83116112935760209261257792016123aa565b910152565b91908260a09103126112935760405161259481611d41565b60806125778183956125a581611b1d565b85526125b360208201611b1d565b60208601526125c460408201611e03565b60408601526125d560608201611e13565b606086015201611b1d565b8051156125ed5760200190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b80518210156125ed5760209160051b010190565b6040519061263b82611d41565b5f6080838281528260208201528260408201528260608201520152565b90816020910312611293575180151581036112935790565b61274b73ffffffffffffffffffffffffffffffffffffffff9485608094602096815f146127c7576401000276a4915b604051906126ac82611da6565b15158152888101918252836040820193168352604051998a9889987ff3cd914c000000000000000000000000000000000000000000000000000000008a528281511660048b0152828c8201511660248b015262ffffff60408201511660448b0152606081015160020b60648b0152015116608488015251151560a48701525160c4860152511660e4840152610120610104840152610124830190611c46565b03815f73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000004444c5dc75cb358380d2e3de08a90165af1908115611288575f91612798575090565b90506020813d6020116127bf575b816127b360209383611dc2565b81010312611293575190565b3d91506127a6565b73fffd8963efd1fc6a506488495d951d5263988d259161269f565b906127eb61262e565b5073ffffffffffffffffffffffffffffffffffffffff82511673ffffffffffffffffffffffffffffffffffffffff8216918183105f146128975773ffffffffffffffffffffffffffffffffffffffff905b168092149262ffffff60208201511673ffffffffffffffffffffffffffffffffffffffff806060604085015160020b94015116936040519561287d87611d41565b865216602085015260408401526060830152608082015291565b5073ffffffffffffffffffffffffffffffffffffffff829161283c56fea26469706673582212202c9a62991b4fb36e5c1f3ce9f73aead57db3aeba8a0887efd8b817bc3e3775fc64736f6c634300081a0033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
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.