Skip to main content

EfficientHash

Git Source

Title: Efficient Keccak256 Library

Provides gas-efficient keccak256 hashing using inline assembly

Functions

efficientKeccak256

Efficiently compute keccak256 hash for position key (address, address, uint256, int24, int24)

function efficientKeccak256(address univ3pool, address owner, uint256 tokenType, int24 tickLower, int24 tickUpper)
internal
pure
returns (bytes32 hash);

Parameters

NameTypeDescription
univ3pooladdressThe Uniswap V3 pool address (20 bytes)
owneraddressThe owner address (20 bytes)
tokenTypeuint256The token type (32 bytes)
tickLowerint24The lower tick (3 bytes when packed)
tickUpperint24The upper tick (3 bytes when packed)

Returns

NameTypeDescription
hashbytes32The keccak256 hash of the packed data

efficientKeccak256

Efficiently compute keccak256 hash for chunk key (int24, int24, uint256)

function efficientKeccak256(int24 strike, int24 width, uint256 tokenType) internal pure returns (bytes32 hash);

Parameters

NameTypeDescription
strikeint24The strike tick (3 bytes when packed)
widthint24The width (3 bytes when packed)
tokenTypeuint256The token type (32 bytes)

Returns

NameTypeDescription
hashbytes32The keccak256 hash of the packed data

efficientKeccak256

Efficiently compute keccak256 hash for a uint256 array

function efficientKeccak256(uint256[] memory data) internal pure returns (bytes32 hash);

Parameters

NameTypeDescription
datauint256[]The uint256 array to hash

Returns

NameTypeDescription
hashbytes32The keccak256 hash of the packed data

efficientKeccak256

Efficiently compute keccak256 hash for bytes memory

function efficientKeccak256(bytes memory data) internal pure returns (bytes32 hash);

Parameters

NameTypeDescription
databytesThe bytes to hash

Returns

NameTypeDescription
hashbytes32The keccak256 hash of the data