@paraswap/dex-lib 3.8.12-solidlyv3 → 3.8.13-arusd-fxusd.1

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 (263) hide show
  1. package/.vscode/launch.json +16 -0
  2. package/.vscode/settings.json +3 -0
  3. package/build/abi/Uncompressor.json +250 -0
  4. package/build/abi/concentrator/arUSD5115.json +1746 -0
  5. package/build/abi/fx-protocol/FxMarket.json +1284 -0
  6. package/build/abi/fx-protocol/weETHOralce.json +676 -0
  7. package/build/abi/integral/factory.json +333 -0
  8. package/build/abi/integral/oracle.json +501 -0
  9. package/build/abi/{inception/inception-ineth-pool.json → integral/pool.json} +522 -543
  10. package/build/abi/integral/relayer.json +1536 -0
  11. package/build/abi/maverick-v2/MaverickV2Router.json +778 -0
  12. package/build/dex/aave-v1/aave-v1.d.ts +1 -2
  13. package/build/dex/aave-v1/aave-v1.js +0 -22
  14. package/build/dex/aave-v1/aave-v1.js.map +1 -1
  15. package/build/dex/bProtocol.d.ts +18 -0
  16. package/build/dex/bProtocol.js +39 -0
  17. package/build/dex/bProtocol.js.map +1 -0
  18. package/build/dex/bancor.d.ts +26 -0
  19. package/build/dex/bancor.js +58 -0
  20. package/build/dex/bancor.js.map +1 -0
  21. package/build/dex/compound.d.ts +18 -0
  22. package/build/dex/compound.js +46 -0
  23. package/build/dex/compound.js.map +1 -0
  24. package/build/dex/concentrator-arusd/concentrator-arusd-event.d.ts +16 -0
  25. package/build/dex/concentrator-arusd/concentrator-arusd-event.js +53 -0
  26. package/build/dex/concentrator-arusd/concentrator-arusd-event.js.map +1 -0
  27. package/build/dex/concentrator-arusd/concentrator-arusd.d.ts +4 -1
  28. package/build/dex/concentrator-arusd/concentrator-arusd.js +24 -33
  29. package/build/dex/concentrator-arusd/concentrator-arusd.js.map +1 -1
  30. package/build/dex/concentrator-arusd/config.js +1 -1
  31. package/build/dex/concentrator-arusd/config.js.map +1 -1
  32. package/build/dex/concentrator-arusd/types.d.ts +6 -2
  33. package/build/dex/concentrator-arusd/utils.d.ts +4 -0
  34. package/build/dex/concentrator-arusd/utils.js +27 -0
  35. package/build/dex/concentrator-arusd/utils.js.map +1 -0
  36. package/build/dex/curve-v2.d.ts +58 -0
  37. package/build/dex/curve-v2.js +180 -0
  38. package/build/dex/curve-v2.js.map +1 -0
  39. package/build/dex/dodo-v1.d.ts +33 -0
  40. package/build/dex/dodo-v1.js +63 -0
  41. package/build/dex/dodo-v1.js.map +1 -0
  42. package/build/dex/etherfi/etherfi.d.ts +26 -0
  43. package/build/dex/etherfi/etherfi.js +96 -0
  44. package/build/dex/etherfi/etherfi.js.map +1 -0
  45. package/build/dex/fx-protocol-rusd/config.d.ts +1 -2
  46. package/build/dex/fx-protocol-rusd/config.js +3 -6
  47. package/build/dex/fx-protocol-rusd/config.js.map +1 -1
  48. package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.d.ts +18 -0
  49. package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.js +63 -0
  50. package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.js.map +1 -0
  51. package/build/dex/fx-protocol-rusd/fx-protocol-rusd.d.ts +10 -10
  52. package/build/dex/fx-protocol-rusd/fx-protocol-rusd.js +82 -65
  53. package/build/dex/fx-protocol-rusd/fx-protocol-rusd.js.map +1 -1
  54. package/build/dex/fx-protocol-rusd/types.d.ts +5 -2
  55. package/build/dex/fx-protocol-rusd/utils.d.ts +4 -0
  56. package/build/dex/fx-protocol-rusd/utils.js +26 -0
  57. package/build/dex/fx-protocol-rusd/utils.js.map +1 -0
  58. package/build/dex/index.js +4 -0
  59. package/build/dex/index.js.map +1 -1
  60. package/build/dex/{infusion → integral}/config.d.ts +1 -1
  61. package/build/dex/integral/config.js +20 -0
  62. package/build/dex/integral/config.js.map +1 -0
  63. package/build/dex/integral/context.d.ts +40 -0
  64. package/build/dex/integral/context.js +158 -0
  65. package/build/dex/integral/context.js.map +1 -0
  66. package/build/dex/integral/helpers.d.ts +17 -0
  67. package/build/dex/integral/helpers.js +157 -0
  68. package/build/dex/integral/helpers.js.map +1 -0
  69. package/build/dex/integral/integral-factory.d.ts +24 -0
  70. package/build/dex/integral/integral-factory.js +95 -0
  71. package/build/dex/integral/integral-factory.js.map +1 -0
  72. package/build/dex/integral/integral-pool.d.ts +50 -0
  73. package/build/dex/integral/integral-pool.js +149 -0
  74. package/build/dex/integral/integral-pool.js.map +1 -0
  75. package/build/dex/integral/integral-pricing.d.ts +18 -0
  76. package/build/dex/integral/integral-pricing.js +114 -0
  77. package/build/dex/integral/integral-pricing.js.map +1 -0
  78. package/build/dex/integral/integral-relayer.d.ts +42 -0
  79. package/build/dex/integral/integral-relayer.js +192 -0
  80. package/build/dex/integral/integral-relayer.js.map +1 -0
  81. package/build/dex/integral/integral-token.d.ts +27 -0
  82. package/build/dex/integral/integral-token.js +59 -0
  83. package/build/dex/integral/integral-token.js.map +1 -0
  84. package/build/dex/{inception/inception.d.ts → integral/integral.d.ts} +19 -20
  85. package/build/dex/integral/integral.js +377 -0
  86. package/build/dex/integral/integral.js.map +1 -0
  87. package/build/dex/integral/types.d.ts +84 -0
  88. package/build/dex/integral/types.js +9 -0
  89. package/build/dex/integral/types.js.map +1 -0
  90. package/build/dex/integral/utils-e2e.d.ts +9 -0
  91. package/build/dex/integral/utils-e2e.js +131 -0
  92. package/build/dex/integral/utils-e2e.js.map +1 -0
  93. package/build/dex/integral/utils.d.ts +17 -0
  94. package/build/dex/integral/utils.js +94 -0
  95. package/build/dex/integral/utils.js.map +1 -0
  96. package/build/dex/lido.d.ts +19 -0
  97. package/build/dex/lido.js +42 -0
  98. package/build/dex/lido.js.map +1 -0
  99. package/build/dex/onebit.d.ts +25 -0
  100. package/build/dex/onebit.js +42 -0
  101. package/build/dex/onebit.js.map +1 -0
  102. package/build/dex/oswap/oswap.js +4 -1
  103. package/build/dex/oswap/oswap.js.map +1 -1
  104. package/build/dex/platypus/platypus.d.ts +1 -2
  105. package/build/dex/platypus/platypus.js +0 -31
  106. package/build/dex/platypus/platypus.js.map +1 -1
  107. package/build/dex/sdai/config.d.ts +11 -0
  108. package/build/dex/sdai/config.js +21 -0
  109. package/build/dex/sdai/config.js.map +1 -0
  110. package/build/dex/sdai/constants.d.ts +2 -0
  111. package/build/dex/sdai/constants.js +6 -0
  112. package/build/dex/sdai/constants.js.map +1 -0
  113. package/build/dex/sdai/scripts/validate-state.d.ts +1 -0
  114. package/build/dex/sdai/scripts/validate-state.js +102 -0
  115. package/build/dex/sdai/scripts/validate-state.js.map +1 -0
  116. package/build/dex/sdai/sdai-pool.d.ts +16 -0
  117. package/build/dex/sdai/sdai-pool.js +85 -0
  118. package/build/dex/sdai/sdai-pool.js.map +1 -0
  119. package/build/dex/sdai/sdai.d.ts +51 -0
  120. package/build/dex/sdai/sdai.js +172 -0
  121. package/build/dex/sdai/sdai.js.map +1 -0
  122. package/build/dex/sdai/types.d.ts +21 -0
  123. package/build/dex/sdai/types.js +11 -0
  124. package/build/dex/sdai/types.js.map +1 -0
  125. package/build/dex/sdai/utils.d.ts +4 -0
  126. package/build/dex/sdai/utils.js +39 -0
  127. package/build/dex/sdai/utils.js.map +1 -0
  128. package/build/dex/smoothy.d.ts +26 -0
  129. package/build/dex/smoothy.js +48 -0
  130. package/build/dex/smoothy.js.map +1 -0
  131. package/build/dex/stable-pool.d.ts +28 -0
  132. package/build/dex/stable-pool.js +62 -0
  133. package/build/dex/stable-pool.js.map +1 -0
  134. package/build/dex/swaap-v1/swaap-v1.d.ts +1 -2
  135. package/build/dex/swaap-v1/swaap-v1.js +0 -10
  136. package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
  137. package/build/dex/trader-joe-v2.1.d.ts +43 -0
  138. package/build/dex/trader-joe-v2.1.js +79 -0
  139. package/build/dex/trader-joe-v2.1.js.map +1 -0
  140. package/build/executor/compressor/Compressor.d.ts +23 -0
  141. package/build/executor/compressor/Compressor.js +144 -0
  142. package/build/executor/compressor/Compressor.js.map +1 -0
  143. package/build/executor/compressor/compress.d.ts +17 -0
  144. package/build/executor/compressor/compress.js +187 -0
  145. package/build/executor/compressor/compress.js.map +1 -0
  146. package/build/executor/compressor/compress_functions/addressSubstitution.d.ts +6 -0
  147. package/build/executor/compressor/compress_functions/addressSubstitution.js +29 -0
  148. package/build/executor/compressor/compress_functions/addressSubstitution.js.map +1 -0
  149. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.d.ts +10 -0
  150. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js +40 -0
  151. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js.map +1 -0
  152. package/build/executor/compressor/compress_functions/byteSubstitution.d.ts +11 -0
  153. package/build/executor/compressor/compress_functions/byteSubstitution.js +64 -0
  154. package/build/executor/compressor/compress_functions/byteSubstitution.js.map +1 -0
  155. package/build/executor/compressor/compress_functions/ffSubstitution.d.ts +7 -0
  156. package/build/executor/compressor/compress_functions/ffSubstitution.js +54 -0
  157. package/build/executor/compressor/compress_functions/ffSubstitution.js.map +1 -0
  158. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.d.ts +8 -0
  159. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js +67 -0
  160. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js.map +1 -0
  161. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.d.ts +8 -0
  162. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js +61 -0
  163. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js.map +1 -0
  164. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.d.ts +6 -0
  165. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js +37 -0
  166. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js.map +1 -0
  167. package/build/executor/compressor/compress_functions/searchUnusedBytes.d.ts +9 -0
  168. package/build/executor/compressor/compress_functions/searchUnusedBytes.js +33 -0
  169. package/build/executor/compressor/compress_functions/searchUnusedBytes.js.map +1 -0
  170. package/build/executor/compressor/fetchSaved.d.ts +0 -0
  171. package/build/executor/compressor/fetchSaved.js +17 -0
  172. package/build/executor/compressor/fetchSaved.js.map +1 -0
  173. package/build/executor/compressor/utils/computeCostL2.d.ts +2 -0
  174. package/build/executor/compressor/utils/computeCostL2.js +14 -0
  175. package/build/executor/compressor/utils/computeCostL2.js.map +1 -0
  176. package/build/executor/compressor/utils/findLongestDuplicatedString.d.ts +2 -0
  177. package/build/executor/compressor/utils/findLongestDuplicatedString.js +30 -0
  178. package/build/executor/compressor/utils/findLongestDuplicatedString.js.map +1 -0
  179. package/build/executor/compressor/utils/getAllIndexes.d.ts +2 -0
  180. package/build/executor/compressor/utils/getAllIndexes.js +12 -0
  181. package/build/executor/compressor/utils/getAllIndexes.js.map +1 -0
  182. package/build/executor/compressor/utils/getByteForAddress.d.ts +2 -0
  183. package/build/executor/compressor/utils/getByteForAddress.js +14 -0
  184. package/build/executor/compressor/utils/getByteForAddress.js.map +1 -0
  185. package/build/executor/compressor/utils/intTo2Bytes.d.ts +2 -0
  186. package/build/executor/compressor/utils/intTo2Bytes.js +14 -0
  187. package/build/executor/compressor/utils/intTo2Bytes.js.map +1 -0
  188. package/build/executor/compressor/utils/intTo3Bytes.d.ts +2 -0
  189. package/build/executor/compressor/utils/intTo3Bytes.js +18 -0
  190. package/build/executor/compressor/utils/intTo3Bytes.js.map +1 -0
  191. package/build/executor/compressor/utils/intToByte.d.ts +2 -0
  192. package/build/executor/compressor/utils/intToByte.js +10 -0
  193. package/build/executor/compressor/utils/intToByte.js.map +1 -0
  194. package/package.json +1 -1
  195. package/src/abi/concentrator/arUSD.json +568 -0
  196. package/src/abi/concentrator/arUSD5115.json +1746 -0
  197. package/src/abi/fx-protocol/FxMarket.json +1284 -0
  198. package/src/abi/fx-protocol/FxUSD.json +1227 -0
  199. package/src/abi/fx-protocol/weETHOralce.json +676 -0
  200. package/src/dex/concentrator-arusd/concentrator-arusd-e2e.test.ts +92 -0
  201. package/src/dex/concentrator-arusd/concentrator-arusd-event.ts +70 -0
  202. package/src/dex/concentrator-arusd/concentrator-arusd-integration.test.ts +104 -0
  203. package/src/dex/concentrator-arusd/concentrator-arusd.ts +251 -0
  204. package/src/dex/concentrator-arusd/concetrator-arusd-events.test.ts +97 -0
  205. package/src/dex/concentrator-arusd/config.ts +18 -0
  206. package/src/dex/concentrator-arusd/types.ts +16 -0
  207. package/src/dex/concentrator-arusd/utils.ts +36 -0
  208. package/src/dex/fx-protocol-rusd/config.ts +14 -0
  209. package/src/dex/fx-protocol-rusd/fx-protocol-e2e.test.ts +96 -0
  210. package/src/dex/fx-protocol-rusd/fx-protocol-events.test.ts +101 -0
  211. package/src/dex/fx-protocol-rusd/fx-protocol-integration.test.ts +104 -0
  212. package/src/dex/fx-protocol-rusd/fx-protocol-rusd-event.ts +80 -0
  213. package/src/dex/fx-protocol-rusd/fx-protocol-rusd.ts +303 -0
  214. package/src/dex/fx-protocol-rusd/types.ts +16 -0
  215. package/src/dex/fx-protocol-rusd/utils.ts +46 -0
  216. package/src/dex/index.ts +4 -0
  217. package/src/dex/wsteth/wsteth-integration.test.ts +0 -1
  218. package/tests/constants-e2e.ts +10 -0
  219. package/build/abi/inception/inception-ineth.json +0 -609
  220. package/build/abi/inception/inception-vault.json +0 -991
  221. package/build/abi/infusion/InfusionFactory.json +0 -147
  222. package/build/abi/infusion/InfusionPair.json +0 -658
  223. package/build/abi/infusion/InfusionRouter.json +0 -442
  224. package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
  225. package/build/dex/idle-dao/idle-dao-pool.js +0 -176
  226. package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
  227. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
  228. package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
  229. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
  230. package/build/dex/idle-dao/scripts.d.ts +0 -9
  231. package/build/dex/idle-dao/scripts.js +0 -552
  232. package/build/dex/idle-dao/scripts.js.map +0 -1
  233. package/build/dex/inception/config.d.ts +0 -5
  234. package/build/dex/inception/config.js +0 -100
  235. package/build/dex/inception/config.js.map +0 -1
  236. package/build/dex/inception/inception-native.d.ts +0 -43
  237. package/build/dex/inception/inception-native.js +0 -131
  238. package/build/dex/inception/inception-native.js.map +0 -1
  239. package/build/dex/inception/inception-pool.d.ts +0 -18
  240. package/build/dex/inception/inception-pool.js +0 -32
  241. package/build/dex/inception/inception-pool.js.map +0 -1
  242. package/build/dex/inception/inception.js +0 -128
  243. package/build/dex/inception/inception.js.map +0 -1
  244. package/build/dex/inception/types.d.ts +0 -11
  245. package/build/dex/inception/types.js +0 -3
  246. package/build/dex/inception/types.js.map +0 -1
  247. package/build/dex/inception/utils.d.ts +0 -4
  248. package/build/dex/inception/utils.js +0 -22
  249. package/build/dex/inception/utils.js.map +0 -1
  250. package/build/dex/infusion/config.js +0 -25
  251. package/build/dex/infusion/config.js.map +0 -1
  252. package/build/dex/infusion/infusion-stable-pool.d.ts +0 -4
  253. package/build/dex/infusion/infusion-stable-pool.js +0 -74
  254. package/build/dex/infusion/infusion-stable-pool.js.map +0 -1
  255. package/build/dex/infusion/infusion.d.ts +0 -54
  256. package/build/dex/infusion/infusion.js +0 -532
  257. package/build/dex/infusion/infusion.js.map +0 -1
  258. package/build/dex/infusion/types.d.ts +0 -47
  259. package/build/dex/infusion/types.js +0 -3
  260. package/build/dex/infusion/types.js.map +0 -1
  261. package/build/dex/infusion/utils/isStablePair.d.ts +0 -2
  262. package/build/dex/infusion/utils/isStablePair.js +0 -18
  263. package/build/dex/infusion/utils/isStablePair.js.map +0 -1
