From 3005de62d47583c3f6fc2c5969a98f0bbf6a4efb Mon Sep 17 00:00:00 2001 From: Abhishek Date: Mon, 16 Sep 2024 02:55:00 +0530 Subject: [PATCH] getTokenId helper of Recipt erc1155 tokens --- src/TakeProfitHook.sol | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/TakeProfitHook.sol b/src/TakeProfitHook.sol index c0fe824..3bb5fdc 100644 --- a/src/TakeProfitHook.sol +++ b/src/TakeProfitHook.sol @@ -61,6 +61,19 @@ contract TakeProfitsHook is BaseHook, ERC1155 { return intervals * tickSpacing; } + // ERc115 helpers + + function getTokenId( + PoolKey calldata key, + int24 tickLower, + bool zeroForOne + ) public pure returns (uint256) { + return + uint256( + keccak256(abi.encodePacked(key.toId(), tickLower, zeroForOne)) + ); + } + // Hooks function afterInitialize( address,