@paraswap/dex-lib 3.8.26 → 3.8.27-dualsync.0

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 (360) hide show
  1. package/build/dex/idex.d.ts +4 -0
  2. package/build/dex/uniswap-v2/uniswap-v2.d.ts +11 -4
  3. package/build/dex/uniswap-v2/uniswap-v2.js +40 -13
  4. package/build/dex/uniswap-v2/uniswap-v2.js.map +1 -1
  5. package/build/dex/uniswap-v3/uniswap-v3-pool.d.ts +3 -2
  6. package/build/dex/uniswap-v3/uniswap-v3-pool.js +3 -3
  7. package/build/dex/uniswap-v3/uniswap-v3-pool.js.map +1 -1
  8. package/build/dex/uniswap-v3/uniswap-v3.d.ts +4 -0
  9. package/build/dex/uniswap-v3/uniswap-v3.js +11 -2
  10. package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
  11. package/build/dex-helper/dummy-dex-helper.d.ts +2 -0
  12. package/build/dex-helper/dummy-dex-helper.js.map +1 -1
  13. package/build/dex-helper/idex-helper.d.ts +2 -0
  14. package/build/dex-utils.d.ts +3 -0
  15. package/build/dex-utils.js +10 -0
  16. package/build/dex-utils.js.map +1 -0
  17. package/build/stateful-dual-synchronizer.d.ts +46 -0
  18. package/build/stateful-dual-synchronizer.js +300 -0
  19. package/build/stateful-dual-synchronizer.js.map +1 -0
  20. package/package.json +1 -1
  21. package/src/dex/idex.ts +8 -0
  22. package/src/dex/uniswap-v2/uniswap-v2.ts +66 -16
  23. package/src/dex/uniswap-v3/uniswap-v3-pool.ts +4 -6
  24. package/src/dex/uniswap-v3/uniswap-v3.ts +28 -2
  25. package/src/dex-helper/dummy-dex-helper.ts +2 -0
  26. package/src/dex-helper/idex-helper.ts +2 -0
  27. package/src/dex-utils.ts +5 -0
  28. package/src/stateful-dual-synchronizer.ts +415 -0
  29. package/.vscode/launch.json +0 -16
  30. package/.vscode/settings.json +0 -3
  31. package/build/abi/AaveV1_lending_pool.json +0 -27
  32. package/build/abi/BProtocol.json +0 -1155
  33. package/build/abi/Jarvis.json +0 -1172
  34. package/build/abi/MStableAsset.json +0 -1545
  35. package/build/abi/OneInchLp.json +0 -1304
  36. package/build/abi/Onebit.json +0 -736
  37. package/build/abi/Shell.json +0 -1294
  38. package/build/abi/TraderJoeV2Router.json +0 -50
  39. package/build/abi/Uncompressor.json +0 -250
  40. package/build/abi/integral/factory.json +0 -333
  41. package/build/abi/integral/oracle.json +0 -501
  42. package/build/abi/integral/pool.json +0 -1041
  43. package/build/abi/integral/relayer.json +0 -1536
  44. package/build/abi/platypus/asset.json +0 -490
  45. package/build/abi/platypus/avax-pool.json +0 -820
  46. package/build/abi/platypus/oracle.json +0 -119
  47. package/build/abi/platypus/pool.json +0 -677
  48. package/build/abi/smardex/all/smardex-router.json +0 -648
  49. package/build/abi/smardex/layer-1/smardex-factory.json +0 -242
  50. package/build/abi/smardex/layer-1/smardex-pool.json +0 -506
  51. package/build/abi/smardex/layer-2/smardex-factory.json +0 -185
  52. package/build/abi/smardex/layer-2/smardex-pool.json +0 -578
  53. package/build/abi/swaap-v1/pool.json +0 -1346
  54. package/build/abi/zrx.v2.json +0 -1967
  55. package/build/abi/zrx.v3.json +0 -3454
  56. package/build/abi/zrx.v4.json +0 -2193
  57. package/build/dex/OneInchLp.d.ts +0 -24
  58. package/build/dex/OneInchLp.js +0 -43
  59. package/build/dex/OneInchLp.js.map +0 -1
  60. package/build/dex/aave-v1/aave-v1.d.ts +0 -33
  61. package/build/dex/aave-v1/aave-v1.js +0 -158
  62. package/build/dex/aave-v1/aave-v1.js.map +0 -1
  63. package/build/dex/aave-v1/config.d.ts +0 -11
  64. package/build/dex/aave-v1/config.js +0 -20
  65. package/build/dex/aave-v1/config.js.map +0 -1
  66. package/build/dex/aave-v1/tokens-mainnet.json +0 -134
  67. package/build/dex/aave-v1/tokens.d.ts +0 -3
  68. package/build/dex/aave-v1/tokens.js +0 -50
  69. package/build/dex/aave-v1/tokens.js.map +0 -1
  70. package/build/dex/aave-v1/types.d.ts +0 -12
  71. package/build/dex/aave-v1/types.js +0 -3
  72. package/build/dex/aave-v1/types.js.map +0 -1
  73. package/build/dex/bProtocol/bProtocol.d.ts +0 -15
  74. package/build/dex/bProtocol/bProtocol.js +0 -56
  75. package/build/dex/bProtocol/bProtocol.js.map +0 -1
  76. package/build/dex/bProtocol/types.d.ts +0 -11
  77. package/build/dex/bProtocol/types.js +0 -8
  78. package/build/dex/bProtocol/types.js.map +0 -1
  79. package/build/dex/bProtocol.d.ts +0 -18
  80. package/build/dex/bProtocol.js +0 -39
  81. package/build/dex/bProtocol.js.map +0 -1
  82. package/build/dex/bancor.d.ts +0 -26
  83. package/build/dex/bancor.js +0 -58
  84. package/build/dex/bancor.js.map +0 -1
  85. package/build/dex/compound.d.ts +0 -18
  86. package/build/dex/compound.js +0 -46
  87. package/build/dex/compound.js.map +0 -1
  88. package/build/dex/curve-v2.d.ts +0 -58
  89. package/build/dex/curve-v2.js +0 -180
  90. package/build/dex/curve-v2.js.map +0 -1
  91. package/build/dex/dodo-v1.d.ts +0 -33
  92. package/build/dex/dodo-v1.js +0 -63
  93. package/build/dex/dodo-v1.js.map +0 -1
  94. package/build/dex/etherfi/etherfi.d.ts +0 -26
  95. package/build/dex/etherfi/etherfi.js +0 -96
  96. package/build/dex/etherfi/etherfi.js.map +0 -1
  97. package/build/dex/integral/config.d.ts +0 -4
  98. package/build/dex/integral/config.js +0 -20
  99. package/build/dex/integral/config.js.map +0 -1
  100. package/build/dex/integral/context.d.ts +0 -40
  101. package/build/dex/integral/context.js +0 -158
  102. package/build/dex/integral/context.js.map +0 -1
  103. package/build/dex/integral/helpers.d.ts +0 -17
  104. package/build/dex/integral/helpers.js +0 -157
  105. package/build/dex/integral/helpers.js.map +0 -1
  106. package/build/dex/integral/integral-factory.d.ts +0 -24
  107. package/build/dex/integral/integral-factory.js +0 -95
  108. package/build/dex/integral/integral-factory.js.map +0 -1
  109. package/build/dex/integral/integral-pool.d.ts +0 -50
  110. package/build/dex/integral/integral-pool.js +0 -149
  111. package/build/dex/integral/integral-pool.js.map +0 -1
  112. package/build/dex/integral/integral-pricing.d.ts +0 -18
  113. package/build/dex/integral/integral-pricing.js +0 -114
  114. package/build/dex/integral/integral-pricing.js.map +0 -1
  115. package/build/dex/integral/integral-relayer.d.ts +0 -42
  116. package/build/dex/integral/integral-relayer.js +0 -192
  117. package/build/dex/integral/integral-relayer.js.map +0 -1
  118. package/build/dex/integral/integral-token.d.ts +0 -27
  119. package/build/dex/integral/integral-token.js +0 -59
  120. package/build/dex/integral/integral-token.js.map +0 -1
  121. package/build/dex/integral/integral.d.ts +0 -41
  122. package/build/dex/integral/integral.js +0 -376
  123. package/build/dex/integral/integral.js.map +0 -1
  124. package/build/dex/integral/types.d.ts +0 -85
  125. package/build/dex/integral/types.js +0 -9
  126. package/build/dex/integral/types.js.map +0 -1
  127. package/build/dex/integral/utils-e2e.d.ts +0 -9
  128. package/build/dex/integral/utils-e2e.js +0 -131
  129. package/build/dex/integral/utils-e2e.js.map +0 -1
  130. package/build/dex/integral/utils.d.ts +0 -17
  131. package/build/dex/integral/utils.js +0 -94
  132. package/build/dex/integral/utils.js.map +0 -1
  133. package/build/dex/jarvis.d.ts +0 -56
  134. package/build/dex/jarvis.js +0 -163
  135. package/build/dex/jarvis.js.map +0 -1
  136. package/build/dex/lido.d.ts +0 -19
  137. package/build/dex/lido.js +0 -42
  138. package/build/dex/lido.js.map +0 -1
  139. package/build/dex/mStable.d.ts +0 -44
  140. package/build/dex/mStable.js +0 -75
  141. package/build/dex/mStable.js.map +0 -1
  142. package/build/dex/onebit/onebit.d.ts +0 -16
  143. package/build/dex/onebit/onebit.js +0 -61
  144. package/build/dex/onebit/onebit.js.map +0 -1
  145. package/build/dex/onebit/types.d.ts +0 -14
  146. package/build/dex/onebit/types.js +0 -8
  147. package/build/dex/onebit/types.js.map +0 -1
  148. package/build/dex/onebit.d.ts +0 -25
  149. package/build/dex/onebit.js +0 -42
  150. package/build/dex/onebit.js.map +0 -1
  151. package/build/dex/platypus/asset.d.ts +0 -14
  152. package/build/dex/platypus/asset.js +0 -97
  153. package/build/dex/platypus/asset.js.map +0 -1
  154. package/build/dex/platypus/config.d.ts +0 -11
  155. package/build/dex/platypus/config.js +0 -69
  156. package/build/dex/platypus/config.js.map +0 -1
  157. package/build/dex/platypus/platypus.d.ts +0 -62
  158. package/build/dex/platypus/platypus.js +0 -442
  159. package/build/dex/platypus/platypus.js.map +0 -1
  160. package/build/dex/platypus/pool-avax.d.ts +0 -8
  161. package/build/dex/platypus/pool-avax.js +0 -54
  162. package/build/dex/platypus/pool-avax.js.map +0 -1
  163. package/build/dex/platypus/pool-base.d.ts +0 -19
  164. package/build/dex/platypus/pool-base.js +0 -86
  165. package/build/dex/platypus/pool-base.js.map +0 -1
  166. package/build/dex/platypus/pool-pure.d.ts +0 -8
  167. package/build/dex/platypus/pool-pure.js +0 -37
  168. package/build/dex/platypus/pool-pure.js.map +0 -1
  169. package/build/dex/platypus/pool-subscriber.d.ts +0 -14
  170. package/build/dex/platypus/pool-subscriber.js +0 -167
  171. package/build/dex/platypus/pool-subscriber.js.map +0 -1
  172. package/build/dex/platypus/pool.d.ts +0 -8
  173. package/build/dex/platypus/pool.js +0 -58
  174. package/build/dex/platypus/pool.js.map +0 -1
  175. package/build/dex/platypus/types.d.ts +0 -92
  176. package/build/dex/platypus/types.js +0 -10
  177. package/build/dex/platypus/types.js.map +0 -1
  178. package/build/dex/quickswap/spiritswap-v3.d.ts +0 -6
  179. package/build/dex/quickswap/spiritswap-v3.js +0 -19
  180. package/build/dex/quickswap/spiritswap-v3.js.map +0 -1
  181. package/build/dex/sdai/config.d.ts +0 -11
  182. package/build/dex/sdai/config.js +0 -21
  183. package/build/dex/sdai/config.js.map +0 -1
  184. package/build/dex/sdai/constants.d.ts +0 -2
  185. package/build/dex/sdai/constants.js +0 -6
  186. package/build/dex/sdai/constants.js.map +0 -1
  187. package/build/dex/sdai/scripts/validate-state.d.ts +0 -1
  188. package/build/dex/sdai/scripts/validate-state.js +0 -102
  189. package/build/dex/sdai/scripts/validate-state.js.map +0 -1
  190. package/build/dex/sdai/sdai-pool.d.ts +0 -16
  191. package/build/dex/sdai/sdai-pool.js +0 -85
  192. package/build/dex/sdai/sdai-pool.js.map +0 -1
  193. package/build/dex/sdai/sdai.d.ts +0 -51
  194. package/build/dex/sdai/sdai.js +0 -172
  195. package/build/dex/sdai/sdai.js.map +0 -1
  196. package/build/dex/sdai/types.d.ts +0 -21
  197. package/build/dex/sdai/types.js +0 -11
  198. package/build/dex/sdai/types.js.map +0 -1
  199. package/build/dex/sdai/utils.d.ts +0 -4
  200. package/build/dex/sdai/utils.js +0 -39
  201. package/build/dex/sdai/utils.js.map +0 -1
  202. package/build/dex/shell.d.ts +0 -25
  203. package/build/dex/shell.js +0 -41
  204. package/build/dex/shell.js.map +0 -1
  205. package/build/dex/smardex/config.d.ts +0 -4
  206. package/build/dex/smardex/config.js +0 -64
  207. package/build/dex/smardex/config.js.map +0 -1
  208. package/build/dex/smardex/constants.d.ts +0 -18
  209. package/build/dex/smardex/constants.js +0 -33
  210. package/build/dex/smardex/constants.js.map +0 -1
  211. package/build/dex/smardex/sdk/constants.d.ts +0 -6
  212. package/build/dex/smardex/sdk/constants.js +0 -13
  213. package/build/dex/smardex/sdk/constants.js.map +0 -1
  214. package/build/dex/smardex/sdk/core.d.ts +0 -113
  215. package/build/dex/smardex/sdk/core.js +0 -499
  216. package/build/dex/smardex/sdk/core.js.map +0 -1
  217. package/build/dex/smardex/sdk/errors.d.ts +0 -15
  218. package/build/dex/smardex/sdk/errors.js +0 -22
  219. package/build/dex/smardex/sdk/errors.js.map +0 -1
  220. package/build/dex/smardex/sdk/types.d.ts +0 -62
  221. package/build/dex/smardex/sdk/types.js +0 -3
  222. package/build/dex/smardex/sdk/types.js.map +0 -1
  223. package/build/dex/smardex/sdk/utils.d.ts +0 -44
  224. package/build/dex/smardex/sdk/utils.js +0 -133
  225. package/build/dex/smardex/sdk/utils.js.map +0 -1
  226. package/build/dex/smardex/smardex-event-pool.d.ts +0 -28
  227. package/build/dex/smardex/smardex-event-pool.js +0 -119
  228. package/build/dex/smardex/smardex-event-pool.js.map +0 -1
  229. package/build/dex/smardex/smardex.d.ts +0 -65
  230. package/build/dex/smardex/smardex.js +0 -519
  231. package/build/dex/smardex/smardex.js.map +0 -1
  232. package/build/dex/smardex/types.d.ts +0 -55
  233. package/build/dex/smardex/types.js +0 -3
  234. package/build/dex/smardex/types.js.map +0 -1
  235. package/build/dex/smoothy.d.ts +0 -26
  236. package/build/dex/smoothy.js +0 -48
  237. package/build/dex/smoothy.js.map +0 -1
  238. package/build/dex/solidly/forks-override/cone.d.ts +0 -22
  239. package/build/dex/solidly/forks-override/cone.js +0 -53
  240. package/build/dex/solidly/forks-override/cone.js.map +0 -1
  241. package/build/dex/solidly/forks-override/solisnek.d.ts +0 -8
  242. package/build/dex/solidly/forks-override/solisnek.js +0 -15
  243. package/build/dex/solidly/forks-override/solisnek.js.map +0 -1
  244. package/build/dex/stable-pool.d.ts +0 -28
  245. package/build/dex/stable-pool.js +0 -62
  246. package/build/dex/stable-pool.js.map +0 -1
  247. package/build/dex/swaap-v1/config.d.ts +0 -17
  248. package/build/dex/swaap-v1/config.js +0 -56
  249. package/build/dex/swaap-v1/config.js.map +0 -1
  250. package/build/dex/swaap-v1/constants.d.ts +0 -6
  251. package/build/dex/swaap-v1/constants.js +0 -17
  252. package/build/dex/swaap-v1/constants.js.map +0 -1
  253. package/build/dex/swaap-v1/libraries/ChainlinkUtils.d.ts +0 -25
  254. package/build/dex/swaap-v1/libraries/ChainlinkUtils.js +0 -62
  255. package/build/dex/swaap-v1/libraries/ChainlinkUtils.js.map +0 -1
  256. package/build/dex/swaap-v1/libraries/Const.d.ts +0 -18
  257. package/build/dex/swaap-v1/libraries/Const.js +0 -26
  258. package/build/dex/swaap-v1/libraries/Const.js.map +0 -1
  259. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.d.ts +0 -77
  260. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js +0 -316
  261. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js.map +0 -1
  262. package/build/dex/swaap-v1/libraries/LogExpMath.d.ts +0 -75
  263. package/build/dex/swaap-v1/libraries/LogExpMath.js +0 -418
  264. package/build/dex/swaap-v1/libraries/LogExpMath.js.map +0 -1
  265. package/build/dex/swaap-v1/libraries/MathMMM.d.ts +0 -185
  266. package/build/dex/swaap-v1/libraries/MathMMM.js +0 -453
  267. package/build/dex/swaap-v1/libraries/MathMMM.js.map +0 -1
  268. package/build/dex/swaap-v1/libraries/Num.d.ts +0 -31
  269. package/build/dex/swaap-v1/libraries/Num.js +0 -167
  270. package/build/dex/swaap-v1/libraries/Num.js.map +0 -1
  271. package/build/dex/swaap-v1/libraries/PoolQuotations.d.ts +0 -23
  272. package/build/dex/swaap-v1/libraries/PoolQuotations.js +0 -131
  273. package/build/dex/swaap-v1/libraries/PoolQuotations.js.map +0 -1
  274. package/build/dex/swaap-v1/libraries/Struct.d.ts +0 -56
  275. package/build/dex/swaap-v1/libraries/Struct.js +0 -3
  276. package/build/dex/swaap-v1/libraries/Struct.js.map +0 -1
  277. package/build/dex/swaap-v1/swaap-v1-pool.d.ts +0 -45
  278. package/build/dex/swaap-v1/swaap-v1-pool.js +0 -656
  279. package/build/dex/swaap-v1/swaap-v1-pool.js.map +0 -1
  280. package/build/dex/swaap-v1/swaap-v1.d.ts +0 -61
  281. package/build/dex/swaap-v1/swaap-v1.js +0 -369
  282. package/build/dex/swaap-v1/swaap-v1.js.map +0 -1
  283. package/build/dex/swaap-v1/types.d.ts +0 -106
  284. package/build/dex/swaap-v1/types.js +0 -9
  285. package/build/dex/swaap-v1/types.js.map +0 -1
  286. package/build/dex/trader-joe-v2.1/optimizer.d.ts +0 -2
  287. package/build/dex/trader-joe-v2.1/optimizer.js +0 -44
  288. package/build/dex/trader-joe-v2.1/optimizer.js.map +0 -1
  289. package/build/dex/trader-joe-v2.1.d.ts +0 -43
  290. package/build/dex/trader-joe-v2.1.js +0 -79
  291. package/build/dex/trader-joe-v2.1.js.map +0 -1
  292. package/build/dex/trader-joe-v2.d.ts +0 -40
  293. package/build/dex/trader-joe-v2.js +0 -74
  294. package/build/dex/trader-joe-v2.js.map +0 -1
  295. package/build/dex/zerox/config.d.ts +0 -2
  296. package/build/dex/zerox/config.js +0 -33
  297. package/build/dex/zerox/config.js.map +0 -1
  298. package/build/dex/zerox/index.d.ts +0 -22
  299. package/build/dex/zerox/index.js +0 -225
  300. package/build/dex/zerox/index.js.map +0 -1
  301. package/build/dex/zerox/order.d.ts +0 -88
  302. package/build/dex/zerox/order.js +0 -53
  303. package/build/dex/zerox/order.js.map +0 -1
  304. package/build/dex/zerox/types.d.ts +0 -73
  305. package/build/dex/zerox/types.js +0 -21
  306. package/build/dex/zerox/types.js.map +0 -1
  307. package/build/executor/compressor/Compressor.d.ts +0 -23
  308. package/build/executor/compressor/Compressor.js +0 -144
  309. package/build/executor/compressor/Compressor.js.map +0 -1
  310. package/build/executor/compressor/compress.d.ts +0 -17
  311. package/build/executor/compressor/compress.js +0 -187
  312. package/build/executor/compressor/compress.js.map +0 -1
  313. package/build/executor/compressor/compress_functions/addressSubstitution.d.ts +0 -6
  314. package/build/executor/compressor/compress_functions/addressSubstitution.js +0 -29
  315. package/build/executor/compressor/compress_functions/addressSubstitution.js.map +0 -1
  316. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.d.ts +0 -10
  317. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js +0 -40
  318. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js.map +0 -1
  319. package/build/executor/compressor/compress_functions/byteSubstitution.d.ts +0 -11
  320. package/build/executor/compressor/compress_functions/byteSubstitution.js +0 -64
  321. package/build/executor/compressor/compress_functions/byteSubstitution.js.map +0 -1
  322. package/build/executor/compressor/compress_functions/ffSubstitution.d.ts +0 -7
  323. package/build/executor/compressor/compress_functions/ffSubstitution.js +0 -54
  324. package/build/executor/compressor/compress_functions/ffSubstitution.js.map +0 -1
  325. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.d.ts +0 -8
  326. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js +0 -67
  327. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js.map +0 -1
  328. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.d.ts +0 -8
  329. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js +0 -61
  330. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js.map +0 -1
  331. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.d.ts +0 -6
  332. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js +0 -37
  333. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js.map +0 -1
  334. package/build/executor/compressor/compress_functions/searchUnusedBytes.d.ts +0 -9
  335. package/build/executor/compressor/compress_functions/searchUnusedBytes.js +0 -33
  336. package/build/executor/compressor/compress_functions/searchUnusedBytes.js.map +0 -1
  337. package/build/executor/compressor/fetchSaved.d.ts +0 -0
  338. package/build/executor/compressor/fetchSaved.js +0 -17
  339. package/build/executor/compressor/fetchSaved.js.map +0 -1
  340. package/build/executor/compressor/utils/computeCostL2.d.ts +0 -2
  341. package/build/executor/compressor/utils/computeCostL2.js +0 -14
  342. package/build/executor/compressor/utils/computeCostL2.js.map +0 -1
  343. package/build/executor/compressor/utils/findLongestDuplicatedString.d.ts +0 -2
  344. package/build/executor/compressor/utils/findLongestDuplicatedString.js +0 -30
  345. package/build/executor/compressor/utils/findLongestDuplicatedString.js.map +0 -1
  346. package/build/executor/compressor/utils/getAllIndexes.d.ts +0 -2
  347. package/build/executor/compressor/utils/getAllIndexes.js +0 -12
  348. package/build/executor/compressor/utils/getAllIndexes.js.map +0 -1
  349. package/build/executor/compressor/utils/getByteForAddress.d.ts +0 -2
  350. package/build/executor/compressor/utils/getByteForAddress.js +0 -14
  351. package/build/executor/compressor/utils/getByteForAddress.js.map +0 -1
  352. package/build/executor/compressor/utils/intTo2Bytes.d.ts +0 -2
  353. package/build/executor/compressor/utils/intTo2Bytes.js +0 -14
  354. package/build/executor/compressor/utils/intTo2Bytes.js.map +0 -1
  355. package/build/executor/compressor/utils/intTo3Bytes.d.ts +0 -2
  356. package/build/executor/compressor/utils/intTo3Bytes.js +0 -18
  357. package/build/executor/compressor/utils/intTo3Bytes.js.map +0 -1
  358. package/build/executor/compressor/utils/intToByte.d.ts +0 -2
  359. package/build/executor/compressor/utils/intToByte.js +0 -10
  360. package/build/executor/compressor/utils/intToByte.js.map +0 -1
