@paraswap/dex-lib 2.42.19 → 2.42.20-hashflow-v3.2

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 (254) hide show
  1. package/build/abi/hashflow/HashflowRouter.abi.json +816 -246
  2. package/build/abi/kyberswap-elastic/IAntiSnipAttackPositionManager.json +1276 -0
  3. package/build/abi/kyberswap-elastic/IFactory.json +550 -0
  4. package/build/abi/kyberswap-elastic/IPool.json +1042 -0
  5. package/build/abi/kyberswap-elastic/IQuoterV2.json +226 -0
  6. package/build/abi/kyberswap-elastic/IRouter.json +239 -0
  7. package/build/abi/kyberswap-elastic/TicksFeesReader.json +142 -0
  8. package/build/abi/wombat/asset.json +769 -0
  9. package/build/abi/wombat/bmw.json +1247 -0
  10. package/build/abi/wombat/pool.json +1364 -0
  11. package/build/config.js +14 -14
  12. package/build/dex/algebra/algebra.d.ts +5 -6
  13. package/build/dex/algebra/algebra.js +36 -89
  14. package/build/dex/algebra/algebra.js.map +1 -1
  15. package/build/dex/algebra/config.js +1 -1
  16. package/build/dex/algebra/types.d.ts +0 -10
  17. package/build/dex/algebra/types.js +0 -7
  18. package/build/dex/algebra/types.js.map +1 -1
  19. package/build/dex/baseswap-v3/baseswap-v3-factory.d.ts +26 -0
  20. package/build/dex/baseswap-v3/baseswap-v3-factory.js +44 -0
  21. package/build/dex/baseswap-v3/baseswap-v3-factory.js.map +1 -0
  22. package/build/dex/baseswap-v3/baseswap-v3-pool.d.ts +46 -0
  23. package/build/dex/baseswap-v3/baseswap-v3-pool.js +312 -0
  24. package/build/dex/baseswap-v3/baseswap-v3-pool.js.map +1 -0
  25. package/build/dex/baseswap-v3/baseswap-v3.d.ts +71 -0
  26. package/build/dex/baseswap-v3/baseswap-v3.js +752 -0
  27. package/build/dex/baseswap-v3/baseswap-v3.js.map +1 -0
  28. package/build/dex/baseswap-v3/config.d.ts +9 -0
  29. package/build/dex/baseswap-v3/config.js +48 -0
  30. package/build/dex/baseswap-v3/config.js.map +1 -0
  31. package/build/dex/baseswap-v3/constants.d.ts +28 -0
  32. package/build/dex/baseswap-v3/constants.js +35 -0
  33. package/build/dex/baseswap-v3/constants.js.map +1 -0
  34. package/build/dex/baseswap-v3/contract-math/BitMath.d.ts +4 -0
  35. package/build/dex/baseswap-v3/contract-math/BitMath.js +93 -0
  36. package/build/dex/baseswap-v3/contract-math/BitMath.js.map +1 -0
  37. package/build/dex/baseswap-v3/contract-math/FixedPoint128.d.ts +3 -0
  38. package/build/dex/baseswap-v3/contract-math/FixedPoint128.js +8 -0
  39. package/build/dex/baseswap-v3/contract-math/FixedPoint128.js.map +1 -0
  40. package/build/dex/baseswap-v3/contract-math/FixedPoint96.d.ts +4 -0
  41. package/build/dex/baseswap-v3/contract-math/FixedPoint96.js +9 -0
  42. package/build/dex/baseswap-v3/contract-math/FixedPoint96.js.map +1 -0
  43. package/build/dex/baseswap-v3/contract-math/FullMath.d.ts +4 -0
  44. package/build/dex/baseswap-v3/contract-math/FullMath.js +19 -0
  45. package/build/dex/baseswap-v3/contract-math/FullMath.js.map +1 -0
  46. package/build/dex/baseswap-v3/contract-math/LiquidityMath.d.ts +3 -0
  47. package/build/dex/baseswap-v3/contract-math/LiquidityMath.js +22 -0
  48. package/build/dex/baseswap-v3/contract-math/LiquidityMath.js.map +1 -0
  49. package/build/dex/baseswap-v3/contract-math/Oracle.d.ts +10 -0
  50. package/build/dex/baseswap-v3/contract-math/Oracle.js +133 -0
  51. package/build/dex/baseswap-v3/contract-math/Oracle.js.map +1 -0
  52. package/build/dex/baseswap-v3/contract-math/SqrtPriceMath.d.ts +10 -0
  53. package/build/dex/baseswap-v3/contract-math/SqrtPriceMath.js +91 -0
  54. package/build/dex/baseswap-v3/contract-math/SqrtPriceMath.js.map +1 -0
  55. package/build/dex/baseswap-v3/contract-math/SwapMath.d.ts +8 -0
  56. package/build/dex/baseswap-v3/contract-math/SwapMath.js +70 -0
  57. package/build/dex/baseswap-v3/contract-math/SwapMath.js.map +1 -0
  58. package/build/dex/baseswap-v3/contract-math/Tick.d.ts +7 -0
  59. package/build/dex/baseswap-v3/contract-math/Tick.js +45 -0
  60. package/build/dex/baseswap-v3/contract-math/Tick.js.map +1 -0
  61. package/build/dex/baseswap-v3/contract-math/TickBitMap.d.ts +7 -0
  62. package/build/dex/baseswap-v3/contract-math/TickBitMap.js +84 -0
  63. package/build/dex/baseswap-v3/contract-math/TickBitMap.js.map +1 -0
  64. package/build/dex/baseswap-v3/contract-math/TickMath.d.ts +8 -0
  65. package/build/dex/baseswap-v3/contract-math/TickMath.js +162 -0
  66. package/build/dex/baseswap-v3/contract-math/TickMath.js.map +1 -0
  67. package/build/dex/baseswap-v3/contract-math/UnsafeMath.d.ts +3 -0
  68. package/build/dex/baseswap-v3/contract-math/UnsafeMath.js +10 -0
  69. package/build/dex/baseswap-v3/contract-math/UnsafeMath.js.map +1 -0
  70. package/build/dex/baseswap-v3/contract-math/uniswap-v3-math.d.ts +37 -0
  71. package/build/dex/baseswap-v3/contract-math/uniswap-v3-math.js +393 -0
  72. package/build/dex/baseswap-v3/contract-math/uniswap-v3-math.js.map +1 -0
  73. package/build/dex/baseswap-v3/contract-math/utils.d.ts +7 -0
  74. package/build/dex/baseswap-v3/contract-math/utils.js +42 -0
  75. package/build/dex/baseswap-v3/contract-math/utils.js.map +1 -0
  76. package/build/dex/baseswap-v3/types.d.ts +164 -0
  77. package/build/dex/baseswap-v3/types.js +9 -0
  78. package/build/dex/baseswap-v3/types.js.map +1 -0
  79. package/build/dex/baseswap-v3/utils.d.ts +6 -0
  80. package/build/dex/baseswap-v3/utils.js +65 -0
  81. package/build/dex/baseswap-v3/utils.js.map +1 -0
  82. package/build/dex/hashflow/config.d.ts +1 -1
  83. package/build/dex/hashflow/config.js +6 -6
  84. package/build/dex/hashflow/config.js.map +1 -1
  85. package/build/dex/hashflow/hashflow.d.ts +7 -7
  86. package/build/dex/hashflow/hashflow.js +47 -54
  87. package/build/dex/hashflow/hashflow.js.map +1 -1
  88. package/build/dex/hashflow/rate-fetcher.d.ts +1 -1
  89. package/build/dex/hashflow/rate-fetcher.js +2 -4
  90. package/build/dex/hashflow/rate-fetcher.js.map +1 -1
  91. package/build/dex/hashflow/types.d.ts +5 -6
  92. package/build/dex/hashflow/types.js.map +1 -1
  93. package/build/dex/hashflow/validators.js +11 -4
  94. package/build/dex/hashflow/validators.js.map +1 -1
  95. package/build/dex/hello/config.d.ts +4 -0
  96. package/build/dex/hello/config.js +15 -0
  97. package/build/dex/hello/config.js.map +1 -0
  98. package/build/dex/hello/hello-pool.d.ts +39 -0
  99. package/build/dex/hello/hello-pool.js +64 -0
  100. package/build/dex/hello/hello-pool.js.map +1 -0
  101. package/build/dex/hello/hello.d.ts +37 -0
  102. package/build/dex/hello/hello.js +126 -0
  103. package/build/dex/hello/hello.js.map +1 -0
  104. package/build/dex/hello/types.d.ts +6 -0
  105. package/build/dex/hello/types.js +3 -0
  106. package/build/dex/hello/types.js.map +1 -0
  107. package/build/dex/kyberswap-elastic/config.d.ts +4 -0
  108. package/build/dex/kyberswap-elastic/config.js +80 -0
  109. package/build/dex/kyberswap-elastic/config.js.map +1 -0
  110. package/build/dex/kyberswap-elastic/constants.d.ts +17 -0
  111. package/build/dex/kyberswap-elastic/constants.js +42 -0
  112. package/build/dex/kyberswap-elastic/constants.js.map +1 -0
  113. package/build/dex/kyberswap-elastic/contract-math/FixedPoint96.d.ts +4 -0
  114. package/build/dex/kyberswap-elastic/contract-math/FixedPoint96.js +9 -0
  115. package/build/dex/kyberswap-elastic/contract-math/FixedPoint96.js.map +1 -0
  116. package/build/dex/kyberswap-elastic/contract-math/FullMath.d.ts +5 -0
  117. package/build/dex/kyberswap-elastic/contract-math/FullMath.js +22 -0
  118. package/build/dex/kyberswap-elastic/contract-math/FullMath.js.map +1 -0
  119. package/build/dex/kyberswap-elastic/contract-math/LiqDeltaMath.d.ts +3 -0
  120. package/build/dex/kyberswap-elastic/contract-math/LiqDeltaMath.js +12 -0
  121. package/build/dex/kyberswap-elastic/contract-math/LiqDeltaMath.js.map +1 -0
  122. package/build/dex/kyberswap-elastic/contract-math/LiquidityMath.d.ts +3 -0
  123. package/build/dex/kyberswap-elastic/contract-math/LiquidityMath.js +22 -0
  124. package/build/dex/kyberswap-elastic/contract-math/LiquidityMath.js.map +1 -0
  125. package/build/dex/kyberswap-elastic/contract-math/QtyDeltaMath.d.ts +5 -0
  126. package/build/dex/kyberswap-elastic/contract-math/QtyDeltaMath.js +25 -0
  127. package/build/dex/kyberswap-elastic/contract-math/QtyDeltaMath.js.map +1 -0
  128. package/build/dex/kyberswap-elastic/contract-math/QuadMath.d.ts +4 -0
  129. package/build/dex/kyberswap-elastic/contract-math/QuadMath.js +27 -0
  130. package/build/dex/kyberswap-elastic/contract-math/QuadMath.js.map +1 -0
  131. package/build/dex/kyberswap-elastic/contract-math/ReinvestmentMath.d.ts +3 -0
  132. package/build/dex/kyberswap-elastic/contract-math/ReinvestmentMath.js +14 -0
  133. package/build/dex/kyberswap-elastic/contract-math/ReinvestmentMath.js.map +1 -0
  134. package/build/dex/kyberswap-elastic/contract-math/SafeCast.d.ts +8 -0
  135. package/build/dex/kyberswap-elastic/contract-math/SafeCast.js +30 -0
  136. package/build/dex/kyberswap-elastic/contract-math/SafeCast.js.map +1 -0
  137. package/build/dex/kyberswap-elastic/contract-math/SqrtPriceMath.d.ts +10 -0
  138. package/build/dex/kyberswap-elastic/contract-math/SqrtPriceMath.js +91 -0
  139. package/build/dex/kyberswap-elastic/contract-math/SqrtPriceMath.js.map +1 -0
  140. package/build/dex/kyberswap-elastic/contract-math/SwapMath.d.ts +13 -0
  141. package/build/dex/kyberswap-elastic/contract-math/SwapMath.js +188 -0
  142. package/build/dex/kyberswap-elastic/contract-math/SwapMath.js.map +1 -0
  143. package/build/dex/kyberswap-elastic/contract-math/TickLinkedList.d.ts +6 -0
  144. package/build/dex/kyberswap-elastic/contract-math/TickLinkedList.js +41 -0
  145. package/build/dex/kyberswap-elastic/contract-math/TickLinkedList.js.map +1 -0
  146. package/build/dex/kyberswap-elastic/contract-math/TickMath.d.ts +9 -0
  147. package/build/dex/kyberswap-elastic/contract-math/TickMath.js +165 -0
  148. package/build/dex/kyberswap-elastic/contract-math/TickMath.js.map +1 -0
  149. package/build/dex/kyberswap-elastic/contract-math/UnsafeMath.d.ts +3 -0
  150. package/build/dex/kyberswap-elastic/contract-math/UnsafeMath.js +10 -0
  151. package/build/dex/kyberswap-elastic/contract-math/UnsafeMath.js.map +1 -0
  152. package/build/dex/kyberswap-elastic/contract-math/kyberswap-elastic-math.d.ts +28 -0
  153. package/build/dex/kyberswap-elastic/contract-math/kyberswap-elastic-math.js +502 -0
  154. package/build/dex/kyberswap-elastic/contract-math/kyberswap-elastic-math.js.map +1 -0
  155. package/build/dex/kyberswap-elastic/contract-math/utils.d.ts +3 -0
  156. package/build/dex/kyberswap-elastic/contract-math/utils.js +16 -0
  157. package/build/dex/kyberswap-elastic/contract-math/utils.js.map +1 -0
  158. package/build/dex/kyberswap-elastic/errors.d.ts +2 -0
  159. package/build/dex/kyberswap-elastic/errors.js +6 -0
  160. package/build/dex/kyberswap-elastic/errors.js.map +1 -0
  161. package/build/dex/kyberswap-elastic/kyberswap-elastic-pool.d.ts +80 -0
  162. package/build/dex/kyberswap-elastic/kyberswap-elastic-pool.js +458 -0
  163. package/build/dex/kyberswap-elastic/kyberswap-elastic-pool.js.map +1 -0
  164. package/build/dex/kyberswap-elastic/kyberswap-elastic.d.ts +53 -0
  165. package/build/dex/kyberswap-elastic/kyberswap-elastic.js +610 -0
  166. package/build/dex/kyberswap-elastic/kyberswap-elastic.js.map +1 -0
  167. package/build/dex/kyberswap-elastic/types.d.ts +134 -0
  168. package/build/dex/kyberswap-elastic/types.js +9 -0
  169. package/build/dex/kyberswap-elastic/types.js.map +1 -0
  170. package/build/dex/kyberswap-elastic/utils/decoders.d.ts +9 -0
  171. package/build/dex/kyberswap-elastic/utils/decoders.js +78 -0
  172. package/build/dex/kyberswap-elastic/utils/decoders.js.map +1 -0
  173. package/build/dex/morphex/config.d.ts +11 -0
  174. package/build/dex/morphex/config.js +43 -0
  175. package/build/dex/morphex/config.js.map +1 -0
  176. package/build/dex/morphex/morphex.d.ts +25 -0
  177. package/build/dex/morphex/morphex.js +19 -0
  178. package/build/dex/morphex/morphex.js.map +1 -0
  179. package/build/dex/my-test-dex/config.d.ts +4 -0
  180. package/build/dex/my-test-dex/config.js +15 -0
  181. package/build/dex/my-test-dex/config.js.map +1 -0
  182. package/build/dex/my-test-dex/my-test-dex-pool.d.ts +39 -0
  183. package/build/dex/my-test-dex/my-test-dex-pool.js +64 -0
  184. package/build/dex/my-test-dex/my-test-dex-pool.js.map +1 -0
  185. package/build/dex/my-test-dex/my-test-dex.d.ts +37 -0
  186. package/build/dex/my-test-dex/my-test-dex.js +126 -0
  187. package/build/dex/my-test-dex/my-test-dex.js.map +1 -0
  188. package/build/dex/my-test-dex/types.d.ts +6 -0
  189. package/build/dex/my-test-dex/types.js +3 -0
  190. package/build/dex/my-test-dex/types.js.map +1 -0
  191. package/build/dex/solidly/forks-override/fvm.d.ts +20 -0
  192. package/build/dex/solidly/forks-override/fvm.js +42 -0
  193. package/build/dex/solidly/forks-override/fvm.js.map +1 -0
  194. package/build/dex/swaap-v2/constants.d.ts +2 -1
  195. package/build/dex/swaap-v2/constants.js +3 -2
  196. package/build/dex/swaap-v2/constants.js.map +1 -1
  197. package/build/dex/swaap-v2/stable-coins.d.ts +5 -0
  198. package/build/dex/swaap-v2/stable-coins.js +26 -0
  199. package/build/dex/swaap-v2/stable-coins.js.map +1 -0
  200. package/build/dex/swaap-v2/swaap-v2.js +4 -1
  201. package/build/dex/swaap-v2/swaap-v2.js.map +1 -1
  202. package/build/dex/swaap-v2/utils.d.ts +2 -0
  203. package/build/dex/swaap-v2/utils.js +11 -1
  204. package/build/dex/swaap-v2/utils.js.map +1 -1
  205. package/build/dex/wombat/config.d.ts +4 -0
  206. package/build/dex/wombat/config.js +99 -0
  207. package/build/dex/wombat/config.js.map +1 -0
  208. package/build/dex/wombat/types.d.ts +33 -0
  209. package/build/dex/wombat/types.js +3 -0
  210. package/build/dex/wombat/types.js.map +1 -0
  211. package/build/dex/wombat/utils.d.ts +9 -0
  212. package/build/dex/wombat/utils.js +66 -0
  213. package/build/dex/wombat/utils.js.map +1 -0
  214. package/build/dex/wombat/wombat-bmw.d.ts +40 -0
  215. package/build/dex/wombat/wombat-bmw.js +147 -0
  216. package/build/dex/wombat/wombat-bmw.js.map +1 -0
  217. package/build/dex/wombat/wombat-pool.d.ts +22 -0
  218. package/build/dex/wombat/wombat-pool.js +161 -0
  219. package/build/dex/wombat/wombat-pool.js.map +1 -0
  220. package/build/dex/wombat/wombat-quoter.d.ts +16 -0
  221. package/build/dex/wombat/wombat-quoter.js +176 -0
  222. package/build/dex/wombat/wombat-quoter.js.map +1 -0
  223. package/build/dex/wombat/wombat.d.ts +55 -0
  224. package/build/dex/wombat/wombat.js +290 -0
  225. package/build/dex/wombat/wombat.js.map +1 -0
  226. package/build/lib/fetcher/fetcher.d.ts +1 -1
  227. package/build/lib/fetcher/fetcher.js.map +1 -1
  228. package/package.json +2 -2
  229. package/src/abi/hashflow/HashflowRouter.abi.json +816 -246
  230. package/src/config.ts +14 -14
  231. package/src/dex/algebra/algebra-e2e.test.ts +13 -84
  232. package/src/dex/algebra/algebra.ts +49 -150
  233. package/src/dex/algebra/config.ts +1 -1
  234. package/src/dex/algebra/types.ts +0 -12
  235. package/src/dex/hashflow/config.ts +8 -8
  236. package/src/dex/hashflow/hashflow-e2e.test.ts +4 -4
  237. package/src/dex/hashflow/hashflow-integration.test.ts +9 -6
  238. package/src/dex/hashflow/hashflow.ts +70 -87
  239. package/src/dex/hashflow/rate-fetcher.ts +6 -8
  240. package/src/dex/hashflow/types.ts +5 -6
  241. package/src/dex/hashflow/validators.ts +11 -4
  242. package/src/dex/swaap-v2/constants.ts +3 -1
  243. package/src/dex/swaap-v2/stable-coins.ts +25 -0
  244. package/src/dex/swaap-v2/swaap-v2.ts +17 -3
  245. package/src/dex/swaap-v2/utils.ts +18 -1
  246. package/src/lib/fetcher/fetcher.ts +2 -2
  247. package/tests/constants-e2e.ts +2 -7
  248. package/tests/tenderly-simulation.ts +5 -2
  249. package/.vscode/launch.json +0 -39
  250. package/.vscode/settings.json +0 -2
  251. package/.vscode/tasks.json +0 -15
  252. package/build/abi/algebra/SwapRouter.json +0 -281
  253. package/find-diff-tests.sh +0 -75
  254. package/src/abi/algebra/SwapRouter.json +0 -281
