@gearbox-protocol/sdk 1.22.4 → 1.23.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 (283) hide show
  1. package/lib/apy/convexAPY.d.ts +10 -10
  2. package/lib/apy/convexAPY.js +100 -121
  3. package/lib/apy/curveAPY.d.ts +3 -4
  4. package/lib/apy/curveAPY.js +57 -111
  5. package/lib/apy/index.js +4 -6
  6. package/lib/apy/lidoAPY.d.ts +1 -2
  7. package/lib/apy/lidoAPY.js +14 -62
  8. package/lib/apy/yearnAPY.d.ts +2 -3
  9. package/lib/apy/yearnAPY.js +26 -82
  10. package/lib/contracts/contracts.js +9 -22
  11. package/lib/contracts/contractsRegister.js +39 -51
  12. package/lib/contracts/protocols.js +10 -11
  13. package/lib/core/adapter.js +9 -4
  14. package/lib/core/assets.d.ts +6 -7
  15. package/lib/core/assets.js +60 -70
  16. package/lib/core/chains.js +30 -80
  17. package/lib/core/constants.d.ts +9 -10
  18. package/lib/core/constants.js +9 -12
  19. package/lib/core/creditAccount.d.ts +20 -20
  20. package/lib/core/creditAccount.js +123 -134
  21. package/lib/core/creditAccount.spec.js +50 -52
  22. package/lib/core/creditManager.d.ts +26 -26
  23. package/lib/core/creditManager.js +172 -136
  24. package/lib/core/creditManager.spec.js +59 -61
  25. package/lib/core/creditSession.d.ts +12 -13
  26. package/lib/core/creditSession.js +120 -77
  27. package/lib/core/errors.d.ts +2 -3
  28. package/lib/core/errors.js +11 -27
  29. package/lib/core/eventOrTx.js +35 -73
  30. package/lib/core/events.d.ts +19 -20
  31. package/lib/core/events.js +698 -711
  32. package/lib/core/operations.js +11 -5
  33. package/lib/core/pool/data.d.ts +29 -29
  34. package/lib/core/pool/data.js +153 -112
  35. package/lib/core/pool/operation.d.ts +1 -2
  36. package/lib/core/pool/operation.js +23 -35
  37. package/lib/core/priceOracle.d.ts +6 -6
  38. package/lib/core/priceOracle.js +23 -29
  39. package/lib/core/rewardClaimer.d.ts +2 -2
  40. package/lib/core/rewardClaimer.js +5 -48
  41. package/lib/core/rewardConvex.js +54 -114
  42. package/lib/core/rewardConvex.spec.js +41 -43
  43. package/lib/core/strategy.d.ts +5 -6
  44. package/lib/core/strategy.js +67 -69
  45. package/lib/core/strategy.spec.js +32 -34
  46. package/lib/core/tokenDistributor.d.ts +1 -2
  47. package/lib/core/trade.d.ts +6 -6
  48. package/lib/core/trade.js +70 -115
  49. package/lib/core/transactions.d.ts +21 -22
  50. package/lib/core/transactions.js +285 -308
  51. package/lib/index.d.ts +0 -2
  52. package/lib/index.js +0 -2
  53. package/lib/oracles/oracles.d.ts +1 -2
  54. package/lib/oracles/priceFeeds.js +2 -3
  55. package/lib/parsers/ERC20Parser.js +20 -38
  56. package/lib/parsers/abstractParser.js +33 -31
  57. package/lib/parsers/addressProviderParser.js +12 -30
  58. package/lib/parsers/airdropDistributorParser.js +12 -30
  59. package/lib/parsers/convexBaseRewardPoolAdapterParser.js +24 -42
  60. package/lib/parsers/convexBaseRewardPoolAdapterParser.spec.js +11 -11
  61. package/lib/parsers/convexBoosterAdapterParser.js +26 -44
  62. package/lib/parsers/convexBoosterAdapterParser.spec.js +10 -10
  63. package/lib/parsers/convextRewardPoolParser.js +12 -30
  64. package/lib/parsers/creditFacadeParser.js +26 -45
  65. package/lib/parsers/creditFacadeParser.spec.js +13 -13
  66. package/lib/parsers/creditManagerParser.js +12 -30
  67. package/lib/parsers/curveAdapterParser.js +60 -78
  68. package/lib/parsers/curveAdapterParser.spec.js +20 -27
  69. package/lib/parsers/dataCompressorParser.js +12 -30
  70. package/lib/parsers/lidoAdapterParser.js +15 -33
  71. package/lib/parsers/lidoAdapterParser.spec.js +9 -9
  72. package/lib/parsers/lidoOracleParser.js +12 -30
  73. package/lib/parsers/lidoSTETHParser.js +19 -37
  74. package/lib/parsers/multicallParser.js +16 -34
  75. package/lib/parsers/offchainOracleParser.js +13 -31
  76. package/lib/parsers/poolParser.js +11 -29
  77. package/lib/parsers/priceOracleParser.js +13 -31
  78. package/lib/parsers/txParser.js +86 -96
  79. package/lib/parsers/uniV2AdapterParser.js +35 -55
  80. package/lib/parsers/uniV2AdapterParser.spec.js +15 -16
  81. package/lib/parsers/uniV3AdapterParser.js +56 -74
  82. package/lib/parsers/uniV3AdapterParser.spec.js +23 -24
  83. package/lib/parsers/wstETHAdapterParser.js +25 -43
  84. package/lib/parsers/wstETHAdapterParser.spec.js +11 -11
  85. package/lib/parsers/yearnAdapterParser.spec.js +17 -17
  86. package/lib/parsers/yearnV2AdapterParser.js +25 -43
  87. package/lib/pathfinder/core.d.ts +3 -4
  88. package/lib/pathfinder/pathOptions.js +52 -101
  89. package/lib/pathfinder/pathOptions.spec.js +55 -57
  90. package/lib/pathfinder/pathfinder.d.ts +3 -3
  91. package/lib/pathfinder/pathfinder.js +109 -202
  92. package/lib/pathfinder/pathfinder.spec.js +13 -13
  93. package/lib/strategies/convex.js +111 -123
  94. package/lib/strategies/creditFacade.js +34 -37
  95. package/lib/strategies/curve.js +74 -80
  96. package/lib/strategies/lido.js +26 -32
  97. package/lib/strategies/uniswapV2.js +21 -24
  98. package/lib/strategies/uniswapV3.js +33 -36
  99. package/lib/strategies/yearn.js +47 -59
  100. package/lib/tokens/balancer.js +3 -5
  101. package/lib/tokens/convex.js +14 -29
  102. package/lib/tokens/curveLP.js +22 -28
  103. package/lib/tokens/gear.js +1 -1
  104. package/lib/tokens/normal.js +3 -5
  105. package/lib/tokens/token.js +29 -35
  106. package/lib/tokens/tokenData.d.ts +0 -9
  107. package/lib/tokens/tokenData.js +17 -15
  108. package/lib/tokens/yearn.js +3 -5
  109. package/lib/types/factories/@chainlink/contracts/src/v0.8/interfaces/AggregatorInterface__factory.js +9 -12
  110. package/lib/types/factories/@chainlink/contracts/src/v0.8/interfaces/AggregatorV2V3Interface__factory.js +9 -12
  111. package/lib/types/factories/@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface__factory.js +9 -12
  112. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IACL.sol/IACLEvents__factory.js +9 -12
  113. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IACL.sol/IACLExceptions__factory.js +9 -12
  114. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IACL.sol/IACL__factory.js +9 -12
  115. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAccountFactory.sol/IAccountFactoryEvents__factory.js +9 -12
  116. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAccountFactory.sol/IAccountFactoryGetters__factory.js +9 -12
  117. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAccountFactory.sol/IAccountFactory__factory.js +9 -12
  118. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAddressProvider.sol/IAddressProviderEvents__factory.js +9 -12
  119. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAddressProvider.sol/IAddressProvider__factory.js +9 -12
  120. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAirdropDistributor.sol/IAirdropDistributorEvents__factory.js +9 -12
  121. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAirdropDistributor.sol/IAirdropDistributor__factory.js +9 -12
  122. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IContractsRegister.sol/IContractsRegisterEvents__factory.js +9 -12
  123. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IContractsRegister.sol/IContractsRegister__factory.js +9 -12
  124. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditAccount.sol/ICrediAccountExceptions__factory.js +9 -12
  125. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditAccount.sol/ICreditAccount__factory.js +9 -12
  126. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditConfigurator.sol/ICreditConfiguratorEvents__factory.js +9 -12
  127. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditConfigurator.sol/ICreditConfiguratorExceptions__factory.js +9 -12
  128. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditConfigurator.sol/ICreditConfigurator__factory.js +9 -12
  129. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeEvents__factory.js +9 -12
  130. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeExceptions__factory.js +9 -12
  131. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeExtended__factory.js +9 -12
  132. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacade__factory.js +9 -12
  133. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditManagerV2.sol/ICreditManagerV2Events__factory.js +9 -12
  134. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditManagerV2.sol/ICreditManagerV2Exceptions__factory.js +9 -12
  135. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditManagerV2.sol/ICreditManagerV2__factory.js +9 -12
  136. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDataCompressor.sol/IDataCompressorExceptions__factory.js +9 -12
  137. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDataCompressor.sol/IDataCompressor__factory.js +9 -12
  138. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDegenDistributor.sol/IDegenDistributorEvents__factory.js +9 -12
  139. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDegenDistributor.sol/IDegenDistributor__factory.js +9 -12
  140. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDegenNFT.sol/IDegenNFTEvents__factory.js +9 -12
  141. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDegenNFT.sol/IDegenNFTExceptions__factory.js +9 -12
  142. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDegenNFT.sol/IDegenNFT__factory.js +9 -12
  143. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDieselToken.sol/IDieselTokenExceptions__factory.js +9 -12
  144. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IDieselToken.sol/IDieselToken__factory.js +9 -12
  145. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IInterestRateModel__factory.js +9 -12
  146. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ILPPriceFeed.sol/ILPPriceFeedEvents__factory.js +9 -12
  147. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ILPPriceFeed.sol/ILPPriceFeedExceptions__factory.js +9 -12
  148. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ILPPriceFeed.sol/ILPPriceFeed__factory.js +9 -12
  149. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPhantomERC20__factory.js +9 -12
  150. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPoolService.sol/IPoolServiceEvents__factory.js +9 -12
  151. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPoolService.sol/IPoolService__factory.js +9 -12
  152. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPriceFeedType__factory.js +9 -12
  153. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2Events__factory.js +9 -12
  154. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2Exceptions__factory.js +9 -12
  155. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2Ext__factory.js +9 -12
  156. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2__factory.js +9 -12
  157. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IVersion__factory.js +9 -12
  158. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IWETHGateway__factory.js +9 -12
  159. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/V1/ICreditFilter__factory.js +9 -12
  160. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/V1/ICreditManager__factory.js +9 -12
  161. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/adapters/IAdapter.sol/IAdapterExceptions__factory.js +9 -12
  162. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/adapters/IAdapter.sol/IAdapter__factory.js +9 -12
  163. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/adapters/IUniversalAdapter.sol/IUniversalAdapterExceptions__factory.js +9 -12
  164. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/adapters/IUniversalAdapter.sol/IUniversalAdapter__factory.js +9 -12
  165. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/external/IWETH__factory.js +9 -12
  166. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/pool/PoolService__factory.js +27 -50
  167. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/test/interfaces/ITokenTestSuite__factory.js +9 -12
  168. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IBaseRewardPool__factory.js +9 -12
  169. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IBooster__factory.js +9 -12
  170. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IClaimZap__factory.js +9 -12
  171. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IConvexToken__factory.js +9 -12
  172. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IRewards.sol/IBasicRewards__factory.js +9 -12
  173. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IRewards.sol/IRewards__factory.js +9 -12
  174. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/ICrvDeposit__factory.js +9 -12
  175. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/ICurveGauge__factory.js +9 -12
  176. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/ICurveVoteEscrow__factory.js +9 -12
  177. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IDeposit__factory.js +9 -12
  178. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IFeeDistro__factory.js +9 -12
  179. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IMinter__factory.js +9 -12
  180. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IPools__factory.js +9 -12
  181. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IRegistry__factory.js +9 -12
  182. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IRewardFactory__factory.js +9 -12
  183. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IRewards__factory.js +9 -12
  184. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IStaker__factory.js +9 -12
  185. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IStashFactory__factory.js +9 -12
  186. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IStash__factory.js +9 -12
  187. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/ITokenFactory__factory.js +9 -12
  188. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/ITokenMinter__factory.js +9 -12
  189. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IVestedEscrow__factory.js +9 -12
  190. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IVoting__factory.js +9 -12
  191. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/convex/Interfaces.sol/IWalletChecker__factory.js +9 -12
  192. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurvePoolStETH__factory.js +9 -12
  193. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurvePool_2.sol/ICurvePool2Assets__factory.js +9 -12
  194. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurvePool_3.sol/ICurvePool3Assets__factory.js +9 -12
  195. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurvePool_4.sol/ICurvePool4Assets__factory.js +9 -12
  196. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurvePool__factory.js +9 -12
  197. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/curve/ICurveRegistry__factory.js +9 -12
  198. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/ILidoOracle__factory.js +9 -12
  199. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IstETH.sol/IstETHGetters__factory.js +9 -12
  200. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IstETH.sol/IstETH__factory.js +9 -12
  201. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IwstETH.sol/IwstETHGetters__factory.js +9 -12
  202. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IwstETH.sol/IwstETH__factory.js +9 -12
  203. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IwstETHGateway.sol/IwstETHGateWay__factory.js +9 -12
  204. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/uniswap/IQuoter__factory.js +9 -12
  205. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/uniswap/IUniswapV2Router01__factory.js +9 -12
  206. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/uniswap/IUniswapV2Router02__factory.js +9 -12
  207. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/uniswap/IUniswapV3.sol/ISwapRouter__factory.js +9 -12
  208. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/integrations/yearn/IYVault__factory.js +9 -12
  209. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/convex/IConvexV1BaseRewardPoolAdapter.sol/IConvexV1BaseRewardPoolAdapterErrors__factory.js +9 -12
  210. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/convex/IConvexV1BaseRewardPoolAdapter.sol/IConvexV1BaseRewardPoolAdapter__factory.js +9 -12
  211. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/convex/IConvexV1BoosterAdapter__factory.js +9 -12
  212. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/curve/ICurveV1Adapter.sol/ICurveV1AdapterExceptions__factory.js +9 -12
  213. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/curve/ICurveV1Adapter.sol/ICurveV1Adapter__factory.js +9 -12
  214. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/curve/ICurveV1_2AssetsAdapter__factory.js +9 -12
  215. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/curve/ICurveV1_3AssetsAdapter__factory.js +9 -12
  216. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/curve/ICurveV1_4AssetsAdapter__factory.js +9 -12
  217. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/lido/ILidoV1Adapter.sol/ILidoV1AdapterEvents__factory.js +9 -12
  218. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/lido/ILidoV1Adapter.sol/ILidoV1AdapterExceptions__factory.js +9 -12
  219. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/lido/ILidoV1Adapter.sol/ILidoV1Adapter__factory.js +9 -12
  220. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/lido/IwstETHV1Adapter__factory.js +9 -12
  221. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/uniswap/IUniswapPathChecker__factory.js +9 -12
  222. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/uniswap/IUniswapV2Adapter.sol/IUniswapV2AdapterExceptions__factory.js +9 -12
  223. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/uniswap/IUniswapV2Adapter.sol/IUniswapV2Adapter__factory.js +9 -12
  224. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/uniswap/IUniswapV3Adapter.sol/IUniswapV3AdapterExceptions__factory.js +9 -12
  225. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/uniswap/IUniswapV3Adapter.sol/IUniswapV3Adapter__factory.js +9 -12
  226. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/interfaces/yearn/IYearnV2Adapter__factory.js +9 -12
  227. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/test/config/SupportedContracts.sol/ISupportedContracts__factory.js +9 -12
  228. package/lib/types/factories/@gearbox-protocol/integrations-v2/contracts/test/mocks/integrations/LidoMock.sol/ILidoMockEvents__factory.js +9 -12
  229. package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IClosePathResolver__factory.js +9 -12
  230. package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IDepositor.sol/IDepositorOptions__factory.js +9 -12
  231. package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IDepositor.sol/IDepositor__factory.js +9 -12
  232. package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IGasPricer__factory.js +9 -12
  233. package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/ILPWorker.sol/ILPWorkerOptions__factory.js +9 -12
  234. package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/ILPWorker.sol/ILPWorker__factory.js +9 -12
  235. package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IPathResolver__factory.js +9 -12
  236. package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IRouterComponent__factory.js +9 -12
  237. package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IRouter__factory.js +9 -12
  238. package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/ISwapAggregator__factory.js +9 -12
  239. package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/ISwapper__factory.js +9 -12
  240. package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IWithdrawer.sol/IWithdrawerOptions__factory.js +9 -12
  241. package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IWithdrawer.sol/IWithdrawer__factory.js +9 -12
  242. package/lib/types/factories/@gearbox-protocol/router/contracts/interfaces/IWrapper__factory.js +9 -12
  243. package/lib/types/factories/@openzeppelin/contracts/token/ERC20/IERC20__factory.js +9 -12
  244. package/lib/types/factories/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata__factory.js +9 -12
  245. package/lib/types/factories/@openzeppelin/contracts/token/ERC721/IERC721Receiver__factory.js +9 -12
  246. package/lib/types/factories/@openzeppelin/contracts/token/ERC721/IERC721__factory.js +9 -12
  247. package/lib/types/factories/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata__factory.js +9 -12
  248. package/lib/types/factories/@openzeppelin/contracts/utils/introspection/IERC165__factory.js +9 -12
  249. package/lib/types/factories/contracts/IGas__factory.js +9 -12
  250. package/lib/types/factories/contracts/IGnosisSafeSignatureValidator__factory.js +9 -12
  251. package/lib/types/factories/contracts/ITokenDistributor.sol/ITokenDistributorEvents__factory.js +9 -12
  252. package/lib/types/factories/contracts/ITokenDistributor.sol/ITokenDistributorExceptions__factory.js +9 -12
  253. package/lib/types/factories/contracts/ITokenDistributor.sol/ITokenDistributor__factory.js +9 -12
  254. package/lib/types/factories/contracts/support/IOffchainOracle__factory.js +9 -12
  255. package/lib/types/factories/contracts/support/MultiCall.sol/Multicall2__factory.js +27 -50
  256. package/lib/utils/errors.js +1 -1
  257. package/lib/utils/extracter.js +4 -4
  258. package/lib/utils/formatter.d.ts +8 -8
  259. package/lib/utils/formatter.js +73 -87
  260. package/lib/utils/loading.js +3 -3
  261. package/lib/utils/mappers.js +7 -34
  262. package/lib/utils/math.d.ts +10 -7
  263. package/lib/utils/math.js +22 -25
  264. package/lib/utils/multicall.js +32 -98
  265. package/lib/utils/price.d.ts +3 -4
  266. package/lib/utils/price.js +8 -20
  267. package/lib/utils/repeater.js +12 -53
  268. package/lib/utils/validate.js +2 -2
  269. package/lib/watchers/creditAccountWatcher.js +136 -237
  270. package/lib/watchers/creditAccountWatcher.spec.js +51 -68
  271. package/lib/watchers/creditManagerWatcher.js +21 -71
  272. package/lib/watchers/creditManagerWatcher.spec.js +20 -23
  273. package/package.json +2 -2
  274. package/lib/core/history.d.ts +0 -42
  275. package/lib/core/history.js +0 -2
  276. package/lib/core/wcOperation/abstractOperations.d.ts +0 -23
  277. package/lib/core/wcOperation/abstractOperations.js +0 -39
  278. package/lib/core/wcOperation/index.d.ts +0 -11
  279. package/lib/core/wcOperation/index.js +0 -30
  280. package/lib/core/wcOperation/operations.d.ts +0 -88
  281. package/lib/core/wcOperation/operations.js +0 -146
  282. package/lib/core/wcOperation/types.d.ts +0 -15
  283. package/lib/core/wcOperation/types.js +0 -2