@@ -1,8 +0,0 @@
1
- import { Address, Token } from '../../types';
2
- import { IDexHelper } from '../../dex-helper/idex-helper';
3
- import { PlatypusPurePoolState, PlatypusPurePoolConfigInfo } from './types';
4
- import { PlatypusPoolBase } from './pool-base';
5
- export declare class PlatypusPurePool extends PlatypusPoolBase<PlatypusPurePoolState> {
6
- constructor(dexKey: string, network: number, name: string, poolAddress: Address, poolCfg: PlatypusPurePoolConfigInfo, dexHelper: IDexHelper);
7
- computePrices(srcToken: Token, destToken: Token, amounts: bigint[], state: PlatypusPurePoolState): bigint[];
8
- }
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlatypusPurePool = void 0;
4
- const lens_1 = require("../../lens");
5
- const asset_1 = require("./asset");
6
- const pool_subscriber_1 = require("./pool-subscriber");
7
- const utils_1 = require("../../utils");
8
- const pool_base_1 = require("./pool-base");
9
- class PlatypusPurePool extends pool_base_1.PlatypusPoolBase {
10
- constructor(dexKey, network, name, poolAddress, poolCfg, dexHelper) {
11
- super(dexKey, network, name, dexHelper, [
12
- new pool_subscriber_1.PlatypusPoolSubscriber(poolAddress, (0, lens_1.lens)().params, dexHelper.getLogger(`${dexKey}-${network} Params ${name}`)),
13
- ...Object.entries(poolCfg.tokens).map(([tokenAddress, c]) => new asset_1.PlatypusAssetSubscriber(c.assetAddress, (0, lens_1.lens)().asset[tokenAddress], dexHelper.getLogger(`${dexKey}-${network} ${c.tokenSymbol} asset ${name}`))),
14
- ], {
15
- params: {
16
- paused: false,
17
- slippageParamK: 0n,
18
- slippageParamN: 0n,
19
- c1: 0n,
20
- xThreshold: 0n,
21
- haircutRate: 0n,
22
- retentionRatio: 0n,
23
- maxPriceDeviation: 0n,
24
- },
25
- asset: {},
26
- });
27
- }
28
- computePrices(srcToken, destToken, amounts, state) {
29
- return amounts.map(fromAmount => {
30
- const idealToAmount = (fromAmount * (0, utils_1.getBigIntPow)(destToken.decimals)) /
31
- (0, utils_1.getBigIntPow)(srcToken.decimals);
32
- return (0, pool_base_1.calcPrice)(srcToken, destToken, fromAmount, idealToAmount, state);
33
- });
34
- }
35
- }
36
- exports.PlatypusPurePool = PlatypusPurePool;
37
- //# sourceMappingURL=pool-pure.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pool-pure.js","sourceRoot":"","sources":["../../../src/dex/platypus/pool-pure.ts"],"names":[],"mappings":";;;AAEA,qCAAkC;AAClC,mCAAkD;AAClD,uDAA2D;AAG3D,uCAA2C;AAC3C,2CAA0D;AAE1D,MAAa,gBAAiB,SAAQ,4BAAuC;IAC3E,YACE,MAAc,EACd,OAAe,EACf,IAAY,EACZ,WAAoB,EACpB,OAAmC,EACnC,SAAqB;QAErB,KAAK,CACH,MAAM,EACN,OAAO,EACP,IAAI,EACJ,SAAS,EACT;YACE,IAAI,wCAAsB,CACxB,WAAW,EACX,IAAA,WAAI,GAAuC,CAAC,MAAM,EAClD,SAAS,CAAC,SAAS,CAAC,GAAG,MAAM,IAAI,OAAO,WAAW,IAAI,EAAE,CAAC,CAC3D;YACD,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CACnC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CACpB,IAAI,+BAAuB,CACzB,CAAC,CAAC,YAAY,EACd,IAAA,WAAI,GAAuC,CAAC,KAAK,CAAC,YAAY,CAAC,EAC/D,SAAS,CAAC,SAAS,CACjB,GAAG,MAAM,IAAI,OAAO,IAAI,CAAC,CAAC,WAAW,UAAU,IAAI,EAAE,CACtD,CACF,CACJ;SACF,EACD;YACE,MAAM,EAAE;gBACN,MAAM,EAAE,KAAK;gBACb,cAAc,EAAE,EAAE;gBAClB,cAAc,EAAE,EAAE;gBAClB,EAAE,EAAE,EAAE;gBACN,UAAU,EAAE,EAAE;gBACd,WAAW,EAAE,EAAE;gBACf,cAAc,EAAE,EAAE;gBAClB,iBAAiB,EAAE,EAAE;aACtB;YACD,KAAK,EAAE,EAAE;SACV,CACF,CAAC;IACJ,CAAC;IAEM,aAAa,CAClB,QAAe,EACf,SAAgB,EAChB,OAAiB,EACjB,KAA4B;QAE5B,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YAC9B,MAAM,aAAa,GACjB,CAAC,UAAU,GAAG,IAAA,oBAAY,EAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBAC/C,IAAA,oBAAY,EAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAClC,OAAO,IAAA,qBAAS,EAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA5DD,4CA4DC"}
@@ -1,14 +0,0 @@
1
- import { DeepReadonly } from 'ts-essentials';
2
- import { PartialEventSubscriber } from '../../composed-event-subscriber';
3
- import { Address, BlockHeader, Log, Logger, MultiCallInput, MultiCallOutput } from '../../types';
4
- import { Lens } from '../../lens';
5
- import { Interface } from '@ethersproject/abi';
6
- import { PlatypusPoolParams } from './types';
7
- export declare class PlatypusPoolSubscriber<State> extends PartialEventSubscriber<State, PlatypusPoolParams> {
8
- private pool;
9
- static readonly poolInterface: Interface;
10
- constructor(pool: Address, lens: Lens<DeepReadonly<State>, DeepReadonly<PlatypusPoolParams>>, logger: Logger);
11
- processLog(state: DeepReadonly<PlatypusPoolParams>, log: Readonly<Log>, blockHeader: Readonly<BlockHeader>): DeepReadonly<PlatypusPoolParams> | null;
12
- getGenerateStateMultiCallInputs(): MultiCallInput[];
13
- generateState(multicallOutputs: MultiCallOutput[], blockNumber?: number | 'latest'): DeepReadonly<PlatypusPoolParams>;
14
- }
@@ -1,167 +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.PlatypusPoolSubscriber = void 0;
7
- const composed_event_subscriber_1 = require("../../composed-event-subscriber");
8
- const abi_1 = require("@ethersproject/abi");
9
- const pool_json_1 = __importDefault(require("../../abi/platypus/pool.json"));
10
- class PlatypusPoolSubscriber extends composed_event_subscriber_1.PartialEventSubscriber {
11
- constructor(pool, lens, logger) {
12
- super([pool], lens, logger);
13
- this.pool = pool;
14
- }
15
- processLog(state, log, blockHeader) {
16
- try {
17
- const parsed = PlatypusPoolSubscriber.poolInterface.parseLog(log);
18
- switch (parsed.name) {
19
- case 'Paused': {
20
- return {
21
- ...state,
22
- paused: true,
23
- };
24
- }
25
- case 'Unpaused': {
26
- return {
27
- ...state,
28
- paused: false,
29
- };
30
- }
31
- case 'PriceDeviationUpdated': {
32
- const previousPriceDeviation = BigInt(parsed.args.previousPriceDeviation.toString());
33
- const newPriceDeviation = BigInt(parsed.args.newPriceDeviation.toString());
34
- if (state.maxPriceDeviation !== previousPriceDeviation) {
35
- this.logger.error('state.maxPriceDeviation !== previousPriceDeviation');
36
- }
37
- return {
38
- ...state,
39
- maxPriceDeviation: newPriceDeviation,
40
- };
41
- }
42
- case 'SlippageParamsUpdated': {
43
- const previousK = BigInt(parsed.args.previousK.toString());
44
- const newK = BigInt(parsed.args.newK.toString());
45
- const previousN = BigInt(parsed.args.previousN.toString());
46
- const newN = BigInt(parsed.args.newN.toString());
47
- const previousC1 = BigInt(parsed.args.previousC1.toString());
48
- const newC1 = BigInt(parsed.args.newC1.toString());
49
- const previousXThreshold = BigInt(parsed.args.previousXThreshold.toString());
50
- const newXThreshold = BigInt(parsed.args.newXThreshold.toString());
51
- if (state.slippageParamK !== previousK) {
52
- this.logger.error('state.slippageParamK !== previousK');
53
- }
54
- if (state.slippageParamN !== previousN) {
55
- this.logger.error('state.slippageParamN !== previousN');
56
- }
57
- if (state.c1 !== previousC1) {
58
- this.logger.error('state.c1 !== previousC1');
59
- }
60
- if (state.xThreshold !== previousXThreshold) {
61
- this.logger.error('state.xThreshold !== previousXThreshold');
62
- }
63
- return {
64
- ...state,
65
- slippageParamK: newK,
66
- slippageParamN: newN,
67
- c1: newC1,
68
- xThreshold: newXThreshold,
69
- };
70
- }
71
- case 'HaircutRateUpdated': {
72
- const previousHaircut = BigInt(parsed.args.previousHaircut.toString());
73
- const newHaircut = BigInt(parsed.args.newHaircut.toString());
74
- if (state.haircutRate !== previousHaircut) {
75
- this.logger.error('state.haircutRate !== previousHaircut');
76
- }
77
- return {
78
- ...state,
79
- haircutRate: newHaircut,
80
- };
81
- }
82
- case 'RetentionRatioUpdated': {
83
- const previousRetentionRatio = BigInt(parsed.args.previousRetentionRatio.toString());
84
- const newRetentionRatio = BigInt(parsed.args.newRetentionRatio.toString());
85
- if (state.retentionRatio !== previousRetentionRatio) {
86
- this.logger.error('state.retentionRatio !== previousRetentionRatio');
87
- }
88
- return {
89
- ...state,
90
- retentionRatio: newRetentionRatio,
91
- };
92
- }
93
- default:
94
- return null;
95
- }
96
- }
97
- catch (e) {
98
- this.logger.error('Failed to parse log', e);
99
- return null;
100
- }
101
- }
102
- getGenerateStateMultiCallInputs() {
103
- return [
104
- {
105
- target: this.pool,
106
- callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('paused'),
107
- },
108
- {
109
- target: this.pool,
110
- callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getSlippageParamK'),
111
- },
112
- {
113
- target: this.pool,
114
- callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getSlippageParamN'),
115
- },
116
- {
117
- target: this.pool,
118
- callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getC1'),
119
- },
120
- {
121
- target: this.pool,
122
- callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getXThreshold'),
123
- },
124
- {
125
- target: this.pool,
126
- callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getHaircutRate'),
127
- },
128
- {
129
- target: this.pool,
130
- callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getRetentionRatio'),
131
- },
132
- {
133
- target: this.pool,
134
- callData: PlatypusPoolSubscriber.poolInterface.encodeFunctionData('getMaxPriceDeviation'),
135
- },
136
- ];
137
- }
138
- generateState(multicallOutputs, blockNumber) {
139
- return {
140
- paused: PlatypusPoolSubscriber.poolInterface.decodeFunctionResult('paused', multicallOutputs[0])[0],
141
- slippageParamK: BigInt(PlatypusPoolSubscriber.poolInterface
142
- .decodeFunctionResult('getSlippageParamK', multicallOutputs[1])[0]
143
- .toString()),
144
- slippageParamN: BigInt(PlatypusPoolSubscriber.poolInterface
145
- .decodeFunctionResult('getSlippageParamN', multicallOutputs[2])[0]
146
- .toString()),
147
- c1: BigInt(PlatypusPoolSubscriber.poolInterface
148
- .decodeFunctionResult('getC1', multicallOutputs[3])[0]
149
- .toString()),
150
- xThreshold: BigInt(PlatypusPoolSubscriber.poolInterface
151
- .decodeFunctionResult('getXThreshold', multicallOutputs[4])[0]
152
- .toString()),
153
- haircutRate: BigInt(PlatypusPoolSubscriber.poolInterface
154
- .decodeFunctionResult('getHaircutRate', multicallOutputs[5])[0]
155
- .toString()),
156
- retentionRatio: BigInt(PlatypusPoolSubscriber.poolInterface
157
- .decodeFunctionResult('getRetentionRatio', multicallOutputs[6])[0]
158
- .toString()),
159
- maxPriceDeviation: BigInt(PlatypusPoolSubscriber.poolInterface
160
- .decodeFunctionResult('getMaxPriceDeviation', multicallOutputs[7])[0]
161
- .toString()),
162
- };
163
- }
164
- }
165
- exports.PlatypusPoolSubscriber = PlatypusPoolSubscriber;
166
- PlatypusPoolSubscriber.poolInterface = new abi_1.Interface(pool_json_1.default);
167
- //# sourceMappingURL=pool-subscriber.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pool-subscriber.js","sourceRoot":"","sources":["../../../src/dex/platypus/pool-subscriber.ts"],"names":[],"mappings":";;;;;;AACA,+EAAyE;AAUzE,4CAA+C;AAC/C,6EAAmD;AAGnD,MAAa,sBAA8B,SAAQ,kDAGlD;IAGC,YACU,IAAa,EACrB,IAAiE,EACjE,MAAc;QAEd,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAJpB,SAAI,GAAJ,IAAI,CAAS;IAKvB,CAAC;IAEM,UAAU,CACf,KAAuC,EACvC,GAAkB,EAClB,WAAkC;QAElC,IAAI;YACF,MAAM,MAAM,GAAG,sBAAsB,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAClE,QAAQ,MAAM,CAAC,IAAI,EAAE;gBACnB,KAAK,QAAQ,CAAC,CAAC;oBACb,OAAO;wBACL,GAAG,KAAK;wBACR,MAAM,EAAE,IAAI;qBACb,CAAC;iBACH;gBACD,KAAK,UAAU,CAAC,CAAC;oBACf,OAAO;wBACL,GAAG,KAAK;wBACR,MAAM,EAAE,KAAK;qBACd,CAAC;iBACH;gBACD,KAAK,uBAAuB,CAAC,CAAC;oBAC5B,MAAM,sBAAsB,GAAG,MAAM,CACnC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,CAC9C,CAAC;oBACF,MAAM,iBAAiB,GAAG,MAAM,CAC9B,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CACzC,CAAC;oBACF,IAAI,KAAK,CAAC,iBAAiB,KAAK,sBAAsB,EAAE;wBACtD,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,oDAAoD,CACrD,CAAC;qBACH;oBACD,O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,wDA+NC;AA3NiB,oCAAa,GAAG,IAAI,eAAS,CAAC,mBAAO,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- import { Address, Token } from '../../types';
2
- import { IDexHelper } from '../../dex-helper/idex-helper';
3
- import { PlatypusPoolState, PlatypusPoolConfigInfo } from './types';
4
- import { PlatypusPoolBase } from './pool-base';
5
- export declare class PlatypusPool extends PlatypusPoolBase<PlatypusPoolState> {
6
- constructor(dexKey: string, network: number, name: string, poolAddress: Address, poolCfg: PlatypusPoolConfigInfo, dexHelper: IDexHelper);
7
- computePrices(srcToken: Token, destToken: Token, amounts: bigint[], state: PlatypusPoolState): bigint[];
8
- }
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlatypusPool = void 0;
4
- const lens_1 = require("../../lens");
5
- const chainlink_1 = require("../../lib/chainlink");
6
- const asset_1 = require("./asset");
7
- const pool_subscriber_1 = require("./pool-subscriber");
8
- const utils_1 = require("../../utils");
9
- const pool_base_1 = require("./pool-base");
10
- class PlatypusPool extends pool_base_1.PlatypusPoolBase {
11
- constructor(dexKey, network, name, poolAddress, poolCfg, dexHelper) {
12
- super(dexKey, network, name, dexHelper, [
13
- new pool_subscriber_1.PlatypusPoolSubscriber(poolAddress, (0, lens_1.lens)().params, dexHelper.getLogger(`${dexKey}-${network} Params ${name}`)),
14
- ...Object.entries(poolCfg.tokens)
15
- .map(([tokenAddress, c]) => [
16
- new asset_1.PlatypusAssetSubscriber(c.assetAddress, (0, lens_1.lens)().asset[tokenAddress], dexHelper.getLogger(`${dexKey}-${network} ${c.tokenSymbol} asset ${name}`)),
17
- new chainlink_1.ChainLinkSubscriber(c.chainlink.proxyAddress, c.chainlink.aggregatorAddress, (0, lens_1.lens)().chainlink[tokenAddress], dexHelper.getLogger(`${c.tokenSymbol} ChainLink for ${dexKey}-${network} ${name}`)),
18
- ])
19
- .flat(),
20
- ], {
21
- params: {
22
- paused: false,
23
- slippageParamK: 0n,
24
- slippageParamN: 0n,
25
- c1: 0n,
26
- xThreshold: 0n,
27
- haircutRate: 0n,
28
- retentionRatio: 0n,
29
- maxPriceDeviation: 0n,
30
- },
31
- asset: {},
32
- chainlink: {},
33
- });
34
- }
35
- computePrices(srcToken, destToken, amounts, state) {
36
- const tokenAPrice = state.chainlink[srcToken.address].answer;
37
- const tokenBPrice = state.chainlink[destToken.address].answer;
38
- if (tokenBPrice > tokenAPrice) {
39
- if (((tokenBPrice - tokenAPrice) * pool_base_1.ETH_UNIT) / tokenBPrice >
40
- state.params.maxPriceDeviation) {
41
- return Array(amounts.length).fill(0n);
42
- }
43
- }
44
- else {
45
- if (((tokenAPrice - tokenBPrice) * pool_base_1.ETH_UNIT) / tokenAPrice >
46
- state.params.maxPriceDeviation) {
47
- return Array(amounts.length).fill(0n);
48
- }
49
- }
50
- return amounts.map(fromAmount => {
51
- const idealToAmount = (fromAmount * (0, utils_1.getBigIntPow)(destToken.decimals)) /
52
- (0, utils_1.getBigIntPow)(srcToken.decimals);
53
- return (0, pool_base_1.calcPrice)(srcToken, destToken, fromAmount, idealToAmount, state);
54
- });
55
- }
56
- }
57
- exports.PlatypusPool = PlatypusPool;
58
- //# sourceMappingURL=pool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pool.js","sourceRoot":"","sources":["../../../src/dex/platypus/pool.ts"],"names":[],"mappings":";;;AAEA,qCAAkC;AAClC,mDAA0D;AAC1D,mCAAkD;AAClD,uDAA2D;AAG3D,uCAA2C;AAC3C,2CAAoE;AAEpE,MAAa,YAAa,SAAQ,4BAAmC;IACnE,YACE,MAAc,EACd,OAAe,EACf,IAAY,EACZ,WAAoB,EACpB,OAA+B,EAC/B,SAAqB;QAErB,KAAK,CACH,MAAM,EACN,OAAO,EACP,IAAI,EACJ,SAAS,EACT;YACE,IAAI,wCAAsB,CACxB,WAAW,EACX,IAAA,WAAI,GAAmC,CAAC,MAAM,EAC9C,SAAS,CAAC,SAAS,CAAC,GAAG,MAAM,IAA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IAAI,WAAW,GAAG,WAAW,EAAE;YAC7B,IACE,CAAC,CAAC,WAAW,GAAG,WAAW,CAAC,GAAG,oBAAQ,CAAC,GAAG,WAAW;gBACtD,KAAK,CAAC,MAAM,CAAC,iBAAiB,EAC9B;gBACA,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;aACvC;SACF;aAAM;YACL,IACE,CAAC,CAAC,WAAW,GAAG,WAAW,CAAC,GAAG,oBAAQ,CAAC,GAAG,WAAW;gBACtD,KAAK,CAAC,MAAM,CAAC,iBAAiB,EAC9B;gBACA,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;aACvC;SACF;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YAC9B,MAAM,aAAa,GACjB,CAAC,UAAU,GAAG,IAAA,oBAAY,EAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBAC/C,IAAA,oBAAY,EAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAClC,OAAO,IAAA,qBAAS,EAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAvFD,oCAuFC"}
@@ -1,92 +0,0 @@
1
- import { Address } from '../../types';
2
- import { ChainLinkState } from '../../lib/chainlink';
3
- import { StakedAvaxState } from '../../lib/benqi/staked-avax';
4
- export declare enum PlatypusOracleType {
5
- None = "None",
6
- ChainLink = "ChainLink",
7
- StakedAvax = "StakedAvax"
8
- }
9
- export declare type PlatypusPoolStateCommon = {
10
- params: PlatypusPoolParams;
11
- asset: {
12
- [underlyingAddress: string]: PlatypusAssetState;
13
- };
14
- };
15
- export declare type PlatypusPoolState = PlatypusPoolStateCommon & {
16
- chainlink: {
17
- [underlyingAddress: string]: ChainLinkState;
18
- };
19
- };
20
- export declare type PlatypusPurePoolState = PlatypusPoolStateCommon;
21
- export declare type PlatypusAvaxPoolState = PlatypusPoolStateCommon & {
22
- stakedAvax: StakedAvaxState;
23
- };
24
- export declare type PlatypusPoolParams = {
25
- paused: boolean;
26
- slippageParamK: bigint;
27
- slippageParamN: bigint;
28
- c1: bigint;
29
- xThreshold: bigint;
30
- haircutRate: bigint;
31
- retentionRatio: bigint;
32
- maxPriceDeviation: bigint;
33
- };
34
- export declare type PlatypusAssetState = {
35
- cash: bigint;
36
- liability: bigint;
37
- };
38
- export declare type PlatypusConfigInfo = {
39
- poolAddresses: Address[];
40
- pools: {
41
- [poolAddress: string]: PlatypusPoolConfigInfo | PlatypusPurePoolConfigInfo | PlatypusAvaxPoolConfigInfo;
42
- };
43
- };
44
- export declare type PlatypusPoolConfigInfo = {
45
- oracleType: PlatypusOracleType.ChainLink;
46
- priceOracleAddress: Address;
47
- tokenAddresses: Address[];
48
- tokens: {
49
- [tokenAddress: string]: {
50
- tokenSymbol: string;
51
- tokenDecimals: number;
52
- assetAddress: Address;
53
- chainlink: {
54
- proxyAddress: Address;
55
- aggregatorAddress: Address;
56
- };
57
- };
58
- };
59
- };
60
- export declare type PlatypusPurePoolConfigInfo = {
61
- oracleType: PlatypusOracleType.None;
62
- tokenAddresses: Address[];
63
- tokens: {
64
- [tokenAddress: string]: {
65
- tokenSymbol: string;
66
- tokenDecimals: number;
67
- assetAddress: Address;
68
- };
69
- };
70
- };
71
- export declare type PlatypusAvaxPoolConfigInfo = {
72
- oracleType: PlatypusOracleType.StakedAvax;
73
- priceOracleAddress: Address;
74
- tokenAddresses: Address[];
75
- tokens: {
76
- [tokenAddress: string]: {
77
- tokenSymbol: string;
78
- tokenDecimals: number;
79
- assetAddress: Address;
80
- };
81
- };
82
- };
83
- export declare type PlatypusData = {
84
- pool: Address;
85
- };
86
- export declare type DexParams = {
87
- pools: {
88
- address: Address;
89
- name: string;
90
- oracleType: PlatypusOracleType;
91
- }[];
92
- };
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlatypusOracleType = void 0;
4
- var PlatypusOracleType;
5
- (function (PlatypusOracleType) {
6
- PlatypusOracleType["None"] = "None";
7
- PlatypusOracleType["ChainLink"] = "ChainLink";
8
- PlatypusOracleType["StakedAvax"] = "StakedAvax";
9
- })(PlatypusOracleType = exports.PlatypusOracleType || (exports.PlatypusOracleType = {}));
10
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/platypus/types.ts"],"names":[],"mappings":";;;AAIA,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,mCAAa,CAAA;IACb,6CAAuB,CAAA;IACvB,+CAAyB,CAAA;AAC3B,CAAC,EAJW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAI7B"}
@@ -1,6 +0,0 @@
1
- import { IDexHelper } from '../../dex-helper';
2
- import { QuickSwapV3 } from './quickswap-v3';
3
- export declare class SpiritSwapV3 extends QuickSwapV3 {
4
- static dexKeys: string[];
5
- constructor(dexHelper: IDexHelper);
6
- }
@@ -1,19 +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.SpiritSwapV3 = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
- const config_1 = require("./config");
9
- const quickswap_v3_1 = require("./quickswap-v3");
10
- const config = lodash_1.default.pick(config_1.QuickSwapConfig, ['SpiritSwapV3']).SpiritSwapV3;
11
- class SpiritSwapV3 extends quickswap_v3_1.QuickSwapV3 {
12
- // public static dexKeysWithNetwork
13
- constructor(dexHelper) {
14
- super(dexHelper, 'spiritswapv3', config[dexHelper.config.data.network].router);
15
- }
16
- }
17
- exports.SpiritSwapV3 = SpiritSwapV3;
18
- SpiritSwapV3.dexKeys = ['spiritswapv3'];
19
- //# sourceMappingURL=spiritswap-v3.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spiritswap-v3.js","sourceRoot":"","sources":["../../../src/dex/quickswap/spiritswap-v3.ts"],"names":[],"mappings":";;;;;;AACA,oDAAuB;AACvB,qCAA2C;AAC3C,iDAA6C;AAE7C,MAAM,MAAM,GAAG,gBAAC,CAAC,IAAI,CAAC,wBAAe,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC;AAEtE,MAAa,YAAa,SAAQ,0BAAW;IAG3C,mCAAmC;IACnC,YAAY,SAAqB;QAC/B,KAAK,CACH,SAAS,EACT,cAAc,EACd,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAC7C,CAAC;IACJ,CAAC;;AAVH,oCAWC;AAVQ,oBAAO,GAAG,CAAC,cAAc,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- import { SDaiParams } from './types';
2
- import { DexConfigMap } from '../../types';
3
- export declare const SDaiConfig: DexConfigMap<SDaiParams>;
4
- export declare const Adapters: {
5
- [chainId: number]: {
6
- [side: string]: {
7
- name: string;
8
- index: number;
9
- }[];
10
- };
11
- };
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Adapters = exports.SDaiConfig = void 0;
4
- const constants_1 = require("../../constants");
5
- const core_1 = require("@paraswap/core");
6
- exports.SDaiConfig = {
7
- sdai: {
8
- [constants_1.Network.MAINNET]: {
9
- sdaiAddress: '0x83F20F44975D03b1b09e64809B757c47f942BEeA',
10
- daiAddress: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
11
- potAddress: '0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7',
12
- },
13
- },
14
- };
15
- exports.Adapters = {
16
- [constants_1.Network.MAINNET]: {
17
- [core_1.SwapSide.SELL]: [{ name: 'Adapter06', index: 1 }],
18
- [core_1.SwapSide.BUY]: [{ name: 'BuyAdapter02', index: 4 }],
19
- },
20
- };
21
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/sdai/config.ts"],"names":[],"mappings":";;;AAEA,+CAA0C;AAC1C,yCAA0C;AAE7B,QAAA,UAAU,GAA6B;IAClD,IAAI,EAAE;QACJ,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,WAAW,EAAE,4CAA4C;YACzD,UAAU,EAAE,4CAA4C;YACxD,UAAU,EAAE,4CAA4C;SACzD;KACF;CACF,CAAC;AAEW,QAAA,QAAQ,GAIjB;IACF,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;QACjB,CAAC,eAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QAClD,CAAC,eAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;KACrD;CACF,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const SDAI_DEPOSIT_GAS_COST = 165000;
2
- export declare const SDAI_REDEEM_GAS_COST = 90000;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SDAI_REDEEM_GAS_COST = exports.SDAI_DEPOSIT_GAS_COST = void 0;
4
- exports.SDAI_DEPOSIT_GAS_COST = 165000;
5
- exports.SDAI_REDEEM_GAS_COST = 90000;
6
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/dex/sdai/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG,MAAO,CAAC;AAChC,QAAA,oBAAoB,GAAG,KAAM,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,102 +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
- /* eslint-disable no-console */
7
- const dotenv_1 = __importDefault(require("dotenv"));
8
- dotenv_1.default.config();
9
- const constants_1 = require("../../../constants");
10
- const dex_helper_1 = require("../../../dex-helper");
11
- const ethers_1 = require("ethers");
12
- const sdai_1 = require("../sdai");
13
- const config_1 = require("../config");
14
- const utils_1 = require("../utils");
15
- const abi_1 = require("@ethersproject/abi");
16
- const pot_json_1 = __importDefault(require("../../../abi/maker-psm/pot.json"));
17
- const network = constants_1.Network.MAINNET;
18
- const dexKey = 'sdai';
19
- const { potAddress } = config_1.SDaiConfig[dexKey][network];
20
- const blockHeaders = {};
21
- const dexHelper = new dex_helper_1.DummyDexHelper(network);
22
- const logger = dexHelper.getLogger(dexKey);
23
- function preprocessField(value) {
24
- if (typeof value === 'bigint' ||
25
- typeof value === 'number' ||
26
- ethers_1.ethers.BigNumber.isBigNumber(value)) {
27
- return value.toString();
28
- }
29
- return value;
30
- }
31
- function compareAndLogDifferences(obj1, obj2, keyNames, checkEachKey = false) {
32
- let isValid = true;
33
- let keys = keyNames;
34
- if (checkEachKey) {
35
- // find common keys
36
- const keys1 = Object.keys(obj1);
37
- const keys2 = new Set(Object.keys(obj2));
38
- keys = keys1.filter(key => keys2.has(key));
39
- }
40
- for (let fieldName of keys) {
41
- const value1 = preprocessField(obj1[fieldName]);
42
- const value2 = preprocessField(obj2[fieldName]);
43
- if (value1 !== value2) {
44
- console.log(`${fieldName.toString()} mismatch: actual: ${value1} vs pool: ${value2}`);
45
- isValid = false;
46
- }
47
- }
48
- return isValid;
49
- }
50
- async function isPoolStateEqualToReal(state, blockNumber) {
51
- const expected = await (0, utils_1.getOnChainState)(dexHelper.multiContract, potAddress, new abi_1.Interface(pot_json_1.default), blockNumber);
52
- const isValidState = compareAndLogDifferences(state, expected, [
53
- 'rho',
54
- 'dsr',
55
- 'dsr',
56
- ]);
57
- return isValidState;
58
- }
59
- async function checkPoolStateForBlockRange(startBlockNumber, endBlockNumber) {
60
- const network = constants_1.Network.MAINNET;
61
- const dexKey = 'sdai';
62
- const dexHelper = new dex_helper_1.DummyDexHelper(network);
63
- const sdai = new sdai_1.SDai(network, dexKey, dexHelper);
64
- const pool = await sdai.eventPool;
65
- const logsToDispatch = await dexHelper.provider.getLogs({
66
- fromBlock: startBlockNumber,
67
- toBlock: endBlockNumber,
68
- address: potAddress,
69
- });
70
- console.log(logsToDispatch.length);
71
- // group logs by block number
72
- const logsByBlockNumber = {};
73
- for (let log of logsToDispatch) {
74
- if (!logsByBlockNumber[log.blockNumber]) {
75
- logsByBlockNumber[log.blockNumber] = [];
76
- }
77
- logsByBlockNumber[log.blockNumber].push(log);
78
- }
79
- const sortedBlocks = Object.keys(logsByBlockNumber)
80
- .map(Number)
81
- .sort((a, b) => Number(a) - Number(b));
82
- for (let blockNumber of sortedBlocks) {
83
- if (!blockHeaders[blockNumber]) {
84
- blockHeaders[blockNumber] = await dexHelper.web3Provider.eth.getBlock(blockNumber);
85
- }
86
- await pool?.update(logsByBlockNumber[blockNumber], {
87
- [blockNumber]: blockHeaders[blockNumber],
88
- });
89
- }
90
- const state = pool?.getState(startBlockNumber);
91
- return isPoolStateEqualToReal(state, endBlockNumber);
92
- }
93
- async function main() {
94
- // use findBreakingBlock to find the block where the state is broken
95
- // console.log(await findBreakingBlock(startBlockNumber, endBlockNumber));
96
- // previously broken block 150502863
97
- console.log(await checkPoolStateForBlockRange(19199247 - 10000, 19199247));
98
- }
99
- main()
100
- .then(() => console.log('Done'))
101
- .catch(e => console.error(e));
102
- //# sourceMappingURL=validate-state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-state.js","sourceRoot":"","sources":["../../../../src/dex/sdai/scripts/validate-state.ts"],"names":[],"mappings":";;;;;AAAA,+BAA+B;AAC/B,oDAA4B;AAC5B,gBAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,kDAA6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