@paraswap/dex-lib 4.0.20 → 4.0.22-bebop-eth.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 (248) hide show
  1. package/.vscode/launch.json +53 -0
  2. package/.vscode/settings.json +2 -0
  3. package/.vscode/tasks.json +15 -0
  4. package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +52 -0
  5. package/build/abi/usual-m-smart-m/usualM.abi.json +483 -0
  6. package/build/abi/{angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json → wombat/pool.json} +637 -594
  7. package/build/dex/aave-v1/aave-v1.js +1 -0
  8. package/build/dex/aave-v1/aave-v1.js.map +1 -1
  9. package/build/dex/aave-v2/tokens-avalanche.json +44 -0
  10. package/build/dex/aave-v2/tokens-mainnet.json +188 -0
  11. package/build/dex/aave-v2/tokens-polygon.json +44 -0
  12. package/build/dex/bProtocol.d.ts +18 -0
  13. package/build/dex/bProtocol.js +39 -0
  14. package/build/dex/bProtocol.js.map +1 -0
  15. package/build/dex/balancer-v3/abi/balancerBatchRouter.d.ts +729 -0
  16. package/build/dex/balancer-v3/abi/balancerBatchRouter.js +732 -0
  17. package/build/dex/balancer-v3/abi/balancerBatchRouter.js.map +1 -0
  18. package/build/dex/balancer-v3/abi/balancerRouter.d.ts +1406 -0
  19. package/build/dex/balancer-v3/abi/balancerRouter.js +1175 -0
  20. package/build/dex/balancer-v3/abi/balancerRouter.js.map +1 -0
  21. package/build/dex/balancer-v3/abi/vaultExtension.V3.d.ts +2081 -0
  22. package/build/dex/balancer-v3/abi/vaultExtension.V3.js +1851 -0
  23. package/build/dex/balancer-v3/abi/vaultExtension.V3.js.map +1 -0
  24. package/build/dex/balancer-v3/balancer-v3-sepolia-pools.d.ts +34 -0
  25. package/build/dex/balancer-v3/balancer-v3-sepolia-pools.js +406 -0
  26. package/build/dex/balancer-v3/balancer-v3-sepolia-pools.js.map +1 -0
  27. package/build/dex/bancor.d.ts +26 -0
  28. package/build/dex/bancor.js +58 -0
  29. package/build/dex/bancor.js.map +1 -0
  30. package/build/dex/bebop/bebop.d.ts +4 -4
  31. package/build/dex/bebop/bebop.js +11 -10
  32. package/build/dex/bebop/bebop.js.map +1 -1
  33. package/build/dex/bebop/rate-fetcher.js +0 -9
  34. package/build/dex/bebop/rate-fetcher.js.map +1 -1
  35. package/build/dex/compound.d.ts +18 -0
  36. package/build/dex/compound.js +46 -0
  37. package/build/dex/compound.js.map +1 -0
  38. package/build/dex/curve-v2.d.ts +58 -0
  39. package/build/dex/curve-v2.js +180 -0
  40. package/build/dex/curve-v2.js.map +1 -0
  41. package/build/dex/dodo-v1.d.ts +33 -0
  42. package/build/dex/dodo-v1.js +63 -0
  43. package/build/dex/dodo-v1.js.map +1 -0
  44. package/build/dex/inception/inception-event-pool.d.ts +4 -4
  45. package/build/dex/inception/inception-event-pool.js +7 -9
  46. package/build/dex/inception/inception-event-pool.js.map +1 -1
  47. package/build/dex/inception/inception.d.ts +6 -6
  48. package/build/dex/inception/inception.js +16 -40
  49. package/build/dex/inception/inception.js.map +1 -1
  50. package/build/dex/inception/utils.d.ts +1 -0
  51. package/build/dex/inception/utils.js +22 -1
  52. package/build/dex/inception/utils.js.map +1 -1
  53. package/build/dex/lido.d.ts +19 -0
  54. package/build/dex/lido.js +42 -0
  55. package/build/dex/lido.js.map +1 -0
  56. package/build/dex/maker-psm/scripts/gem.abi.json +136 -0
  57. package/build/dex/maker-psm/scripts/validate-state.d.ts +0 -0
  58. package/build/dex/maker-psm/scripts/validate-state.js +185 -0
  59. package/build/dex/maker-psm/scripts/validate-state.js.map +1 -0
  60. package/build/dex/maker-psm/scripts/vat.abi.json +243 -0
  61. package/build/dex/onebit.d.ts +25 -0
  62. package/build/dex/onebit.js +42 -0
  63. package/build/dex/onebit.js.map +1 -0
  64. package/build/dex/platypus/platypus.js +17 -3
  65. package/build/dex/platypus/platypus.js.map +1 -1
  66. package/build/dex/smoothy.d.ts +26 -0
  67. package/build/dex/smoothy.js +48 -0
  68. package/build/dex/smoothy.js.map +1 -0
  69. package/build/dex/solidly-v3/scripts/check-event-pool-event.d.ts +1 -0
  70. package/build/dex/solidly-v3/scripts/check-event-pool-event.js +53 -0
  71. package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +1 -0
  72. package/build/dex/stable-pool.d.ts +28 -0
  73. package/build/dex/stable-pool.js +55 -0
  74. package/build/dex/stable-pool.js.map +1 -0
  75. package/build/dex/stkgho/stkgho.js +4 -2
  76. package/build/dex/stkgho/stkgho.js.map +1 -1
  77. package/build/dex/swaap-v1/swaap-v1.js +4 -0
  78. package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
  79. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +7 -0
  80. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +20 -0
  81. package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +1 -0
  82. package/build/dex/trader-joe-v2.1.d.ts +43 -0
  83. package/build/dex/trader-joe-v2.1.js +79 -0
  84. package/build/dex/trader-joe-v2.1.js.map +1 -0
  85. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +17 -0
  86. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +64 -0
  87. package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +1 -0
  88. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +17 -0
  89. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +79 -0
  90. package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +1 -0
  91. package/build/dex/uniswap-v3/uniswap-v3-pricing.d.ts +4 -0
  92. package/build/dex/uniswap-v3/uniswap-v3-pricing.js +43 -0
  93. package/build/dex/uniswap-v3/uniswap-v3-pricing.js.map +1 -0
  94. package/build/dex/uniswap-v3/uniswap-v3-worker.d.ts +1 -0
  95. package/build/dex/uniswap-v3/uniswap-v3-worker.js +10 -0
  96. package/build/dex/uniswap-v3/uniswap-v3-worker.js.map +1 -0
  97. package/build/dex/usual/usual-m-smart-m.d.ts +17 -0
  98. package/build/dex/usual/usual-m-smart-m.js +50 -0
  99. package/build/dex/usual/usual-m-smart-m.js.map +1 -0
  100. package/build/dex/usual-m-smart-m/config.d.ts +3 -0
  101. package/build/dex/usual-m-smart-m/config.js +13 -0
  102. package/build/dex/usual-m-smart-m/config.js.map +1 -0
  103. package/build/dex/usual-m-smart-m/types.d.ts +7 -0
  104. package/build/dex/usual-m-smart-m/types.js +3 -0
  105. package/build/dex/usual-m-smart-m/types.js.map +1 -0
  106. package/build/dex/usual-m-smart-m/usual-m-smart-m.d.ts +35 -0
  107. package/build/dex/usual-m-smart-m/usual-m-smart-m.js +161 -0
  108. package/build/dex/usual-m-smart-m/usual-m-smart-m.js.map +1 -0
  109. package/build/dex/usual-m-usd0/config.d.ts +3 -0
  110. package/build/dex/usual-m-usd0/config.js +14 -0
  111. package/build/dex/usual-m-usd0/config.js.map +1 -0
  112. package/build/dex/usual-m-usd0/types.d.ts +8 -0
  113. package/build/dex/usual-m-usd0/types.js +3 -0
  114. package/build/dex/usual-m-usd0/types.js.map +1 -0
  115. package/build/dex/usual-m-usd0/usual-m-usd0.d.ts +35 -0
  116. package/build/dex/usual-m-usd0/usual-m-usd0.js +159 -0
  117. package/build/dex/usual-m-usd0/usual-m-usd0.js.map +1 -0
  118. package/package.json +1 -1
  119. package/src/dex/bebop/bebop.ts +18 -14
  120. package/src/dex/bebop/rate-fetcher.ts +2 -17
  121. package/src/dex/stkgho/stkgho.ts +4 -2
  122. package/build/abi/Aave_GSM.json +0 -751
  123. package/build/abi/Balancer.json +0 -257
  124. package/build/abi/BalancerV2.json +0 -1179
  125. package/build/abi/RamsesV2Pool.abi.json +0 -1554
  126. package/build/abi/RamsesV2Quoter.abi.json +0 -274
  127. package/build/abi/USDM.json +0 -807
  128. package/build/abi/UniswapV2Router.json +0 -397
  129. package/build/abi/angle-transmuter/ChainlinkEACAggregatorProxy.json +0 -509
  130. package/build/abi/curve-v1/CurveBUSDv2.abi.json +0 -1356
  131. package/build/abi/curve-v1/CurveTokenV1.json +0 -305
  132. package/build/abi/curve-v1/CurveTokenV2.json +0 -318
  133. package/build/abi/curve-v1/CurveV1StableNg.json +0 -1452
  134. package/build/abi/curve-v1/CurveV2Swap.json +0 -700
  135. package/build/abi/curve-v1/FactoryCryptoRegistry.json +0 -316
  136. package/build/abi/curve-v1/FactoryRegistry.json +0 -508
  137. package/build/abi/curve-v1/StableSwapAave.json +0 -1152
  138. package/build/abi/curve-v1/StableSwapBUSD.json +0 -814
  139. package/build/abi/curve-v1/StableSwapCompound.json +0 -814
  140. package/build/abi/curve-v1/StableSwapIDLE.json +0 -1253
  141. package/build/abi/curve-v1/StableSwapPax.json +0 -865
  142. package/build/abi/curve-v1/StableSwapSnow.json +0 -900
  143. package/build/abi/curve-v1/StableSwapUSDN.json +0 -1004
  144. package/build/abi/curve-v1/StableSwapUSDT.json +0 -814
  145. package/build/abi/curve-v1/StableSwapY.json +0 -814
  146. package/build/abi/inception/inception-ineth.json +0 -609
  147. package/build/abi/kyberdmm/kyber-storage.abi.json +0 -824
  148. package/build/abi/kyberdmm.abi.json +0 -1148
  149. package/build/abi/maverick-v2/MaverickV2Quoter.json +0 -278
  150. package/build/abi/nerve/nerve-metapool.json +0 -790
  151. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
  152. package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +0 -267
  153. package/build/dex/balancer-v1/balancer-pools.json +0 -33333
  154. package/build/dex/bebop/websocket-fetcher.d.ts +0 -35
  155. package/build/dex/bebop/websocket-fetcher.js +0 -87
  156. package/build/dex/bebop/websocket-fetcher.js.map +0 -1
  157. package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
  158. package/build/dex/idle-dao/idle-dao-pool.js +0 -176
  159. package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
  160. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
  161. package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
  162. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
  163. package/build/dex/idle-dao/scripts.d.ts +0 -9
  164. package/build/dex/idle-dao/scripts.js +0 -552
  165. package/build/dex/idle-dao/scripts.js.map +0 -1
  166. package/build/dex/inception/inception-native.d.ts +0 -43
  167. package/build/dex/inception/inception-native.js +0 -131
  168. package/build/dex/inception/inception-native.js.map +0 -1
  169. package/build/dex/inception/inception-pool.d.ts +0 -18
  170. package/build/dex/inception/inception-pool.js +0 -32
  171. package/build/dex/inception/inception-pool.js.map +0 -1
  172. package/build/dex/inception/inception-price-feed.d.ts +0 -19
  173. package/build/dex/inception/inception-price-feed.js +0 -51
  174. package/build/dex/inception/inception-price-feed.js.map +0 -1
  175. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -16
  176. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -16
  177. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -16
  178. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -16
  179. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -16
  180. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -16
  181. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -16
  182. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -16
  183. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -9
  184. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -9
  185. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -9
  186. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +0 -9
  187. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +0 -9
  188. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -9
  189. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +0 -9
  190. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +0 -9
  191. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +0 -9
  192. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -12
  193. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -7
  194. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -7
  195. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -7
  196. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -7
  197. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -12
  198. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +0 -7
  199. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +0 -7
  200. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -78
  201. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -81
  202. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -78
  203. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -78
  204. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -81
  205. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -81
  206. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -81
  207. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -81
  208. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -64
  209. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -85
  210. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -64
  211. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +0 -52
  212. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +0 -52
  213. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -52
  214. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +0 -55
  215. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +0 -55
  216. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +0 -55
  217. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -23
  218. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -37
  219. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -23
  220. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -23
  221. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -51
  222. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +0 -58
  223. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -23
  224. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -23
  225. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -9
  226. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -16
  227. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -23
  228. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -12
  229. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -7
  230. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -12
  231. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -12
  232. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -7
  233. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +0 -7
  234. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -7
  235. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -7
  236. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -7
  237. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -7
  238. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -130
  239. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -136
  240. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -100
  241. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -100
  242. package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -166
  243. package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +0 -190
  244. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -114
  245. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -114
  246. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -55
  247. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -73
  248. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -82
