@paraswap/dex-lib 4.6.14 → 4.6.17

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 (168) hide show
  1. package/build/abi/miro-migrator/MiroMigrator.abi.json +19 -36
  2. package/build/abi/pangolin-v3/PangolinV3StateMulticall.abi.json +796 -0
  3. package/build/abi/ring-v2/few-wrapped-token.json +587 -0
  4. package/build/abi/ring-v2/ring-v2-factory.json +125 -0
  5. package/build/abi/ring-v2/ring-v2-pool.json +461 -0
  6. package/build/abi/ring-v2/ring-v2-router.json +332 -0
  7. package/build/abi/uniswap-v4/hooks/cabalcoin-hook.abi.json +682 -0
  8. package/build/abi/uniswap-v4/hooks/fee-hook.abi.json +1335 -0
  9. package/build/abi/{wUSDM.json → usual-usual-usdc/abi.json} +245 -304
  10. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying.d.ts +39 -0
  11. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying.js +244 -0
  12. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying.js.map +1 -0
  13. package/build/dex/aave-pt-to-underlying/config.d.ts +3 -0
  14. package/build/dex/aave-pt-to-underlying/config.js +47 -0
  15. package/build/dex/aave-pt-to-underlying/config.js.map +1 -0
  16. package/build/dex/aave-pt-to-underlying/constants.d.ts +2 -0
  17. package/build/dex/aave-pt-to-underlying/constants.js +6 -0
  18. package/build/dex/aave-pt-to-underlying/constants.js.map +1 -0
  19. package/build/dex/aave-pt-to-underlying/types.d.ts +22 -0
  20. package/build/dex/aave-pt-to-underlying/types.js.map +1 -0
  21. package/build/dex/aave-pt-to-usdc/aave-pt-to-usdc.d.ts +39 -0
  22. package/build/dex/aave-pt-to-usdc/aave-pt-to-usdc.js +244 -0
  23. package/build/dex/aave-pt-to-usdc/aave-pt-to-usdc.js.map +1 -0
  24. package/build/dex/{usual-bond → aave-pt-to-usdc}/config.d.ts +1 -1
  25. package/build/dex/aave-pt-to-usdc/config.js +47 -0
  26. package/build/dex/aave-pt-to-usdc/config.js.map +1 -0
  27. package/build/dex/aave-pt-to-usdc/constants.d.ts +2 -0
  28. package/build/dex/aave-pt-to-usdc/constants.js +6 -0
  29. package/build/dex/aave-pt-to-usdc/constants.js.map +1 -0
  30. package/build/dex/aave-pt-to-usdc/types.d.ts +22 -0
  31. package/build/dex/aave-pt-to-usdc/types.js +3 -0
  32. package/build/dex/{usual-bond → aave-pt-to-usdc}/types.js.map +1 -1
  33. package/build/dex/ekubo/pools/math/sqrt-ratio.d.ts +8 -0
  34. package/build/dex/ekubo/pools/math/sqrt-ratio.js +113 -0
  35. package/build/dex/ekubo/pools/math/sqrt-ratio.js.map +1 -0
  36. package/build/dex/ekubo/pools/mev-resist.d.ts +7 -0
  37. package/build/dex/ekubo/pools/mev-resist.js +40 -0
  38. package/build/dex/ekubo/pools/mev-resist.js.map +1 -0
  39. package/build/dex/ekubo/pools/pool.d.ts +52 -0
  40. package/build/dex/ekubo/pools/pool.js +86 -0
  41. package/build/dex/ekubo/pools/pool.js.map +1 -0
  42. package/build/dex/index.js +2 -0
  43. package/build/dex/index.js.map +1 -1
  44. package/build/dex/maker-psm/maker-psm-event-pool.d.ts +43 -0
  45. package/build/dex/maker-psm/maker-psm-event-pool.js +132 -0
  46. package/build/dex/maker-psm/maker-psm-event-pool.js.map +1 -0
  47. package/build/dex/miro-migrator/config.js +16 -3
  48. package/build/dex/miro-migrator/config.js.map +1 -1
  49. package/build/dex/miro-migrator/constants.d.ts +0 -1
  50. package/build/dex/miro-migrator/constants.js +1 -2
  51. package/build/dex/miro-migrator/constants.js.map +1 -1
  52. package/build/dex/miro-migrator/miro-migrator-pool.d.ts +5 -8
  53. package/build/dex/miro-migrator/miro-migrator-pool.js +28 -45
  54. package/build/dex/miro-migrator/miro-migrator-pool.js.map +1 -1
  55. package/build/dex/miro-migrator/miro-migrator-state.d.ts +27 -0
  56. package/build/dex/miro-migrator/miro-migrator-state.js +89 -0
  57. package/build/dex/miro-migrator/miro-migrator-state.js.map +1 -0
  58. package/build/dex/miro-migrator/miro-migrator.d.ts +4 -5
  59. package/build/dex/miro-migrator/miro-migrator.js +83 -40
  60. package/build/dex/miro-migrator/miro-migrator.js.map +1 -1
  61. package/build/dex/miro-migrator/types.d.ts +4 -2
  62. package/build/dex/miro-migrator/types.js +2 -1
  63. package/build/dex/miro-migrator/types.js.map +1 -1
  64. package/build/dex/uniswap-v3/forks/pangolin-v3/utils.d.ts +4 -0
  65. package/build/dex/uniswap-v3/forks/pangolin-v3/utils.js +56 -0
  66. package/build/dex/uniswap-v3/forks/pangolin-v3/utils.js.map +1 -0
  67. package/build/dex/uniswap-v4/contract-math/Position.d.ts +6 -0
  68. package/build/dex/uniswap-v4/contract-math/Position.js +29 -0
  69. package/build/dex/uniswap-v4/contract-math/Position.js.map +1 -1
  70. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.d.ts +7 -0
  71. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.js +28 -0
  72. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.js.map +1 -0
  73. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/types.d.ts +0 -0
  74. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/types.js +2 -0
  75. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/types.js.map +1 -0
  76. package/build/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.d.ts +7 -0
  77. package/build/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.js +28 -0
  78. package/build/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.js.map +1 -0
  79. package/build/dex/uniswap-v4/hooks/fee-hook/types.d.ts +0 -0
  80. package/build/dex/uniswap-v4/hooks/fee-hook/types.js +2 -0
  81. package/build/dex/uniswap-v4/hooks/fee-hook/types.js.map +1 -0
  82. package/build/dex/uniswap-v4/hooks/index.d.ts +2 -0
  83. package/build/dex/uniswap-v4/hooks/index.js +8 -0
  84. package/build/dex/uniswap-v4/hooks/index.js.map +1 -0
  85. package/build/dex/usdc-transmuter/usdc-transmuter-pool.d.ts +26 -0
  86. package/build/dex/usdc-transmuter/usdc-transmuter-pool.js +75 -0
  87. package/build/dex/usdc-transmuter/usdc-transmuter-pool.js.map +1 -0
  88. package/build/dex/usual/usdc-usual-usdc.d.ts +17 -0
  89. package/build/dex/usual/usdc-usual-usdc.js +60 -0
  90. package/build/dex/usual/usdc-usual-usdc.js.map +1 -0
  91. package/build/dex/usual/usual-usdc-usd0.d.ts +17 -0
  92. package/build/dex/usual/usual-usdc-usd0.js +55 -0
  93. package/build/dex/usual/usual-usdc-usd0.js.map +1 -0
  94. package/package.json +1 -1
  95. package/build/abi/BProtocol.json +0 -1155
  96. package/build/abi/Jarvis.json +0 -1172
  97. package/build/abi/MStableAsset.json +0 -1545
  98. package/build/abi/OneInchLp.json +0 -1304
  99. package/build/abi/Onebit.json +0 -736
  100. package/build/abi/Shell.json +0 -1294
  101. package/build/abi/TraderJoeV2Router.json +0 -50
  102. package/build/abi/zrx.v2.json +0 -1967
  103. package/build/abi/zrx.v3.json +0 -3454
  104. package/build/abi/zrx.v4.json +0 -2193
  105. package/build/dex/OneInchLp.d.ts +0 -24
  106. package/build/dex/OneInchLp.js +0 -43
  107. package/build/dex/OneInchLp.js.map +0 -1
  108. package/build/dex/bProtocol/bProtocol.d.ts +0 -15
  109. package/build/dex/bProtocol/bProtocol.js +0 -56
  110. package/build/dex/bProtocol/bProtocol.js.map +0 -1
  111. package/build/dex/bProtocol/types.d.ts +0 -11
  112. package/build/dex/bProtocol/types.js +0 -8
  113. package/build/dex/bProtocol/types.js.map +0 -1
  114. package/build/dex/jarvis.d.ts +0 -56
  115. package/build/dex/jarvis.js +0 -163
  116. package/build/dex/jarvis.js.map +0 -1
  117. package/build/dex/mStable.d.ts +0 -44
  118. package/build/dex/mStable.js +0 -75
  119. package/build/dex/mStable.js.map +0 -1
  120. package/build/dex/onebit/onebit.d.ts +0 -16
  121. package/build/dex/onebit/onebit.js +0 -61
  122. package/build/dex/onebit/onebit.js.map +0 -1
  123. package/build/dex/onebit/types.d.ts +0 -14
  124. package/build/dex/onebit/types.js +0 -8
  125. package/build/dex/onebit/types.js.map +0 -1
  126. package/build/dex/shell.d.ts +0 -25
  127. package/build/dex/shell.js +0 -41
  128. package/build/dex/shell.js.map +0 -1
  129. package/build/dex/trader-joe-v2.d.ts +0 -40
  130. package/build/dex/trader-joe-v2.js +0 -74
  131. package/build/dex/trader-joe-v2.js.map +0 -1
  132. package/build/dex/uniswap-v3/uniswap-v3-new.d.ts +0 -94
  133. package/build/dex/uniswap-v3/uniswap-v3-new.js +0 -923
  134. package/build/dex/uniswap-v3/uniswap-v3-new.js.map +0 -1
  135. package/build/dex/usual-bond/config.js +0 -13
  136. package/build/dex/usual-bond/config.js.map +0 -1
  137. package/build/dex/usual-bond/types.d.ts +0 -7
  138. package/build/dex/usual-bond/usual-bond.d.ts +0 -35
  139. package/build/dex/usual-bond/usual-bond.js +0 -176
  140. package/build/dex/usual-bond/usual-bond.js.map +0 -1
  141. package/build/dex/wusdm/config.d.ts +0 -3
  142. package/build/dex/wusdm/config.js +0 -43
  143. package/build/dex/wusdm/config.js.map +0 -1
  144. package/build/dex/wusdm/constants.d.ts +0 -2
  145. package/build/dex/wusdm/constants.js +0 -6
  146. package/build/dex/wusdm/constants.js.map +0 -1
  147. package/build/dex/wusdm/types.d.ts +0 -18
  148. package/build/dex/wusdm/types.js +0 -11
  149. package/build/dex/wusdm/types.js.map +0 -1
  150. package/build/dex/wusdm/wusdm-pool.d.ts +0 -21
  151. package/build/dex/wusdm/wusdm-pool.js +0 -74
  152. package/build/dex/wusdm/wusdm-pool.js.map +0 -1
  153. package/build/dex/wusdm/wusdm.d.ts +0 -46
  154. package/build/dex/wusdm/wusdm.js +0 -243
  155. package/build/dex/wusdm/wusdm.js.map +0 -1
  156. package/build/dex/zerox/config.d.ts +0 -2
  157. package/build/dex/zerox/config.js +0 -33
  158. package/build/dex/zerox/config.js.map +0 -1
  159. package/build/dex/zerox/index.d.ts +0 -22
  160. package/build/dex/zerox/index.js +0 -225
  161. package/build/dex/zerox/index.js.map +0 -1
  162. package/build/dex/zerox/order.d.ts +0 -88
  163. package/build/dex/zerox/order.js +0 -53
  164. package/build/dex/zerox/order.js.map +0 -1
  165. package/build/dex/zerox/types.d.ts +0 -73
  166. package/build/dex/zerox/types.js +0 -21
  167. package/build/dex/zerox/types.js.map +0 -1
  168. /package/build/dex/{usual-bond → aave-pt-to-underlying}/types.js +0 -0
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MiroMigratorEventState = void 0;
7
+ const abi_1 = require("@ethersproject/abi");
8
+ const utils_1 = require("../../utils");
9
+ const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
10
+ const decoders_1 = require("../../lib/decoders");
11
+ const MiroMigrator_abi_json_1 = __importDefault(require("../../abi/miro-migrator/MiroMigrator.abi.json"));
12
+ const erc20_json_1 = __importDefault(require("../../abi/erc20.json"));
13
+ class MiroMigratorEventState extends stateful_event_subscriber_1.StatefulEventSubscriber {
14
+ parentName;
15
+ network;
16
+ dexHelper;
17
+ migratorAddress;
18
+ xyzAddress;
19
+ transferTopic;
20
+ migratorInterface;
21
+ xyzInterface;
22
+ handlers = {};
23
+ logDecoder;
24
+ addressesSubscribed;
25
+ constructor(parentName, network, dexHelper, logger, migratorAddress, xyzAddress, transferTopic, migratorInterface = new abi_1.Interface(MiroMigrator_abi_json_1.default), xyzInterface = new abi_1.Interface(erc20_json_1.default)) {
26
+ super(parentName, 'state', dexHelper, logger);
27
+ this.parentName = parentName;
28
+ this.network = network;
29
+ this.dexHelper = dexHelper;
30
+ this.migratorAddress = migratorAddress;
31
+ this.xyzAddress = xyzAddress;
32
+ this.transferTopic = transferTopic;
33
+ this.migratorInterface = migratorInterface;
34
+ this.xyzInterface = xyzInterface;
35
+ this.logDecoder = (log) => this.migratorInterface.parseLog(log);
36
+ this.addressesSubscribed = [xyzAddress];
37
+ }
38
+ async processLog(state, log) {
39
+ try {
40
+ const event = this.logDecoder(log);
41
+ if (log.topics[0] === this.transferTopic &&
42
+ event.args.to.toLowerCase() === this.migratorAddress.toLowerCase()) {
43
+ return this.handleTransferTo(event, state, log);
44
+ }
45
+ if (log.topics[0] === this.transferTopic &&
46
+ event.args.from.toLowerCase() === this.migratorAddress.toLowerCase()) {
47
+ return this.handleTransferFrom(event, state, log);
48
+ }
49
+ return null;
50
+ }
51
+ catch (e) {
52
+ (0, utils_1.catchParseLogError)(e, this.logger);
53
+ return null;
54
+ }
55
+ }
56
+ async generateState(blockNumber = 'latest') {
57
+ const calls = [
58
+ {
59
+ target: this.xyzAddress,
60
+ callData: this.xyzInterface.encodeFunctionData('balanceOf', [
61
+ this.migratorAddress,
62
+ ]),
63
+ decodeFunction: decoders_1.uint256ToBigInt,
64
+ },
65
+ ];
66
+ const [balance] = await this.dexHelper.multiWrapper.tryAggregate(true, calls, blockNumber);
67
+ return { balance: balance.returnData };
68
+ }
69
+ async getOrGenerateState(blockNumber) {
70
+ let state = this.getState(blockNumber);
71
+ if (!state) {
72
+ state = await this.generateState(blockNumber);
73
+ this.setState(state, blockNumber);
74
+ }
75
+ return state;
76
+ }
77
+ async handleTransferTo(event, state, log) {
78
+ return {
79
+ balance: state.balance + BigInt(event.args.value),
80
+ };
81
+ }
82
+ async handleTransferFrom(event, state, log) {
83
+ return {
84
+ balance: state.balance - BigInt(event.args.value),
85
+ };
86
+ }
87
+ }
88
+ exports.MiroMigratorEventState = MiroMigratorEventState;
89
+ //# sourceMappingURL=miro-migrator-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"miro-migrator-state.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/miro-migrator-state.ts"],"names":[],"mappings":";;;;;;AAAA,4CA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W,CAAC,CAAC;YAC9C,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,gBAAgB,CACpB,KAAU,EACV,KAAsC,EACtC,GAAkB;QAElB,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;SAClD,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,KAAU,EACV,KAAsC,EACtC,GAAkB;QAElB,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;SAClD,CAAC;IACJ,CAAC;CACF;AA3GD,wDA2GC"}
@@ -10,9 +10,7 @@ export declare class MiroMigrator extends SimpleExchange implements IDex<MiroMig
10
10
  readonly network: Network;
