feat: Pancakeswap V3 support

This commit is contained in:
TAMARA LIPOWSKI
2025-03-21 11:26:41 -04:00
parent 59a5a558f5
commit d582543057
7 changed files with 82 additions and 12 deletions

View File

@@ -18,12 +18,14 @@ library CallbackValidationV2 {
address factory,
address tokenA,
address tokenB,
uint24 fee
uint24 fee,
bytes32 initCode
) internal view returns (IUniswapV3Pool pool) {
return
verifyCallback(
factory,
PoolAddressV2.getPoolKey(tokenA, tokenB, fee)
PoolAddressV2.getPoolKey(tokenA, tokenB, fee),
initCode
);
}
@@ -33,9 +35,10 @@ library CallbackValidationV2 {
/// @return pool The V3 pool contract address
function verifyCallback(
address factory,
PoolAddressV2.PoolKey memory poolKey
PoolAddressV2.PoolKey memory poolKey,
bytes32 initCode
) internal view returns (IUniswapV3Pool pool) {
pool = IUniswapV3Pool(PoolAddressV2.computeAddress(factory, poolKey));
pool = IUniswapV3Pool(PoolAddressV2.computeAddress(factory, poolKey, initCode));
require(msg.sender == address(pool), "CV");
}
}