Skip to main content
Helpful?

CalldataDecoder

Git Source - Generated with forge doc

State Variables

OFFSET_OR_LENGTH_MASK

mask used for offsets and lengths to ensure no overflow

no sane abi encoding will pass in an offset or length greater than type(uint32).max (note that this does deviate from standard solidity behavior and offsets/lengths will be interpreted as mod type(uint32).max which will only impact malicious/buggy callers)

uint256 constant OFFSET_OR_LENGTH_MASK = 0xffffffff;

OFFSET_OR_LENGTH_MASK_AND_WORD_ALIGN

uint256 constant OFFSET_OR_LENGTH_MASK_AND_WORD_ALIGN = 0xffffffe0;

SLICE_ERROR_SELECTOR

equivalent to SliceOutOfBounds.selector, stored in least-significant bits

uint256 constant SLICE_ERROR_SELECTOR = 0x3b99b53d;

Functions

decodeActionsRouterParams

equivalent to: abi.decode(params, (bytes, bytes[])) in calldata (requires strict abi encoding)

function decodeActionsRouterParams(bytes calldata _bytes)
internal
pure
returns (bytes calldata actions, bytes[] calldata params);

decodeModifyLiquidityParams

equivalent to: abi.decode(params, (uint256, uint256, uint128, uint128, bytes)) in calldata

function decodeModifyLiquidityParams(bytes calldata params)
internal
pure
returns (uint256 tokenId, uint256 liquidity, uint128 amount0, uint128 amount1, bytes calldata hookData);

decodeMintParams

equivalent to: abi.decode(params, (PoolKey, int24, int24, uint256, uint128, uint128, address, bytes)) in calldata

function decodeMintParams(bytes calldata params)
internal
pure
returns (
PoolKey calldata poolKey,
int24 tickLower,
int24 tickUpper,
uint256 liquidity,
uint128 amount0Max,
uint128 amount1Max,
address owner,
bytes calldata hookData
);

decodeBurnParams

equivalent to: abi.decode(params, (uint256, uint128, uint128, bytes)) in calldata

function decodeBurnParams(bytes calldata params)
internal
pure
returns (uint256 tokenId, uint128 amount0Min, uint128 amount1Min, bytes calldata hookData);

decodeSwapExactInParams

equivalent to: abi.decode(params, (IV4Router.ExactInputParams))

function decodeSwapExactInParams(bytes calldata params)
internal
pure
returns (IV4Router.ExactInputParams calldata swapParams);

decodeSwapExactInSingleParams

equivalent to: abi.decode(params, (IV4Router.ExactInputSingleParams))

function decodeSwapExactInSingleParams(bytes calldata params)
internal
pure
returns (IV4Router.ExactInputSingleParams calldata swapParams);

decodeSwapExactOutParams

equivalent to: abi.decode(params, (IV4Router.ExactOutputParams))

function decodeSwapExactOutParams(bytes calldata params)
internal
pure
returns (IV4Router.ExactOutputParams calldata swapParams);

decodeSwapExactOutSingleParams

equivalent to: abi.decode(params, (IV4Router.ExactOutputSingleParams))

function decodeSwapExactOutSingleParams(bytes calldata params)
internal
pure
returns (IV4Router.ExactOutputSingleParams calldata swapParams);

decodeCurrency

equivalent to: abi.decode(params, (Currency)) in calldata

function decodeCurrency(bytes calldata params) internal pure returns (Currency currency);

decodeCurrencyPair

equivalent to: abi.decode(params, (Currency, Currency)) in calldata

function decodeCurrencyPair(bytes calldata params) internal pure returns (Currency currency0, Currency currency1);

decodeCurrencyPairAndAddress

equivalent to: abi.decode(params, (Currency, Currency, address)) in calldata

function decodeCurrencyPairAndAddress(bytes calldata params)
internal
pure
returns (Currency currency0, Currency currency1, address _address);

decodeCurrencyAndAddress

equivalent to: abi.decode(params, (Currency, address)) in calldata

function decodeCurrencyAndAddress(bytes calldata params) internal pure returns (Currency currency, address _address);

decodeCurrencyAddressAndUint256

equivalent to: abi.decode(params, (Currency, address, uint256)) in calldata

function decodeCurrencyAddressAndUint256(bytes calldata params)
internal
pure
returns (Currency currency, address _address, uint256 amount);

decodeCurrencyAndUint256

equivalent to: abi.decode(params, (Currency, uint256)) in calldata

function decodeCurrencyAndUint256(bytes calldata params) internal pure returns (Currency currency, uint256 amount);

decodeUint256

equivalent to: abi.decode(params, (uint256)) in calldata

function decodeUint256(bytes calldata params) internal pure returns (uint256 amount);

decodeCurrencyUint256AndBool

equivalent to: abi.decode(params, (Currency, uint256, bool)) in calldata

function decodeCurrencyUint256AndBool(bytes calldata params)
internal
pure
returns (Currency currency, uint256 amount, bool boolean);

toBytes

Decode the _arg-th element in _bytes as bytes

function toBytes(bytes calldata _bytes, uint256 _arg) internal pure returns (bytes calldata res);

Parameters

NameTypeDescription
_bytesbytesThe input bytes string to extract a bytes string from
_arguint256The index of the argument to extract

Errors

SliceOutOfBounds

error SliceOutOfBounds();
Helpful?