@@ -1,43 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- import { AsyncOrSync } from 'ts-essentials';
3
- import { NumberAsString, SwapSide } from '@paraswap/core';
4
- import { AdapterExchangeParam, Address, DexExchangeParam, ExchangePrices, Logger, PoolLiquidity, PoolPrices, Token } from '../../types';
5
- import { Network } from '../../constants';
6
- import { IDex } from '../../dex/idex';
7
- import { IDexHelper } from '../../dex-helper/idex-helper';
8
- import { InceptionData } from './types';
9
- import { SimpleExchange } from '../simple-exchange';
10
- import { InceptionPool } from './inception-pool';
11
- export declare const depositETHFunction = "stake()";
12
- export declare class InceptionNative extends SimpleExchange implements IDex<InceptionData> {
13
- readonly network: Network;
14
- readonly dexKey: string;
15
- readonly dexHelper: IDexHelper;
16
- protected config: import("./types").DexParams;
17
- protected adapters: import("../../types").AdapterMappings;
18
- protected inceptionPool: InceptionPool;
19
- protected vaultInterface: Interface;
20
- protected tokenInterface: Interface;
21
- readonly hasConstantPriceLargeAmounts = false;
22
- readonly needWrapNative = false;
23
- readonly isFeeOnTransferSupported = false;
24
- static dexKeysWithNetwork: {
25
- key: string;
26
- networks: Network[];
27
- }[];
28
- logger: Logger;
29
- constructor(network: Network, dexKey: string, dexHelper: IDexHelper, config?: import("./types").DexParams, adapters?: import("../../types").AdapterMappings);
30
- initializePricing(blockNumber: number): Promise<void>;
31
- getAdapters(side: SwapSide): {
32
- name: string;
33
- index: number;
34
- }[] | null;
35
- getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
36
- getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<InceptionData>>;
37
- getCalldataGasCost(poolPrices: PoolPrices<InceptionData>): number | number[];
38
- getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: InceptionData, side: SwapSide): AdapterExchangeParam;
39
- getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: InceptionData, side: SwapSide): DexExchangeParam;
40
- updatePoolState(): Promise<void>;
41
- getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
42
- releaseResources(): AsyncOrSync<void>;
43
- }
@@ -1,131 +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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.InceptionNative = exports.depositETHFunction = void 0;
30
- const abi_1 = require("@ethersproject/abi");
31
- const inception_ineth_json_1 = __importDefault(require("../../abi/inception/inception-ineth.json"));
32
- const inception_ineth_pool_json_1 = __importDefault(require("../../abi/inception/inception-ineth-pool.json"));
33
- const constants_1 = require("../../constants");
34
- const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
35
- const utils_1 = require("../../utils");
36
- const simple_exchange_1 = require("../simple-exchange");
37
- const config_1 = require("./config");
38
- const inception_pool_1 = require("./inception-pool");
39
- const ethers_1 = require("ethers");
40
- const bigint_constants_1 = require("../../bigint-constants");
41
- exports.depositETHFunction = 'stake()';
42
- class InceptionNative extends simple_exchange_1.SimpleExchange {
43
- constructor(network, dexKey, dexHelper, config = config_1.InceptionNativeConfig[dexKey][network], adapters = config_1.Adapters[network] || {}) {
44
- super(dexHelper, dexKey);
45
- this.network = network;
46
- this.dexKey = dexKey;
47
- this.dexHelper = dexHelper;
48
- this.config = config;
49
- this.adapters = adapters;
50
- this.hasConstantPriceLargeAmounts = false;
51
- this.needWrapNative = false;
52
- this.isFeeOnTransferSupported = false;
53
- this.logger = dexHelper.getLogger(dexKey);
54
- this.vaultInterface = new abi_1.Interface(inception_ineth_pool_json_1.default);
55
- this.tokenInterface = new abi_1.Interface(inception_ineth_json_1.default);
56
- this.inceptionPool = new inception_pool_1.InceptionPool(this.dexKey, network, dexHelper, this.logger, this.config.token, this.tokenInterface);
57
- }
58
- async initializePricing(blockNumber) {
59
- const data = await this.dexHelper.multiContract.methods
60
- .aggregate([
61
- {
62
- target: this.config.token,
63
- callData: this.tokenInterface.encodeFunctionData('ratio', []),
64
- },
65
- ])
66
- .call({}, blockNumber);
67
- const decodedData = data.returnData.map(d => ethers_1.ethers.utils.defaultAbiCoder.decode(['uint256'], d));
68
- const [ratio] = decodedData.map(d => BigInt(d[0].toString()));
69
- await Promise.all([
70
- this.inceptionPool.initialize(blockNumber, {
71
- state: { ratio },
72
- }),
73
- ]);
74
- }
75
- getAdapters(side) {
76
- return this.adapters[side] ? this.adapters[side] : null;
77
- }
78
- async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
79
- return [`ETH_${destToken.address}`.toLowerCase()];
80
- }
81
- async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
82
- const pool = this.inceptionPool;
83
- if (!pool.getState(blockNumber))
84
- return null;
85
- const unitIn = bigint_constants_1.BI_POWS[18];
86
- const unitOut = pool.getPrice(blockNumber, unitIn);
87
- const amountsOut = amounts.map(amountIn => pool.getPrice(blockNumber, amountIn));
88
- return [
89
- {
90
- prices: amountsOut,
91
- unit: unitOut,
92
- data: {
93
- ratio: unitOut,
94
- },
95
- exchange: this.dexKey,
96
- poolIdentifier: `ETH_${destToken.address}`.toLowerCase(),
97
- gasCost: 120000,
98
- poolAddresses: [this.config.vault],
99
- },
100
- ];
101
- }
102
- getCalldataGasCost(poolPrices) {
103
- return CALLDATA_GAS_COST.DEX_OVERHEAD + CALLDATA_GAS_COST.LENGTH_SMALL;
104
- }
105
- getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
106
- return {
107
- targetExchange: constants_1.NULL_ADDRESS,
108
- payload: '0x',
109
- networkFee: '0',
110
- };
111
- }
112
- getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
113
- const swapData = this.vaultInterface.encodeFunctionData(exports.depositETHFunction, []);
114
- return {
115
- needWrapNative: this.needWrapNative,
116
- dexFuncHasRecipient: false,
117
- exchangeData: swapData,
118
- targetExchange: this.config.vault,
119
- swappedAmountNotPresentInExchangeData: true,
120
- returnAmountPos: undefined,
121
- };
122
- }
123
- async updatePoolState() { }
124
- async getTopPoolsForToken(tokenAddress, limit) {
125
- return [];
126
- }
127
- releaseResources() { }
128
- }
129
- exports.InceptionNative = InceptionNative;
130
- InceptionNative.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.InceptionNativeConfig);
131
- //# sourceMappingURL=inception-native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inception-native.js","sourceRoot":"","sources":["../../../src/dex/inception/inception-native.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA6D;AAa7D,oGAAiE;AACjE,8GAA4E;AAC5E,+CAAwD;AACxD,2EAA6D;AAC7D,uCAAoD;AAIpD,wDAAoD;AACpD,qCAA2D;AAC3D,qDAAiD;AACjD,mCAAgC;AAChC,6DAAiD;AAEpC,QAAA,kBAAkB,GAAG,SAAS,CAAC;AAE5C,MAAa,eACX,SAAQ,gCAAc;IAetB,YACW,OAAgB,EAChB,MAAc,EACd,SAAqB,EACpB,SAAS,8BAAqB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAC/C,WAAW,iBAAQ,CAAC,OAAO,CAAC,IAAI,EAAE;QAE5C,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;Q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
3
- import { Log, Logger } from '../../types';
4
- import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
5
- import { IDexHelper } from '../../dex-helper/idex-helper';
6
- import { PoolState } from './types';
7
- export declare class InceptionPool extends StatefulEventSubscriber<PoolState> {
8
- readonly parentName: string;
9
- protected network: number;
10
- protected dexHelper: IDexHelper;
11
- protected vault: string;
12
- protected inceptionIface: Interface;
13
- logDecoder: (log: Log) => any;
14
- constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, vault: string, inceptionIface: Interface);
15
- protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>): DeepReadonly<PoolState> | null;
16
- generateState(blockNumber: number): Promise<DeepReadonly<PoolState>>;
17
- getPrice(blockNumber: number, ethAmount: bigint): bigint;
18
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InceptionPool = void 0;
4
- const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
5
- const utils_1 = require("./utils");
6
- const bigint_constants_1 = require("../../bigint-constants");
7
- class InceptionPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
8
- constructor(parentName, network, dexHelper, logger, vault, inceptionIface) {
9
- super(parentName, 'inception_pool', dexHelper, logger);
10
- this.parentName = parentName;
11
- this.network = network;
12
- this.dexHelper = dexHelper;
13
- this.vault = vault;
14
- this.inceptionIface = inceptionIface;
15
- this.logDecoder = (log) => this.inceptionIface.parseLog(log);
16
- }
17
- processLog(state, log) {
18
- return state;
19
- }
20
- async generateState(blockNumber) {
21
- const state = await (0, utils_1.getOnChainRatio)(this.dexHelper.multiContract, this.vault, this.inceptionIface, blockNumber);
22
- return state;
23
- }
24
- getPrice(blockNumber, ethAmount) {
25
- const state = this.getState(blockNumber);
26
- if (!state)
27
- throw new Error('Cannot compute price');
28
- return (ethAmount * state.ratio) / bigint_constants_1.BI_POWS[18];
29
- }
30
- }
31
- exports.InceptionPool = InceptionPool;
32
- //# sourceMappingURL=inception-pool.js.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,128 +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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.Inception = exports.depositETHFunction = void 0;
30
- const abi_1 = require("@ethersproject/abi");
31
- const inception_vault_json_1 = __importDefault(require("../../abi/inception/inception-vault.json"));
32
- const constants_1 = require("../../constants");
33
- const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
34
- const utils_1 = require("../../utils");
35
- const simple_exchange_1 = require("../simple-exchange");
36
- const config_1 = require("./config");
37
- const inception_pool_1 = require("./inception-pool");
38
- const ethers_1 = require("ethers");
39
- const bigint_constants_1 = require("../../bigint-constants");
40
- exports.depositETHFunction = 'deposit';
41
- class Inception extends simple_exchange_1.SimpleExchange {
42
- constructor(network, dexKey, dexHelper, config = config_1.InceptionConfig[dexKey][network], adapters = config_1.Adapters[network] || {}) {
43
- super(dexHelper, dexKey);
44
- this.network = network;
45
- this.dexKey = dexKey;
46
- this.dexHelper = dexHelper;
47
- this.config = config;
48
- this.adapters = adapters;
49
- this.hasConstantPriceLargeAmounts = false;
50
- this.needWrapNative = false;
51
- this.isFeeOnTransferSupported = false;
52
- this.logger = dexHelper.getLogger(dexKey);
53
- this.vaultInterface = new abi_1.Interface(inception_vault_json_1.default);
54
- this.inceptionPool = new inception_pool_1.InceptionPool(this.dexKey, network, dexHelper, this.logger, this.config.vault, this.vaultInterface);
55
- }
56
- async initializePricing(blockNumber) {
57
- const data = await this.dexHelper.multiContract.methods
58
- .aggregate([
59
- {
60
- target: this.config.vault,
61
- callData: this.vaultInterface.encodeFunctionData('ratio', []),
62
- },
63
- ])
64
- .call({}, blockNumber);
65
- const decodedData = data.returnData.map(d => ethers_1.ethers.utils.defaultAbiCoder.decode(['uint256'], d));
66
- const [ratio] = decodedData.map(d => BigInt(d[0].toString()));
67
- await Promise.all([
68
- this.inceptionPool.initialize(blockNumber, {
69
- state: { ratio },
70
- }),
71
- ]);
72
- }
73
- getAdapters(side) {
74
- return this.adapters[side] ? this.adapters[side] : null;
75
- }
76
- async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
77
- return [`${srcToken.address}_${destToken.address}`.toLowerCase()];
78
- }
79
- async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
80
- const pool = this.inceptionPool;
81
- if (!pool.getState(blockNumber))
82
- return null;
83
- const unitIn = bigint_constants_1.BI_POWS[18];
84
- const unitOut = pool.getPrice(blockNumber, unitIn);
85
- const amountsOut = amounts.map(amountIn => pool.getPrice(blockNumber, amountIn));
86
- return [
87
- {
88
- prices: amountsOut,
89
- unit: unitOut,
90
- data: {
91
- ratio: unitOut,
92
- },
93
- exchange: this.dexKey,
94
- poolIdentifier: `${srcToken.address}_${destToken.address}`.toLowerCase(),
95
- gasCost: 120000,
96
- poolAddresses: [this.config.vault],
97
- },
98
- ];
99
- }
100
- getCalldataGasCost(poolPrices) {
101
- return CALLDATA_GAS_COST.DEX_OVERHEAD + CALLDATA_GAS_COST.LENGTH_SMALL;
102
- }
103
- getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
104
- return {
105
- targetExchange: constants_1.NULL_ADDRESS,
106
- payload: '0x',
107
- networkFee: '0',
108
- };
109
- }
110
- getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
111
- const swapData = this.vaultInterface.encodeFunctionData(exports.depositETHFunction, [srcAmount, recipient]);
112
- return {
113
- needWrapNative: this.needWrapNative,
114
- dexFuncHasRecipient: true,
115
- exchangeData: swapData,
116
- targetExchange: this.config.vault,
117
- returnAmountPos: undefined,
118
- };
119
- }
120
- async updatePoolState() { }
121
- async getTopPoolsForToken(tokenAddress, limit) {
122
- return [];
123
- }
124
- releaseResources() { }
125
- }
126
- exports.Inception = Inception;
127
- Inception.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.InceptionConfig);
128
- //# sourceMappingURL=inception.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inception.js","sourceRoot":"","sources":["../../../src/dex/inception/inception.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA6D;AAa7D,oGAAqE;AACrE,+CAAwD;AACxD,2EAA6D;AAC7D,uCAAoD;AAIpD,wDAAoD;AACpD,qCAAqD;AACrD,qDAAiD;AACjD,mCAAgC;AAChC,6DAAiD;AAEpC,QAAA,kBAAkB,GAAG,SAAS,CAAC;AAE5C,MAAa,SAAU,SAAQ,gCAAc;IAY3C,YACW,OAAgB,EAChB,MAAc,EACd,SAAqB,EACpB,SAAS,wBAAe,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EACzC,WAAW,iBAAQ,CAAC,OAAO,CAAC,IAAI,EAAE;QAE5C,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QANhB,YAAO,GAAP,OAAO,CAAS;QAChB,WAAM,GAAN,MAAM,CAAQ;QACd,cAAS,GAAT,SAAS,CAAY;QACp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gBAChB,aAAa,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;aACnC;SACF,CAAC;IACJ,CAAC;IAED,kBAAkB,CAAC,UAAqC;QACtD,OAAO,iBAAiB,CAAC,YAAY,GAAG,iBAAiB,CAAC,YAAY,CAAC;IACzE,CAAC;IAED,eAAe,CACb,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAmB,EACnB,IAAc;QAEd,OAAO;YACL,cAAc,EAAE,wBAAY;YAC5B,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,GAAG;SAChB,CAAC;IACJ,CAAC;IAED,WAAW,CACT,QAAiB,EACjB,SAAkB,EAClB,SAAyB,EACzB,UAA0B,EAC1B,SAAkB,EAClB,IAAmB,EACnB,IAAc;QAEd,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,kBAAkB,CACrD,0BAAkB,EAClB,CAAC,SAAS,EAAE,SAAS,CAAC,CACvB,CAAC;QAEF,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,mBAAmB,EAAE,IAAI;YACzB,YAAY,EAAE,QAAQ;YACtB,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;YACjC,eAAe,EAAE,SAAS;SAC3B,CAAC;IACJ,CAAC;IACD,KAAK,CAAC,eAAe,KAAmB,CAAC;IAEzC,KAAK,CAAC,mBAAmB,CACvB,YAAqB,EACrB,KAAa;QAEb,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,gBAAgB,KAAuB,CAAC;;AAxJ1C,8BAyJC;AAlJe,4BAAkB,GAC9B,IAAA,6BAAqB,EAAC,wBAAe,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- export declare type PoolState = {
2
- ratio: bigint;
3
- };
4
- export declare type InceptionData = {
5
- ratio: bigint;
6
- };
7
- export declare type DexParams = {
8
- vault: string;
9
- token?: string;
10
- baseTokenSlug: string;
11
- };
@@ -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/inception/types.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- import { Contract } from 'web3-eth-contract';
2
- import { PoolState } from './types';
3
- import { Interface } from '@ethersproject/abi';
4
- export declare function getOnChainRatio(multiContract: Contract, vaultAddress: string, poolInterface: Interface, blockNumber: number | 'latest'): Promise<PoolState>;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOnChainRatio = void 0;
4
- const abi_1 = require("@ethersproject/abi");
5
- const coder = new abi_1.AbiCoder();
6
- async function getOnChainRatio(multiContract, vaultAddress, poolInterface, blockNumber) {
7
- const data = await multiContract.methods
8
- .aggregate([
9
- {
10
- target: vaultAddress,
11
- callData: poolInterface.encodeFunctionData('ratio', []),
12
- },
13
- ])
14
- .call({}, blockNumber);
15
- const decodedData = coder.decode(['uint256'], data.returnData[0]);
16
- const ratio = BigInt(decodedData[0].toString());
17
- return {
18
- ratio,
19
- };
20
- }
21
- exports.getOnChainRatio = getOnChainRatio;
22
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/dex/inception/utils.ts"],"names":[],"mappings":";;;AAEA,4CAAyD;AAEzD,MAAM,KAAK,GAAG,IAAI,cAAQ,EAAE,CAAC;AAEtB,KAAK,UAAU,eAAe,CACnC,aAAuB,EACvB,YAAoB,EACpB,aAAwB,EACxB,WAA8B;IAE9B,MAAM,IAAI,GAA0B,MAAM,aAAa,CAAC,OAAO;SAC5D,SAAS,CAAC;QACT;YACE,MAAM,EAAE,YAAY;YACpB,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,OAAO,EAAE,EAAE,CAAC;SACxD;KACF,CAAC;SACD,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;IAEzB,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAElE,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEhD,OAAO;QACL,KAAK;KACN,CAAC;AACJ,CAAC;AAtBD,0CAsBC"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Adapters = exports.InfusionConfig = void 0;
4
- const constants_1 = require("../../constants");
5
- exports.InfusionConfig = {
6
- Infusion: {
7
- [constants_1.Network.BASE]: {
8
- subgraphURL: 'https://api.goldsky.com/api/public/project_clvn0ei0x2qro0130fpihh83o/subgraphs/infusion-subgraph/1.0.0/gn',
9
- factoryAddress: '0x2D9A3a2bd6400eE28d770c7254cA840c82faf23f',
10
- router: '0x1E891C9F96DcA29Da8B97bE3403D16135EBe8028',
11
- initCode: '0xc1ac28b1c4ebe53c0cff67bab5878c4eb68759bb1e9f73977cd266b247d149f0',
12
- // updatable fees on the factory without event
13
- stableFee: 2,
14
- volatileFee: 2,
15
- poolGasCost: 180 * 1000,
16
- feeCode: 2,
17
- },
18
- },
19
- };
20
- exports.Adapters = {
21
- [constants_1.Network.BASE]: {
22
- [constants_1.SwapSide.SELL]: [{ name: 'BaseAdapter01', index: 6 }], // velodrome
23
- },
24
- };
25
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/infusion/config.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAEvC,QAAA,cAAc,GAA4B;IACrD,QAAQ,EAAE;QACR,CAAC,mBAAO,CAAC,IAAI,CAAC,EAAE;YACd,WAAW,EACT,2GAA2G;YAC7G,cAAc,EAAE,4CAA4C;YAC5D,MAAM,EAAE,4CAA4C;YACpD,QAAQ,EACN,oEAAoE;YACtE,8CAA8C;YAC9C,SAAS,EAAE,CAAC;YACZ,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,GAAG,GAAG,IAAI;YACvB,OAAO,EAAE,CAAC;SACX;KACF;CACF,CAAC;AAEW,QAAA,QAAQ,GAAoC;IACvD,CAAC,mBAAO,CAAC,IAAI,CAAC,EAAE;QACd,CAAC,oBAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,YAAY;KACrE;CACF,CAAC"}
@@ -1,4 +0,0 @@
1
- import { InfusionPoolOrderedParams } from './types';
2
- export declare class InfusionStablePool {
3
- static getSellPrice(priceParams: InfusionPoolOrderedParams, srcAmount: bigint, feeFactor: number): Promise<bigint>;
4
- }
@@ -1,74 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InfusionStablePool = void 0;
4
- const bigint_constants_1 = require("../../bigint-constants");
5
- const uniswap_v2_1 = require("../uniswap-v2/uniswap-v2");
6
- const e18 = bigint_constants_1.BI_POWS[18];
7
- function _k(x, y, decimals0, decimals1) {
8
- const _x = (x * e18) / decimals0;
9
- const _y = (y * e18) / decimals1;
10
- const _a = (_x * _y) / e18;
11
- const _b = (_x * _x) / e18 + (_y * _y) / e18;
12
- // x3y+y3x >= k
13
- return (_a * _b) / e18;
14
- }
15
- function _f(x0, y) {
16
- return ((x0 * ((((y * y) / e18) * y) / e18)) / e18 +
17
- (((((x0 * x0) / e18) * x0) / e18) * y) / e18);
18
- }
19
- function _d(x0, y) {
20
- return (3n * x0 * ((y * y) / e18)) / e18 + (((x0 * x0) / e18) * x0) / e18;
21
- }
22
- function _getY(x0, xy, y) {
23
- for (let i = 0; i < 255; i++) {
24
- const yPrev = y;
25
- const k = _f(x0, y);
26
- if (k < xy) {
27
- const dy = ((xy - k) * e18) / _d(x0, y);
28
- y = y + dy;
29
- }
30
- else {
31
- const dy = ((k - xy) * e18) / _d(x0, y);
32
- y = y - dy;
33
- }
34
- if (_closeTo(y, yPrev, 1n)) {
35
- break;
36
- }
37
- }
38
- return y;
39
- }
40
- function _closeTo(a, b, target) {
41
- if (a > b) {
42
- if (a - b <= target) {
43
- return true;
44
- }
45
- }
46
- else {
47
- if (b - a <= target) {
48
- return true;
49
- }
50
- }
51
- return false;
52
- }
53
- class InfusionStablePool {
54
- static async getSellPrice(priceParams, srcAmount, feeFactor) {
55
- const { reservesIn, reservesOut, decimalsIn, decimalsOut, fee } = priceParams;
56
- // FIXME: some dexes use uint112 others use uint256
57
- if (BigInt(reservesIn) + srcAmount > uniswap_v2_1.RESERVE_LIMIT) {
58
- return 0n;
59
- }
60
- const amountIn = srcAmount - (srcAmount * BigInt(fee)) / BigInt(feeFactor);
61
- const reservesInN = BigInt(reservesIn);
62
- const reservesOutN = BigInt(reservesOut);
63
- const decimalsInN = 10n ** BigInt(decimalsIn);
64
- const decimalsOutN = 10n ** BigInt(decimalsOut);
65
- const xy = _k(reservesInN, reservesOutN, decimalsInN, decimalsOutN);
66
- const reserveA = (reservesInN * e18) / decimalsInN;
67
- const reserveB = (reservesOutN * e18) / decimalsOutN;
68
- const amountInNorm = (amountIn * e18) / decimalsInN;
69
- const y = reserveB - _getY(amountInNorm + reserveA, xy, reserveB);
70
- return (y * decimalsOutN) / e18;
71
- }
72
- }
73
- exports.InfusionStablePool = InfusionStablePool;
74
- //# sourceMappingURL=infusion-stable-pool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"infusion-stable-pool.js","sourceRoot":"","sources":["../../../src/dex/infusion/infusion-stable-pool.ts"],"names":[],"mappings":";;;AAAA,6DAAiD;AACjD,yDAAyD;AAGzD,MAAM,GAAG,GAAG,0BAAO,CAAC,EAAE,CAAC,CAAC;AAExB,SAAS,EAAE,CACT,CAAS,EACT,CAAS,EACT,SAAiB,EACjB,SAAiB;IAEjB,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,GAAG,C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,SAAS,CAAC,CAAC;QAE3E,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QACvC,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;QACzC,MAAM,WAAW,GAAG,GAAG,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9C,MAAM,YAAY,GAAG,GAAG,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC;QAEhD,MAAM,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;QACpE,MAAM,QAAQ,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC,GAAG,WAAW,CAAC;QACnD,MAAM,QAAQ,GAAG,CAAC,YAAY,GAAG,GAAG,CAAC,GAAG,YAAY,CAAC;QACrD,MAAM,YAAY,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,GAAG,WAAW,CAAC;QACpD,MAAM,CAAC,GAAG,QAAQ,GAAG,KAAK,CAAC,YAAY,GAAG,QAAQ,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;QAClE,OAAO,CAAC,CAAC,GAAG,YAAY,CAAC,GAAG,GAAG,CAAC;IAClC,CAAC;CACF;AA5BD,gDA4BC"}
@@ -1,54 +0,0 @@
1
- import { UniswapV2 } from '../uniswap-v2/uniswap-v2';
2
- import { Network } from '../../constants';
3
- import { AdapterExchangeParam, Address, DexExchangeParam, ExchangePrices, PoolLiquidity, SimpleExchangeParam, Token, TransferFeeParams } from '../../types';
4
- import { IDexHelper } from '../../dex-helper';
5
- import { UniswapData, UniswapV2Data } from '../uniswap-v2/types';
6
- import { NumberAsString, SwapSide } from '@paraswap/core';
7
- import { PoolState, InfusionData, InfusionPair, InfusionPoolOrderedParams } from './types';
8
- export declare enum InfusionRouterFunctions {
9
- sellExactEth = "swapExactETHForTokens",
10
- sellExactToken = "swapExactTokensForETH",
11
- swapExactIn = "swapExactTokensForTokens"
12
- }
13
- export interface SmardexData extends Omit<UniswapV2Data, 'feeFactor'> {
14
- deadline: number;
15
- receiver: Address;
16
- }
17
- export declare class Infusion extends UniswapV2 {
18
- protected network: Network;
19
- protected dexHelper: IDexHelper;
20
- pairs: {
21
- [key: string]: InfusionPair;
22
- };
23
- stableFee?: number;
24
- volatileFee?: number;
25
- readonly isFeeOnTransferSupported: boolean;
26
- readonly SRC_TOKEN_DEX_TRANSFERS = 1;
27
- readonly DEST_TOKEN_DEX_TRANSFERS = 1;
28
- static dexKeysWithNetwork: {
29
- key: string;
30
- networks: Network[];
31
- }[];
32
- constructor(network: Network, dexKey: string, dexHelper: IDexHelper, isDynamicFees?: boolean, factoryAddress?: Address, subgraphURL?: string, initCode?: string, feeCode?: number, poolGasCost?: number, routerAddress?: Address);
33
- findInfusionPair(from: Token, to: Token, stable: boolean): Promise<InfusionPair | null>;
34
- batchCatchUpPairs(pairs: [Token, Token][], blockNumber: number): Promise<void>;
35
- getManyPoolReserves(pairs: InfusionPair[], blockNumber: number): Promise<PoolState[]>;
36
- getSellPrice(priceParams: InfusionPoolOrderedParams, srcAmount: bigint): Promise<bigint>;
37
- getBuyPrice(priceParams: InfusionPoolOrderedParams, srcAmount: bigint): Promise<bigint>;
38
- getPricesVolume(_from: Token, _to: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[], transferFees?: TransferFeeParams): Promise<ExchangePrices<UniswapV2Data> | null>;
39
- getTopPoolsForToken(tokenAddress: Address, count: number): Promise<PoolLiquidity[]>;
40
- getInfusionPairOrderedParams(from: Token, to: Token, blockNumber: number, stable: boolean, tokenDexTransferFee: number): Promise<InfusionPoolOrderedParams | null>;
41
- getPoolIdentifiers(_from: Token, _to: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
42
- poolPostfix(stable: boolean): "S" | "V";
43
- getSimpleParam(src: Address, dest: Address, srcAmount: NumberAsString, destAmount: NumberAsString, data: UniswapData, side: SwapSide): Promise<SimpleExchangeParam>;
44
- getAdapterParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, toAmount: NumberAsString, // required for buy case
45
- data: InfusionData, side: SwapSide): AdapterExchangeParam;
46
- getDexParam(src: Address, dest: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: InfusionData, side: SwapSide): DexExchangeParam;
47
- protected getFeesMultiCallData(pair: InfusionPair): {
48
- callEntry: {
49
- target: string;
50
- callData: string;
51
- };
52
- callDecoder: (values: any[]) => number;
53
- };
54
- }