@whetstone-research/doppler-sdk 1.0.21 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,6 +10,7 @@ The Doppler SDK exposes network-specific entrypoints for creating, managing, and
10
10
 
11
11
  - **EVM Auctions**: Static auctions, dynamic auctions, and multicurve launches across Uniswap V3/V4 paths
12
12
  - **EVM Migration Paths**: Support for V2, V2 split, V4, V4 split, DopplerHook, and no-op migration
13
+ - **EVM Multicurve Fees**: Pending-fee previews and beneficiary fee claiming for locked multicurve pools
13
14
  - **Solana Launches**: Initializer, CPMM, migrator, hook, oracle, and Token-2022-compatible instruction helpers
14
15
  - **Solana Clients and React**: Read clients, PDA helpers, generated codecs, and optional React bindings
15
16
  - **Token Management**: Built-in EVM support for DERC20 tokens with vesting
@@ -603,8 +604,9 @@ const result = await sdk.factory.createMulticurve(params);
603
604
  const assetAddress = result.tokenAddress; // SAVE THIS - you'll need it to collect fees!
604
605
  console.log('Asset address:', assetAddress);
605
606
 
606
- // Later, to collect fees (works before and after migration):
607
+ // Later, to preview and claim fees while the pool is locked:
607
608
  // const pool = await sdk.getMulticurvePool(assetAddress)
609
+ // const pending = await pool.getPendingFees('0xBeneficiary...')
608
610
  // await pool.collectFees()
609
611
  ```
610
612
 
@@ -612,12 +614,14 @@ console.log('Asset address:', assetAddress);
612
614
 
613
615
  - Set `fee` > 0 (e.g., 3000 for 0.3%) to accumulate trading fees for beneficiaries
614
616
  - **Save the asset address** (token address) returned from creation - you need it to collect fees later
615
- - Beneficiaries receive fees proportional to their shares when `collectFees()` is called
617
+ - Use `getPendingFees(beneficiary)` to preview a beneficiary's claimable token0/token1 fees
618
+ - `collectFees()` claims a payout for the calling account only when the caller is a configured beneficiary
616
619
  - Pool enters "Locked" status (status = 2) and liquidity cannot be migrated
617
620
  - Beneficiaries are immutable and set at pool creation time
618
621
  - The SDK automatically handles PoolKey construction and PoolId computation for you
619
622
 
620
623
  See [examples/multicurve-lockable-beneficiaries.ts](./examples/multicurve-lockable-beneficiaries.ts) for a complete example.
624
+ See [docs/multicurve-fees.md](./docs/multicurve-fees.md) for pending-fee previews, claiming, and current migrated-launch limitations.
621
625
 
622
626
  #### Transaction gas override
623
627
 
@@ -773,7 +777,8 @@ const currentEpoch = await auction.getCurrentEpoch();
773
777
 
774
778
  ### Multicurve Pool Interactions
775
779
 
776
- Multicurve pools support fee collection and distribution to beneficiaries when configured with `lockableBeneficiaries`.
780
+ Multicurve pools support fee collection and beneficiary claims when configured
781
+ with `pool.beneficiaries` and no-op migration.
777
782
 
778
783
  ```typescript
779
784
  // Get a multicurve pool instance using the asset address (token address)
@@ -795,15 +800,21 @@ if (feeSchedule) {
795
800
  console.log('Fee schedule:', feeSchedule);
796
801
  }
797
802
 
798
- // Collect and distribute fees to beneficiaries
799
- // This can be called by anyone, but only beneficiaries receive fees
803
+ // Preview pending fees for a beneficiary. This is a read-only call.
804
+ const pendingFees = await pool.getPendingFees(beneficiaryAddress);
805
+ console.log('Pending fees (token0):', pendingFees.fees0);
806
+ console.log('Pending fees (token1):', pendingFees.fees1);
807
+
808
+ // Claim fees from a beneficiary wallet while the pool is locked.
809
+ // Any account can call collectFees(), but only a configured beneficiary caller
810
+ // receives their pending share.
800
811
  const { fees0, fees1, transactionHash } = await pool.collectFees();
801
812
  console.log('Fees collected (token0):', fees0);
802
813
  console.log('Fees collected (token1):', fees1);
803
814
  console.log('Transaction:', transactionHash);
804
815
 
805
816
  // Get token addresses
806
- const tokenAddress = await pool.getTokenAddress();
817
+ const tokenAddress = pool.getTokenAddress();
807
818
  const numeraireAddress = await pool.getNumeraireAddress();
808
819
  ```
809
820
 
@@ -812,22 +823,21 @@ const numeraireAddress = await pool.getNumeraireAddress();
812
823
  The SDK handles the complexity of fee collection by:
813
824
 
814
825
  1. **Retrieving pool configuration** from the multicurve initializer contract
815
- 2. **Detecting migration status** and, if the pool has migrated, resolving the shared `StreamableFeesLockerV2`
816
- address via the multicurve migrator (no manual lookup required)
826
+ 2. **Detecting pool status** so only locked initializer-side pools proceed
817
827
  3. **Computing the PoolId** from the PoolKey using `keccak256(abi.encode(poolKey))`
818
- 4. **Calling the correct contract** (initializer while locked, locker after migration) with the computed PoolId
819
- 5. **Distributing fees** proportionally to all configured beneficiaries
828
+ 4. **Previewing pending fees** with a Multicall3 aggregate that simulates collection and reads beneficiary share/checkpoint data
829
+ 5. **Calling the initializer** with the computed PoolId when a beneficiary claims via `collectFees()`
820
830
 
821
831
  **Important Notes:**
822
832
 
823
833
  - Fees accumulate from swap activity on the pool (only if fee tier > 0)
824
- - Anyone can call `collectFees()`, but fees are distributed to beneficiaries only
825
- - Fees are automatically split according to configured beneficiary shares
826
- - The function returns the total amount collected for both tokens in the pair
827
- - Works exclusively with pools created using `lockableBeneficiaries` in the multicurve configuration
834
+ - `getPendingFees(beneficiary)` returns the beneficiary's pending share for both tokens in the pair
835
+ - `collectFees()` sends a transaction; the caller needs a wallet client
836
+ - Anyone can call `collectFees()`, but only a configured beneficiary caller receives their pending share
837
+ - The `collectFees()` return values are the newly collected pool fees, not necessarily the caller's beneficiary payout
838
+ - Works exclusively with initializer-side locked pools created with `pool.beneficiaries` and no-op migration
828
839
  - Pools in "Locked" status (status = 2) use the multicurve initializer for collection
829
- - Pools in "Exited" status (status = 3) automatically stream fees through `StreamableFeesLockerV2`; the SDK
830
- resolves the locker address and stream data for you
840
+ - Pools in "Exited" status (status = 3) are migrated and are not currently supported by `MulticurvePool.getPendingFees()` or `MulticurvePool.collectFees()`
831
841
  - `getFeeSchedule()` returns decay schedule details only for dynamic-fee multicurve pools, otherwise `null`
832
842
  - Beneficiaries must be configured at pool creation time and cannot be changed
833
843
 
@@ -838,7 +848,7 @@ The SDK handles the complexity of fee collection by:
838
848
  - Allow any beneficiary to trigger collection after significant trading activity
839
849
  - Monitor swap events to determine optimal collection timing
840
850
 
841
- See [examples/multicurve-collect-fees.ts](./examples/multicurve-collect-fees.ts) for a complete example.
851
+ See [docs/multicurve-fees.md](./docs/multicurve-fees.md) for a focused guide and [examples/multicurve-collect-fees.ts](./examples/multicurve-collect-fees.ts) for a complete example.
842
852
 
843
853
  ## Token Management
844
854