Custom Fees
Arbitrary migration to Uniswap v4 pools with customizable fees
The V3 SDK includes support for creating Doppler V3 pools that can migrate their liquidity to Uniswap V4 with customizable fee streaming. This allows protocols to distribute trading fees to multiple beneficiaries over time, and importantly, customize the post-graduation fee amounts.
Overview
The "V4 migrator" enables:
Migration from v3 or v4 Doppler pools to Uniswap V4 pools
Fee streaming to multiple beneficiaries with custom shares
Time-locked liquidity with configurable duration
Support for both standard and no-op governance models
Usage with V3 SDK
Doppler v3 tokens can specify their usage of the Uniswap v4 migrator at the time of creation.
Integration with CreateV3PoolParams
The V3 SDK's CreateV3PoolParams interface now includes an optional liquidityMigratorData field:
interface CreateV3PoolParams {
// ... other parameters ...
liquidityMigratorData?: Hex; // Encoded V4 migration configuration
}Step 1: Configure Beneficiaries
Step 2: Sort and Validate Beneficiaries
Beneficiaries must be sorted by address in ascending order:
Step 3: Configure V4 Migrator
Step 4: Encode Configuration
Step 5: Create Pool with V4 Migration
Querying Migrator State
Use the ReadMigrator class to query migrator configuration:
Important Considerations
Beneficiary Requirements
Sorted Order: Beneficiaries must be sorted by address (ascending)
Positive Shares: All shares must be greater than 0
Sum to WAD: Total shares must equal exactly 1e18 (100%)
Fee Tiers and Tick Spacing
Common V4 configurations:
0.01% fee → 1 tick spacing
0.05% fee → 10 tick spacing
0.3% fee → 60 tick spacing
1% fee → 200 tick spacing
Lock Duration
Minimum: No minimum (can be 0 for immediate unlocking)
Maximum: No maximum (can be set to centuries for permanent locks)
Typical: 1-4 years for protocol-owned liquidity
Helper Functions
sortBeneficiaries
Sorts beneficiaries by address in ascending order (required by contract).
encodeV4MigratorData
Encodes the V4 migrator configuration for use in pool creation. Validates:
Beneficiaries are sorted
All shares are positive
Total shares equal WAD
Migration Flow
Pool Creation: Doppler V3 pool is created with initial liquidity
Trading Phase: Users trade in the V3 pool during the sale period
Migration Trigger: When conditions are met (time/volume), migration begins
Liquidity Exit: All liquidity is removed from the V3 pool
V4 Pool Creation: New V4 pool is created with full-range liquidity
Fee Streaming: Trading fees accumulate and stream to beneficiaries
Example: Multi-Beneficiary Setup
See Also
Last updated