@@ -0,0 +1,159 @@
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.UsualMUsd01 = void 0;
30
+ const constants_1 = require("../../constants");
31
+ const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
32
+ const utils_1 = require("../../utils");
33
+ const simple_exchange_1 = require("../simple-exchange");
34
+ const config_1 = require("./config");
35
+ const abi_1 = require("@ethersproject/abi");
36
+ const usualCollateralDao_abi_json_1 = __importDefault(require("../../abi/usual-m-usd0/usualCollateralDao.abi.json"));
37
+ const bigint_constants_1 = require("../../bigint-constants");
38
+ class UsualMUsd01 extends simple_exchange_1.SimpleExchange {
39
+ constructor(network, dexKey, dexHelper) {
40
+ super(dexHelper, dexKey);
41
+ this.network = network;
42
+ this.dexKey = dexKey;
43
+ this.dexHelper = dexHelper;
44
+ this.hasConstantPriceLargeAmounts = true;
45
+ this.needWrapNative = false;
46
+ this.isFeeOnTransferSupported = false;
47
+ const config = config_1.UsualMUsd0Config[dexKey][network];
48
+ this.usualDaoCollateralIface = new abi_1.Interface(usualCollateralDao_abi_json_1.default);
49
+ this.config = {
50
+ usualMAddress: config.usualMAddress.toLowerCase(),
51
+ usd0Address: config.usd0Address.toLowerCase(),
52
+ usualDaoCollateralAddress: config.usualDaoCollateralAddress.toLowerCase(),
53
+ };
54
+ this.logger = dexHelper.getLogger(dexKey);
55
+ }
56
+ async initializePricing(blockNumber) {
57
+ // No initialization needed for constant price
58
+ }
59
+ getConfig() {
60
+ return this.config;
61
+ }
62
+ is_usualM(token) {
63
+ return token.toLowerCase() === this.config.usualMAddress.toLowerCase();
64
+ }
65
+ is_usd0(token) {
66
+ return token.toLowerCase() === this.config.usd0Address.toLowerCase();
67
+ }
68
+ is_usd0_swap_token(srcToken, destToken) {
69
+ return this.is_usualM(srcToken) && this.is_usd0(destToken);
70
+ }
71
+ getAdapters() {
72
+ return null;
73
+ }
74
+ async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
75
+ if (!srcToken || !destToken) {
76
+ this.logger.error('Source or destination token is undefined');
77
+ return [];
78
+ }
79
+ const srcTokenAddress = srcToken.address?.toLowerCase();
80
+ const destTokenAddress = destToken.address?.toLowerCase();
81
+ if (!srcTokenAddress || !destTokenAddress) {
82
+ this.logger.error('Source or destination token address is undefined');
83
+ return [];
84
+ }
85
+ if (this.is_usd0_swap_token(srcTokenAddress, destTokenAddress)) {
86
+ return [`${this.dexKey}_${this.config.usd0Address}`];
87
+ }
88
+ return [];
89
+ }
90
+ async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
91
+ if (side === constants_1.SwapSide.BUY) {
92
+ return null;
93
+ }
94
+ const isUsd0SwapToken = this.is_usd0_swap_token(srcToken.address, destToken.address);
95
+ if (!isUsd0SwapToken) {
96
+ return null;
97
+ }
98
+ const unitOut = bigint_constants_1.BI_POWS[18]; // 1:1 swap
99
+ const amountsOut = amounts; // 1:1 swap, so output amounts are the same as input
100
+ return [
101
+ {
102
+ unit: unitOut,
103
+ prices: amountsOut,
104
+ data: {},
105
+ poolAddresses: [this.config.usd0Address],
106
+ exchange: this.dexKey,
107
+ gasCost: 70000,
108
+ poolIdentifier: this.dexKey,
109
+ },
110
+ ];
111
+ }
112
+ getCalldataGasCost(poolPrices) {
113
+ return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
114
+ }
115
+ getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
116
+ const payload = '0x';
117
+ return {
118
+ targetExchange: this.config.usualMAddress,
119
+ payload,
120
+ networkFee: '0',
121
+ };
122
+ }
123
+ async getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
124
+ if (this.is_usualM(srcToken) && this.is_usd0(destToken)) {
125
+ const exchangeData = this.usualDaoCollateralIface.encodeFunctionData('swap', [srcToken, srcAmount, destAmount]);
126
+ return {
127
+ needWrapNative: false,
128
+ dexFuncHasRecipient: false,
129
+ exchangeData,
130
+ targetExchange: this.config.usualDaoCollateralAddress,
131
+ returnAmountPos: undefined,
132
+ };
133
+ }
134
+ throw new Error('LOGIC ERROR');
135
+ }
136
+ async getTopPoolsForToken(tokenAddress, limit) {
137
+ const isUsualM = this.is_usualM(tokenAddress);
138
+ if (!isUsualM && !this.is_usd0(tokenAddress))
139
+ return [];
140
+ return [
141
+ {
142
+ exchange: this.dexKey,
143
+ address: this.config.usualMAddress,
144
+ connectorTokens: [
145
+ {
146
+ decimals: isUsualM ? 6 : 18,
147
+ address: isUsualM
148
+ ? this.config.usd0Address
149
+ : this.config.usualMAddress,
150
+ },
151
+ ],
152
+ liquidityUSD: 1000000000, // Just returning a big number so this DEX will be preferred
153
+ },
154
+ ];
155
+ }
156
+ }
157
+ exports.UsualMUsd01 = UsualMUsd01;
158
+ UsualMUsd01.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.UsualMUsd0Config);
159
+ //# sourceMappingURL=usual-m-usd0.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usual-m-usd0.js","sourceRoot":"","sources":["../../../src/dex/usual-m-usd0/usual-m-usd0.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,+CAAoD;AACpD,2EAA6D;AAC7D,uCAAoD;AAIpD,wDAAoD;AACpD,qCAA4C;AAC5C,4CAA6D;AAC7D,qHAA0F;AAC1F,6DAAiD;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mBAAmB,CACvB,YAAqB,EACrB,KAAa;QAEb,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAC9C,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;YAAE,OAAO,EAAE,CAAC;QAExD,OAAO;YACL;gBACE,QAAQ,EAAE,IAAI,CAAC,MAAM;gBACrB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa;gBAClC,eAAe,EAAE;oBACf;wBACE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;wBAC3B,OAAO,EAAE,QAAQ;4BACf,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW;4BACzB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa;qBAC9B;iBACF;gBACD,YAAY,EAAE,UAAU,EAAE,4DAA4D;aACvF;SACF,CAAC;IACJ,CAAC;;AA9LH,kCA+LC;AAxLe,8BAAkB,GAC9B,IAAA,6BAAqB,EAAC,yBAAgB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraswap/dex-lib",
3
- "version": "4.0.20",
3
+ "version": "4.0.22-bebop-eth.0",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "repository": "https://github.com/paraswap/paraswap-dex-lib",
@@ -13,7 +13,7 @@ import {
13
13
  NumberAsString,
14
14
  DexExchangeParam,
15
15
  } from '../../types';
