@whetstone-research/doppler-sdk 0.0.17 → 0.0.19

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.
Files changed (162) hide show
  1. package/README.md +66 -1
  2. package/dist/DopplerSDK.js +19 -19
  3. package/dist/DopplerSDK.mjs +18 -18
  4. package/dist/abis/index.d.mts +32 -1
  5. package/dist/abis/index.d.ts +32 -1
  6. package/dist/abis/index.js +26 -22
  7. package/dist/abis/index.mjs +1 -1
  8. package/dist/addresses.d.mts +1 -0
  9. package/dist/addresses.d.ts +1 -0
  10. package/dist/addresses.js +7 -7
  11. package/dist/addresses.mjs +2 -2
  12. package/dist/builders/DynamicAuctionBuilder.js +10 -10
  13. package/dist/builders/DynamicAuctionBuilder.mjs +9 -9
  14. package/dist/builders/MulticurveBuilder.d.mts +16 -0
  15. package/dist/builders/MulticurveBuilder.d.ts +16 -0
  16. package/dist/builders/MulticurveBuilder.js +10 -10
  17. package/dist/builders/MulticurveBuilder.mjs +9 -9
  18. package/dist/builders/StaticAuctionBuilder.js +10 -10
  19. package/dist/builders/StaticAuctionBuilder.mjs +9 -9
  20. package/dist/builders/index.js +18 -18
  21. package/dist/builders/index.mjs +11 -11
  22. package/dist/builders/shared.js +11 -11
  23. package/dist/builders/shared.mjs +7 -7
  24. package/dist/{chunk-LOVD3NCN.js → chunk-3MVW6UIW.js} +18 -2
  25. package/dist/chunk-3MVW6UIW.js.map +1 -0
  26. package/dist/{chunk-DVAQB7TB.mjs → chunk-3NFSMMBF.mjs} +3 -3
  27. package/dist/{chunk-DVAQB7TB.mjs.map → chunk-3NFSMMBF.mjs.map} +1 -1
  28. package/dist/{chunk-PBWOCVDZ.mjs → chunk-4TAAZ6W3.mjs} +248 -51
  29. package/dist/chunk-4TAAZ6W3.mjs.map +1 -0
  30. package/dist/{chunk-4DUE547M.js → chunk-6BQY5EPB.js} +4 -2
  31. package/dist/chunk-6BQY5EPB.js.map +1 -0
  32. package/dist/{chunk-HVM7KZJM.mjs → chunk-6HFZ6XMV.mjs} +4 -4
  33. package/dist/{chunk-HVM7KZJM.mjs.map → chunk-6HFZ6XMV.mjs.map} +1 -1
  34. package/dist/{chunk-EG6O2TUX.js → chunk-7Z2UGWE7.js} +26 -26
  35. package/dist/{chunk-EG6O2TUX.js.map → chunk-7Z2UGWE7.js.map} +1 -1
  36. package/dist/{chunk-O2DZH23A.mjs → chunk-CYY5IATT.mjs} +9 -5
  37. package/dist/chunk-CYY5IATT.mjs.map +1 -0
  38. package/dist/{chunk-BZKX3J3R.mjs → chunk-E2NF4AQB.mjs} +18 -3
  39. package/dist/chunk-E2NF4AQB.mjs.map +1 -0
  40. package/dist/{chunk-B4B7BXLI.js → chunk-E6ACC5S6.js} +24 -24
  41. package/dist/{chunk-B4B7BXLI.js.map → chunk-E6ACC5S6.js.map} +1 -1
  42. package/dist/{chunk-K5CV3MIH.mjs → chunk-FQ3PVXZU.mjs} +5 -5
  43. package/dist/{chunk-K5CV3MIH.mjs.map → chunk-FQ3PVXZU.mjs.map} +1 -1
  44. package/dist/{chunk-WQKBQRBS.mjs → chunk-GCT3IZ3E.mjs} +12 -12
  45. package/dist/{chunk-WQKBQRBS.mjs.map → chunk-GCT3IZ3E.mjs.map} +1 -1
  46. package/dist/{chunk-LDZCTC5Q.mjs → chunk-H5SUGQ2C.mjs} +45 -7
  47. package/dist/chunk-H5SUGQ2C.mjs.map +1 -0
  48. package/dist/{chunk-PE47QUJV.mjs → chunk-HH7HQ4HC.mjs} +3 -3
  49. package/dist/{chunk-PE47QUJV.mjs.map → chunk-HH7HQ4HC.mjs.map} +1 -1
  50. package/dist/{chunk-LXUF7RNX.mjs → chunk-IWJOPXYN.mjs} +4 -3
  51. package/dist/chunk-IWJOPXYN.mjs.map +1 -0
  52. package/dist/{chunk-MBOKYN2Y.js → chunk-K3TEDYUG.js} +20 -20
  53. package/dist/{chunk-MBOKYN2Y.js.map → chunk-K3TEDYUG.js.map} +1 -1
  54. package/dist/{chunk-NVVEUALG.mjs → chunk-MH74WYVZ.mjs} +5 -5
  55. package/dist/{chunk-NVVEUALG.mjs.map → chunk-MH74WYVZ.mjs.map} +1 -1
  56. package/dist/{chunk-ZVH7VBH5.mjs → chunk-N74ICDSX.mjs} +118 -20
  57. package/dist/chunk-N74ICDSX.mjs.map +1 -0
  58. package/dist/{chunk-C7GN6GPG.js → chunk-OROTK4OT.js} +51 -27
  59. package/dist/chunk-OROTK4OT.js.map +1 -0
  60. package/dist/{chunk-Z7ZGPSQF.js → chunk-P4BT5GDO.js} +76 -72
  61. package/dist/chunk-P4BT5GDO.js.map +1 -0
  62. package/dist/{chunk-YBDWQTUH.mjs → chunk-QFQXHDC7.mjs} +76 -9
  63. package/dist/chunk-QFQXHDC7.mjs.map +1 -0
  64. package/dist/{chunk-RKJ2466C.mjs → chunk-QOGBOT2M.mjs} +3 -3
  65. package/dist/{chunk-RKJ2466C.mjs.map → chunk-QOGBOT2M.mjs.map} +1 -1
  66. package/dist/{chunk-3ALNQHGL.js → chunk-RLUMYHPI.js} +76 -9
  67. package/dist/chunk-RLUMYHPI.js.map +1 -0
  68. package/dist/{chunk-5FJCRKQ6.js → chunk-RXUJ4DUB.js} +28 -28
  69. package/dist/{chunk-5FJCRKQ6.js.map → chunk-RXUJ4DUB.js.map} +1 -1
  70. package/dist/{chunk-MGLI4N4B.js → chunk-SAX7P3MH.js} +22 -22
  71. package/dist/{chunk-MGLI4N4B.js.map → chunk-SAX7P3MH.js.map} +1 -1
  72. package/dist/{chunk-3ORKVXQL.js → chunk-TJCMFITE.js} +27 -27
  73. package/dist/{chunk-3ORKVXQL.js.map → chunk-TJCMFITE.js.map} +1 -1
  74. package/dist/{chunk-TL7U67CX.js → chunk-UIPSHVT4.js} +11 -11
  75. package/dist/{chunk-TL7U67CX.js.map → chunk-UIPSHVT4.js.map} +1 -1
  76. package/dist/{chunk-5ZPBKSNS.mjs → chunk-UY4TVYEU.mjs} +3 -3
  77. package/dist/{chunk-5ZPBKSNS.mjs.map → chunk-UY4TVYEU.mjs.map} +1 -1
  78. package/dist/{chunk-PQUS2LCD.js → chunk-UZTVXZP3.js} +16 -16
  79. package/dist/{chunk-PQUS2LCD.js.map → chunk-UZTVXZP3.js.map} +1 -1
  80. package/dist/{chunk-HMZEYBFO.mjs → chunk-V32Q2S3U.mjs} +4 -4
  81. package/dist/{chunk-HMZEYBFO.mjs.map → chunk-V32Q2S3U.mjs.map} +1 -1
  82. package/dist/{chunk-7F4O7NPS.js → chunk-V5GPJ6S2.js} +26 -26
  83. package/dist/{chunk-7F4O7NPS.js.map → chunk-V5GPJ6S2.js.map} +1 -1
  84. package/dist/{chunk-DOWDXOTK.mjs → chunk-VGCXJRUV.mjs} +51 -27
  85. package/dist/chunk-VGCXJRUV.mjs.map +1 -0
  86. package/dist/{chunk-J32XSN44.js → chunk-WYRM5BAI.js} +344 -147
  87. package/dist/chunk-WYRM5BAI.js.map +1 -0
  88. package/dist/{chunk-OUUFER2X.mjs → chunk-X7FRTHUL.mjs} +4 -4
  89. package/dist/{chunk-OUUFER2X.mjs.map → chunk-X7FRTHUL.mjs.map} +1 -1
  90. package/dist/{chunk-E54BP2GN.js → chunk-Y6VZD4C6.js} +53 -15
  91. package/dist/chunk-Y6VZD4C6.js.map +1 -0
  92. package/dist/{chunk-5MP6AMPB.js → chunk-YFJUIO2A.js} +132 -34
  93. package/dist/chunk-YFJUIO2A.js.map +1 -0
  94. package/dist/{chunk-WHQHXYPB.js → chunk-YKRDFXU3.js} +5 -5
  95. package/dist/{chunk-WHQHXYPB.js.map → chunk-YKRDFXU3.js.map} +1 -1
  96. package/dist/constants.d.mts +7 -1
  97. package/dist/constants.d.ts +7 -1
  98. package/dist/constants.js +51 -47
  99. package/dist/constants.mjs +1 -1
  100. package/dist/deployments.generated.d.mts +72 -5
  101. package/dist/deployments.generated.d.ts +72 -5
  102. package/dist/deployments.generated.js +2 -2
  103. package/dist/deployments.generated.mjs +1 -1
  104. package/dist/entities/DopplerFactory.d.mts +2 -0
  105. package/dist/entities/DopplerFactory.d.ts +2 -0
  106. package/dist/entities/DopplerFactory.js +8 -8
  107. package/dist/entities/DopplerFactory.mjs +7 -7
  108. package/dist/entities/auction/DynamicAuction.js +5 -5
  109. package/dist/entities/auction/DynamicAuction.mjs +4 -4
  110. package/dist/entities/auction/MulticurvePool.d.mts +9 -3
  111. package/dist/entities/auction/MulticurvePool.d.ts +9 -3
  112. package/dist/entities/auction/MulticurvePool.js +7 -6
  113. package/dist/entities/auction/MulticurvePool.mjs +6 -5
  114. package/dist/entities/auction/StaticAuction.js +5 -5
  115. package/dist/entities/auction/StaticAuction.mjs +4 -4
  116. package/dist/entities/auction/index.js +11 -10
  117. package/dist/entities/auction/index.mjs +8 -7
  118. package/dist/entities/quoter/Quoter.js +5 -5
  119. package/dist/entities/quoter/Quoter.mjs +4 -4
  120. package/dist/entities/quoter/index.js +5 -5
  121. package/dist/entities/quoter/index.mjs +4 -4
  122. package/dist/entities/token/derc20/Derc20.js +3 -3
  123. package/dist/entities/token/derc20/Derc20.mjs +2 -2
  124. package/dist/entities/token/derc20/index.js +3 -3
  125. package/dist/entities/token/derc20/index.mjs +2 -2
  126. package/dist/entities/token/index.js +3 -3
  127. package/dist/entities/token/index.mjs +2 -2
  128. package/dist/index.d.mts +3 -3
  129. package/dist/index.d.ts +3 -3
  130. package/dist/index.js +110 -102
  131. package/dist/index.js.map +1 -1
  132. package/dist/index.mjs +18 -18
  133. package/dist/index.mjs.map +1 -1
  134. package/dist/types.d.mts +32 -1
  135. package/dist/types.d.ts +32 -1
  136. package/dist/types.js +8 -8
  137. package/dist/types.mjs +3 -3
  138. package/dist/utils/airlock.js +7 -7
  139. package/dist/utils/airlock.mjs +3 -3
  140. package/dist/utils/index.js +10 -10
  141. package/dist/utils/index.mjs +5 -5
  142. package/dist/utils/tokenAddressMiner.d.mts +7 -0
  143. package/dist/utils/tokenAddressMiner.d.ts +7 -0
  144. package/dist/utils/tokenAddressMiner.js +3 -3
  145. package/dist/utils/tokenAddressMiner.mjs +2 -2
  146. package/package.json +1 -1
  147. package/dist/chunk-3ALNQHGL.js.map +0 -1
  148. package/dist/chunk-4DUE547M.js.map +0 -1
  149. package/dist/chunk-5MP6AMPB.js.map +0 -1
  150. package/dist/chunk-BZKX3J3R.mjs.map +0 -1
  151. package/dist/chunk-C7GN6GPG.js.map +0 -1
  152. package/dist/chunk-DOWDXOTK.mjs.map +0 -1
  153. package/dist/chunk-E54BP2GN.js.map +0 -1
  154. package/dist/chunk-J32XSN44.js.map +0 -1
  155. package/dist/chunk-LDZCTC5Q.mjs.map +0 -1
  156. package/dist/chunk-LOVD3NCN.js.map +0 -1
  157. package/dist/chunk-LXUF7RNX.mjs.map +0 -1
  158. package/dist/chunk-O2DZH23A.mjs.map +0 -1
  159. package/dist/chunk-PBWOCVDZ.mjs.map +0 -1
  160. package/dist/chunk-YBDWQTUH.mjs.map +0 -1
  161. package/dist/chunk-Z7ZGPSQF.js.map +0 -1
  162. package/dist/chunk-ZVH7VBH5.mjs.map +0 -1