@@ -1,46 +1,28 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.LidoAdapterParser = void 0;
19
- var types_1 = require("../types");
20
- var abstractParser_1 = require("./abstractParser");
21
- var LidoAdapterParser = /** @class */ (function (_super) {
22
- __extends(LidoAdapterParser, _super);
23
- function LidoAdapterParser(contract, isContract) {
24
- var _this = _super.call(this, contract) || this;
25
- _this.ifc = types_1.ILidoV1Adapter__factory.createInterface();
4
+ const types_1 = require("../types");
5
+ const abstractParser_1 = require("./abstractParser");
6
+ class LidoAdapterParser extends abstractParser_1.AbstractParser {
7
+ constructor(contract, isContract) {
8
+ super(contract);
9
+ this.ifc = types_1.ILidoV1Adapter__factory.createInterface();
26
10
  if (!isContract)
27
- _this.adapterName = "LidoV1Adapter";
28
- return _this;
11
+ this.adapterName = "LidoV1Adapter";
29
12
  }
30
- LidoAdapterParser.prototype.parse = function (calldata) {
31
- var _a = this.parseSelector(calldata), functionFragment = _a.functionFragment, functionName = _a.functionName;
13
+ parse(calldata) {
14
+ const { functionFragment, functionName } = this.parseSelector(calldata);
32
15
  switch (functionFragment.name) {
33
16
  case "submit": {
34
- var amount = this.decodeFunctionData(functionFragment, calldata)[0];
35
- return "".concat(functionName, "(amount: ").concat(this.formatBN(amount, "STETH"), ")");
17
+ const [amount] = this.decodeFunctionData(functionFragment, calldata);
18
+ return `${functionName}(amount: ${this.formatBN(amount, "STETH")})`;
36
19
  }
37
20
  case "submitAll": {
38
- return "".concat(functionName, "()");
21
+ return `${functionName}()`;
39
22
  }
40
23
  default:
41
- return "".concat(functionName, ": Unknown operation ").concat(functionFragment.name, " with calldata ").concat(calldata);
24
+ return `${functionName}: Unknown operation ${functionFragment.name} with calldata ${calldata}`;
42
25
  }
43
- };
44
- return LidoAdapterParser;
45
- }(abstractParser_1.AbstractParser));
26
+ }
27
+ }
46
28
  exports.LidoAdapterParser = LidoAdapterParser;
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var chai_1 = require("chai");
4
- var constants_1 = require("../core/constants");
5
- var types_1 = require("../types");
6
- var lidoAdapterParser_1 = require("./lidoAdapterParser");
7
- describe("LidoAdapterParser test", function () {
8
- it("submit & submitAll function works well", function () {
9
- var parser = new lidoAdapterParser_1.LidoAdapterParser("LIDO_STETH_GATEWAY", false);
10
- var ifc = types_1.ILidoV1Adapter__factory.createInterface();
11
- var parsed = parser.parse(ifc.encodeFunctionData("submit", [constants_1.WAD.mul(1020)]));
3
+ const chai_1 = require("chai");
4
+ const constants_1 = require("../core/constants");
5
+ const types_1 = require("../types");
6
+ const lidoAdapterParser_1 = require("./lidoAdapterParser");
7
+ describe("LidoAdapterParser test", () => {
8
+ it("submit & submitAll function works well", () => {
9
+ let parser = new lidoAdapterParser_1.LidoAdapterParser("LIDO_STETH_GATEWAY", false);
10
+ const ifc = types_1.ILidoV1Adapter__factory.createInterface();
11
+ let parsed = parser.parse(ifc.encodeFunctionData("submit", [constants_1.WAD * 1020n]));
12
12
  (0, chai_1.expect)(parsed).to.be.eq("LidoV1Adapter[LIDO_STETH_GATEWAY].submit(amount: 1.02K [1020000000000000000000])", "Incorrect parse submit(amount)");
13
13
  parser = new lidoAdapterParser_1.LidoAdapterParser("LIDO_STETH_GATEWAY", true);
14
14
  parsed = parser.parse(ifc.encodeFunctionData("submitAll"));
@@ -1,39 +1,21 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.LidoOracleParser = void 0;
19
- var types_1 = require("../types");
20
- var abstractParser_1 = require("./abstractParser");
21
- var LidoOracleParser = /** @class */ (function (_super) {
22
- __extends(LidoOracleParser, _super);
23
- function LidoOracleParser() {
24
- var _this = _super.call(this, "LidoOracle") || this;
25
- _this.ifc = types_1.ILidoOracle__factory.createInterface();
26
- return _this;
4
+ const types_1 = require("../types");
5
+ const abstractParser_1 = require("./abstractParser");
6
+ class LidoOracleParser extends abstractParser_1.AbstractParser {
7
+ constructor() {
8
+ super("LidoOracle");
9
+ this.ifc = types_1.ILidoOracle__factory.createInterface();
27
10
  }
28
- LidoOracleParser.prototype.parse = function (calldata) {
29
- var _a = this.parseSelector(calldata), functionFragment = _a.functionFragment, functionName = _a.functionName;
11
+ parse(calldata) {
12
+ const { functionFragment, functionName } = this.parseSelector(calldata);
30
13
  switch (functionFragment.name) {
31
14
  case "getLastCompletedReportDelta":
32
- return "".concat(functionName, "()");
15
+ return `${functionName}()`;
33
16
  default:
34
- return "".concat(functionName, ": Unknown operation ").concat(functionFragment.name, " with calldata ").concat(calldata);
17
+ return `${functionName}: Unknown operation ${functionFragment.name} with calldata ${calldata}`;
35
18
  }
36
- };
37
- return LidoOracleParser;
38
- }(abstractParser_1.AbstractParser));
19
+ }
20
+ }
39
21
  exports.LidoOracleParser = LidoOracleParser;
@@ -1,54 +1,36 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.LidoSTETHParser = void 0;
19
- var ethers_1 = require("ethers");
20
- var types_1 = require("../types");
21
- var abstractParser_1 = require("./abstractParser");
22
- var LidoSTETHParser = /** @class */ (function (_super) {
23
- __extends(LidoSTETHParser, _super);
24
- function LidoSTETHParser(symbol) {
25
- var _this = _super.call(this, "LIDO_".concat(symbol)) || this;
26
- _this.ifc = types_1.IstETH__factory.createInterface();
27
- return _this;
4
+ const types_1 = require("../types");
5
+ const formatter_1 = require("../utils/formatter");
6
+ const abstractParser_1 = require("./abstractParser");
7
+ class LidoSTETHParser extends abstractParser_1.AbstractParser {
8
+ constructor(symbol) {
9
+ super(`LIDO_${symbol}`);
10
+ this.ifc = types_1.IstETH__factory.createInterface();
28
11
  }
29
- LidoSTETHParser.prototype.parse = function (calldata) {
30
- var _a = this.parseSelector(calldata), functionFragment = _a.functionFragment, functionName = _a.functionName;
12
+ parse(calldata) {
13
+ const { functionFragment, functionName } = this.parseSelector(calldata);
31
14
  switch (functionFragment.name) {
32
15
  case "getFee":
33
16
  case "totalSupply": {
34
- return "".concat(functionName, "()");
17
+ return `${functionName}()`;
35
18
  }
36
19
  case "balanceOf": {
37
- var address = this.decodeFunctionData(functionFragment, calldata)[0];
38
- return "".concat(functionName, "(").concat(address, ")");
20
+ const [address] = this.decodeFunctionData(functionFragment, calldata);
21
+ return `${functionName}(${address})`;
39
22
  }
40
23
  case "allowance": {
41
- var _b = this.decodeFunctionData(functionFragment, calldata), account = _b[0], to = _b[1];
42
- return "".concat(functionName, "(account: ").concat(account, ", to: ").concat(to, ")");
24
+ const [account, to] = this.decodeFunctionData(functionFragment, calldata);
25
+ return `${functionName}(account: ${account}, to: ${to})`;
43
26
  }
44
27
  case "approve": {
45
- var _c = this.decodeFunctionData(functionFragment, calldata), spender = _c[0], amount = _c[1];
46
- return "".concat(functionName, "(").concat(spender, ", [").concat(ethers_1.BigNumber.from(amount).toString(), "])");
28
+ const [spender, amount] = this.decodeFunctionData(functionFragment, calldata);
29
+ return `${functionName}(${spender}, [${(0, formatter_1.toBigInt)(amount).toString()}])`;
47
30
  }
48
31
  default:
49
- return "".concat(functionName, ": Unknown operation ").concat(functionFragment.name, " with calldata ").concat(calldata);
32
+ return `${functionName}: Unknown operation ${functionFragment.name} with calldata ${calldata}`;
50
33
  }
51
- };
52
- return LidoSTETHParser;
53
- }(abstractParser_1.AbstractParser));
34
+ }
35
+ }
54
36
  exports.LidoSTETHParser = LidoSTETHParser;
@@ -1,48 +1,30 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.MulticallParser = void 0;
19
- var types_1 = require("../types");
20
- var abstractParser_1 = require("./abstractParser");
21
- var MulticallParser = /** @class */ (function (_super) {
22
- __extends(MulticallParser, _super);
23
- function MulticallParser() {
24
- var _this = _super.call(this, "Multicall") || this;
25
- _this.ifc = types_1.Multicall2__factory.createInterface();
26
- return _this;
4
+ const types_1 = require("../types");
5
+ const abstractParser_1 = require("./abstractParser");
6
+ class MulticallParser extends abstractParser_1.AbstractParser {
7
+ constructor() {
8
+ super("Multicall");
9
+ this.ifc = types_1.Multicall2__factory.createInterface();
27
10
  }
28
- MulticallParser.prototype.parse = function (calldata) {
29
- var _a = this.parseSelector(calldata), functionFragment = _a.functionFragment, functionName = _a.functionName;
11
+ parse(calldata) {
12
+ const { functionFragment, functionName } = this.parseSelector(calldata);
30
13
  switch (functionFragment.name) {
31
14
  case "aggregate": {
32
- var calls = this.decodeFunctionData(functionFragment, calldata)[0];
33
- return "".concat(functionName, ": ").concat(calls);
15
+ const [calls] = this.decodeFunctionData(functionFragment, calldata);
16
+ return `${functionName}: ${calls}`;
34
17
  }
35
18
  case "getBlockNumber": {
36
- return "".concat(functionName, "()");
19
+ return `${functionName}()`;
37
20
  }
38
21
  case "getEthBalance": {
39
- var account = this.decodeFunctionData(functionFragment, calldata)[0];
40
- return "".concat(functionName, "(").concat(account, ")");
22
+ const [account] = this.decodeFunctionData(functionFragment, calldata);
23
+ return `${functionName}(${account})`;
41
24
  }
42
25
  default:
43
- return "".concat(functionName, ": Unknown operation ").concat(functionFragment.name, " with calldata ").concat(calldata);
26
+ return `${functionName}: Unknown operation ${functionFragment.name} with calldata ${calldata}`;
44
27
  }
45
- };
46
- return MulticallParser;
47
- }(abstractParser_1.AbstractParser));
28
+ }
29
+ }
48
30
  exports.MulticallParser = MulticallParser;
@@ -1,41 +1,23 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.OffchainOracleParserParser = void 0;
19
- var types_1 = require("../types");
20
- var abstractParser_1 = require("./abstractParser");
21
- var OffchainOracleParserParser = /** @class */ (function (_super) {
22
- __extends(OffchainOracleParserParser, _super);
23
- function OffchainOracleParserParser() {
24
- var _this = _super.call(this, "OffchainOracleParser") || this;
25
- _this.ifc = types_1.IOffchainOracle__factory.createInterface();
26
- return _this;
4
+ const types_1 = require("../types");
5
+ const abstractParser_1 = require("./abstractParser");
6
+ class OffchainOracleParserParser extends abstractParser_1.AbstractParser {
7
+ constructor() {
8
+ super("OffchainOracleParser");
9
+ this.ifc = types_1.IOffchainOracle__factory.createInterface();
27
10
  }
28
- OffchainOracleParserParser.prototype.parse = function (calldata) {
29
- var _a = this.parseSelector(calldata), functionFragment = _a.functionFragment, functionName = _a.functionName;
11
+ parse(calldata) {
12
+ const { functionFragment, functionName } = this.parseSelector(calldata);
30
13
  switch (functionFragment.name) {
31
14
  case "getRate": {
32
- var _b = this.decodeFunctionData(functionFragment, calldata), srcToken = _b[0], dstToken = _b[1], useWrappers = _b[2];
33
- return "".concat(functionName, "(token: ").concat(this.tokenSymbol(srcToken), ", measured in: ").concat(this.tokenSymbol(dstToken), ", use wrappers: ").concat(useWrappers, ")");
15
+ const [srcToken, dstToken, useWrappers] = this.decodeFunctionData(functionFragment, calldata);
16
+ return `${functionName}(token: ${this.tokenSymbol(srcToken)}, measured in: ${this.tokenSymbol(dstToken)}, use wrappers: ${useWrappers})`;
34
17
  }
35
18
  default:
36
- return "".concat(functionName, ": Unknown operation ").concat(functionFragment.name, " with calldata ").concat(calldata);
19
+ return `${functionName}: Unknown operation ${functionFragment.name} with calldata ${calldata}`;
37
20
  }
38
- };
39
- return OffchainOracleParserParser;
40
- }(abstractParser_1.AbstractParser));
21
+ }
22
+ }
41
23
  exports.OffchainOracleParserParser = OffchainOracleParserParser;
@@ -1,37 +1,19 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.PoolParser = void 0;
19
- var types_1 = require("../types");
20
- var abstractParser_1 = require("./abstractParser");
21
- var PoolParser = /** @class */ (function (_super) {
22
- __extends(PoolParser, _super);
23
- function PoolParser(version) {
24
- var _this = _super.call(this, "Pool_V".concat(version)) || this;
25
- _this.ifc = types_1.PoolService__factory.createInterface();
26
- return _this;
4
+ const types_1 = require("../types");
5
+ const abstractParser_1 = require("./abstractParser");
6
+ class PoolParser extends abstractParser_1.AbstractParser {
7
+ constructor(version) {
8
+ super(`Pool_V${version}`);
9
+ this.ifc = types_1.PoolService__factory.createInterface();
27
10
  }
28
- PoolParser.prototype.parse = function (calldata) {
29
- var _a = this.parseSelector(calldata), functionFragment = _a.functionFragment, functionName = _a.functionName;
11
+ parse(calldata) {
12
+ const { functionFragment, functionName } = this.parseSelector(calldata);
30
13
  switch (functionFragment.name) {
31
14
  default:
32
- return "".concat(functionName, ": Unknown operation ").concat(functionFragment.name, " with calldata ").concat(calldata);
15
+ return `${functionName}: Unknown operation ${functionFragment.name} with calldata ${calldata}`;
33
16
  }
34
- };
35
- return PoolParser;
36
- }(abstractParser_1.AbstractParser));
17
+ }
18
+ }
37
19
  exports.PoolParser = PoolParser;
@@ -1,41 +1,23 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.PriceOracleParser = void 0;
19
- var types_1 = require("../types");
20
- var abstractParser_1 = require("./abstractParser");
21
- var PriceOracleParser = /** @class */ (function (_super) {
22
- __extends(PriceOracleParser, _super);
23
- function PriceOracleParser() {
24
- var _this = _super.call(this, "PriceOracle") || this;
25
- _this.ifc = types_1.IPriceOracleV2__factory.createInterface();
26
- return _this;
4
+ const types_1 = require("../types");
5
+ const abstractParser_1 = require("./abstractParser");
6
+ class PriceOracleParser extends abstractParser_1.AbstractParser {
7
+ constructor() {
8
+ super("PriceOracle");
9
+ this.ifc = types_1.IPriceOracleV2__factory.createInterface();
27
10
  }
28
- PriceOracleParser.prototype.parse = function (calldata) {
29
- var _a = this.parseSelector(calldata), functionFragment = _a.functionFragment, functionName = _a.functionName;
11
+ parse(calldata) {
12
+ const { functionFragment, functionName } = this.parseSelector(calldata);
30
13
  switch (functionFragment.name) {
31
14
  case "getPrice": {
32
- var token = this.decodeFunctionData(functionFragment, calldata)[0];
33
- return "".concat(functionName, "(").concat(this.tokenSymbol(token), ")");
15
+ const [token] = this.decodeFunctionData(functionFragment, calldata);
16
+ return `${functionName}(${this.tokenSymbol(token)})`;
34
17
  }
35
18
  default:
36
- return "".concat(functionName, ": Unknown operation ").concat(functionFragment.name, " with calldata ").concat(calldata);
19
+ return `${functionName}: Unknown operation ${functionFragment.name} with calldata ${calldata}`;
37
20
  }
38
- };
39
- return PriceOracleParser;
40
- }(abstractParser_1.AbstractParser));
21
+ }
22
+ }
41
23
  exports.PriceOracleParser = PriceOracleParser;