11
11
  readonly dexKey: string;
12
12
  readonly dexHelper: IDexHelper;
13
- readonly migratorAddress: string;
14
- readonly pspTokenAddress: string;
15
- readonly xyzTokenAddress: string;
13
+ readonly config: import("./types").DexParams;
16
14
  protected unitPrice: bigint;
17
15
  protected migratorInterface: Interface;
18
16
  readonly hasConstantPriceLargeAmounts = true;
@@ -23,9 +21,10 @@ export declare class MiroMigrator extends SimpleExchange implements IDex<MiroMig
23
21
  }[];
24
22
  readonly eventPool: MiroMigratorEventPool;
25
23
  logger: Logger;
26
- constructor(network: Network, dexKey: string, dexHelper: IDexHelper, migratorAddress?: string, pspTokenAddress?: string, xyzTokenAddress?: string, unitPrice?: bigint, migratorInterface?: Interface);
24
+ constructor(network: Network, dexKey: string, dexHelper: IDexHelper, config?: import("./types").DexParams, unitPrice?: bigint, migratorInterface?: Interface);
27
25
  isPSP(tokenAddress: Address): boolean;
28
- isXYZ(tokenAddress: Address): boolean;
26
+ isSePSP1Token(tokenAddress: Address): boolean;
27
+ isVLRToken(tokenAddress: Address): boolean;
29
28
  isAppropriatePair(srcToken: Token, destToken: Token): boolean;
