Skip to content

Feature request: include payer in callback data for decreaseLiquidity (currently only present in increaseLiquidity) #151

@cipst

Description

@cipst

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 payer optional or defaulting to address(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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions