From 50eee982dff806f042bbe72f7a64ea318f672baa Mon Sep 17 00:00:00 2001 From: AyaneBTC <1564239399@qq.com> Date: Mon, 14 Oct 2024 15:29:48 +0800 Subject: [PATCH] fix: uint256 to address explicit type conversion error --- contracts/libraries/PoolAddress.sol | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/contracts/libraries/PoolAddress.sol b/contracts/libraries/PoolAddress.sol index 60de3852b..eccebc0fd 100644 --- a/contracts/libraries/PoolAddress.sol +++ b/contracts/libraries/PoolAddress.sol @@ -33,13 +33,15 @@ library PoolAddress { function computeAddress(address factory, PoolKey memory key) internal pure returns (address pool) { require(key.token0 < key.token1); pool = address( - uint256( - keccak256( - abi.encodePacked( - hex'ff', - factory, - keccak256(abi.encode(key.token0, key.token1, key.fee)), - POOL_INIT_CODE_HASH + uint160( + uint256( + keccak256( + abi.encodePacked( + hex'ff', + factory, + keccak256(abi.encode(key.token0, key.token1, key.fee)), + POOL_INIT_CODE_HASH + ) ) ) )