16
- import { SwapSide, Network, ETHER_ADDRESS } from '../../constants';
16
+ import { SwapSide, Network } from '../../constants';
17
17
  import * as CALLDATA_GAS_COST from '../../calldata-gas-cost';
18
18
  import { getDexKeysWithNetwork, Utils } from '../../utils';
19
19
  import { IDex } from '../../dex/idex';
@@ -56,11 +56,10 @@ import BigNumber from 'bignumber.js';
56
56
  import { getBigNumberPow } from '../../bignumber-constants';
57
57
  import { ethers, utils } from 'ethers';
58
58
  import qs from 'qs';
59
- import { isEqual } from 'lodash';
60
59
 
61
60
  export class Bebop extends SimpleExchange implements IDex<BebopData> {
62
61
  readonly hasConstantPriceLargeAmounts = false;
63
- readonly needWrapNative = false;
62
+ readonly needWrapNative = true;
64
63
 
65
64
  readonly isFeeOnTransferSupported = false;
66
65
  readonly isStatePollingDex = true;
@@ -186,11 +185,7 @@ export class Bebop extends SimpleExchange implements IDex<BebopData> {
186
185
  srcToken.address.toLowerCase(),
187
186
  destToken.address.toLowerCase(),
188
187
  ]);
189
- const nativeWrappedSet = new Set([
190
- this.dexHelper.config.data.wrappedNativeTokenAddress.toLowerCase(),
191
- ETHER_ADDRESS.toLowerCase(),
192
- ]);
193
- if (tokensSet.size < 2 || isEqual(tokensSet, nativeWrappedSet)) {
188
+ if (tokensSet.size < 2) {
194
189
  return [];
195
190
  }
196
191
 
@@ -281,11 +276,14 @@ export class Bebop extends SimpleExchange implements IDex<BebopData> {
281
276
  // across DEXes. It is recommended to use
282
277
  // ${dexKey}_${poolAddress} as a poolIdentifier
283
278
  async getPoolIdentifiers(
284
- srcToken: Token,
285
- destToken: Token,
279
+ _srcToken: Token,
280
+ _destToken: Token,
286
281
  side: SwapSide,
287
282
  blockNumber: number,
288
283
  ): Promise<string[]> {
284
+ const srcToken = this.dexHelper.config.wrapETH(_srcToken);
285
+ const destToken = this.dexHelper.config.wrapETH(_destToken);
286
+
289
287
  if (
290
288
  (await this.calculateInstructions(srcToken, destToken, side)).length > 0
291
289
  ) {
@@ -387,8 +385,8 @@ export class Bebop extends SimpleExchange implements IDex<BebopData> {
387
385
  // should be used. If limitPools is undefined then
388
386
  // any pools can be used.
389
387
  async getPricesVolume(
390
- srcToken: Token,
391
- destToken: Token,
388
+ _srcToken: Token,
389
+ _destToken: Token,
392
390
  amounts: bigint[],
393
391
  side: SwapSide,
394
392
  blockNumber: number,
@@ -399,6 +397,9 @@ export class Bebop extends SimpleExchange implements IDex<BebopData> {
399
397
  return null;
400
398
  }
401
399
 
400
+ const srcToken = this.dexHelper.config.wrapETH(_srcToken);
401
+ const destToken = this.dexHelper.config.wrapETH(_destToken);
402
+
402
403
  try {
403
404
  let pools = limitPools
404
405
  ? limitPools.filter(
@@ -696,14 +697,17 @@ export class Bebop extends SimpleExchange implements IDex<BebopData> {
696
697
 
697
698
  async preProcessTransaction(
698
699
  optimalSwapExchange: OptimalSwapExchange<BebopData>,
699
- srcToken: Token,
700
- destToken: Token,
700
+ _srcToken: Token,
701
+ _destToken: Token,
701
702
  side: SwapSide,
702
703
  options: PreprocessTransactionOptions,
703
704
  ): Promise<[OptimalSwapExchange<BebopData>, ExchangeTxInfo]> {
704
705
  const isSell = side === SwapSide.SELL;
705
706
  const isBuy = side === SwapSide.BUY;
706
707
 
708
+ const srcToken = this.dexHelper.config.wrapETH(_srcToken);
709
+ const destToken = this.dexHelper.config.wrapETH(_destToken);
710
+
707
711
  const params = {
708
712
  sell_tokens: utils.getAddress(srcToken.address),
709
713
  buy_tokens: utils.getAddress(destToken.address),
@@ -1,4 +1,4 @@
1
- import { ETHER_ADDRESS, Network } from '../../constants';
1
+ import { Network } from '../../constants';
2
2
  import { IDexHelper } from '../../dex-helper';
3
3
  import { Fetcher } from '../../lib/fetcher/fetcher';
4
4
  import { validateAndCast, ValidationError } from '../../lib/validators';
@@ -10,11 +10,7 @@ import {
10
10
  BebopRateFetcherConfig,
11
11
  BebopTokensResponse,
12
12
  } from './types';
13
- import {
14
- BebopPricingUpdate,
15
- pricesResponseValidator,
16
- tokensResponseValidator,
17
- } from './validators';
13
+ import { BebopPricingUpdate, tokensResponseValidator } from './validators';
18
14
  import { WebSocketFetcher } from '../../lib/fetcher/wsFetcher';
19
15
  import { utils } from 'ethers';
20
16
 
@@ -156,20 +152,9 @@ export class RateFetcher {
156
152
  }
157
153
 
158
154
  private handlePricesResponse(resp: BebopPricingResponse): void {
159
- const wethAddress =
160
- this.dexHelper.config.data.wrappedNativeTokenAddress.toLowerCase();
161
155
  const normalizedPrices: BebopPricingResponse = {};
162
156
  for (const [pair, levels] of Object.entries(resp)) {
163
157
  normalizedPrices[pair.toLowerCase()] = levels;
164
- const [base, quote] = pair.split('/');
165
- // Also enter native token prices. Pricing doesn't come with these
166
- if (
167
- base.toLowerCase() === wethAddress ||
168
- quote.toLowerCase() === wethAddress
169
- ) {
170
- const nativePair = pair.replace(base, ETHER_ADDRESS);
171
- normalizedPrices[nativePair.toLowerCase()] = levels;
172
- }
173
158
  }
174
159
 
175
160
  this.dexHelper.cache.setex(
@@ -195,8 +195,10 @@ export class StkGHO extends SimpleExchange implements IDex<StkGHOData> {
195
195
  limit: number,
196
196
  ): Promise<PoolLiquidity[]> {
197
197
  tokenAddress = tokenAddress.toLowerCase();
198
+ const isGHO = tokenAddress == this.config.GHO;
199
+ const isStkGHO = tokenAddress == this.config.stkGHO;
198
200
 
199
- if (tokenAddress == this.config.GHO) {
201
+ if (isGHO || isStkGHO) {
200
202
  return [
201
203
  {
202
204
  exchange: this.dexKey,
@@ -204,7 +206,7 @@ export class StkGHO extends SimpleExchange implements IDex<StkGHOData> {
204
206
  connectorTokens: [
205
207
  {
206
208
  decimals: 18,
207
- address: this.config.stkGHO,
209
+ address: isGHO ? this.config.stkGHO : this.config.GHO,
208
210
  },
209
211
  ],
210
212
  liquidityUSD: 1_000_000_000_000, // GHO to stkGHO supply is unlimited