@paraswap/dex-lib 4.7.20-native-insert-amount.3 → 4.7.20-native-insert-amount.4

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 (148) hide show
  1. package/build/dex/idle-dao/idle-dao.d.ts +1 -0
  2. package/build/dex/idle-dao/idle-dao.js +23 -11
  3. package/build/dex/idle-dao/idle-dao.js.map +1 -1
  4. package/build/dex/index.js +12 -15
  5. package/build/dex/index.js.map +1 -1
  6. package/build/dex/maker-psm/maker-psm.d.ts +4 -41
  7. package/build/dex/maker-psm/maker-psm.js +40 -143
  8. package/build/dex/maker-psm/maker-psm.js.map +1 -1
  9. package/build/dex/uniswap-v2/constants.js +1 -0
  10. package/build/dex/uniswap-v2/constants.js.map +1 -1
  11. package/build/executor/Executor02BytecodeBuilderMultiRoute.d.ts +101 -0
  12. package/build/executor/Executor02BytecodeBuilderMultiRoute.js +878 -0
  13. package/build/executor/Executor02BytecodeBuilderMultiRoute.js.map +1 -0
  14. package/package.json +1 -1
  15. package/build/abi/PendleRouterStatic.json +0 -19
  16. package/build/abi/apex-defi/ApexDefiFactory.abi.json +0 -1749
  17. package/build/abi/apex-defi/ApexDefiRouter.abi.json +0 -1120
  18. package/build/abi/apex-defi/ApexDefiToken.abi.json +0 -229
  19. package/build/abi/apex-defi/ApexDefiWrapper.abi.json +0 -92
  20. package/build/abi/apex-defi/ApexDefiWrapperFactory.abi.json +0 -1107
  21. package/build/abi/pangolin-v3/PangolinV3StateMulticall.abi.json +0 -796
  22. package/build/abi/pendle/pendle-deployer.abi.json +0 -520
  23. package/build/abi/pendle/pendle-oracle.abi.json +0 -413
  24. package/build/abi/ring-v2/few-wrapped-token.json +0 -587
  25. package/build/abi/ring-v2/ring-v2-factory.json +0 -125
  26. package/build/abi/ring-v2/ring-v2-pool.json +0 -461
  27. package/build/abi/ring-v2/ring-v2-router.json +0 -332
  28. package/build/abi/stabull/stabull-curve.json +0 -738
  29. package/build/abi/stabull/stabull-router.json +0 -76
  30. package/build/abi/uniswap-v4/hooks/SpotDynamicFeeManager.json +0 -26
  31. package/build/abi/uniswap-v4/hooks/SpotHook.json +0 -54
  32. package/build/abi/uniswap-v4/hooks/SpotPolicyManager.json +0 -45
  33. package/build/abi/uniswap-v4/hooks/cabalcoin-hook.abi.json +0 -682
  34. package/build/abi/uniswap-v4/hooks/fee-hook.abi.json +0 -1335
  35. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying-factory.d.ts +0 -29
  36. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying-factory.js +0 -153
  37. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying-factory.js.map +0 -1
  38. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying.d.ts +0 -40
  39. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying.js +0 -323
  40. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying.js.map +0 -1
  41. package/build/dex/aave-pt-to-underlying/config.d.ts +0 -3
  42. package/build/dex/aave-pt-to-underlying/config.js +0 -24
  43. package/build/dex/aave-pt-to-underlying/config.js.map +0 -1
  44. package/build/dex/aave-pt-to-underlying/constants.d.ts +0 -2
  45. package/build/dex/aave-pt-to-underlying/constants.js +0 -6
  46. package/build/dex/aave-pt-to-underlying/constants.js.map +0 -1
  47. package/build/dex/aave-pt-to-underlying/types.d.ts +0 -24
  48. package/build/dex/aave-pt-to-underlying/types.js +0 -3
  49. package/build/dex/aave-pt-to-underlying/types.js.map +0 -1
  50. package/build/dex/aave-pt-to-usdc/aave-pt-to-usdc.d.ts +0 -39
  51. package/build/dex/aave-pt-to-usdc/aave-pt-to-usdc.js +0 -244
  52. package/build/dex/aave-pt-to-usdc/aave-pt-to-usdc.js.map +0 -1
  53. package/build/dex/aave-pt-to-usdc/config.d.ts +0 -3
  54. package/build/dex/aave-pt-to-usdc/config.js +0 -47
  55. package/build/dex/aave-pt-to-usdc/config.js.map +0 -1
  56. package/build/dex/aave-pt-to-usdc/constants.d.ts +0 -2
  57. package/build/dex/aave-pt-to-usdc/constants.js +0 -6
  58. package/build/dex/aave-pt-to-usdc/constants.js.map +0 -1
  59. package/build/dex/aave-pt-to-usdc/types.d.ts +0 -22
  60. package/build/dex/aave-pt-to-usdc/types.js +0 -3
  61. package/build/dex/aave-pt-to-usdc/types.js.map +0 -1
  62. package/build/dex/apex-defi/apex-defi-factory.d.ts +0 -26
  63. package/build/dex/apex-defi/apex-defi-factory.js +0 -53
  64. package/build/dex/apex-defi/apex-defi-factory.js.map +0 -1
  65. package/build/dex/apex-defi/apex-defi-pool.d.ts +0 -55
  66. package/build/dex/apex-defi/apex-defi-pool.js +0 -247
  67. package/build/dex/apex-defi/apex-defi-pool.js.map +0 -1
  68. package/build/dex/apex-defi/apex-defi-wrapper-factory.d.ts +0 -57
  69. package/build/dex/apex-defi/apex-defi-wrapper-factory.js +0 -250
  70. package/build/dex/apex-defi/apex-defi-wrapper-factory.js.map +0 -1
  71. package/build/dex/apex-defi/apex-defi.d.ts +0 -97
  72. package/build/dex/apex-defi/apex-defi.js +0 -1021
  73. package/build/dex/apex-defi/apex-defi.js.map +0 -1
  74. package/build/dex/apex-defi/config.d.ts +0 -4
  75. package/build/dex/apex-defi/config.js +0 -138
  76. package/build/dex/apex-defi/config.js.map +0 -1
  77. package/build/dex/apex-defi/types.d.ts +0 -32
  78. package/build/dex/apex-defi/types.js +0 -3
  79. package/build/dex/apex-defi/types.js.map +0 -1
  80. package/build/dex/apex-defi/utils.d.ts +0 -46
  81. package/build/dex/apex-defi/utils.js +0 -133
  82. package/build/dex/apex-defi/utils.js.map +0 -1
  83. package/build/dex/miro-migrator/miro-migrator-state.d.ts +0 -27
  84. package/build/dex/miro-migrator/miro-migrator-state.js +0 -89
  85. package/build/dex/miro-migrator/miro-migrator-state.js.map +0 -1
  86. package/build/dex/stabull/config.d.ts +0 -3
  87. package/build/dex/stabull/config.js +0 -177
  88. package/build/dex/stabull/config.js.map +0 -1
  89. package/build/dex/stabull/stabull-pool.d.ts +0 -46
  90. package/build/dex/stabull/stabull-pool.js +0 -113
  91. package/build/dex/stabull/stabull-pool.js.map +0 -1
  92. package/build/dex/stabull/stabull.d.ts +0 -55
  93. package/build/dex/stabull/stabull.js +0 -286
  94. package/build/dex/stabull/stabull.js.map +0 -1
  95. package/build/dex/stabull/types.d.ts +0 -21
  96. package/build/dex/stabull/types.js +0 -3
  97. package/build/dex/stabull/types.js.map +0 -1
  98. package/build/dex/uniswap-v3/forks/pangolin-v3/utils.d.ts +0 -4
  99. package/build/dex/uniswap-v3/forks/pangolin-v3/utils.js +0 -56
  100. package/build/dex/uniswap-v3/forks/pangolin-v3/utils.js.map +0 -1
  101. package/build/dex/uniswap-v4/hooks/arena.d.ts +0 -6
  102. package/build/dex/uniswap-v4/hooks/arena.js +0 -10
  103. package/build/dex/uniswap-v4/hooks/arena.js.map +0 -1
  104. package/build/dex/uniswap-v4/hooks/base-fee/base-fee-hook.d.ts +0 -0
  105. package/build/dex/uniswap-v4/hooks/base-fee/base-fee-hook.js +0 -2
  106. package/build/dex/uniswap-v4/hooks/base-fee/base-fee-hook.js.map +0 -1
  107. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.d.ts +0 -7
  108. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.js +0 -28
  109. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.js.map +0 -1
  110. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/types.d.ts +0 -0
  111. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/types.js +0 -2
  112. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/types.js.map +0 -1
  113. package/build/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.d.ts +0 -7
  114. package/build/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.js +0 -28
  115. package/build/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.js.map +0 -1
  116. package/build/dex/uniswap-v4/hooks/fee-hook/types.d.ts +0 -0
  117. package/build/dex/uniswap-v4/hooks/fee-hook/types.js +0 -2
  118. package/build/dex/uniswap-v4/hooks/fee-hook/types.js.map +0 -1
  119. package/build/dex/uniswap-v4/hooks/index.d.ts +0 -1
  120. package/build/dex/uniswap-v4/hooks/index.js +0 -18
  121. package/build/dex/uniswap-v4/hooks/index.js.map +0 -1
  122. package/build/dex/uniswap-v4/hooks/spot.d.ts +0 -15
  123. package/build/dex/uniswap-v4/hooks/spot.js +0 -109
  124. package/build/dex/uniswap-v4/hooks/spot.js.map +0 -1
  125. package/build/dex/uniswap-v4/hooks/template.d.ts +0 -150
  126. package/build/dex/uniswap-v4/hooks/template.js +0 -104
  127. package/build/dex/uniswap-v4/hooks/template.js.map +0 -1
  128. package/build/dex/usdc-transmuter/usdc-transmuter-pool.d.ts +0 -26
  129. package/build/dex/usdc-transmuter/usdc-transmuter-pool.js +0 -75
  130. package/build/dex/usdc-transmuter/usdc-transmuter-pool.js.map +0 -1
  131. package/build/dex/usual/usual-usdc-usdc.d.ts +0 -17
  132. package/build/dex/usual/usual-usdc-usdc.js +0 -59
  133. package/build/dex/usual/usual-usdc-usdc.js.map +0 -1
  134. package/build/dex/yo/config.d.ts +0 -3
  135. package/build/dex/yo/config.js +0 -21
  136. package/build/dex/yo/config.js.map +0 -1
  137. package/build/dex/yo/types.d.ts +0 -13
  138. package/build/dex/yo/types.js +0 -3
  139. package/build/dex/yo/types.js.map +0 -1
  140. package/build/dex/yo/yo-pool.d.ts +0 -13
  141. package/build/dex/yo/yo-pool.js +0 -26
  142. package/build/dex/yo/yo-pool.js.map +0 -1
  143. package/build/dex/yo/yo.d.ts +0 -39
  144. package/build/dex/yo/yo.js +0 -248
  145. package/build/dex/yo/yo.js.map +0 -1
  146. package/build/implementations/api-paraswap-sdk.d.ts +0 -25
  147. package/build/implementations/api-paraswap-sdk.js +0 -102
  148. package/build/implementations/api-paraswap-sdk.js.map +0 -1