@@ -1,15 +1,15 @@
1
1
  import dotenv from 'dotenv';
2
2
  dotenv.config();
3
3
 
4
- import { testE2E } from '../../../tests/utils-e2e';
4
+ import { StaticJsonRpcProvider } from '@ethersproject/providers';
5
5
  import {
6
- Tokens,
7
6
  Holders,
8
7
  NativeTokenSymbols,
8
+ Tokens,
9
9
  } from '../../../tests/constants-e2e';
10
- import { Network, ContractMethod, SwapSide } from '../../constants';
11
- import { StaticJsonRpcProvider } from '@ethersproject/providers';
10
+ import { testE2E } from '../../../tests/utils-e2e';
12
11
  import { generateConfig } from '../../config';
12
+ import { ContractMethod, Network, SwapSide } from '../../constants';
13
13
 
14
14
  // Give time for rate fetcher to fill the cache
15
15
  const sleepMs = 3000;
@@ -2,16 +2,17 @@
2
2
  import dotenv from 'dotenv';
3
3
  dotenv.config();
4
4
 
5
- import { DummyDexHelper } from '../../dex-helper/index';
6
- import { Network, SwapSide } from '../../constants';
7
- import { BI_POWS } from '../../bigint-constants';
8
- import { Hashflow } from './hashflow';
5
+ import { Tokens } from '../../../tests/constants-e2e';
9
6
  import {
7
+ checkConstantPoolPrices,
10
8
  checkPoolPrices,
11
9
  checkPoolsLiquidity,
12
- checkConstantPoolPrices,
10
+ sleep,
13
11
  } from '../../../tests/utils';