30
29
  getAdapters(side: SwapSide): {
31
30
  name: string;
@@ -37,6 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.MiroMigrator = void 0;
40
+ const constants_1 = require("../../constants");
40
41
  const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
41
42
  const utils_1 = require("../../utils");
42
43
  const types_1 = require("./types");
@@ -45,15 +46,13 @@ const config_1 = require("./config");
45
46
  const bigint_constants_1 = require("../../bigint-constants");
46
47
  const abi_1 = require("@ethersproject/abi");
47
48
  const MiroMigrator_abi_json_1 = __importDefault(require("../../abi/miro-migrator/MiroMigrator.abi.json"));
48
- const constants_1 = require("./constants");
49
+ const constants_2 = require("./constants");
49
50
  const miro_migrator_pool_1 = require("./miro-migrator-pool");
50
51
  class MiroMigrator extends simple_exchange_1.SimpleExchange {
51
52
  network;
52
53
  dexKey;
53
54
  dexHelper;
54
- migratorAddress;
55
- pspTokenAddress;
56
- xyzTokenAddress;
55
+ config;
57
56
  unitPrice;
58
57
  migratorInterface;
59
58
  hasConstantPriceLargeAmounts = true;
@@ -61,30 +60,31 @@ class MiroMigrator extends simple_exchange_1.SimpleExchange {
61
60
  static dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.MiroMigratorConfig);
62
61
  eventPool;
63
62
  logger;
64
- constructor(network, dexKey, dexHelper, migratorAddress = config_1.MiroMigratorConfig[dexKey][network]
65
- .migratorAddress, pspTokenAddress = config_1.MiroMigratorConfig[dexKey][network]
66
- .pspTokenAddress, xyzTokenAddress = config_1.MiroMigratorConfig[dexKey][network]
67
- .xyzTokenAddress, unitPrice = bigint_constants_1.BI_POWS[18], migratorInterface = new abi_1.Interface(MiroMigrator_abi_json_1.default)) {
63
+ constructor(network, dexKey, dexHelper, config = config_1.MiroMigratorConfig[dexKey][network], unitPrice = bigint_constants_1.BI_POWS[18], migratorInterface = new abi_1.Interface(MiroMigrator_abi_json_1.default)) {
68
64
  super(dexHelper, dexKey);
69
65
  this.network = network;
70
66
  this.dexKey = dexKey;
71
67
  this.dexHelper = dexHelper;
72
- this.migratorAddress = migratorAddress;
73
- this.pspTokenAddress = pspTokenAddress;
74
- this.xyzTokenAddress = xyzTokenAddress;
68
+ this.config = config;
75
69
  this.unitPrice = unitPrice;
76
70
  this.migratorInterface = migratorInterface;
77
71
  this.logger = dexHelper.getLogger(dexKey);
78
- this.eventPool = new miro_migrator_pool_1.MiroMigratorEventPool(this.dexKey, this.network, this.dexHelper, this.logger, this.migratorAddress, this.xyzTokenAddress, constants_1.TRANSFER_TOPIC);
72
+ this.eventPool = new miro_migrator_pool_1.MiroMigratorEventPool(this.dexKey, this.network, this.dexHelper, this.logger, this.config.migratorAddress, this.config.vlrTokenAddress);
79
73
  }
80
74
  isPSP(tokenAddress) {
81
- return this.pspTokenAddress.toLowerCase() === tokenAddress.toLowerCase();
75
+ return (this.config.pspTokenAddress.toLowerCase() === tokenAddress.toLowerCase());
82
76
  }
83
- isXYZ(tokenAddress) {
84
- return this.xyzTokenAddress.toLowerCase() === tokenAddress.toLowerCase();
77
+ isSePSP1Token(tokenAddress) {
78
+ return (this.config.sePsp1TokenAddress.toLowerCase() ===
79
+ tokenAddress.toLowerCase());
80
+ }
81
+ isVLRToken(tokenAddress) {
82
+ return (this.config.vlrTokenAddress.toLowerCase() === tokenAddress.toLowerCase());
85
83
  }
86
84
  isAppropriatePair(srcToken, destToken) {
87
- return this.isPSP(srcToken.address) && this.isXYZ(destToken.address);
85
+ return ((this.isPSP(srcToken.address) && this.isVLRToken(destToken.address)) ||
86
+ (this.isSePSP1Token(srcToken.address) &&
87
+ this.isVLRToken(destToken.address)));
88
88
  }
89
89
  getAdapters(side) {
90
90
  return null;
@@ -118,55 +118,98 @@ class MiroMigrator extends simple_exchange_1.SimpleExchange {
118
118
  {
119
119
  prices,
120
120
  unit: this.unitPrice,
121
- gasCost: constants_1.MIRO_MIGRATION_GAS_COST,
121
+ gasCost: constants_2.MIRO_MIGRATION_GAS_COST,
122
122
  exchange: this.dexKey,
123
- poolAddresses: [this.migratorAddress],
123
+ poolAddresses: [this.config.migratorAddress],
124
124
  data: null,
125
125
  },
126
126
  ];
127
127
  }
128
128
  getCalldataGasCost(poolPrices) {
129
- return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
129
+ return (CALLDATA_GAS_COST.FUNCTION_SELECTOR +
130
+ CALLDATA_GAS_COST.AMOUNT +
131
+ CALLDATA_GAS_COST.OFFSET_SMALL +
132
+ CALLDATA_GAS_COST.ZERO);
130
133
  }
131
134
  getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
132
135
  return {
133
- targetExchange: this.migratorAddress,
136
+ targetExchange: this.config.migratorAddress,
134
137
  payload: '0x',
135
138
  networkFee: '0',
136
139
  };
137
140
  }
138
141
  async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
139
- const swapData = this.migratorInterface.encodeFunctionData(types_1.MiroMigratorFunctions.migratePSPtoXYZ, [srcAmount, '0x']);
140
- return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, this.migratorAddress);
142
+ const isPSPtoVLR = this.isPSP(srcToken) && this.isVLRToken(destToken);
143
+ const functionName = isPSPtoVLR
144
+ ? types_1.MiroMigratorFunctions.migratePSPtoVLR
145
+ : types_1.MiroMigratorFunctions.migrateSePSP1toVLR;
146
+ const swapData = this.migratorInterface.encodeFunctionData(functionName, [
147
+ srcAmount,
148
+ '0x',
149
+ ]);
150
+ return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, this.config.migratorAddress);
141
151
  }
