Skip to content

[Feature Request]: ERC6909 Credits Support in PositionManager #475

@mshakeg

Description

@mshakeg

Component

Position Manager

Describe the suggested feature and problem it solves.

Summary

Add support for using ERC6909 credits as a payment method in the PositionManager, allowing users to leverage their existing credits in the PoolManager for position-related operations without requiring external token transfers.

Motivation

The current PositionManager implementation supports creating and modifying positions using external tokens via Permit2, but lacks the ability to utilize ERC6909 credits that users may already have in the PoolManager. This creates an architectural disconnect between the core and periphery layers, as the PoolManager supports a dual accounting system (delta accounting and ERC6909 credits) while the PositionManager only interfaces with one side of this system.

Adding ERC6909 credits support would:

  1. Improve gas efficiency by eliminating unnecessary token transfers for users who already have credits
  2. Create a more cohesive UX between swapping and liquidity provision
  3. Better align the periphery with core design principles
  4. Enable more sophisticated integrations with hooks and other protocols

Describe the desired implementation.

Proposed Solution

Enhance the PositionManager to support using ERC6909 credits for operations such as minting positions and modifying liquidity. This would involve:

  1. Modifying the _pay method to check for and use ERC6909 credits when available
  2. Adding new action types to the Actions library to explicitly support ERC6909-based operations
  3. Implementing preference mechanisms to allow users to choose between credits and external transfers

Example Usage Flows

Current Flow (Using External Tokens):

  1. User approves tokens via Permit2
  2. User calls PositionManager to mint/modify position
  3. PositionManager transfers tokens from user via Permit2
  4. Position is created/modified

Proposed Flow (Using ERC6909 Credits):

  1. User already has ERC6909 credits in PoolManager
  2. User calls PositionManager with action indicating ERC6909 credit usage
  3. PositionManager burns user's credits via PoolManager
  4. Position is created/modified

Hybrid Flow:

  1. User has some credits and some external tokens
  2. User approves external tokens via Permit2
  3. User calls PositionManager with hybrid action
  4. PositionManager uses credits first, then external tokens as needed
  5. Position is created/modified

Implementation Considerations

Core Components to Modify

  1. DeltaResolver Base Contract:

    • Enhance _pay method to support ERC6909 credits
  2. Actions Library:

    • Add new action codes for ERC6909-specific operations
    • Consider adding preference parameters to existing actions
  3. PositionManager Contract:

    • Extend _handleAction to process new ERC6909-related actions

Initial Action Types to Consider

  • MINT_POSITION_FROM_6909 - Create position using existing credits
  • INCREASE_LIQUIDITY_FROM_6909 - Add liquidity using existing credits

Describe alternatives.

No response

Additional context.

No response

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