14
- import { Tokens } from '../../../tests/constants-e2e';
12
+ import { BI_POWS } from '../../bigint-constants';
13
+ import { Network, SwapSide } from '../../constants';
14
+ import { DummyDexHelper } from '../../dex-helper/index';
15
+ import { Hashflow } from './hashflow';
15
16
 
16
17
  async function testPricingOnNetwork(
17
18
  hashflow: Hashflow,
@@ -104,6 +105,8 @@ describe('Hashflow', function () {
104
105
  beforeAll(async () => {
105
106
  blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
106
107
  hashflow = new Hashflow(network, dexKey, dexHelper);
108
+ await hashflow.initializePricing(0);
109
+ await sleep(5000);
107
110
  });
108
111
 
109
112
  it('getPoolIdentifiers and getPricesVolume SELL', async function () {
@@ -1,62 +1,61 @@
1
+ import { ChainId, ZERO_ADDRESS } from '@hashflow/sdk';
2
+ import { Chain, ChainType, HashflowApi } from '@hashflow/taker-js';
1
3
  import {
2
- Token,
4
+ MarketMakersResponse,
5
+ PriceLevelsResponse,
6
+ RfqResponse,
7
+ } from '@hashflow/taker-js/dist/types/rest';
8
+ import BigNumber from 'bignumber.js';
9
+ import { Interface } from 'ethers/lib/utils';
10
+ import { assert } from 'ts-essentials';
11
+ import routerAbi from '../../abi/hashflow/HashflowRouter.abi.json';
12
+ import { BI_MAX_UINT256 } from '../../bigint-constants';
13
+ import { BN_0, BN_1, getBigNumberPow } from '../../bignumber-constants';
14
+ import * as CALLDATA_GAS_COST from '../../calldata-gas-cost';
15
+ import {
16
+ CACHE_PREFIX,
17
+ ETHER_ADDRESS,
18
+ Network,
19
+ SwapSide,
20
+ } from '../../constants';
21
+ import { IDexHelper } from '../../dex-helper/idex-helper';
22
+ import { IDex } from '../../dex/idex';
23
+ import {
24
+ AdapterExchangeParam,
3
25
  Address,
4
26
  ExchangePrices,
5
- PoolPrices,
6
- AdapterExchangeParam,
7
- SimpleExchangeParam,
8
- PoolLiquidity,
9
- Logger,
10
27
  ExchangeTxInfo,
28
+ Logger,
11
29
  OptimalSwapExchange,
30
+ PoolLiquidity,
31
+ PoolPrices,
12
32
  PreprocessTransactionOptions,
33
+ SimpleExchangeParam,
34
+ Token,
13
35
  } from '../../types';
14
- import {
15
- SwapSide,
16
- Network,
17
- ETHER_ADDRESS,
18
- CACHE_PREFIX,
19
- } from '../../constants';
20
- import * as CALLDATA_GAS_COST from '../../calldata-gas-cost';
21
36
  import { getDexKeysWithNetwork } from '../../utils';
22
- import { IDex } from '../../dex/idex';
23
- import { IDexHelper } from '../../dex-helper/idex-helper';
24
- import {
25
- HashflowData,
26
- PriceLevel,
27
- RfqError,
28
- RFQType,
29
- SlippageCheckError,
30
- } from './types';
37
+ import { TooStrictSlippageCheckError } from '../generic-rfq/types';
31
38
  import { SimpleExchange } from '../simple-exchange';
32
39
  import { Adapters, HashflowConfig } from './config';
33
- import { HashflowApi } from '@hashflow/taker-js';
34
- import { RateFetcher } from './rate-fetcher';
35
- import routerAbi from '../../abi/hashflow/HashflowRouter.abi.json';
36
- import BigNumber from 'bignumber.js';
37
- import { BN_0, BN_1, getBigNumberPow } from '../../bignumber-constants';
38
- import { Interface } from 'ethers/lib/utils';
39
- import { ChainId, ZERO_ADDRESS } from '@hashflow/sdk';
40
- import {
41
- MarketMakersResponse,
42
- PriceLevelsResponse,
43
- RfqResponse,
44
- } from '@hashflow/taker-js/dist/types/rest';
45
- import { assert } from 'ts-essentials';
46
40
  import {
47
- HASHFLOW_BLACKLIST_TTL_S,
48
- HASHFLOW_MM_RESTRICT_TTL_S,
49
41
  HASHFLOW_API_CLIENT_NAME,
50
- HASHFLOW_API_URL,
51
- HASHFLOW_API_PRICES_POLLING_INTERVAL_MS,
52
42
  HASHFLOW_API_MARKET_MAKERS_POLLING_INTERVAL_MS,
53
- HASHFLOW_PRICES_CACHES_TTL_S,
54
- HASHFLOW_MARKET_MAKERS_CACHES_TTL_S,
43
+ HASHFLOW_API_PRICES_POLLING_INTERVAL_MS,
44
+ HASHFLOW_API_URL,
45
+ HASHFLOW_BLACKLIST_TTL_S,
55
46
  HASHFLOW_GAS_COST,
47
+ HASHFLOW_MARKET_MAKERS_CACHES_TTL_S,
56
48
  HASHFLOW_MIN_SLIPPAGE_FACTOR_THRESHOLD_FOR_RESTRICTION,
49
+ HASHFLOW_MM_RESTRICT_TTL_S,
50
+ HASHFLOW_PRICES_CACHES_TTL_S,
57
51
  } from './constants';
58
- import { BI_MAX_UINT256 } from '../../bigint-constants';
59
- import { TooStrictSlippageCheckError } from '../generic-rfq/types';
52
+ import { RateFetcher } from './rate-fetcher';
53
+ import {
54
+ HashflowData,
55
+ PriceLevel,
56
+ RfqError,
57
+ SlippageCheckError,
58
+ } from './types';
60
59
 
61
60
  export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
62
61
  readonly isStatePollingDex = true;
@@ -121,19 +120,21 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
121
120
  markerMakersIntervalMs:
122
121
  HASHFLOW_API_MARKET_MAKERS_POLLING_INTERVAL_MS,
123
122
  marketMakersReqParams: {
124
- url: `${HASHFLOW_API_URL}/taker/v1/marketMakers`,
123
+ url: `${HASHFLOW_API_URL}/taker/v3/market-makers`,
125
124
  params: {
126
- networkId: this.network,
125
+ baseChainId: this.network,
127
126
  source: HASHFLOW_API_CLIENT_NAME,
127
+ baseChainType: 'evm',
128
128
  },
129
129
  headers: { Authorization: this.hashFlowAuthToken },
130
130
  },
131
131
  pricesReqParams: {
132
- url: `${HASHFLOW_API_URL}/taker/v2/price-levels`,
132
+ url: `${HASHFLOW_API_URL}/taker/v3/price-levels`,
133
133
  params: {
134
- networkId: this.network,
134
+ baseChainId: this.network,
135
135
  source: HASHFLOW_API_CLIENT_NAME,
136
136
  marketMakers: [],
137
+ baseChainType: 'evm',
137
138
  },
138
139
  headers: { Authorization: this.hashFlowAuthToken },
139
140
  },
@@ -321,8 +322,8 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
321
322
  priceLevels: PriceLevel[],
322
323
  ): { level: BigNumber; price: BigNumber }[] =>
323
324
  priceLevels.map(l => ({
324
- level: new BigNumber(l.level),
325
- price: new BigNumber(l.price),
325
+ level: new BigNumber(l.q),
326
+ price: new BigNumber(l.p),
326
327
  }));
327
328
 
328
329
  computeLevelsQuote(
@@ -488,7 +489,7 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
488
489
  new BigNumber(a.toString()).dividedBy(divider),
489
490
  );
490
491
  const firstLevelRaw = levels[0];
491
- const firstLevelAmountBN = new BigNumber(firstLevelRaw.level);
492
+ const firstLevelAmountBN = new BigNumber(firstLevelRaw.q);
492
493
 
493
494
  if (amountsRaw[amountsRaw.length - 1].lt(firstLevelAmountBN)) {
494
495
  return null;
@@ -496,7 +497,7 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
496
497
 
497
498
  if (firstLevelAmountBN.gt(0)) {
498
499
  // Add zero level for price computation
499
- levels.unshift({ level: '0', price: firstLevelRaw.price });
500
+ levels.unshift({ q: '0', p: firstLevelRaw.p });
500
501
  }
501
502
 
502
503
  const unitPrice = this.computePricesFromLevels(
@@ -565,14 +566,15 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
565
566
  `${this.dexKey}-${this.network}: MM was not provided in data`,
566
567
  );
567
568
  const chainId = this.network as ChainId;
568
-
569
+ let chainType: ChainType = 'evm';
570
+ const chain: Chain = { chainType, chainId };
569
571
  const normalizedSrcToken = this.normalizeToken(srcToken);
570
572
  const normalizedDestToken = this.normalizeToken(destToken);
571
573
 
572
574
  let rfq: RfqResponse;
573
575
  try {
574
576
  rfq = await this.api.requestQuote({
575
- chainId,
577
+ baseChain: chain,
576
578
  baseToken: normalizedSrcToken.address,
577
579
  quoteToken: normalizedDestToken.address,
578
580
  ...(side === SwapSide.SELL
@@ -594,7 +596,7 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
594
596
  )}: ${JSON.stringify(rfq)}`;
595
597
  this.logger.warn(message);
596
598
  throw new RfqError(message);
597
- } else if (!rfq.quoteData) {
599
+ } else if (!rfq.quotes[0].quoteData) {
598
600
  const message = `${this.dexKey}-${
599
601
  this.network
600
602
  }: Failed to fetch RFQ for ${this.getPairName(
@@ -603,7 +605,7 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
603
605
  )}. Missing quote data`;
604
606
  this.logger.warn(message);
605
607
  throw new RfqError(message);
606
- } else if (!rfq.signature) {
608
+ } else if (!rfq.quotes[0].signature) {
607
609
  const message = `${this.dexKey}-${
608
610
  this.network
609
611
  }: Failed to fetch RFQ for ${this.getPairName(
@@ -612,40 +614,22 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
612
614
  )}. Missing signature`;
613
615
  this.logger.warn(message);
614
616
  throw new RfqError(message);
615
- } else if (!rfq.gasEstimate) {
616
- const message = `${this.dexKey}-${
617
- this.network
618
- }: Failed to fetch RFQ for ${this.getPairName(
619
- normalizedSrcToken.address,
620
- normalizedDestToken.address,
621
- )}. No gas estimate.`;
622
- this.logger.warn(message);
623
- throw new RfqError(message);
624
- } else if (rfq.quoteData.rfqType !== RFQType.RFQT) {
625
- const message = `${this.dexKey}-${
626
- this.network
627
- }: Failed to fetch RFQ for ${this.getPairName(
628
- normalizedSrcToken.address,
629
- normalizedDestToken.address,
630
- )}. Invalid RFQ type.`;
631
- this.logger.warn(message);
632
- throw new RfqError(message);
633
617
  }
634
618
 
635
619
  assert(
636
- rfq.quoteData.baseToken === normalizedSrcToken.address,
637
- `QuoteData baseToken=${rfq.quoteData.baseToken} is different from srcToken=${normalizedSrcToken.address}`,
620
+ rfq.quotes[0].quoteData.baseToken === normalizedSrcToken.address,
621
+ `QuoteData baseToken=${rfq.quotes[0].quoteData.baseToken} is different from srcToken=${normalizedSrcToken.address}`,
638
622
  );
639
623
  assert(
640
- rfq.quoteData.quoteToken === normalizedDestToken.address,
641
- `QuoteData baseToken=${rfq.quoteData.quoteToken} is different from srcToken=${normalizedDestToken.address}`,
624
+ rfq.quotes[0].quoteData.quoteToken === normalizedDestToken.address,
625
+ `QuoteData baseToken=${rfq.quotes[0].quoteData.quoteToken} is different from srcToken=${normalizedDestToken.address}`,
642
626
  );
643
627
 
644
- const expiryAsBigInt = BigInt(rfq.quoteData.quoteExpiry);
628
+ const expiryAsBigInt = BigInt(rfq.quotes[0].quoteData.quoteExpiry);
645
629
  const minDeadline = expiryAsBigInt > 0 ? expiryAsBigInt : BI_MAX_UINT256;
646
630
 
647
- const baseTokenAmount = BigInt(rfq.quoteData.baseTokenAmount);
648
- const quoteTokenAmount = BigInt(rfq.quoteData.quoteTokenAmount);
631
+ const baseTokenAmount = BigInt(rfq.quotes[0].quoteData.baseTokenAmount);
632
+ const quoteTokenAmount = BigInt(rfq.quotes[0].quoteData.quoteTokenAmount);
649
633
 
650
634
  const srcAmount = BigInt(optimalSwapExchange.srcAmount);
651
635
  const destAmount = BigInt(optimalSwapExchange.destAmount);
@@ -721,9 +705,8 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
721
705
  ...optimalSwapExchange,
722
706
  data: {
723
707
  mm,
724
- quoteData: rfq.quoteData,
725
- signature: rfq.signature,
726
- gasEstimate: rfq.gasEstimate,
708
+ quoteData: rfq.quotes[0].quoteData,
709
+ signature: rfq.quotes[0].signature,
727
710
  },
728
711
  },
729
712
  { deadline: minDeadline },
@@ -818,7 +801,7 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
818
801
  {
819
802
  pool: quoteData.pool,
820
803
  quoteToken: quoteData.quoteToken,
821
- externalAccount: quoteData.eoa ?? ZERO_ADDRESS,
804
+ externalAccount: quoteData.externalAccount ?? ZERO_ADDRESS,
822
805
  baseTokenAmount: quoteData.baseTokenAmount,
823
806
  quoteTokenAmount: quoteData.quoteTokenAmount,
824
807
  quoteExpiry: quoteData.quoteExpiry,
@@ -879,10 +862,10 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
879
862
  );
880
863
 
881
864
  // Encode here the transaction arguments
882
- const swapData = this.routerInterface.encodeFunctionData('tradeSingleHop', [
865
+ const swapData = this.routerInterface.encodeFunctionData('tradeRFQT', [
883
866
  [
884
867
  quoteData.pool,
885
- quoteData.eoa ?? ZERO_ADDRESS,
868
+ quoteData.externalAccount ?? ZERO_ADDRESS,
886
869
  quoteData.trader,
887
870
  quoteData.effectiveTrader ?? quoteData.trader,
888
871
  quoteData.baseToken,
@@ -924,7 +907,7 @@ export class Hashflow extends SimpleExchange implements IDex<HashflowData> {
924
907
  levels: PriceLevel[],
925
908
  baseTokenPriceUsd: number,
926
909
  ): number => {
927
- const maxLevel = new BigNumber(levels[levels.length - 1]?.level ?? '0');
910
+ const maxLevel = new BigNumber(levels[levels.length - 1]?.q ?? '0');
928
911
  return maxLevel.multipliedBy(baseTokenPriceUsd).toNumber();
929
912
  };
930
913
 
@@ -1,14 +1,14 @@
1
+ import { Network } from '../../constants';
1
2
  import { IDexHelper } from '../../dex-helper';
2
3
  import { Fetcher, SkippingRequest } from '../../lib/fetcher/fetcher';
3
4
  import { validateAndCast } from '../../lib/validators';
4
5
  import { Logger } from '../../types';
5
6
  import {
7
+ HashflowMarketMakersResponse,
6
8
  HashflowRateFetcherConfig,
7
9
  HashflowRatesResponse,
8
- HashflowMarketMakersResponse,
9
10
  } from './types';
10
- import { pricesResponseValidator, marketMakersValidator } from './validators';
11
- import { Network } from '../../constants';
11
+ import { marketMakersValidator, pricesResponseValidator } from './validators';
12
12
 
13
13
  export class RateFetcher {
14
14
  private rateFetcher: Fetcher<HashflowRatesResponse>;
@@ -30,7 +30,6 @@ export class RateFetcher {
30
30
  this.pricesCacheTTL = config.rateConfig.pricesCacheTTLSecs;
31
31
  this.marketMakersCacheKey = config.rateConfig.marketMakersCacheKey;
32
32
  this.marketMakersCacheTTL = config.rateConfig.marketMakersCacheTTLSecs;
33
-
34
33
  this.marketMakersFetcher = new Fetcher<HashflowMarketMakersResponse>(
35
34
  dexHelper.httpRequest,
36
35
  {
@@ -69,10 +68,9 @@ export class RateFetcher {
69
68
  );
70
69
  }
71
70
 
72
- const prices = await dexHelper.httpRequest.request({
73
- ...options,
74
- params: { ...options.params, marketMakers: filteredMarketMakers },
75
- });
71
+ options.params.marketMakers = filteredMarketMakers;
72
+
73
+ const prices = await dexHelper.httpRequest.request(options);
76
74
 
77
75
  return prices;
78
76
  },
@@ -1,11 +1,10 @@
1
- import { QuoteData } from '@hashflow/taker-js/dist/types/common';
1
+ import { Chain, QuoteData } from '@hashflow/taker-js/dist/types/common';
2
2
  import { RequestHeaders } from '../../dex-helper';
3
3
 
4
4
  export type HashflowData = {
5
5
  mm: string;
6
6
  quoteData?: QuoteData;
7
7
  signature?: string;
8
- gasEstimate?: number;
9
8
  };
10
9
 
11
10
  export type DexParams = {
@@ -13,8 +12,8 @@ export type DexParams = {
13
12
  };
14
13
 
15
14
  export interface PriceLevel {
16
- level: string;
17
- price: string;
15
+ q: string;
16
+ p: string;
18
17
  }
19
18
 
20
19
  export class RfqError extends Error {}
@@ -29,7 +28,6 @@ export class SlippageCheckError extends Error {}
29
28
  export type HashflowRatesLevel = {
30
29
  pair: Record<string, string>;
31
30
  levels: Array<Record<string, string>>;
32
- includesFees: boolean;
33
31
  };
34
32
 
35
33
  export type HashflowMarketMakersResponse = {
@@ -38,7 +36,8 @@ export type HashflowMarketMakersResponse = {
38
36
 
39
37
  export type HashflowRatesResponse = {
40
38
  status: string;
41
- networkId: string;
39
+ baseChain: Chain;
40
+ quoteChain: Chain;
42
41
  levels: Record<string, Array<HashflowRatesLevel>>;
43
42
  };
44
43
 
@@ -12,17 +12,24 @@ export const levelValidator = joi.array().items(
12
12
  }),
13
13
  levels: joi.array().items(
14
14
  joi.object({
15
- level: joi.string().min(1).required(),
16
- price: joi.string().min(1).required(),
15
+ q: joi.string().min(1).required(),
16
+ p: joi.string().min(1).required(),
17
17
  }),
18
18
  ),
19
- includesFees: joi.boolean().required(),
20
19
  }),
21
20
  );
22
21
 
23
22
  export const pricesResponseValidator = joi.object({
24
23
  status: joi.string().required(),
25
- networkId: joi.number().required(),
24
+ // networkId: joi.number().required(),
25
+ baseChain: joi.object({
26
+ chainType: joi.string().required(),
27
+ chainId: joi.number().required(),
28
+ }),
29
+ quoteChain: joi.object({
30
+ chainType: joi.string().required(),
31
+ chainId: joi.number().required(),
32
+ }),
26
33
  levels: joi.object().pattern(joi.string().min(1), levelValidator),
27
34
  });
28
35
 
@@ -30,7 +30,9 @@ export const SWAAP_429_TTL_S = 60 * 60 * 1; // 1 hour
30
30
 
31
31
  export const SWAAP_POOL_RESTRICT_TTL_S = 60 * 30; // 30 minutes
32
32
 
33
- export const GAS_COST_ESTIMATION = 170_000;
33
+ export const STABLE_SWAP_GAS_COST_ESTIMATION = 130_000;
34
+
35
+ export const VOLATILE_SWAP_GAS_COST_ESTIMATION = 150_000;
34
36
 
35
37
  export const BATCH_SWAP_SELECTOR = '0x945bcec9';
36
38
 
@@ -0,0 +1,25 @@
1
+ import { Network } from '../../constants';
2
+
3
+ // addresses must be consistant with utils.normalizeTokenAddress
4
+ export const STABLE_COINS: {
5
+ [network: number]: { [symbol: string]: boolean };
6
+ } = {
7
+ [Network.MAINNET]: {
8
+ '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': true, // USDT
9
+ '0xdac17f958d2ee523a2206206994597c13d831ec7': true, // USDC
10
+ '0x6b175474e89094c44da98b954eedeac495271d0f': true, // DAI
11
+ '0x853d955acef822db058eb8505911ed77f175b99e': true, // FRAX
12
+ },
13
+ [Network.POLYGON]: {
14
+ '0x3c499c542cef5e3811e1192ce70d8cc03d5c3359': true, // USDC
15
+ '0x2791bca1f2de4661ed88a30c99a7a9449aa84174': true, // USDC.e
16
+ '0xc2132d05d31c914a87c6611c10748aeb04b58e8f': true, // USDT
17
+ '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063': true, // DAI
18
+ },
19
+ [Network.ARBITRUM]: {
20
+ '0xaf88d065e77c8cc2239327c5edb3a432268e5831': true, // USDC
21
+ '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8': true, // USDC.e
22
+ '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9': true, // USDT
23
+ '0xda10009cbd5d07dd0cecc66161fc93d7c9000da1': true, // DAI
24
+ },
25
+ };
@@ -45,7 +45,8 @@ import {
45
45
  SWAAP_RFQ_QUOTE_ENDPOINT,
46
46
  SWAAP_RFQ_API_PRICES_POLLING_INTERVAL_MS,
47
47
  SWAAP_RFQ_PRICES_CACHES_TTL_S,
48
- GAS_COST_ESTIMATION,
48
+ STABLE_SWAP_GAS_COST_ESTIMATION,
49
+ VOLATILE_SWAP_GAS_COST_ESTIMATION,
49
50
  BATCH_SWAP_SELECTOR,
50
51
  CALLER_SLOT,
51
52
  SWAAP_403_TTL_S,
@@ -62,7 +63,12 @@ import {
62
63
  SWAAP_BANNED_CODE,
63
64
  SWAAP_NOTIFY_ENDPOINT,
64
65
  } from './constants';
65
- import { getPoolIdentifier, normalizeTokenAddress, getPairName } from './utils';
66
+ import {
67
+ getPoolIdentifier,
68
+ normalizeTokenAddress,
69
+ getPairName,
70
+ isStablePair,
71
+ } from './utils';
66
72
  import { Method } from '../../dex-helper/irequest-wrapper';
67
73
  import {
68
74
  SlippageCheckError,
@@ -404,8 +410,16 @@ export class SwaapV2 extends SimpleExchange implements IDex<SwaapV2Data> {
404
410
  return null;
405
411
  }
406
412
 
413
+ const gasCost = isStablePair(
414
+ this.network,
415
+ normalizedSrcToken.address,
416
+ normalizedDestToken.address,
417
+ )
418
+ ? STABLE_SWAP_GAS_COST_ESTIMATION
419
+ : VOLATILE_SWAP_GAS_COST_ESTIMATION;
420
+
407
421
  return {
408
- gasCost: GAS_COST_ESTIMATION,
422
+ gasCost: gasCost,
409
423
  exchange: this.dexKey,
410
424
  data: {},
411
425
  prices,
@@ -1,5 +1,7 @@
1
- import { Address } from '../../types';
1
+ import { Address, Token } from '../../types';
2
2
  import { ETHER_ADDRESS, NULL_ADDRESS } from '../../constants';
3
+ import { Network } from '../../constants';
4
+ import { STABLE_COINS } from './stable-coins';
3
5
 
4
6
  export const getIdentifierPrefix = (
5
7
  dexKey: string,
@@ -27,3 +29,18 @@ export const normalizeTokenAddress = (address: string): string => {
27
29
  ? NULL_ADDRESS
28
30
  : address.toLowerCase();
29
31
  };
32
+
33
+ export const isStablePair = (
34
+ network: Network,
35
+ normalizedSrcTokenAddress: string,
36
+ normalizedDestTokenAddress: string,
37
+ ): boolean => {
38
+ const networkStableCoins = STABLE_COINS[network];
39
+ if (networkStableCoins === undefined) {
40
+ return false;
41
+ }
42
+ return (
43
+ networkStableCoins[normalizedSrcTokenAddress] === true &&
44
+ networkStableCoins[normalizedDestTokenAddress] === true
45
+ );
46
+ };
@@ -1,7 +1,7 @@
1
- import { IRequestWrapper } from '../../dex-helper';
1
+ import { isFunction } from 'lodash';
2
2
  import { Logger } from 'log4js';
3
+ import { IRequestWrapper } from '../../dex-helper';
3
4
  import { RequestConfig, Response } from '../../dex-helper/irequest-wrapper';
4
- import { isFunction } from 'lodash';
5
5
 
6
6
  const FETCH_TIMEOUT_MS = 10 * 1000;
7
7
  const FETCH_FAIL_MAX_ATTEMPT = 5;
@@ -853,10 +853,6 @@ export const Tokens: {
853
853
  address: '0x3d9907f9a368ad0a51be60f7da3b97cf940982d8',
854
854
  decimals: 18,
855
855
  },
856
- RDPX: {
857
- address: '0x32eb7902d4134bf98a28b963d26de779af92a212',
858
- decimals: 18,
859
- },
860
856
  },
861
857
  [Network.OPTIMISM]: {
862
858
  DAI: {
@@ -1149,13 +1145,12 @@ export const Holders: {
1149
1145
  AMPL: '0xfcaA5ea7F8eb0631BcA72C345025C0A5a6D93f0E',
1150
1146
  },
1151
1147
  [Network.ARBITRUM]: {
1152
- RDPX: '0x2fa6f21ecfe274f594f470c376f5bdd061e08a37',
1153
1148
  ARB: '0xb65edba80a3d81903ecd499c8eb9cf0e19096bd0',
1154
1149
  ETH: '0xF977814e90dA44bFA03b6295A0616a897441aceC',
1155
1150
  DAI: '0x07d7f291e731a41d3f0ea4f1ae5b6d920ffb3fe0',
1156
1151
  WETH: '0xc31e54c7a869b9fcbecc14363cf510d1c41fa443',
1157
1152
  USDCe: '0x62383739d68dd0f844103db8dfb05a7eded5bbe6',
1158
- USDC: '0x489ee077994b6658eafa855c308275ead8097c4a',
1153
+ USDC: '0x463f5d63e5a5edb8615b0e485a090a18aba08578',
1159
1154
  OHM: '0xebce5f29ff5ca9aa330ebdf7ec6b5f474bff271e',
1160
1155
  USDT: '0x5ff47d4ab75bcaff6807c81f1367abb53439883c',
1161
1156
  POPS: '0x4b78b52e7de4d8b7d367297cb8a87c1875a9d591',
@@ -1178,7 +1173,7 @@ export const Holders: {
1178
1173
  DAI: '0x1337bedc9d22ecbe766df105c9623922a27963ec',
1179
1174
  WETH: '0x68F5C0A2DE713a54991E01858Fd27a3832401849',
1180
1175
  POPS: '0x3cbd9044aaabef08ce93a68448e093cff405ad76',
1181
- USDC: '0xEBb8EA128BbdFf9a1780A4902A9380022371d466',
1176
+ USDC: ' 0x9f7b6e20bc64f12adaabeb739ead802fc7765d03',
1182
1177
  USDT: '0xEBb8EA128BbdFf9a1780A4902A9380022371d466',
1183
1178
  OP: '0xEBb8EA128BbdFf9a1780A4902A9380022371d466',
1184
1179
  aOptWETH: '0x7B7D80C40415F744864f051B806b466e2fbB8E68',
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable no-console */
2
- import axios from 'axios';
3
- import { Address } from '@paraswap/core';
4
2
  import { Provider } from '@ethersproject/providers';
3
+ import { Address } from '@paraswap/core';
4
+ import axios from 'axios';
5
5
  import { TxObject } from '../src/types';
6
6
  import { StateOverrides, StateSimulateApiOverride } from './smart-tokens';
7
7
 
@@ -76,6 +76,7 @@ export class TenderlySimulation implements TransactionSimulator {
76
76
  }
77
77
 
78
78
  try {
79
+ await process.nextTick(() => {}); // https://stackoverflow.com/questions/69169492/async-external-function-leaves-open-handles-jest-supertest-express
79
80
  let res = await axios.post(
80
81
  `https://api.tenderly.co/api/v1/account/${TENDERLY_ACCOUNT_ID}/project/${TENDERLY_PROJECT}/fork`,
81
82
  {
@@ -109,6 +110,7 @@ export class TenderlySimulation implements TransactionSimulator {
109
110
  };
110
111
  try {
111
112
  if (stateOverrides) {
113
+ await process.nextTick(() => {}); // https://stackoverflow.com/questions/69169492/async-external-function-leaves-open-handles-jest-supertest-express
112
114
  const result = await axios.post(
113
115
  `
114
116
  https://api.tenderly.co/api/v1/account/${TENDERLY_ACCOUNT_ID}/project/${TENDERLY_PROJECT}/contracts/encode-states`,
@@ -133,6 +135,7 @@ export class TenderlySimulation implements TransactionSimulator {
133
135
  );
134
136
  }
135
137
 
138
+ await process.nextTick(() => {}); // https://stackoverflow.com/questions/69169492/async-external-function-leaves-open-handles-jest-supertest-express
136
139
  const { data } = await axios.post(
137
140
  `https://api.tenderly.co/api/v1/account/${TENDERLY_ACCOUNT_ID}/project/${TENDERLY_PROJECT}/fork/${this.forkId}/simulate`,
138
141
  _params,