@@ -1,9 +1,9 @@
1
1
  import { computeOptimalGamma } from './chunk-H3B54PFV.mjs';
2
2
  import { isToken0Expected } from './chunk-ABT6AT7C.mjs';
3
3
  import { MIN_TICK, MAX_TICK } from './chunk-25GEBO3B.mjs';
4
- import { DEFAULT_V3_MAX_SHARE_TO_BE_SOLD, DEFAULT_V3_NUM_POSITIONS, DEFAULT_V4_YEARLY_MINT_RATE, DEFAULT_V3_INITIAL_VOTING_DELAY, DEFAULT_V3_INITIAL_VOTING_PERIOD, DEFAULT_V3_INITIAL_PROPOSAL_THRESHOLD, ZERO_ADDRESS, DEFAULT_CREATE_GAS_LIMIT, DEFAULT_PD_SLUGS, DEFAULT_V4_INITIAL_VOTING_DELAY, DEFAULT_V4_INITIAL_VOTING_PERIOD, DEFAULT_V4_INITIAL_PROPOSAL_THRESHOLD, WAD, DEFAULT_V3_YEARLY_MINT_RATE, TICK_SPACINGS, DOPPLER_MAX_TICK_SPACING, FLAG_MASK } from './chunk-LXUF7RNX.mjs';
5
- import { getAddresses } from './chunk-O2DZH23A.mjs';
6
- import { airlockAbi, bundlerAbi, v4MulticurveInitializerAbi } from './chunk-BZKX3J3R.mjs';
4
+ import { DEFAULT_V3_MAX_SHARE_TO_BE_SOLD, DEFAULT_V3_NUM_POSITIONS, DEFAULT_V4_YEARLY_MINT_RATE, DEFAULT_V3_INITIAL_VOTING_DELAY, DEFAULT_V3_INITIAL_VOTING_PERIOD, DEFAULT_V3_INITIAL_PROPOSAL_THRESHOLD, ZERO_ADDRESS, DEFAULT_CREATE_GAS_LIMIT, DEFAULT_PD_SLUGS, DEFAULT_V4_INITIAL_VOTING_DELAY, DEFAULT_V4_INITIAL_VOTING_PERIOD, DEFAULT_V4_INITIAL_PROPOSAL_THRESHOLD, DECAY_MAX_START_FEE, V4_MAX_FEE, WAD, DEFAULT_V3_YEARLY_MINT_RATE, TICK_SPACINGS, DOPPLER_MAX_TICK_SPACING, FLAG_MASK, DYNAMIC_FEE_FLAG } from './chunk-IWJOPXYN.mjs';
5
+ import { getAddresses } from './chunk-CYY5IATT.mjs';
6
+ import { airlockAbi, bundlerAbi, v4MulticurveInitializerAbi } from './chunk-E2NF4AQB.mjs';
7
7
  import { derc20_default } from './chunk-64ZQRKG3.mjs';
