-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
Context
In decreaseLiquidity, the payer parameter is not provided in the callback data - instead, it defaults to 0x0.
By contrast, the increaseLiquidity operation correctly passes the payer, using msg.sender, to the callback.
> IncreaseLiquidity behavior
LiquidityManagement.sol used by NonFungiblePositionManager.sol
function addLiquidity(AddLiquidityParams memory params) internal returns (uint128 liquidity, uint128 actualLiquidity, uint256 amount0, uint256 amount1, IAlgebraPool pool) {
// ...
pool = IAlgebraPool(PoolAddress.computeAddress(poolDeployer, poolKey));
(amount0, amount1, actualLiquidity) = pool.mint(
msg.sender,
params.recipient,
params.tickLower,
params.tickUpper,
liquidity,
abi.encode(MintCallbackData({poolKey: poolKey, payer: msg.sender})) // IMPORTANT
);
// ...
}> DecreaseLiquidity behavior
NonFungiblePositionManager.sol
function decreaseLiquidity(DecreaseLiquidityParams calldata params) external payable override isAuthorizedForToken(params.tokenId) checkDeadline(params.deadline) returns (uint256 amount0, uint256 amount1) {
// ...
IAlgebraPool pool = IAlgebraPool(_getPoolById(poolId));
(amount0, amount1) = pool._burnPositionInPool(tickLower, tickUpper, params.liquidity); // IMPORTANT
// ...
}PoolInteraction.sol
function _burnPositionInPool(IAlgebraPool pool, int24 tickLower, int24 tickUpper, uint128 liquidity) internal returns (uint256 amount0, uint256 amount1) {
return pool.burn(tickLower, tickUpper, liquidity, '0x0'); // '0x0' as callback data
}Why this matters
Both pool.mint(...) and pool.burn(...) calls plugin's hooks but one (pool.burn(...)) without the original msg.sender.
Having the payer parameter is useful for identifying who initiated or paid for the operation.
Current behavior (version 1.2.2)
| Operation | payer included in callback? |
|---|---|
| increaseLiquidity | Yes |
| decreaseLiquidity | No |
Suggested behavior
Extend the implementation of decreaseLiquidity to include the payer parameter in the callback data, for consistency with increaseLiquidity.
- At minimum, make the same information available in callbacks.
- For backward compatibility, consider making
payeroptional or defaulting toaddress(0)when not provided.
Benefits of this change
- Consistent behavior across liquidity operations.
- Improved traceability and security.
- Greater flexibility for developers building integrations around these hooks/callbacks.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels