@paraswap/dex-lib 4.1.24 → 4.2.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 (380) hide show
  1. package/build/constants.js +1 -1
  2. package/build/dex/index.js +2 -0
  3. package/build/dex/index.js.map +1 -1
  4. package/build/dex/uniswap-v4/constants.d.ts +1 -0
  5. package/build/dex/uniswap-v4/constants.js +3 -2
  6. package/build/dex/uniswap-v4/constants.js.map +1 -1
  7. package/build/dex/uniswap-v4/encoder.d.ts +1 -1
  8. package/build/dex/uniswap-v4/encoder.js +3 -2
  9. package/build/dex/uniswap-v4/encoder.js.map +1 -1
  10. package/build/dex/uniswap-v4/optimizer.d.ts +2 -0
  11. package/build/dex/uniswap-v4/optimizer.js +47 -0
  12. package/build/dex/uniswap-v4/optimizer.js.map +1 -0
  13. package/build/dex/uniswap-v4/subgraph.d.ts +2 -2
  14. package/build/dex/uniswap-v4/subgraph.js +42 -34
  15. package/build/dex/uniswap-v4/subgraph.js.map +1 -1
  16. package/build/dex/uniswap-v4/types.d.ts +10 -6
  17. package/build/dex/uniswap-v4/uniswap-v4-pool-manager.d.ts +4 -3
  18. package/build/dex/uniswap-v4/uniswap-v4-pool-manager.js +47 -33
  19. package/build/dex/uniswap-v4/uniswap-v4-pool-manager.js.map +1 -1
  20. package/build/dex/uniswap-v4/uniswap-v4-pool.d.ts +4 -5
  21. package/build/dex/uniswap-v4/uniswap-v4-pool.js +16 -3
  22. package/build/dex/uniswap-v4/uniswap-v4-pool.js.map +1 -1
  23. package/build/dex/uniswap-v4/uniswap-v4.d.ts +1 -0
  24. package/build/dex/uniswap-v4/uniswap-v4.js +34 -19
  25. package/build/dex/uniswap-v4/uniswap-v4.js.map +1 -1
  26. package/build/executor/ExecutorBytecodeBuilder.js +11 -0
  27. package/build/executor/ExecutorBytecodeBuilder.js.map +1 -1
  28. package/package.json +1 -1
  29. package/build/abi/AaveV1_lending_pool.json +0 -27
  30. package/build/abi/Aave_GSM.json +0 -751
  31. package/build/abi/BProtocol.json +0 -1155
  32. package/build/abi/Balancer.json +0 -257
  33. package/build/abi/BalancerV2.json +0 -1179
  34. package/build/abi/Jarvis.json +0 -1172
  35. package/build/abi/MStableAsset.json +0 -1545
  36. package/build/abi/OneInchLp.json +0 -1304
  37. package/build/abi/Onebit.json +0 -736
  38. package/build/abi/RamsesV2Pool.abi.json +0 -1554
  39. package/build/abi/RamsesV2Quoter.abi.json +0 -274
  40. package/build/abi/Shell.json +0 -1294
  41. package/build/abi/TraderJoeV2Router.json +0 -50
  42. package/build/abi/USDM.json +0 -807
  43. package/build/abi/UniswapV2Router.json +0 -397
  44. package/build/abi/angle-transmuter/ChainlinkAccessControlledOffchainAggregator.json +0 -1246
  45. package/build/abi/angle-transmuter/ChainlinkEACAggregatorProxy.json +0 -509
  46. package/build/abi/curve-v1/CurveBUSDv2.abi.json +0 -1356
  47. package/build/abi/curve-v1/CurveTokenV1.json +0 -305
  48. package/build/abi/curve-v1/CurveTokenV2.json +0 -318
  49. package/build/abi/curve-v1/CurveV1StableNg.json +0 -1452
  50. package/build/abi/curve-v1/CurveV2Swap.json +0 -700
  51. package/build/abi/curve-v1/FactoryCryptoRegistry.json +0 -316
  52. package/build/abi/curve-v1/FactoryRegistry.json +0 -508
  53. package/build/abi/curve-v1/StableSwapAave.json +0 -1152
  54. package/build/abi/curve-v1/StableSwapBUSD.json +0 -814
  55. package/build/abi/curve-v1/StableSwapCompound.json +0 -814
  56. package/build/abi/curve-v1/StableSwapIDLE.json +0 -1253
  57. package/build/abi/curve-v1/StableSwapPax.json +0 -865
  58. package/build/abi/curve-v1/StableSwapSnow.json +0 -900
  59. package/build/abi/curve-v1/StableSwapUSDN.json +0 -1004
  60. package/build/abi/curve-v1/StableSwapUSDT.json +0 -814
  61. package/build/abi/curve-v1/StableSwapY.json +0 -814
  62. package/build/abi/inception/inception-ineth-pool.json +0 -1062
  63. package/build/abi/inception/inception-ineth.json +0 -609
  64. package/build/abi/inception/inception-ratio-feed.json +0 -329
  65. package/build/abi/inception/inception-vault.json +0 -991
  66. package/build/abi/kyberdmm/kyber-storage.abi.json +0 -824
  67. package/build/abi/kyberdmm.abi.json +0 -1148
  68. package/build/abi/maverick-v2/MaverickV2Quoter.json +0 -278
  69. package/build/abi/nerve/nerve-metapool.json +0 -790
  70. package/build/abi/platypus/asset.json +0 -490
  71. package/build/abi/platypus/avax-pool.json +0 -820
  72. package/build/abi/platypus/oracle.json +0 -119
  73. package/build/abi/platypus/pool.json +0 -677
  74. package/build/abi/smardex/all/smardex-router.json +0 -648
  75. package/build/abi/smardex/layer-1/smardex-factory.json +0 -242
  76. package/build/abi/smardex/layer-1/smardex-pool.json +0 -506
  77. package/build/abi/smardex/layer-2/smardex-factory.json +0 -185
  78. package/build/abi/smardex/layer-2/smardex-pool.json +0 -578
  79. package/build/abi/swaap-v1/pool.json +0 -1346
  80. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
  81. package/build/abi/velodrome-slipstream/VelodromeSlipstreamQuoterV2.abi.json +0 -267
  82. package/build/abi/wUSDM.json +0 -757
  83. package/build/abi/zrx.v2.json +0 -1967
  84. package/build/abi/zrx.v3.json +0 -3454
  85. package/build/abi/zrx.v4.json +0 -2193
  86. package/build/dex/OneInchLp.d.ts +0 -24
  87. package/build/dex/OneInchLp.js +0 -43
  88. package/build/dex/OneInchLp.js.map +0 -1
  89. package/build/dex/aave-v1/aave-v1.d.ts +0 -34
  90. package/build/dex/aave-v1/aave-v1.js +0 -180
  91. package/build/dex/aave-v1/aave-v1.js.map +0 -1
  92. package/build/dex/aave-v1/config.d.ts +0 -11
  93. package/build/dex/aave-v1/config.js +0 -20
  94. package/build/dex/aave-v1/config.js.map +0 -1
  95. package/build/dex/aave-v1/tokens-mainnet.json +0 -134
  96. package/build/dex/aave-v1/tokens.d.ts +0 -3
  97. package/build/dex/aave-v1/tokens.js +0 -50
  98. package/build/dex/aave-v1/tokens.js.map +0 -1
  99. package/build/dex/aave-v1/types.d.ts +0 -12
  100. package/build/dex/aave-v1/types.js +0 -3
  101. package/build/dex/aave-v1/types.js.map +0 -1
  102. package/build/dex/bProtocol/bProtocol.d.ts +0 -15
  103. package/build/dex/bProtocol/bProtocol.js +0 -56
  104. package/build/dex/bProtocol/bProtocol.js.map +0 -1
  105. package/build/dex/bProtocol/types.d.ts +0 -11
  106. package/build/dex/bProtocol/types.js +0 -8
  107. package/build/dex/bProtocol/types.js.map +0 -1
  108. package/build/dex/balancer-v1/balancer-pools.json +0 -33333
  109. package/build/dex/bebop/websocket-fetcher.d.ts +0 -35
  110. package/build/dex/bebop/websocket-fetcher.js +0 -87
  111. package/build/dex/bebop/websocket-fetcher.js.map +0 -1
  112. package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
  113. package/build/dex/idle-dao/idle-dao-pool.js +0 -176
  114. package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
  115. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
  116. package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
  117. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
  118. package/build/dex/idle-dao/scripts.d.ts +0 -9
  119. package/build/dex/idle-dao/scripts.js +0 -552
  120. package/build/dex/idle-dao/scripts.js.map +0 -1
  121. package/build/dex/inception/config.d.ts +0 -4
  122. package/build/dex/inception/config.js +0 -109
  123. package/build/dex/inception/config.js.map +0 -1
  124. package/build/dex/inception/inception-event-pool.d.ts +0 -16
  125. package/build/dex/inception/inception-event-pool.js +0 -51
  126. package/build/dex/inception/inception-event-pool.js.map +0 -1
  127. package/build/dex/inception/inception-native.d.ts +0 -43
  128. package/build/dex/inception/inception-native.js +0 -131
  129. package/build/dex/inception/inception-native.js.map +0 -1
  130. package/build/dex/inception/inception-pool.d.ts +0 -18
  131. package/build/dex/inception/inception-pool.js +0 -32
  132. package/build/dex/inception/inception-pool.js.map +0 -1
  133. package/build/dex/inception/inception-price-feed.d.ts +0 -19
  134. package/build/dex/inception/inception-price-feed.js +0 -51
  135. package/build/dex/inception/inception-price-feed.js.map +0 -1
  136. package/build/dex/inception/inception.d.ts +0 -43
  137. package/build/dex/inception/inception.js +0 -204
  138. package/build/dex/inception/inception.js.map +0 -1
  139. package/build/dex/inception/tokens.d.ts +0 -9
  140. package/build/dex/inception/tokens.js +0 -28
  141. package/build/dex/inception/tokens.js.map +0 -1
  142. package/build/dex/inception/types.d.ts +0 -22
  143. package/build/dex/inception/types.js +0 -3
  144. package/build/dex/inception/types.js.map +0 -1
  145. package/build/dex/inception/utils.d.ts +0 -6
  146. package/build/dex/inception/utils.js +0 -37
  147. package/build/dex/inception/utils.js.map +0 -1
  148. package/build/dex/jarvis.d.ts +0 -56
  149. package/build/dex/jarvis.js +0 -163
  150. package/build/dex/jarvis.js.map +0 -1
  151. package/build/dex/mStable.d.ts +0 -44
  152. package/build/dex/mStable.js +0 -75
  153. package/build/dex/mStable.js.map +0 -1
  154. package/build/dex/onebit/onebit.d.ts +0 -16
  155. package/build/dex/onebit/onebit.js +0 -61
  156. package/build/dex/onebit/onebit.js.map +0 -1
  157. package/build/dex/onebit/types.d.ts +0 -14
  158. package/build/dex/onebit/types.js +0 -8
  159. package/build/dex/onebit/types.js.map +0 -1
  160. package/build/dex/platypus/asset.d.ts +0 -14
  161. package/build/dex/platypus/asset.js +0 -97
  162. package/build/dex/platypus/asset.js.map +0 -1
  163. package/build/dex/platypus/config.d.ts +0 -11
  164. package/build/dex/platypus/config.js +0 -69
  165. package/build/dex/platypus/config.js.map +0 -1
  166. package/build/dex/platypus/platypus.d.ts +0 -63
  167. package/build/dex/platypus/platypus.js +0 -473
  168. package/build/dex/platypus/platypus.js.map +0 -1
  169. package/build/dex/platypus/pool-avax.d.ts +0 -8
  170. package/build/dex/platypus/pool-avax.js +0 -54
  171. package/build/dex/platypus/pool-avax.js.map +0 -1
  172. package/build/dex/platypus/pool-base.d.ts +0 -19
  173. package/build/dex/platypus/pool-base.js +0 -86
  174. package/build/dex/platypus/pool-base.js.map +0 -1
  175. package/build/dex/platypus/pool-pure.d.ts +0 -8
  176. package/build/dex/platypus/pool-pure.js +0 -37
  177. package/build/dex/platypus/pool-pure.js.map +0 -1
  178. package/build/dex/platypus/pool-subscriber.d.ts +0 -14
  179. package/build/dex/platypus/pool-subscriber.js +0 -167
  180. package/build/dex/platypus/pool-subscriber.js.map +0 -1
  181. package/build/dex/platypus/pool.d.ts +0 -8
  182. package/build/dex/platypus/pool.js +0 -58
  183. package/build/dex/platypus/pool.js.map +0 -1
  184. package/build/dex/platypus/types.d.ts +0 -92
  185. package/build/dex/platypus/types.js +0 -10
  186. package/build/dex/platypus/types.js.map +0 -1
  187. package/build/dex/quickswap/spiritswap-v3.d.ts +0 -6
  188. package/build/dex/quickswap/spiritswap-v3.js +0 -19
  189. package/build/dex/quickswap/spiritswap-v3.js.map +0 -1
  190. package/build/dex/shell.d.ts +0 -25
  191. package/build/dex/shell.js +0 -41
  192. package/build/dex/shell.js.map +0 -1
  193. package/build/dex/smardex/config.d.ts +0 -4
  194. package/build/dex/smardex/config.js +0 -64
  195. package/build/dex/smardex/config.js.map +0 -1
  196. package/build/dex/smardex/constants.d.ts +0 -18
  197. package/build/dex/smardex/constants.js +0 -33
  198. package/build/dex/smardex/constants.js.map +0 -1
  199. package/build/dex/smardex/sdk/constants.d.ts +0 -6
  200. package/build/dex/smardex/sdk/constants.js +0 -13
  201. package/build/dex/smardex/sdk/constants.js.map +0 -1
  202. package/build/dex/smardex/sdk/core.d.ts +0 -113
  203. package/build/dex/smardex/sdk/core.js +0 -499
  204. package/build/dex/smardex/sdk/core.js.map +0 -1
  205. package/build/dex/smardex/sdk/errors.d.ts +0 -15
  206. package/build/dex/smardex/sdk/errors.js +0 -22
  207. package/build/dex/smardex/sdk/errors.js.map +0 -1
  208. package/build/dex/smardex/sdk/types.d.ts +0 -62
  209. package/build/dex/smardex/sdk/types.js +0 -3
  210. package/build/dex/smardex/sdk/types.js.map +0 -1
  211. package/build/dex/smardex/sdk/utils.d.ts +0 -44
  212. package/build/dex/smardex/sdk/utils.js +0 -133
  213. package/build/dex/smardex/sdk/utils.js.map +0 -1
  214. package/build/dex/smardex/smardex-event-pool.d.ts +0 -28
  215. package/build/dex/smardex/smardex-event-pool.js +0 -119
  216. package/build/dex/smardex/smardex-event-pool.js.map +0 -1
  217. package/build/dex/smardex/smardex.d.ts +0 -65
  218. package/build/dex/smardex/smardex.js +0 -519
  219. package/build/dex/smardex/smardex.js.map +0 -1
  220. package/build/dex/smardex/types.d.ts +0 -55
  221. package/build/dex/smardex/types.js +0 -3
  222. package/build/dex/smardex/types.js.map +0 -1
  223. package/build/dex/solidly/forks-override/cone.d.ts +0 -22
  224. package/build/dex/solidly/forks-override/cone.js +0 -53
  225. package/build/dex/solidly/forks-override/cone.js.map +0 -1
  226. package/build/dex/solidly/forks-override/solisnek.d.ts +0 -8
  227. package/build/dex/solidly/forks-override/solisnek.js +0 -15
  228. package/build/dex/solidly/forks-override/solisnek.js.map +0 -1
  229. package/build/dex/swaap-v1/config.d.ts +0 -17
  230. package/build/dex/swaap-v1/config.js +0 -56
  231. package/build/dex/swaap-v1/config.js.map +0 -1
  232. package/build/dex/swaap-v1/constants.d.ts +0 -6
  233. package/build/dex/swaap-v1/constants.js +0 -17
  234. package/build/dex/swaap-v1/constants.js.map +0 -1
  235. package/build/dex/swaap-v1/libraries/ChainlinkUtils.d.ts +0 -25
  236. package/build/dex/swaap-v1/libraries/ChainlinkUtils.js +0 -62
  237. package/build/dex/swaap-v1/libraries/ChainlinkUtils.js.map +0 -1
  238. package/build/dex/swaap-v1/libraries/Const.d.ts +0 -18
  239. package/build/dex/swaap-v1/libraries/Const.js +0 -26
  240. package/build/dex/swaap-v1/libraries/Const.js.map +0 -1
  241. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.d.ts +0 -77
  242. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js +0 -316
  243. package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js.map +0 -1
  244. package/build/dex/swaap-v1/libraries/LogExpMath.d.ts +0 -75
  245. package/build/dex/swaap-v1/libraries/LogExpMath.js +0 -418
  246. package/build/dex/swaap-v1/libraries/LogExpMath.js.map +0 -1
  247. package/build/dex/swaap-v1/libraries/MathMMM.d.ts +0 -185
  248. package/build/dex/swaap-v1/libraries/MathMMM.js +0 -453
  249. package/build/dex/swaap-v1/libraries/MathMMM.js.map +0 -1
  250. package/build/dex/swaap-v1/libraries/Num.d.ts +0 -31
  251. package/build/dex/swaap-v1/libraries/Num.js +0 -167
  252. package/build/dex/swaap-v1/libraries/Num.js.map +0 -1
  253. package/build/dex/swaap-v1/libraries/PoolQuotations.d.ts +0 -23
  254. package/build/dex/swaap-v1/libraries/PoolQuotations.js +0 -131
  255. package/build/dex/swaap-v1/libraries/PoolQuotations.js.map +0 -1
  256. package/build/dex/swaap-v1/libraries/Struct.d.ts +0 -56
  257. package/build/dex/swaap-v1/libraries/Struct.js +0 -3
  258. package/build/dex/swaap-v1/libraries/Struct.js.map +0 -1
  259. package/build/dex/swaap-v1/swaap-v1-pool.d.ts +0 -45
  260. package/build/dex/swaap-v1/swaap-v1-pool.js +0 -656
  261. package/build/dex/swaap-v1/swaap-v1-pool.js.map +0 -1
  262. package/build/dex/swaap-v1/swaap-v1.d.ts +0 -62
  263. package/build/dex/swaap-v1/swaap-v1.js +0 -379
  264. package/build/dex/swaap-v1/swaap-v1.js.map +0 -1
  265. package/build/dex/swaap-v1/types.d.ts +0 -106
  266. package/build/dex/swaap-v1/types.js +0 -9
  267. package/build/dex/swaap-v1/types.js.map +0 -1
  268. package/build/dex/trader-joe-v2.d.ts +0 -40
  269. package/build/dex/trader-joe-v2.js +0 -74
  270. package/build/dex/trader-joe-v2.js.map +0 -1
  271. package/build/dex/usual-bond/config.d.ts +0 -3
  272. package/build/dex/usual-bond/config.js +0 -13
  273. package/build/dex/usual-bond/config.js.map +0 -1
  274. package/build/dex/usual-bond/types.d.ts +0 -7
  275. package/build/dex/usual-bond/types.js +0 -3
  276. package/build/dex/usual-bond/types.js.map +0 -1
  277. package/build/dex/usual-bond/usual-bond.d.ts +0 -35
  278. package/build/dex/usual-bond/usual-bond.js +0 -176
  279. package/build/dex/usual-bond/usual-bond.js.map +0 -1
  280. package/build/dex/wusdm/config.d.ts +0 -3
  281. package/build/dex/wusdm/config.js +0 -43
  282. package/build/dex/wusdm/config.js.map +0 -1
  283. package/build/dex/wusdm/constants.d.ts +0 -2
  284. package/build/dex/wusdm/constants.js +0 -6
  285. package/build/dex/wusdm/constants.js.map +0 -1
  286. package/build/dex/wusdm/types.d.ts +0 -18
  287. package/build/dex/wusdm/types.js +0 -11
  288. package/build/dex/wusdm/types.js.map +0 -1
  289. package/build/dex/wusdm/wusdm-pool.d.ts +0 -21
  290. package/build/dex/wusdm/wusdm-pool.js +0 -74
  291. package/build/dex/wusdm/wusdm-pool.js.map +0 -1
  292. package/build/dex/wusdm/wusdm.d.ts +0 -46
  293. package/build/dex/wusdm/wusdm.js +0 -243
  294. package/build/dex/wusdm/wusdm.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/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -16
  308. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -16
  309. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -16
  310. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -16
  311. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -16
  312. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -16
  313. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -16
  314. package/build/executor/fixtures/executor01/exchange-params/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -16
  315. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -9
  316. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -9
  317. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -9
  318. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-eth-steth.json +0 -9
  319. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-steth-eth.json +0 -9
  320. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -9
  321. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-eth-usdc.json +0 -9
  322. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-eth.json +0 -9
  323. package/build/executor/fixtures/executor01/exchange-params/price-route-simpleSwap-univ3-usdc-usdt.json +0 -9
  324. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -12
  325. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -7
  326. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -7
  327. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -7
  328. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -7
  329. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -12
  330. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-eth-usdc.json +0 -7
  331. package/build/executor/fixtures/executor01/maybe-weth-calldata/price-route-simpleSwap-univ3-usdc-eth.json +0 -7
  332. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-curvev1-eth-usdc-gusd.json +0 -78
  333. package/build/executor/fixtures/executor01/routes/price-route-multiswap-balancerv1-sushiv3-wbtc-eth-sushi.json +0 -81
  334. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-eth-usdc-gusd.json +0 -78
  335. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-curvev1-gusd-usdc-eth.json +0 -78
  336. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-dai-usdc-eth.json +0 -81
  337. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-eth-usdc-dai.json +0 -81
  338. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdc-eth-wbtc.json +0 -81
  339. package/build/executor/fixtures/executor01/routes/price-route-multiswap-sushiv3-usdt-usdc-dai.json +0 -81
  340. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-eth-usdc.json +0 -64
  341. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-eth.json +0 -85
  342. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-balancerv1-usdc-wbtc.json +0 -64
  343. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-eth-steth.json +0 -52
  344. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-steth-eth.json +0 -52
  345. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-curvev1-usdc-usdt.json +0 -52
  346. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-eth-usdc.json +0 -55
  347. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-eth.json +0 -55
  348. package/build/executor/fixtures/executor01/routes/price-route-simpleSwap-univ3-usdc-usdt.json +0 -55
  349. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -23
  350. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -37
  351. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -23
  352. package/build/executor/fixtures/executor02/exchange-params/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -23
  353. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -51
  354. package/build/executor/fixtures/executor02/exchange-params/price-route-multiswap-univ3-usdt-dai-eth.json +0 -58
  355. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -23
  356. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -23
  357. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -9
  358. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -16
  359. package/build/executor/fixtures/executor02/exchange-params/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -23
  360. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -12
  361. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -7
  362. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -12
  363. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -12
  364. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -7
  365. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-multiswap-univ3-usdt-dai-eth.json +0 -7
  366. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -7
  367. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -7
  368. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -7
  369. package/build/executor/fixtures/executor02/maybe-weth-calldata/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -7
  370. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-balancerv1-sushiv3-univ3-bal-eth-sushi.json +0 -130
  371. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-maverickv1-sushiv3-univ3-eth-usdc-mav.json +0 -136
  372. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-sushi-eth-wbtc.json +0 -100
  373. package/build/executor/fixtures/executor02/routes/price-route-multiSwap-univ3-sushiv3-wbtc-eth-sushi.json +0 -100
  374. package/build/executor/fixtures/executor02/routes/price-route-multiswap-curvev1-univ3-dai-usdc-eth.json +0 -166
  375. package/build/executor/fixtures/executor02/routes/price-route-multiswap-univ3-usdt-dai-eth.json +0 -190
  376. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-eth-usdc.json +0 -114
  377. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-balancerv1-usdc-eth.json +0 -114
  378. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-eth-sushi.json +0 -55
  379. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-sushiv3-univ3-sushi-eth.json +0 -73
  380. package/build/executor/fixtures/executor02/routes/price-route-simpleSwap-univ3-curvev1-usdt-dai.json +0 -82
@@ -1,316 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GeometricBrownianMotion = void 0;
4
- const Const_1 = require("./Const");
5
- const Num_1 = require("./Num");
6
- const LogExpMath_1 = require("./LogExpMath");
7
- const ChainlinkUtils_1 = require("./ChainlinkUtils");
8
- class GeometricBrownianMotion {
9
- /**
10
- * @notice Gets asset-pair approximate historical return's mean and variance
11
- * @param latestRoundIn The round-to-start-from's data including its ID of tokenIn
12
- * @param latestRoundOut The round-to-start-from's data including its ID of tokenOut
13
- * @param hpParameters The parameters for historical prices retrieval
14
- * @return gbmEstimation The asset-pair historical return's mean and variance
15
- */
16
- static getParametersEstimation(latestRoundIn, latestRoundOut, hpParameters, historicalOracleStateIn, historicalOracleStateOut) {
17
- // retrieve historical prices of tokenIn
18
- let [pricesIn, timestampsIn, startIndexIn, noMoreDataPointIn] = GeometricBrownianMotion.getHistoricalPrices(latestRoundIn, hpParameters, historicalOracleStateIn);
19
- if (!noMoreDataPointIn && startIndexIn < hpParameters.lookbackInRound - 1) {
20
- return {
21
- mean: 0n,
22
- variance: 0n,
23
- success: false,
24
- };
25
- }
26
- let reducedLookbackInSecCandidate = hpParameters.timestamp - timestampsIn[startIndexIn];
27
- if (reducedLookbackInSecCandidate < hpParameters.lookbackInSec) {
28
- hpParameters.lookbackInSec = reducedLookbackInSecCandidate;
29
- }
30
- // retrieve historical prices of tokenOut
31
- let [pricesOut, timestampsOut, startIndexOut, noMoreDataPointOut] = GeometricBrownianMotion.getHistoricalPrices(latestRoundOut, hpParameters, historicalOracleStateOut);
32
- if (!noMoreDataPointOut &&
33
- startIndexOut < hpParameters.lookbackInRound - 1) {
34
- return {
35
- mean: 0n,
36
- variance: 0n,
37
- success: false,
38
- };
39
- }
40
- return GeometricBrownianMotion._getParametersEstimation(noMoreDataPointIn && noMoreDataPointOut, { startIndex: startIndexIn, timestamps: timestampsIn, prices: pricesIn }, {
41
- startIndex: startIndexOut,
42
- timestamps: timestampsOut,
43
- prices: pricesOut,
44
- }, hpParameters);
45
- }
46
- /**
47
- * @notice Gets asset-pair historical data return's mean and variance
48
- * @param noMoreDataPoints True if and only if the retrieved data span over the whole time window of interest
49
- * @param hpDataIn Historical prices data of tokenIn
50
- * @param hpDataOut Historical prices data of tokenOut
51
- * @param hpParameters The parameters for historical prices retrieval
52
- * @return gbmEstimation The asset-pair historical return's mean and variance
53
- */
54
- static _getParametersEstimation(noMoreDataPoints, hpDataIn, hpDataOut, hpParameters) {
55
- // no price return can be calculated with only 1 data point
56
- if (hpDataIn.startIndex == 0 && hpDataOut.startIndex == 0) {
57
- return {
58
- mean: 0n,
59
- variance: 0n,
60
- success: true,
61
- };
62
- }
63
- if (noMoreDataPoints) {
64
- let ts = hpParameters.timestamp - hpParameters.lookbackInSec;
65
- hpDataIn.timestamps[hpDataIn.startIndex] = ts;
66
- hpDataOut.timestamps[hpDataOut.startIndex] = ts;
67
- }
68
- else {
69
- GeometricBrownianMotion.consolidateStartIndices(hpDataIn, hpDataOut);
70
- // no price return can be calculated with only 1 data point
71
- if (hpDataIn.startIndex == 0 && hpDataOut.startIndex == 0) {
72
- return {
73
- mean: 0n,
74
- variance: 0n,
75
- success: true,
76
- };
77
- }
78
- }
79
- let [values, timestamps] = GeometricBrownianMotion.getSeries(hpDataIn.prices, hpDataIn.timestamps, hpDataIn.startIndex, hpDataOut.prices, hpDataOut.timestamps, hpDataOut.startIndex);
80
- let [mean, variance] = GeometricBrownianMotion.getStatistics(values, timestamps);
81
- return {
82
- mean: mean,
83
- variance: variance,
84
- success: true,
85
- };
86
- }
87
- /**
88
- * @notice Gets asset-pair historical prices with timestamps
89
- * @param pricesIn The historical prices of tokenIn
90
- * @param timestampsIn The timestamps corresponding to the tokenIn's historical prices
91
- * @param startIndexIn The tokenIn historical data's last valid index
92
- * @param pricesOut The tokenIn historical data's last valid index
93
- * @param timestampsOut The timestamps corresponding to the tokenOut's historical prices
94
- * @param startIndexOut The tokenOut historical data's last valid index
95
- * @return values The asset-pair historical prices array
96
- * @return timestamps The asset-pair historical timestamps array
97
- */
98
- static getSeries(pricesIn, timestampsIn, startIndexIn, pricesOut, timestampsOut, startIndexOut) {
99
- let values, timestamps;
100
- // compute the number of returns
101
- let count = 1;
102
- {
103
- let _startIndexIn = startIndexIn;
104
- let _startIndexOut = startIndexOut;
105
- let skip = true;
106
- while (_startIndexIn > 0 || _startIndexOut > 0) {
107
- [skip, _startIndexIn, _startIndexOut] =
108
- GeometricBrownianMotion.getNextSample(_startIndexIn, _startIndexOut, timestampsIn, timestampsOut);
109
- if (!skip) {
110
- count += 1;
111
- }
112
- }
113
- values = new Array(count);
114
- timestamps = new Array(count);
115
- values[0] = Num_1.Num.div(pricesOut[startIndexOut], pricesIn[startIndexIn]);
116
- timestamps[0] =
117
- Num_1.Num.max(timestampsOut[startIndexOut], timestampsIn[startIndexIn]) *
118
- Const_1.Const.ONE;
119
- }
120
- // compute actual returns
121
- {
122
- count = 1;
123
- let skip = true;
124
- while (startIndexIn > 0 || startIndexOut > 0) {
125
- [skip, startIndexIn, startIndexOut] =
126
- GeometricBrownianMotion.getNextSample(startIndexIn, startIndexOut, timestampsIn, timestampsOut);
127
- if (!skip) {
128
- values[count] = Num_1.Num.div(pricesOut[startIndexOut], pricesIn[startIndexIn]);
129
- timestamps[count] =
130
- Num_1.Num.max(timestampsOut[startIndexOut], timestampsIn[startIndexIn]) *
131
- Const_1.Const.ONE;
132
- count += 1;
133
- }
134
- }
135
- }
136
- return [values, timestamps];
137
- }
138
- /**
139
- * @notice Gets asset-pair historical mean/variance from timestamped data
140
- * @param values The historical values
141
- * @param timestamps The corresponding time deltas, in seconds
142
- * @return mean The asset-pair historical return's mean
143
- * @return variance asset-pair historical return's variance
144
- */
145
- static getStatistics(values, timestamps) {
146
- let n = values.length;
147
- if (n < 2) {
148
- return [0n, 0n];
149
- }
150
- n -= 1;
151
- let tWithPrecision = timestamps[n] - timestamps[0];
152
- // mean
153
- let mean = Num_1.Num.divInt256(LogExpMath_1.LogExpMath.ln(Num_1.Num.divInt256(values[n], values[0])), tWithPrecision);
154
- let meanSquare;
155
- if (mean < 0) {
156
- meanSquare = Num_1.Num.mul(-mean, -mean);
157
- }
158
- else {
159
- meanSquare = Num_1.Num.mul(mean, mean);
160
- }
161
- // variance
162
- let variance = -Num_1.Num.mul(meanSquare, tWithPrecision);
163
- for (let i = 1; i <= n; i++) {
164
- let d = LogExpMath_1.LogExpMath.ln(Num_1.Num.divInt256(values[i], values[i - 1]));
165
- if (d < 0) {
166
- d = -d;
167
- }
168
- let dAbs = d;
169
- variance += Num_1.Num.div(Num_1.Num.mul(dAbs, dAbs), timestamps[i] - timestamps[i - 1]);
170
- }
171
- variance = Num_1.Num.divInt256(variance, BigInt(n) * Const_1.Const.ONE);
172
- return [mean, Num_1.Num.positivePart(variance)];
173
- }
174
- /**
175
- * @notice Gets historical prices from a Chainlink data feed
176
- * @dev Few specificities:
177
- * - it filters out round data with null price or timestamp
178
- * - it stops filling the prices/timestamps when:
179
- * a) hpParameters.lookbackInRound rounds have already been found
180
- * b) time window induced by hpParameters.lookbackInSec is no more satisfied
181
- * @param latestRound The round-to-start-from's data including its ID
182
- * @param hpParameters The parameters for historical prices retrieval
183
- * @return historicalPrices The historical prices of a token
184
- * @return historicalTimestamps The timestamps of the reported prices
185
- * @return index The last valid index of the returned arrays
186
- * @return noMoreDataPoints True if the reported historical prices reaches the lookback time limit
187
- */
188
- static getHistoricalPrices(latestRound, hpParameters, historicalOracleState) {
189
- let latestTimestamp = latestRound.timestamp;
190
- // historical price endtimestamp >= lookback window or it reverts
191
- let timeLimit = Num_1.Num.sub(hpParameters.timestamp, hpParameters.lookbackInSec);
192
- // result variables
193
- let prices = new Array(hpParameters.lookbackInRound);
194
- let timestamps = new Array(hpParameters.lookbackInRound);
195
- let idx = 1;
196
- {
197
- prices[0] = latestRound.price; // is supposed to be well valid
198
- timestamps[0] = latestTimestamp; // is supposed to be well valid
199
- if (latestTimestamp < timeLimit) {
200
- return [prices, timestamps, 0, true];
201
- }
202
- let count = 1;
203
- // buffer variables
204
- let _roundId = latestRound.roundId;
205
- while (_roundId >= hpParameters.lookbackStepInRound &&
206
- count < hpParameters.lookbackInRound) {
207
- _roundId -= hpParameters.lookbackStepInRound;
208
- let [_price, _timestamp] = ChainlinkUtils_1.ChainlinkUtils.getRoundData(_roundId, historicalOracleState);
209
- if (_price > 0 && _timestamp > 0) {
210
- prices[idx] = _price;
211
- timestamps[idx] = _timestamp;
212
- idx += 1;
213
- if (_timestamp < timeLimit) {
214
- return [prices, timestamps, idx - 1, true];
215
- }
216
- }
217
- count += 1;
218
- }
219
- }
220
- return [prices, timestamps, idx - 1, false];
221
- }
222
- /**
223
- * @notice Finds the next data point in chronological order
224
- * @dev Few considerations:
225
- * - data point with same timestamp as previous point are tagged with a 'skip=true'
226
- * - when we reach the last point of a token, we consider it's value constant going forward with the other token
227
- * As a result the variance of those returns will be underestimated.
228
- * @param startIndexIn The tokenIn historical data's last valid index
229
- * @param startIndexOut The tokenOut historical data's last valid index
230
- * @param timestampsIn The timestamps corresponding to the tokenIn's historical prices
231
- * @param timestampsOut The timestamps corresponding to the tokenOut's historical prices
232
- * @return skip The 'skip' tag
233
- * @return startIndexIn The updated startIndexIn
234
- * @return startIndexOut The updated startIndexOut
235
- */
236
- static getNextSample(startIndexIn, startIndexOut, timestampsIn, timestampsOut) {
237
- let skip = true;
238
- let nextStartIndexIn = startIndexIn > 0 ? startIndexIn - 1 : startIndexIn;
239
- let nextStartIndexOut = startIndexOut > 0 ? startIndexOut - 1 : startIndexOut;
240
- if (timestampsIn[nextStartIndexIn] == timestampsOut[nextStartIndexOut]) {
241
- if (timestampsIn[nextStartIndexIn] != timestampsIn[startIndexIn] &&
242
- timestampsOut[nextStartIndexOut] != timestampsOut[startIndexOut]) {
243
- skip = false;
244
- }
245
- if (startIndexIn > 0) {
246
- startIndexIn--;
247
- }
248
- if (startIndexOut > 0) {
249
- startIndexOut--;
250
- }
251
- }
252
- else {
253
- if (startIndexOut == 0) {
254
- if (timestampsIn[nextStartIndexIn] != timestampsIn[startIndexIn]) {
255
- skip = false;
256
- }
257
- if (startIndexIn > 0) {
258
- startIndexIn--;
259
- }
260
- }
261
- else if (startIndexIn == 0) {
262
- if (timestampsOut[nextStartIndexOut] != timestampsOut[startIndexOut]) {
263
- skip = false;
264
- }
265
- if (startIndexOut > 0) {
266
- startIndexOut--;
267
- }
268
- }
269
- else {
270
- if (timestampsIn[nextStartIndexIn] < timestampsOut[nextStartIndexOut]) {
271
- if (timestampsIn[nextStartIndexIn] != timestampsIn[startIndexIn]) {
272
- skip = false;
273
- }
274
- if (startIndexIn > 0) {
275
- startIndexIn--;
276
- }
277
- }
278
- else {
279
- if (timestampsOut[nextStartIndexOut] != timestampsOut[startIndexOut]) {
280
- skip = false;
281
- }
282
- if (startIndexOut > 0) {
283
- startIndexOut--;
284
- }
285
- }
286
- }
287
- }
288
- return [skip, startIndexIn, startIndexOut];
289
- }
290
- /**
291
- * @notice Consolidate the last valid indexes of tokenIn and tokenOut
292
- * @param hpDataIn Historical prices data of tokenIn
293
- * @param hpDataOut Historical prices data of tokenOut
294
- */
295
- static consolidateStartIndices(hpDataIn, hpDataOut) {
296
- // trim prices/timestamps by adjusting startIndexes
297
- if (hpDataIn.timestamps[hpDataIn.startIndex] >
298
- hpDataOut.timestamps[hpDataOut.startIndex]) {
299
- while (hpDataOut.startIndex > 0 &&
300
- hpDataOut.timestamps[hpDataOut.startIndex - 1] <=
301
- hpDataIn.timestamps[hpDataIn.startIndex]) {
302
- --hpDataOut.startIndex;
303
- }
304
- }
305
- else if (hpDataIn.timestamps[hpDataIn.startIndex] <
306
- hpDataOut.timestamps[hpDataOut.startIndex]) {
307
- while (hpDataIn.startIndex > 0 &&
308
- hpDataIn.timestamps[hpDataIn.startIndex - 1] <=
309
- hpDataOut.timestamps[hpDataOut.startIndex]) {
310
- --hpDataIn.startIndex;
311
- }
312
- }
313
- }
314
- }
315
- exports.GeometricBrownianMotion = GeometricBrownianMotion;
316
- //# sourceMappingURL=GeometricBrownianMotion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GeometricBrownianMotion.js","sourceRoot":"","sources":["../../../../src/dex/swaap-v1/libraries/GeometricBrownianMotion.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,+BAA4B;AAC5B,6CAA0C;AAE1C,qDAAkD;AAGlD,MAAa,uBAAuB;IAClC;;;;;;OAMG;IACH,MAAM,CAAC,uBAAuB,CAC5B,aAAiC,EACjC,cAAkC,EAClC,YAA+C,EAC/C,uBAAsC,EACtC,wBAAuC;QAEvC,wCAAwC;QACxC,IAAI,CAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,iBAAiB,CAAC,GAC3D,uBAAuB,CAAC,mBAAmB,CACzC,aAAa,EACb,YAAY,EACZ,uBAAuB,CACxB,CAAC;QACJ,IAAI,CAAC,iBAAiB,IAAI,YAAY,GAAG,YAAY,CAAC,eAAe,GAAG,CAAC,EAAE;YACzE,OAAO;gBACL,IAAI,EAAE,EAAE;gBACR,QAAQ,EAAE,EAAE;gBACZ,OAAO,EAAE,KAAK;aACf,CAAC;SACH;QAED,IAAI,6BAA6B,GAC/B,YAAY,CAAC,SAAS,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;QACtD,IAAI,6BAA6B,GAAG,YAAY,CAAC,aAAa,EAAE;YAC9D,YAAY,CAAC,aAAa,GAAG,6BAA6B,CAAC;SAC5D;QAED,yCAAyC;QACzC,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,CAAC,GAC/D,uBAAuB,CAAC,mBAAmB,CACzC,cAAc,EACd,YAAY,EACZ,wBAAwB,CACz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,CAAC,UAAU,CAAC,EAC1C;gBACA,EAAE,SAAS,CAAC,UAAU,CAAC;aACxB;SACF;aAAM,IACL,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC;YACxC,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,EAC1C;YACA,OACE,QAAQ,CAAC,UAAU,GAAG,CAAC;gBACvB,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,GAAG,CAAC,CAAC;oBAC1C,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,EAC5C;gBACA,EAAE,QAAQ,CAAC,UAAU,CAAC;aACvB;SACF;IACH,CAAC;CACF;AAzaD,0DAyaC"}
@@ -1,75 +0,0 @@
1
- /**
2
- * @dev Exponentiation and logarithm functions for 18 decimal fixed point numbers (both base and exponent/argument).
3
- *
4
- * Exponentiation and logarithm with arbitrary bases (x^y and log_x(y)) are implemented by conversion to natural
5
- * exponentiation and logarithm (where the base is Euler's number).
6
- *
7
- * @author Fernando Martinelli - @fernandomartinelli
8
- * @author Sergio Yuhjtman - @sergioyuhjtman
9
- * @author Daniel Fernandez - @dmf7z
10
- */
11
- export declare class LogExpMath {
12
- static ONE_18: bigint;
13
- static ONE_20: bigint;
14
- static ONE_36: bigint;
15
- static MAX_NATURAL_EXPONENT: bigint;
16
- static MIN_NATURAL_EXPONENT: bigint;
17
- static LN_36_LOWER_BOUND: bigint;
18
- static LN_36_UPPER_BOUND: bigint;
19
- static MILD_EXPONENT_BOUND: bigint;
20
- static x0: bigint;
21
- static a0: bigint;
22
- static x1: bigint;
23
- static a1: bigint;
24
- static x2: bigint;
25
- static a2: bigint;
26
- static x3: bigint;
27
- static a3: bigint;
28
- static x4: bigint;
29
- static a4: bigint;
30
- static x5: bigint;
31
- static a5: bigint;
32
- static x6: bigint;
33
- static a6: bigint;
34
- static x7: bigint;
35
- static a7: bigint;
36
- static x8: bigint;
37
- static a8: bigint;
38
- static x9: bigint;
39
- static a9: bigint;
40
- static x10: bigint;
41
- static a10: bigint;
42
- static x11: bigint;
43
- static a11: bigint;
44
- /**
45
- * @dev Exponentiation (x^y) with unsigned 18 decimal fixed point base and exponent.
46
- *
47
- * Reverts if ln(x) * y is smaller than `MIN_NATURAL_EXPONENT`, or larger than `MAX_NATURAL_EXPONENT`.
48
- */
49
- static pow(x: bigint, y: bigint): bigint;
50
- /**
51
- * @dev Natural exponentiation (e^x) with signed 18 decimal fixed point exponent.
52
- *
53
- * Reverts if `x` is smaller than MIN_NATURAL_EXPONENT, or larger than `MAX_NATURAL_EXPONENT`.
54
- */
55
- static exp(x: bigint): bigint;
56
- /**
57
- * @dev Logarithm (log(arg, base), with signed 18 decimal fixed point base and argument.
58
- */
59
- static log(arg: bigint, base: bigint): bigint;
60
- /**
61
- * @dev Natural logarithm (ln(a)) with signed 18 decimal fixed point argument.
62
- */
63
- static ln(a: bigint): bigint;
64
- /**
65
- * @dev Internal natural logarithm (ln(a)) with signed 18 decimal fixed point argument.
66
- */
67
- static _ln(a: bigint): bigint;
68
- /**
69
- * @dev Intrnal high precision (36 decimal places) natural logarithm (ln(x)) with signed 18 decimal fixed point argument,
70
- * for x close to one.
71
- *
72
- * Should only be used if x is between LN_36_LOWER_BOUND and LN_36_UPPER_BOUND.
73
- */
74
- static _ln_36(x: bigint): bigint;
75
- }