142
152
  getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
143
- const swapData = this.migratorInterface.encodeFunctionData(types_1.MiroMigratorFunctions.migratePSPtoXYZ, [srcAmount, '0x']);
153
+ const isPSPtoVLR = this.isPSP(srcToken) && this.isVLRToken(destToken);
154
+ const functionName = isPSPtoVLR
155
+ ? types_1.MiroMigratorFunctions.migratePSPtoVLR
156
+ : types_1.MiroMigratorFunctions.migrateSePSP1toVLR;
157
+ const swapData = this.migratorInterface.encodeFunctionData(functionName, [
158
+ srcAmount,
159
+ '0x',
160
+ ]);
144
161
  return {
145
162
  needWrapNative: this.needWrapNative,
146
163
  dexFuncHasRecipient: false,
147
164
  exchangeData: swapData,
148
- targetExchange: this.migratorAddress,
165
+ targetExchange: this.config.migratorAddress,
149
166
  };
150
167
  }
151
168
  async getTopPoolsForToken(tokenAddress, limit) {
152
- if (!this.isPSP(tokenAddress) && !this.isXYZ(tokenAddress)) {
169
+ const isPSP = this.isPSP(tokenAddress);
170
+ const isSePSP1 = this.isSePSP1Token(tokenAddress);
171
+ const isVLR = this.isVLRToken(tokenAddress);
172
+ if (!isPSP && !isSePSP1 && !isVLR) {
153
173
  return [];
154
174
  }
155
- return [
156
- {
157
- exchange: this.dexKey,
158
- address: this.migratorAddress,
159
- connectorTokens: [
160
- {
161
- address: this.isPSP(tokenAddress)
162
- ? this.xyzTokenAddress
163
- : this.pspTokenAddress,
164
- decimals: 18,
165
- },
166
- ],
167
- liquidityUSD: 1000000000, // Just returning a big number so this DEX will be preferred
168
- },
169
- ];
175
+ if (isPSP || isSePSP1) {
176
+ return [
177
+ {
178
+ exchange: this.dexKey,
179
+ address: this.config.migratorAddress,
180
+ connectorTokens: [
181
+ {
182
+ address: this.config.vlrTokenAddress,
183
+ decimals: 18,
184
+ liquidityUSD: constants_1.NO_USD_LIQUIDITY,
185
+ },
186
+ ],
187
+ liquidityUSD: 1_000_000_000,
188
+ },
189
+ ];
190
+ }
191
+ if (isVLR) {
192
+ return [
193
+ {
194
+ exchange: this.dexKey,
195
+ address: this.config.migratorAddress,
196
+ connectorTokens: [
197
+ {
198
+ address: this.config.pspTokenAddress,
199
+ decimals: 18,
200
+ liquidityUSD: 1000000000,
201
+ },
202
+ {
203
+ address: this.config.sePsp1TokenAddress,
204
+ decimals: 18,
205
+ liquidityUSD: 1000000000,
206
+ },
207
+ ],
208
+ liquidityUSD: constants_1.NO_USD_LIQUIDITY,
209
+ },
210
+ ];
211
+ }
212
+ return [];
170
213
  }
171
214
  }