8
8
  import { derc2080_default } from './chunk-LPA32BIK.mjs';
9
9
  import { doppler_default } from './chunk-VK5HAWX6.mjs';
@@ -820,6 +820,163 @@ var DopplerFactory = class {
820
820
  /**
821
821
  * Encode create params for Uniswap V4 Multicurve initializer/migrator flow
822
822
  */
823
+ normalizeUint32(value, label) {
824
+ const normalized = typeof value === "bigint" ? Number(value) : Number(value);
825
+ if (!Number.isFinite(normalized) || !Number.isInteger(normalized)) {
826
+ throw new Error(
827
+ `${label} must be an integer number of seconds since Unix epoch`
828
+ );
829
+ }
830
+ if (normalized < 0) {
831
+ throw new Error(`${label} cannot be negative`);
832
+ }
833
+ const UINT32_MAX = 4294967295;
834
+ if (normalized > UINT32_MAX) {
835
+ throw new Error(
836
+ `${label} must fit within uint32 (seconds since Unix epoch up to year 2106)`
837
+ );
838
+ }
839
+ return normalized;
840
+ }
841
+ resolveMulticurveInitializerMode(params) {
842
+ const legacySchedule = params.schedule;
843
+ const legacyHook = params.dopplerHook;
844
+ const hasLegacySchedule = legacySchedule !== void 0;
845
+ const hasLegacyHook = legacyHook !== void 0;
846
+ if (hasLegacySchedule && hasLegacyHook) {
847
+ throw new Error(
848
+ "Cannot combine schedule and dopplerHook legacy multicurve options. Use exactly one initializer mode."
849
+ );
850
+ }
851
+ const initializer = params.initializer;
852
+ let mode;
853
+ if (!initializer) {
854
+ if (hasLegacySchedule) {
855
+ mode = {
856
+ type: "scheduled",
857
+ startTime: this.normalizeUint32(
858
+ legacySchedule.startTime,
859
+ "Scheduled multicurve startTime"
860
+ )
861
+ };
862
+ } else if (hasLegacyHook) {
863
+ mode = {
864
+ type: "rehype",
865
+ hookConfig: legacyHook
866
+ };
867
+ } else {
868
+ mode = { type: "standard" };
869
+ }
870
+ } else {
871
+ switch (initializer.type) {
872
+ case "standard": {
873
+ if (hasLegacySchedule || hasLegacyHook) {
874
+ throw new Error(
875
+ "Initializer type 'standard' cannot be combined with legacy schedule/dopplerHook fields"
876
+ );
877
+ }
878
+ mode = { type: "standard" };
879
+ break;
880
+ }
881
+ case "scheduled": {
882
+ if (hasLegacyHook) {
883
+ throw new Error(
884
+ "Initializer type 'scheduled' cannot be combined with dopplerHook"
885
+ );
886
+ }
887
+ const normalizedStart = this.normalizeUint32(
888
+ initializer.startTime,
889
+ "Scheduled multicurve startTime"
890
+ );
891
+ if (hasLegacySchedule) {
892
+ const legacyStart = this.normalizeUint32(
893
+ legacySchedule.startTime,
894
+ "Scheduled multicurve startTime"
895
+ );
896
+ if (legacyStart !== normalizedStart) {
897
+ throw new Error(
898
+ "Conflicting scheduled start times provided via initializer and schedule"
899
+ );
900
+ }
901
+ }
902
+ mode = { type: "scheduled", startTime: normalizedStart };
903
+ break;
904
+ }
905
+ case "decay": {
906
+ if (hasLegacySchedule || hasLegacyHook) {
907
+ throw new Error(
908
+ "Initializer type 'decay' cannot be combined with legacy schedule/dopplerHook fields"
909
+ );
910
+ }
911
+ const startTime = this.normalizeUint32(
912
+ initializer.startTime,
913
+ "Decay multicurve startTime"
914
+ );
915
+ const startFee = Number(initializer.startFee);
916
+ const durationSeconds = this.normalizeUint32(
917
+ initializer.durationSeconds,
918
+ "Decay multicurve durationSeconds"
919
+ );
920
+ const endFee = Number(params.pool.fee);
921
+ if (!Number.isInteger(startFee)) {
922
+ throw new Error("Decay multicurve startFee must be an integer");
923
+ }
924
+ if (startFee < 0 || startFee > DECAY_MAX_START_FEE) {
925
+ throw new Error(
926
+ `Decay multicurve startFee must be between 0 and ${DECAY_MAX_START_FEE}`
927
+ );
928
+ }
929
+ if (!Number.isInteger(endFee) || endFee < 0 || endFee > V4_MAX_FEE) {
930
+ throw new Error(
931
+ `Multicurve pool fee must be between 0 and ${V4_MAX_FEE}`
932
+ );
933
+ }
934
+ if (startFee < endFee) {
935
+ throw new Error(
936
+ `Decay multicurve startFee (${startFee}) must be greater than or equal to terminal pool fee (${endFee})`
937
+ );
938
+ }
939
+ if (startFee > endFee && durationSeconds <= 0) {
940
+ throw new Error(
941
+ "Decay multicurve durationSeconds must be greater than 0 when startFee is greater than terminal pool fee"
942
+ );
943
+ }
944
+ mode = {
945
+ type: "decay",
946
+ startTime,
947
+ startFee,
948
+ durationSeconds
949
+ };
950
+ break;
951
+ }
952
+ case "rehype": {
953
+ if (hasLegacySchedule) {
954
+ throw new Error(
955
+ "Initializer type 'rehype' cannot be combined with schedule"
956
+ );
957
+ }
958
+ mode = { type: "rehype", hookConfig: initializer.config };
959
+ break;
960
+ }
961
+ default: {
962
+ const exhaustive = initializer;
963
+ throw new Error(
964
+ `Unsupported multicurve initializer type: ${exhaustive?.type ?? "unknown"}`
965
+ );
966
+ }
967
+ }
968
+ }
969
+ if (params.modules?.dopplerHookInitializer !== void 0) {
970
+ if (mode.type === "standard") {
971
+ mode = { type: "rehype" };
972
+ } else if (mode.type !== "rehype") {
973
+ throw new Error(
974
+ "modules.dopplerHookInitializer can only be used with the rehype or standard multicurve initializer mode"
975
+ );
976
+ }
977
+ }
978
+ return mode;
979
+ }
823
980
  encodeCreateMulticurveParams(params) {
824
981
  this.validateMulticurveParams(params);
825
982
  if (!params.pool || params.pool.curves.length === 0) {
@@ -837,29 +994,12 @@ var DopplerFactory = class {
837
994
  return aAddr < bAddr ? -1 : aAddr > bAddr ? 1 : 0;
838
995
  }
839
996
  );
840
- const useScheduledInitializer = params.schedule !== void 0;
841
- const useDopplerHook = params.dopplerHook !== void 0;
842
- const useDopplerHookInitializer = useDopplerHook || params.modules?.dopplerHookInitializer !== void 0;
843
- let scheduleStartTime;
844
- if (useScheduledInitializer) {
845
- scheduleStartTime = Number(params.schedule.startTime);
846
- if (!Number.isFinite(scheduleStartTime) || !Number.isInteger(scheduleStartTime)) {
847
- throw new Error(
848
- "Scheduled multicurve startTime must be an integer number of seconds since Unix epoch"
849
- );
850
- }
851
- if (scheduleStartTime < 0) {
852
- throw new Error("Scheduled multicurve startTime cannot be negative");
853
- }
854
- const UINT32_MAX = 4294967295;
855
- if (scheduleStartTime > UINT32_MAX) {
856
- throw new Error(
857
- "Scheduled multicurve startTime must fit within uint32 (seconds since Unix epoch up to year 2106)"
858
- );
859
- }
860
- }
861
- if (useDopplerHook) {
862
- const hook = params.dopplerHook;
997
+ const initializerMode = this.resolveMulticurveInitializerMode(params);
998
+ const useScheduledInitializer = initializerMode.type === "scheduled";
999
+ const useDecayInitializer = initializerMode.type === "decay";
1000
+ const useDopplerHookInitializer = initializerMode.type === "rehype";
1001
+ if (initializerMode.type === "rehype" && initializerMode.hookConfig) {
1002
+ const hook = initializerMode.hookConfig;
863
1003
  const totalDistribution = hook.assetBuybackPercentWad + hook.numeraireBuybackPercentWad + hook.beneficiaryPercentWad + hook.lpPercentWad;
864
1004
  if (totalDistribution !== WAD) {
865
1005
  throw new Error(
@@ -893,9 +1033,10 @@ var DopplerFactory = class {
893
1033
  );
894
1034
  let poolInitializerData;
895
1035
  if (useDopplerHookInitializer) {
1036
+ const hookConfig = initializerMode.type === "rehype" ? initializerMode.hookConfig : void 0;
896
1037
  let farTick;
897
- if (params.dopplerHook?.farTick !== void 0) {
898
- farTick = params.dopplerHook.farTick;
1038
+ if (hookConfig?.farTick !== void 0) {
1039
+ farTick = hookConfig.farTick;
899
1040
  } else {
900
1041
  const allTickUppers = params.pool.curves.map((c) => c.tickUpper);
901
1042
  farTick = Math.max(...allTickUppers);
@@ -903,9 +1044,8 @@ var DopplerFactory = class {
903
1044
  let onInitializationDopplerHookCalldata = "0x";
904
1045
  let graduationDopplerHookCalldata = "0x";
905
1046
  let dopplerHookAddress = ZERO_ADDRESS;
906
- if (useDopplerHook) {
907
- const hook = params.dopplerHook;
908
- dopplerHookAddress = hook.hookAddress;
1047
+ if (hookConfig) {
1048
+ dopplerHookAddress = hookConfig.hookAddress;
909
1049
  onInitializationDopplerHookCalldata = encodeAbiParameters(
910
1050
  [
911
1051
  { type: "address" },
@@ -925,15 +1065,15 @@ var DopplerFactory = class {
925
1065
  ],
926
1066
  [
927
1067
  params.sale.numeraire,
928
- hook.buybackDestination,
929
- hook.customFee,
930
- hook.assetBuybackPercentWad,
931
- hook.numeraireBuybackPercentWad,
932
- hook.beneficiaryPercentWad,
933
- hook.lpPercentWad
1068
+ hookConfig.buybackDestination,
1069
+ hookConfig.customFee,
1070
+ hookConfig.assetBuybackPercentWad,
1071
+ hookConfig.numeraireBuybackPercentWad,
1072
+ hookConfig.beneficiaryPercentWad,
1073
+ hookConfig.lpPercentWad
934
1074
  ]
935
1075
  );
936
- graduationDopplerHookCalldata = hook.graduationCalldata ?? "0x";
1076
+ graduationDopplerHookCalldata = hookConfig.graduationCalldata ?? "0x";
937
1077
  }
938
1078
  const dopplerHookTupleComponents = [
939
1079
  { name: "fee", type: "uint24" },
@@ -964,7 +1104,43 @@ var DopplerFactory = class {
964
1104
  }
965
1105
  ]
966
1106
  );
1107
+ } else if (useDecayInitializer) {
1108
+ const decayTupleComponents = [
1109
+ { name: "startFee", type: "uint24" },
1110
+ { name: "fee", type: "uint24" },
1111
+ { name: "durationSeconds", type: "uint32" },
1112
+ { name: "tickSpacing", type: "int24" },
1113
+ { name: "curves", type: "tuple[]", components: curveComponents },
1114
+ {
1115
+ name: "beneficiaries",
1116
+ type: "tuple[]",
1117
+ components: beneficiaryComponents
1118
+ },
1119
+ { name: "startingTime", type: "uint32" }
1120
+ ];
1121
+ if (initializerMode.type !== "decay") {
1122
+ throw new Error("Invalid multicurve initializer state for decay mode");
1123
+ }
1124
+ poolInitializerData = encodeAbiParameters(
1125
+ [{ type: "tuple", components: decayTupleComponents }],
1126
+ [
1127
+ {
1128
+ startFee: initializerMode.startFee,
1129
+ fee: params.pool.fee,
1130
+ durationSeconds: initializerMode.durationSeconds,
1131
+ tickSpacing: params.pool.tickSpacing,
1132
+ curves: curvesData,
1133
+ beneficiaries: beneficiariesData,
1134
+ startingTime: initializerMode.startTime
1135
+ }
1136
+ ]
1137
+ );
967
1138
  } else if (useScheduledInitializer) {
1139
+ if (initializerMode.type !== "scheduled") {
1140
+ throw new Error(
1141
+ "Invalid multicurve initializer state for scheduled mode"
1142
+ );
1143
+ }
968
1144
  const scheduledTupleComponents = [
969
1145
  { name: "fee", type: "uint24" },
970
1146
  { name: "tickSpacing", type: "int24" },
@@ -984,7 +1160,7 @@ var DopplerFactory = class {
984
1160
  tickSpacing: params.pool.tickSpacing,
985
1161
  curves: curvesData,
986
1162
  beneficiaries: beneficiariesData,
987
- startingTime: scheduleStartTime
1163
+ startingTime: initializerMode.startTime
988
1164
  }
989
1165
  ]
990
1166
  );
@@ -1098,6 +1274,9 @@ var DopplerFactory = class {
1098
1274
  if (useDopplerHookInitializer) {
1099
1275
  return params.modules?.dopplerHookInitializer ?? addresses.dopplerHookInitializer;
1100
1276
  }
1277
+ if (useDecayInitializer) {
1278
+ return params.modules?.v4DecayMulticurveInitializer ?? addresses.v4DecayMulticurveInitializer;
1279
+ }
1101
1280
  if (useScheduledInitializer) {
1102
1281
  return params.modules?.v4ScheduledMulticurveInitializer ?? addresses.v4ScheduledMulticurveInitializer;
1103
1282
  }
@@ -1109,6 +1288,11 @@ var DopplerFactory = class {
1109
1288
  "DopplerHookInitializer address not configured on this chain. Override via builder.withDopplerHookInitializer() or update chain config."
1110
1289
  );
1111
1290
  }
1291
+ if (useDecayInitializer) {
1292
+ throw new Error(
1293
+ "Decay multicurve initializer address not configured on this chain. Override via builder.withV4DecayMulticurveInitializer() or update chain config."
1294
+ );
1295
+ }
1112
1296
  throw new Error(
1113
1297
  useScheduledInitializer ? "Scheduled multicurve initializer address not configured on this chain. Override via builder or update chain config." : "Multicurve initializer address not configured on this chain. Override via builder or update chain config."
1114
1298
  );
@@ -1501,6 +1685,7 @@ var DopplerFactory = class {
1501
1685
  if (params.sale.numTokensToSell > params.sale.initialSupply) {
1502
1686
  throw new Error("Cannot sell more tokens than initial supply");
1503
1687
  }
1688
+ this.resolveMulticurveInitializerMode(params);
1504
1689
  if (params.vesting) {
1505
1690
  if (params.vesting.recipients && params.vesting.amounts) {
1506
1691
  if (params.vesting.recipients.length !== params.vesting.amounts.length) {
@@ -2155,25 +2340,37 @@ var DopplerFactory = class {
2155
2340
  */
2156
2341
  async computeMulticurvePoolId(params, tokenAddress) {
2157
2342
  const addresses = getAddresses(this.chainId);
2158
- const useScheduledInitializer = params.schedule !== void 0;
2159
- const initializerAddress = useScheduledInitializer ? params.modules?.v4ScheduledMulticurveInitializer ?? addresses.v4ScheduledMulticurveInitializer : params.modules?.v4MulticurveInitializer ?? addresses.v4MulticurveInitializer;
2160
- if (!initializerAddress) {
2161
- throw new Error("Multicurve initializer address not configured");
2162
- }
2163
- const hookAddress = await this.publicClient.readContract(
2164
- {
2343
+ const initializerMode = this.resolveMulticurveInitializerMode(params);
2344
+ let hookAddress;
2345
+ if (initializerMode.type === "rehype") {
2346
+ hookAddress = initializerMode.hookConfig?.hookAddress ?? ZERO_ADDRESS;
2347
+ } else {
2348
+ const initializerAddress = (() => {
2349
+ if (initializerMode.type === "decay") {
2350
+ return params.modules?.v4DecayMulticurveInitializer ?? addresses.v4DecayMulticurveInitializer;
2351
+ }
2352
+ if (initializerMode.type === "scheduled") {
2353
+ return params.modules?.v4ScheduledMulticurveInitializer ?? addresses.v4ScheduledMulticurveInitializer;
2354
+ }
2355
+ return params.modules?.v4MulticurveInitializer ?? addresses.v4MulticurveInitializer;
2356
+ })();
2357
+ if (!initializerAddress) {
2358
+ throw new Error("Multicurve initializer address not configured");
2359
+ }
2360
+ hookAddress = await this.publicClient.readContract({
2165
2361
  address: initializerAddress,
2166
2362
  abi: v4MulticurveInitializerAbi,
2167
2363
  functionName: "HOOK"
2168
- }
2169
- );
2364
+ });
2365
+ }
2170
2366
  const numeraire = params.sale.numeraire;
2171
2367
  const currency0 = tokenAddress < numeraire ? tokenAddress : numeraire;
2172
2368
  const currency1 = tokenAddress < numeraire ? numeraire : tokenAddress;
2369
+ const fee = initializerMode.type === "decay" ? DYNAMIC_FEE_FLAG : params.pool.fee;
2173
2370
  return this.computePoolId({
2174
2371
  currency0,
2175
2372
  currency1,
2176
- fee: params.pool.fee,
2373
+ fee,
2177
2374
  tickSpacing: params.pool.tickSpacing,
2178
2375
  hooks: hookAddress
2179
2376
  });
@@ -2204,5 +2401,5 @@ var DopplerFactory = class {
2204
2401
  var MULTICURVE_BUNDLER_SELECTORS = ["0xe2e9faa1", "0x07087b06"];
2205
2402
 
2206
2403
  export { DopplerFactory };
2207
- //# sourceMappingURL=chunk-PBWOCVDZ.mjs.map
2208
- //# sourceMappingURL=chunk-PBWOCVDZ.mjs.map
2404
+ //# sourceMappingURL=chunk-4TAAZ6W3.mjs.map
2405
+ //# sourceMappingURL=chunk-4TAAZ6W3.mjs.map