@@ -1,286 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.Stabull = void 0;
40
- const constants_1 = require("../../constants");
41
- const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
42
- const utils_1 = require("../../utils");
43
- const stabull_pool_1 = require("./stabull-pool");
44
- const simple_exchange_1 = require("../simple-exchange");
45
- const config_1 = require("./config");
46
- const stabull_curve_json_1 = __importDefault(require("../../abi/stabull/stabull-curve.json"));
47
- const stabull_router_json_1 = __importDefault(require("../../abi/stabull/stabull-router.json"));
48
- const ethers_1 = require("ethers");
49
- const decoders_1 = require("../../lib/decoders");
50
- const bigint_constants_1 = require("../../bigint-constants");
51
- class Stabull extends simple_exchange_1.SimpleExchange {
52
- network;
53
- dexKey;
54
- dexHelper;
55
- poolIface;
56
- routerIface;
57
- routerAddress;
58
- quoteCurrency;
59
- pools = {};
60
- poolsConfig;
61
- hasConstantPriceLargeAmounts = false;
62
- needWrapNative = true;
63
- isFeeOnTransferSupported = false;
64
- static dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.StabullConfig);
65
- logger;
66
- constructor(network, dexKey, dexHelper, poolIface = new ethers_1.ethers.utils.Interface(stabull_curve_json_1.default), routerIface = new ethers_1.ethers.utils.Interface(stabull_router_json_1.default), routerAddress = config_1.StabullConfig.Stabull[network].router, quoteCurrency = config_1.StabullConfig.Stabull[network].quoteCurrency) {
67
- super(dexHelper, dexKey);
68
- this.network = network;
69
- this.dexKey = dexKey;
70
- this.dexHelper = dexHelper;
71
- this.poolIface = poolIface;
72
- this.routerIface = routerIface;
73
- this.routerAddress = routerAddress;
74
- this.quoteCurrency = quoteCurrency;
75
- this.logger = dexHelper.getLogger(dexKey);
76
- this.poolsConfig = config_1.StabullConfig.Stabull[network].pools;
77
- //Iterate over pools and Initialize event pools
78
- Object.keys(this.poolsConfig).forEach(poolAddress => {
79
- const pool = this.poolsConfig[poolAddress];
80
- const tokenAddresses = pool.tokens.map(t => t.address);
81
- // Initialize event pools
82
- this.pools[poolAddress] = new stabull_pool_1.StabullEventPool(dexKey, network, dexHelper, poolAddress, tokenAddresses, this.logger);
83
- });
84
- }
85
- // Legacy: was only used for V5
86
- // Returns the list of contract adapters (name and index)
87
- // for a buy/sell. Return null if there are no adapters.
88
- getAdapters(side) {
89
- return null;
90
- }
91
- // Returns list of pool identifiers that can be used
92
- // for a given swap. poolIdentifiers must be unique
93
- // across DEXes. It is recommended to use
94
- // ${dexKey}_${poolAddress} as a poolIdentifier
95
- async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
96
- const pool = Object.entries(this.poolsConfig).find(([, pool]) => {
97
- const tokenAddresses = pool.tokens.map(t => t.address.toLowerCase());
98
- return (tokenAddresses.includes(srcToken.address.toLowerCase()) &&
99
- tokenAddresses.includes(destToken.address.toLowerCase()));
100
- })?.[0];
101
- return pool ? [`${this.dexKey}_${pool}`.toLowerCase()] : [];
102
- }
103
- // Returns pool prices for amounts.
104
- // If limitPools is defined only pools in limitPools
105
- // should be used. If limitPools is undefined then
106
- // any pools can be used.
107
- async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
108
- const poolIdentifiers = await this.getPoolIdentifiers(srcToken, destToken, side, blockNumber);
109
- if (poolIdentifiers.length === 0)
110
- return null;
111
- const poolIdentifier = poolIdentifiers[0];
112
- const poolAddress = poolIdentifier.split('_')[1];
113
- if (!poolAddress) {
114
- this.logger.debug(`Invalid pool identifier: ${poolIdentifier}`);
115
- return null;
116
- }
117
- const isSell = side === constants_1.SwapSide.SELL;
118
- const methodName = isSell ? 'viewOriginSwap' : 'viewTargetSwap';
119
- try {
120
- const unitAmount = bigint_constants_1.BI_POWS[isSell ? srcToken.decimals : destToken.decimals];
121
- const queryAmounts = [unitAmount, ...amounts];
122
- const callData = queryAmounts.map(amount => ({
123
- target: poolAddress,
124
- callData: this.poolIface.encodeFunctionData(methodName, [
125
- srcToken.address,
126
- destToken.address,
127
- amount.toString(),
128
- ]),
129
- decodeFunction: decoders_1.uint256ToBigInt,
130
- }));
131
- const quotes = await this.dexHelper.multiWrapper.tryAggregate(false, callData, blockNumber, this.dexHelper.multiWrapper.defaultBatchSize, false);
132
- const unit = quotes[0].success ? quotes[0].returnData : 0n;
133
- const prices = quotes.slice(1).map(q => (q.success ? q.returnData : 0n));
134
- return [
135
- {
136
- unit,
137
- prices,
138
- data: { poolAddress },
139
- exchange: this.dexKey,
140
- gasCost: 150000,
141
- poolAddresses: [poolAddress],
142
- poolIdentifiers: [poolIdentifier],
143
- },
144
- ];
145
- }
146
- catch (e) {
147
- this.logger.error('Failed to get prices', e);
148
- return null;
149
- }
150
- }
151
- // Returns estimated gas cost of calldata for this DEX in multiSwap
152
- getCalldataGasCost(poolPrices) {
153
- return (CALLDATA_GAS_COST.DEX_OVERHEAD +
154
- CALLDATA_GAS_COST.FUNCTION_SELECTOR +
155
- CALLDATA_GAS_COST.ADDRESS * 2 +
156
- CALLDATA_GAS_COST.AMOUNT * 2 +
157
- CALLDATA_GAS_COST.TIMESTAMP);
158
- }
159
- // Encode params required by the exchange adapter
160
- // V5: Used for multiSwap, buy & megaSwap
161
- // V6: Not used, can be left blank
162
- // Hint: abiCoder.encodeParameter() could be useful
163
- // Update this method to use the correct AbiCoder syntax
164
- getAdapterParam = (srcToken, destToken, srcAmount, destAmount, data, side) => {
165
- return {
166
- targetExchange: config_1.StabullConfig.Stabull[this.network].router,
167
- payload: '0x',
168
- networkFee: '0',
169
- };
170
- };
171
- // This is called once before getTopPoolsForToken is
172
- // called for multiple tokens. This can be helpful to
173
- // update common state required for calculating
174
- // getTopPoolsForToken. It is optional for a DEX
175
- // to implement this
176
- async updatePoolState() {
177
- const blockNumber = await this.dexHelper.web3Provider.eth.getBlockNumber();
178
- await Promise.all(Object.values(this.pools).map(async (poolInstance) => {
179
- const state = await poolInstance.generateState(blockNumber);
180
- poolInstance.setState(state, blockNumber);
181
- }));
182
- }
183
- // Returns list of top pools based on liquidity. Max
184
- // limit number pools should be returned.
185
- async getTopPoolsForToken(tokenAddress, limit) {
186
- const lowerToken = tokenAddress.toLowerCase();
187
- const poolsWithToken = [];
188
- for (const [poolAddress, pool] of Object.entries(this.pools)) {
189
- const tokenIndex = pool.addressesSubscribed.findIndex(t => t.toLowerCase() === lowerToken);
190
- if (tokenIndex === -1)
191
- continue;
192
- poolsWithToken.push({
193
- pool,
194
- tokenIndex,
195
- connectorIndex: 1 - tokenIndex,
196
- poolConfig: this.poolsConfig[poolAddress],
197
- });
198
- }
199
- if (poolsWithToken.length === 0)
200
- return [];
201
- const tokenToAmount = new Map();
202
- for (const { pool, tokenIndex, connectorIndex } of poolsWithToken) {
203
- const state = pool.getStaleState();
204
- if (!state)
205
- continue;
206
- const token = pool.addressesSubscribed[tokenIndex];
207
- const connector = pool.addressesSubscribed[connectorIndex];
208
- tokenToAmount.set(token, state[tokenIndex === 0 ? 'reserves0' : 'reserves1'] ?? 0n);
209
- tokenToAmount.set(connector, state[connectorIndex === 0 ? 'reserves0' : 'reserves1'] ?? 0n);
210
- }
211
- const tokenAmountsArray = Array.from(tokenToAmount.entries());
212
- const usdAmounts = await this.dexHelper.getUsdTokenAmounts(tokenAmountsArray);
213
- const usdMap = new Map(tokenAmountsArray.map((t, i) => [t[0], usdAmounts[i]]));
214
- const relevantPools = poolsWithToken.map(({ pool, tokenIndex, connectorIndex, poolConfig }) => {
215
- const token = pool.addressesSubscribed[tokenIndex];
216
- const connector = pool.addressesSubscribed[connectorIndex];
217
- return {
218
- exchange: this.dexKey,
219
- address: pool.poolAddress,
220
- connectorTokens: [
221
- {
222
- address: connector,
223
- decimals: poolConfig.tokens[connectorIndex]?.decimals ?? 18,
224
- liquidityUSD: usdMap.get(connector) ?? 0,
225
- },
226
- ],
227
- liquidityUSD: usdMap.get(token) ?? 0,
228
- };
229
- });
230
- relevantPools.sort((a, b) => b.liquidityUSD - a.liquidityUSD);
231
- return relevantPools.slice(0, limit);
232
- }
233
- /**
234
- * Retrieves the decentralized exchange (DEX) parameters for a swap operation.
235
- *
236
- * @param srcToken - The address of the source token.
237
- * @param destToken - The address of the destination token.
238
- * @param srcAmount - The amount of the source token to swap.
239
- * @param destAmount - The desired amount of the destination token.
240
- * @param recipient - The address of the recipient.
241
- * @param data - Additional data required for the swap.
242
- * @param side - The side of the swap (SELL or BUY).
243
- * @param options - Options for global tokens.
244
- * @param executorAddress - The address of the executor.
245
- * @returns A promise that resolves to the DEX exchange parameters.
246
- */
247
- async getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side, options, executorAddress) {
248
- // For SELL operations, always use the router for swaps
249
- if (side === constants_1.SwapSide.SELL) {
250
- const swapData = this.routerIface.encodeFunctionData('originSwap', [
251
- this.quoteCurrency, // quoteCurrency
252
- srcToken, // origin
253
- destToken, // target
254
- srcAmount, // originAmount
255
- '1', // minTargetAmount - set to minimum to ensure execution
256
- (0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)(), // deadline
257
- ]);
258
- return {
259
- needWrapNative: this.needWrapNative,
260
- dexFuncHasRecipient: false,
261
- exchangeData: swapData,
262
- targetExchange: this.routerAddress,
263
- spender: this.routerAddress,
264
- returnAmountPos: 0,
265
- };
266
- }
267
- // Direct swap case for BUY operations (one token must be quote currency)
268
- const swapData = this.poolIface.encodeFunctionData('targetSwap', [
269
- srcToken, // origin
270
- destToken, // target
271
- ethers_1.ethers.constants.MaxUint256.toString(), // maxOriginAmount
272
- destAmount, // targetAmount
273
- (0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)(), // deadline
274
- ]);
275
- return {
276
- needWrapNative: this.needWrapNative,
277
- dexFuncHasRecipient: false,
278
- exchangeData: swapData,
279
- targetExchange: data.poolAddress,
280
- spender: data.poolAddress,
281
- returnAmountPos: 0,
282
- };
283
- }
284
- }
285
- exports.Stabull = Stabull;
286
- //# sourceMappingURL=stabull.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stabull.js","sourceRoot":"","sources":["../../../src/dex/stabull/stabull.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,+CAAoD;AACpD,2EAA6D;AAC7D,uCAAoD;AAGpD,iDAAkD;AAElD,wDAG4B;AAC5B,qCAAyC;AACzC,8FAA4D;AAC5D,gGAA8D;AAC9D,mCAAgC;AAChC,iDAAqD;AACrD,6DAAiD;AAEjD,MAAa,OAAQ,SAAQ,gCAAc;IAe9B;IACA;IACA;IACC;IACA;IACA;IACA;IApBJ,KAAK,GAAqC,EAAE,CAAC;IAC7C,WAAW,CAAc;IAExB,4BAA4B,GAAG,KAAK,CAAC;IACrC,cAAc,GAAG,IA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1B,GAAG,EAAE,uDAAuD;gBAC5D,IAAA,uDAAqC,GAAE,EAAE,WAAW;aACrD,CAAC,CAAC;YAEH,OAAO;gBACL,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,mBAAmB,EAAE,KAAK;gBAC1B,YAAY,EAAE,QAAQ;gBACtB,cAAc,EAAE,IAAI,CAAC,aAAa;gBAClC,OAAO,EAAE,IAAI,CAAC,aAAa;gBAC3B,eAAe,EAAE,CAAC;aACnB,CAAC;QACJ,CAAC;QAED,yEAAyE;QACzE,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,YAAY,EAAE;YAC/D,QAAQ,EAAE,SAAS;YACnB,SAAS,EAAE,SAAS;YACpB,eAAM,CAAC,SAAS,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,kBAAkB;YAC1D,UAAU,EAAE,eAAe;YAC3B,IAAA,uDAAqC,GAAE,EAAE,WAAW;SACrD,CAAC,CAAC;QAEH,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,mBAAmB,EAAE,KAAK;YAC1B,YAAY,EAAE,QAAQ;YACtB,cAAc,EAAE,IAAI,CAAC,WAAW;YAChC,OAAO,EAAE,IAAI,CAAC,WAAW;YACzB,eAAe,EAAE,CAAC;SACnB,CAAC;IACJ,CAAC;;AAjVH,0BAkVC"}
@@ -1,21 +0,0 @@
1
- export type PoolState = {
2
- reserves0: bigint;
3
- reserves1: bigint;
4
- };
5
- export type StabullData = {
6
- poolAddress: string;
7
- };
8
- export type TokenConfig = {
9
- address: string;
10
- decimals: number;
11
- };
12
- export type PoolsConfig = {
13
- [poolAddress: string]: {
14
- tokens: TokenConfig[];
15
- };
16
- };
17
- export type DexParams = {
18
- router: string;
19
- quoteCurrency: string;
20
- pools: PoolsConfig;
21
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/stabull/types.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
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;
@@ -1,56 +0,0 @@
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
@@ -1 +0,0 @@
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,6 +0,0 @@
1
- import { Network } from '../../../constants';
2
- export declare const ARENA_HOOK: {
3
- name: string;
4
- address: string;
5
- networks: Network[];
6
- };
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ARENA_HOOK = void 0;
4
- const constants_1 = require("../../../constants");
5
- exports.ARENA_HOOK = {
6
- name: 'ArenaHook',
7
- address: '0xe32a5d788c568fc5a671255d17b618e70552e044',
8
- networks: [constants_1.Network.AVALANCHE],
9
- };
10
- //# sourceMappingURL=arena.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arena.js","sourceRoot":"","sources":["../../../../src/dex/uniswap-v4/hooks/arena.ts"],"names":[],"mappings":";;;AAAA,kDAA6C;AAEhC,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,4CAA4C;IACrD,QAAQ,EAAE,CAAC,mBAAO,CAAC,SAAS,CAAC;CAC9B,CAAC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=base-fee-hook.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-fee-hook.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v4/hooks/base-fee/base-fee-hook.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
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
- }
@@ -1,28 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v4/hooks/cabalcoin-hook/types.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
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
- }
@@ -1,28 +0,0 @@
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
@@ -1 +0,0 @@
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
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v4/hooks/fee-hook/types.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- export * from './arena';
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./arena"), exports);
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dex/uniswap-v4/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB"}
@@ -1,15 +0,0 @@
1
- import { BaseUniswapV4Hook, HookAfterSwapParams, HookAfterSwapResult, HookBeforeSwapParams, HookBeforeSwapResult, HookFactoryParams } from './template';
2
- export declare class SpotHook extends BaseUniswapV4Hook {
3
- private policyManagerAddress?;
4
- private dynamicFeeManagerAddress?;
5
- private policyManagerContract?;
6
- private dynamicFeeManagerContract?;
7
- private feeCache;
8
- constructor(params: HookFactoryParams);
9
- bootstrap(): Promise<void>;
10
- beforeSwap(params: HookBeforeSwapParams): Promise<HookBeforeSwapResult | void>;
11
- afterSwap(params: HookAfterSwapParams): Promise<HookAfterSwapResult | void>;
12
- private calculateHookFee;
13
- private ensureContracts;
14
- private loadFeeState;
15
- }