172
215
  exports.MiroMigrator = MiroMigrator;
@@ -1 +1 @@
1
- {"version":3,"file":"miro-migrator.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/miro-migrator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,2EAA6D;AAC7D,uCAAoD;AAGpD,mCAAkE;AAClE,wDAAoD;AACpD,qCAA8C;AAC9C,6DAAiD;AACjD,4CAA+C;AAC/C,0GAA4E;AAC5E,2CAAsE;AACtE,6DAA6D;AAE7D,MAAa,YACX,SAAQ,gCAAc;IAcX;IACA;IACA;IACA;IAEA;IAEA;IAEC;IACA;IArBH,4BAA4B,GAAG,IAAI,CAAC;IAEpC,wBAAwB,GAAG,KAAK,CAAC;IAEnC,MAAM,CAAC,kBAAkB,GAC9B,IAAA,6BAAqB,EAAC,2BAAkB,CAAC,CAAC;IAC5B,SAAS,CAAwB;IAEjD,MAAM,CAAS;IAEf,YACW,OAAgB,EAChB,MAAc,EACd,SAAqB,EACrB,kBAA0B,2BAAkB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;SACnE,eAAe,EACT,kBAA0B,2BAAkB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;SACnE,eAAe,EACT,kBAA0B,2BAAkB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;SACnE,eAAe,EACR,YAAY,0BAAO,CAAC,EAAE,CAAC,EACvB,oBAAoB,IAAI,eAAS,CAAC,+BAAe,CAAC;QAE5D,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAZhB,YAAO,GAAP,OAAO,CAAS;QAChB,WAAM,GAAN,MAAM,CAAQ;QACd,cAAS,GAAT,SAAS,CAAY;QACrB,oBAAe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QAAQ,EAAE,EAAE;4BACZ,YAAY,EAAE,UAAU;yBACzB;qBACF;oBACD,YAAY,EAAE,4BAAgB;iBAC/B;aACF,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;;AA7PH,oCA8PC"}
@@ -5,9 +5,11 @@ export type PoolState = {
5
5
  export type MiroMigratorData = null;
6
6
  export type DexParams = {
7
7
  migratorAddress: Address;
8
+ vlrTokenAddress: Address;
8
9
  pspTokenAddress: Address;
9
- xyzTokenAddress: Address;
10
+ sePsp1TokenAddress: Address;
10
11
  };
11
12
  export declare enum MiroMigratorFunctions {
12
- migratePSPtoXYZ = "migratePSPtoXYZ"
13
+ migratePSPtoVLR = "migratePSPtoVLR",
14
+ migrateSePSP1toVLR = "migrateSePSP1toVLR"
13
15
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MiroMigratorFunctions = void 0;
4
4
  var MiroMigratorFunctions;
5
5
  (function (MiroMigratorFunctions) {
6
- MiroMigratorFunctions["migratePSPtoXYZ"] = "migratePSPtoXYZ";
6
+ MiroMigratorFunctions["migratePSPtoVLR"] = "migratePSPtoVLR";
7
+ MiroMigratorFunctions["migrateSePSP1toVLR"] = "migrateSePSP1toVLR";
7
8
  })(MiroMigratorFunctions || (exports.MiroMigratorFunctions = MiroMigratorFunctions = {}));
8
9
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/types.ts"],"names":[],"mappings":";;;AAcA,IAAY,qBAEX;AAFD,WAAY,qBAAqB;IAC/B,4DAAmC,CAAA;AACrC,CAAC,EAFW,qBAAqB,qCAArB,qBAAqB,QAEhC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/types.ts"],"names":[],"mappings":";;;AAeA,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,4DAAmC,CAAA;IACnC,kEAAyC,CAAA;AAC3C,CAAC,EAHW,qBAAqB,qCAArB,qBAAqB,QAGhC"}
@@ -0,0 +1,4 @@
1
+ import { MultiResult } from '../../../../lib/multi-wrapper';
2
+ import { BytesLike } from 'ethers';
3
+ import { DecodedStateMultiCallResultWithRelativeBitmaps } from '../../types';
4
+ export declare function decodeStateMultiCallResultWithRelativeBitmaps(result: MultiResult<BytesLike> | BytesLike): DecodedStateMultiCallResultWithRelativeBitmaps;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decodeStateMultiCallResultWithRelativeBitmaps = decodeStateMultiCallResultWithRelativeBitmaps;
4
+ const ethers_1 = require("ethers");
5
+ const decoders_1 = require("../../../../lib/decoders");
6
+ const ts_essentials_1 = require("ts-essentials");
7
+ function decodeStateMultiCallResultWithRelativeBitmaps(result) {
8
+ const [isSuccess, toDecode] = (0, decoders_1.extractSuccessAndValue)(result);
9
+ (0, ts_essentials_1.assert)(isSuccess && toDecode !== '0x', `decodeStateMultiCallResultWithRelativeBitmaps failed to get decodable result: ${result}`);
10
+ const decoded = ethers_1.ethers.utils.defaultAbiCoder.decode([
11
+ // I don't want to pass here any interface, so I just use it in ethers format
12
+ `
13
+ tuple(
14
+ address pool,
15
+ uint256 blockTimestamp,
16
+ tuple(
17
+ uint160 sqrtPriceX96,
18
+ int24 tick,
19
+ uint16 observationIndex,
20
+ uint16 observationCardinality,
21
+ uint16 observationCardinalityNext,
22
+ uint8 feeProtocol,
23
+ bool unlocked
24
+ ) slot0,
25
+ uint128 liquidity,
26
+ int24 tickSpacing,
27
+ uint128 maxLiquidityPerTick,
28
+ tuple(
29
+ uint32 blockTimestamp,
30
+ int56 tickCumulative,
31
+ uint160 secondsPerLiquidityCumulativeX128,
32
+ bool initialized
33
+ ) observation,
34
+ tuple(
35
+ int16 index,
36
+ uint256 value
37
+ )[] tickBitmap,
38
+ tuple(
39
+ int24 index,
40
+ tuple(
41
+ uint128 liquidityGross,
42
+ int128 liquidityNet,
43
+ int56 tickCumulativeOutside,
44
+ uint160 secondsPerLiquidityOutsideX128,
45
+ uint32 secondsOutside,
46
+ bool initialized
47
+ ) value
48
+ )[] ticks
49
+ )
50
+ `,
51
+ ], toDecode)[0];
52
+ // This conversion is not precise, because when we decode, we have more values
53
+ // But I typed only the ones that are used later
54
+ return decoded;
55
+ }
56
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v3/forks/pangolin-v3/utils.ts"],"names":[],"mappings":";;AAMA,sGA2DC;AAhED,mCAA2C;AAE3C,uDAAkE;AAClE,iDAAuC;AAEvC,SAAgB,6CAA6C,CAC3D,MAA0C;IAE1C,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,IAAA,iCAAsB,EAAC,MAAM,CAAC,CAAC;IAE7D,IAAA,sBAAM,EACJ,SAAS,IAAI,QAAQ,KAAK,IAAI,EAC9B,iFAAiF,MAAM,EAAE,CAC1F,CAAC;IAEF,MAAM,OAAO,GAAG,eAAM,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CACjD;QACE,6EAA6E;QAC7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsCD;KACA,EACD,QAAQ,CACT,CAAC,CAAC,CAAC,CAAC;IAEL,8EAA8E;IAC9E,gDAAgD;IAChD,OAAO,OAAyD,CAAC;AACnE,CAAC"}
@@ -1,3 +1,9 @@
1
+ import { PoolState, PositionState } from '../types';
1
2
  export declare class Position {
2
3
  static calculatePositionKey(owner: string, tickLower: bigint, tickUpper: bigint, salt: string): string;
4
+ static get(poolState: PoolState, owner: string, tickLower: bigint, tickUpper: bigint, salt: string): PositionState | undefined;
5
+ static update(poolState: PoolState, owner: string, tickLower: bigint, tickUpper: bigint, salt: string, liquidityDelta: bigint, feeGrowthInside0X128: bigint, feeGrowthInside1X128: bigint): {
6
+ feesOwed0: bigint;
7
+ feesOwed1: bigint;
8
+ };
3
9
  }
@@ -1,10 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Position = void 0;
4
+ const utils_1 = require("../../../utils");
4
5
  class Position {
5
6
  static calculatePositionKey(owner, tickLower, tickUpper, salt) {
6
7
  return `${owner}-${tickLower.toString()}-${tickUpper.toString()}-${salt}`;
7
8
  }
9
+ static get(poolState, owner, tickLower, tickUpper, salt) {
10
+ const positionKey = Position.calculatePositionKey(owner, tickLower, tickUpper, salt);
11
+ return poolState.positions[positionKey];
12
+ }
13
+ static update(poolState, owner, tickLower, tickUpper, salt, liquidityDelta, feeGrowthInside0X128, feeGrowthInside1X128) {
14
+ const positionKey = Position.calculatePositionKey(owner, tickLower, tickUpper, salt);
15
+ let position = poolState.positions[positionKey];
16
+ (0, utils_1._require)(Boolean(position), 'Position does not exist', { position });
17
+ let { liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128 } = position;
18
+ if (liquidityDelta === 0n) {
19
+ (0, utils_1._require)(liquidity !== 0n, 'Cannot update empty position', {
20
+ liquidityDelta,
21
+ });
22
+ }
23
+ else {
24
+ liquidity += liquidityDelta;
25
+ }
26
+ const feesOwed0 = ((feeGrowthInside0X128 - feeGrowthInside0LastX128) * liquidity) /
27
+ BigInt(1 << 128);
28
+ const feesOwed1 = ((feeGrowthInside1X128 - feeGrowthInside1LastX128) * liquidity) /
29
+ BigInt(1 << 128);
30
+ poolState.positions[positionKey] = {
31
+ liquidity,
32
+ feeGrowthInside0LastX128: feeGrowthInside0X128,
33
+ feeGrowthInside1LastX128: feeGrowthInside1X128,
34
+ };
35
+ return { feesOwed0, feesOwed1 };
36
+ }
8
37
  }
9
38
  exports.Position = Position;
10
39
  //# sourceMappingURL=Position.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Position.js","sourceRoot":"","sources":["../../../../src/dex/uniswap-v4/contract-math/Position.ts"],"names":[],"mappings":";;;AAGA,MAAa,QAAQ;IACZ,MA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wB,EAAE,wBAAwB,EAAE,GACnE,QAAQ,CAAC;QAEX,IAAI,cAAc,KAAK,EAAE,EAAE,CAAC;YAC1B,IAAA,gBAAQ,EAAC,SAAS,KAAK,EAAE,EAAE,8BAA8B,EAAE;gBACzD,cAAc;aACf,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,SAAS,IAAI,cAAc,CAAC;QAC9B,CAAC;QAED,MAAM,SAAS,GACb,CAAC,CAAC,oBAAoB,GAAG,wBAAwB,CAAC,GAAG,SAAS,CAAC;YAC/D,MAAM,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;QACnB,MAAM,SAAS,GACb,CAAC,CAAC,oBAAoB,GAAG,wBAAwB,CAAC,GAAG,SAAS,CAAC;YAC/D,MAAM,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;QAEnB,SAAS,CAAC,SAAU,CAAC,WAAW,CAAC,GAAG;YAClC,SAAS;YACT,wBAAwB,EAAE,oBAAoB;YAC9C,wBAAwB,EAAE,oBAAoB;SAC/C,CAAC;QAEF,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;IAClC,CAAC;CACF;AAzED,4BAyEC"}
@@ -0,0 +1,7 @@
1
+ import { UniswapV4Pool } from '../../uniswap-v4-pool';
2
+ import { PoolState } from '../../types';
3
+ export declare class CabalcoinHookPool extends UniswapV4Pool {
4
+ private hookInterface;
5
+ constructor(...args: ConstructorParameters<typeof UniswapV4Pool>);
6
+ handleCustomFeeChangedEvent(event: any, poolState: PoolState): Promise<PoolState>;
7
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CabalcoinHookPool = void 0;
7
+ const abi_1 = require("@ethersproject/abi");
8
+ const uniswap_v4_pool_1 = require("../../uniswap-v4-pool");
9
+ const uniswap_v4_pool_math_1 = require("../../contract-math/uniswap-v4-pool-math");
10
+ const cabalcoin_hook_abi_json_1 = __importDefault(require("../../../../abi/uniswap-v4/hooks/cabalcoin-hook.abi.json"));
11
+ class CabalcoinHookPool extends uniswap_v4_pool_1.UniswapV4Pool {
12
+ hookInterface = new abi_1.Interface(cabalcoin_hook_abi_json_1.default);
13
+ constructor(...args) {
14
+ super(...args);
15
+ this.addressesSubscribed.push(this.hooks);
16
+ this.logDecoders.push((log) => this.hookInterface.parseLog(log));
17
+ this.handlers['CustomFeeChanged'] =
18
+ this.handleCustomFeeChangedEvent.bind(this);
19
+ }
20
+ async handleCustomFeeChangedEvent(event, poolState) {
21
+ const id = event.args.id.toLowerCase();
22
+ uniswap_v4_pool_math_1.uniswapV4PoolMath.checkPoolInitialized(poolState);
23
+ poolState.fee = event.args.newFee.toString();
24
+ return poolState;
25
+ }
26
+ }
27
+ exports.CabalcoinHookPool = CabalcoinHookPool;
28
+ //# sourceMappingURL=cabalcoin-hook-pool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cabalcoin-hook-pool.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAC/C,2DAAsD;AAEtD,mFAA6E;AAE7E,uHAAwF;AAExF,MAAa,iBAAkB,SAAQ,+BAAa;IAC1C,aAAa,GAAG,IAAI,eAAS,CAAC,iCAAgB,CAAC,CAAC;IAExD,YAAY,GAAG,IAAiD;QAC9D,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;QAEf,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAEtE,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YAC/B,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,2BAA2B,CAAC,KAAU,EAAE,SAAoB;QAChE,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;QACvC,wCAAiB,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;QAElD,SAAS,CAAC,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAE7C,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AArBD,8CAqBC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v4/hooks/cabalcoin-hook/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { UniswapV4Pool } from '../../uniswap-v4-pool';
2
+ import { PoolState } from '../../types';
3
+ export declare class FeeHookPool extends UniswapV4Pool {
4
+ private hookInterface;
5
+ constructor(...args: ConstructorParameters<typeof UniswapV4Pool>);
6
+ handleCustomFeeChangedEvent(event: any, poolState: PoolState): Promise<PoolState>;
7
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FeeHookPool = void 0;
7
+ const abi_1 = require("@ethersproject/abi");
8
+ const uniswap_v4_pool_1 = require("../../uniswap-v4-pool");
9
+ const uniswap_v4_pool_math_1 = require("../../contract-math/uniswap-v4-pool-math");
10
+ const fee_hook_abi_json_1 = __importDefault(require("../../../../abi/uniswap-v4/hooks/fee-hook.abi.json"));
11
+ class FeeHookPool extends uniswap_v4_pool_1.UniswapV4Pool {
12
+ hookInterface = new abi_1.Interface(fee_hook_abi_json_1.default);
13
+ constructor(...args) {
14
+ super(...args);
15
+ this.addressesSubscribed.push(this.hooks);
16
+ this.logDecoders.push((log) => this.hookInterface.parseLog(log));
17
+ this.handlers['CustomFeeChanged'] =
18
+ this.handleCustomFeeChangedEvent.bind(this);
19
+ }
20
+ async handleCustomFeeChangedEvent(event, poolState) {
21
+ const id = event.args.id.toLowerCase();
22
+ uniswap_v4_pool_math_1.uniswapV4PoolMath.checkPoolInitialized(poolState);
23
+ poolState.fee = event.args.newFee.toString();
24
+ return poolState;
25
+ }
26
+ }
27
+ exports.FeeHookPool = FeeHookPool;
28
+ //# sourceMappingURL=fee-hook-pool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fee-hook-pool.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAC/C,2DAAsD;AAEtD,mFAA6E;AAE7E,2GAA4E;AAE5E,MAAa,WAAY,SAAQ,+BAAa;IACpC,aAAa,GAAG,IAAI,eAAS,CAAC,2BAAU,CAAC,CAAC;IAElD,YAAY,GAAG,IAAiD;QAC9D,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;QAEf,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAEtE,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YAC/B,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,2BAA2B,CAAC,KAAU,EAAE,SAAoB;QAChE,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;QACvC,wCAAiB,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;QAElD,SAAS,CAAC,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAE7C,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AArBD,kCAqBC"}
File without changes
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v4/hooks/fee-hook/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export { FeeHookPool } from './fee-hook/fee-hook-pool';
2
+ export { CabalcoinHookPool } from './cabalcoin-hook/cabalcoin-hook-pool';
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CabalcoinHookPool = exports.FeeHookPool = void 0;
4
+ var fee_hook_pool_1 = require("./fee-hook/fee-hook-pool");
5
+ Object.defineProperty(exports, "FeeHookPool", { enumerable: true, get: function () { return fee_hook_pool_1.FeeHookPool; } });
6
+ var cabalcoin_hook_pool_1 = require("./cabalcoin-hook/cabalcoin-hook-pool");
7
+ Object.defineProperty(exports, "CabalcoinHookPool", { enumerable: true, get: function () { return cabalcoin_hook_pool_1.CabalcoinHookPool; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dex/uniswap-v4/hooks/index.ts"],"names":[],"mappings":";;;AAAA,0DAAuD;AAA9C,4GAAA,WAAW,OAAA;AACpB,4EAAyE;AAAhE,wHAAA,iBAAiB,OAAA"}