@gearbox-protocol/sdk 1.22.3 → 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 +31 -24
  31. package/lib/core/events.js +702 -702
  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,27 +1,16 @@
1
1
  "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.YearnV2Strategies = exports.YearnV2Multicaller = exports.YearnV2Calls = void 0;
13
- var contracts_1 = require("../contracts/contracts");
14
- var constants_1 = require("../core/constants");
15
- var token_1 = require("../tokens/token");
16
- var tokenType_1 = require("../tokens/tokenType");
17
- var types_1 = require("../types");
18
- var curve_1 = require("./curve");
19
- var uniswapV2_1 = require("./uniswapV2");
20
- var YearnV2Calls = /** @class */ (function () {
21
- function YearnV2Calls() {
22
- }
23
- YearnV2Calls.deposit = function (amount, recipient) {
24
- var contractInterface = types_1.IYVault__factory.createInterface();
4
+ const contracts_1 = require("../contracts/contracts");
5
+ const constants_1 = require("../core/constants");
6
+ const token_1 = require("../tokens/token");
7
+ const tokenType_1 = require("../tokens/tokenType");
8
+ const types_1 = require("../types");
9
+ const curve_1 = require("./curve");
10
+ const uniswapV2_1 = require("./uniswapV2");
11
+ class YearnV2Calls {
12
+ static deposit(amount, recipient) {
13
+ const contractInterface = types_1.IYVault__factory.createInterface();
25
14
  if (amount && recipient) {
26
15
  return contractInterface.encodeFunctionData("deposit(uint256,address)", [
27
16
  amount,
@@ -32,9 +21,9 @@ var YearnV2Calls = /** @class */ (function () {
32
21
  return contractInterface.encodeFunctionData("deposit(uint256)", [amount]);
33
22
  }
34
23
  return contractInterface.encodeFunctionData("deposit()");
35
- };
36
- YearnV2Calls.withdraw = function (maxShares, recipient, maxLoss) {
37
- var contractInterface = types_1.IYVault__factory.createInterface();
24
+ }
25
+ static withdraw(maxShares, recipient, maxLoss) {
26
+ const contractInterface = types_1.IYVault__factory.createInterface();
38
27
  if (maxShares && recipient && maxLoss) {
39
28
  return contractInterface.encodeFunctionData("withdraw(uint256,address,uint256)", [maxShares, recipient, maxLoss]);
40
29
  }
@@ -50,40 +39,37 @@ var YearnV2Calls = /** @class */ (function () {
50
39
  ]);
51
40
  }
52
41
  return contractInterface.encodeFunctionData("withdraw()");
53
- };
54
- return YearnV2Calls;
55
- }());
42
+ }
43
+ }
56
44
  exports.YearnV2Calls = YearnV2Calls;
57
- var YearnV2Multicaller = /** @class */ (function () {
58
- function YearnV2Multicaller(address) {
45
+ class YearnV2Multicaller {
46
+ _address;
47
+ constructor(address) {
59
48
  this._address = address;
60
49
  }
61
- YearnV2Multicaller.connect = function (address) {
50
+ static connect(address) {
62
51
  return new YearnV2Multicaller(address);
63
- };
64
- YearnV2Multicaller.prototype.deposit = function (amount, recipient) {
52
+ }
53
+ deposit(amount, recipient) {
65
54
  return {
66
55
  target: this._address,
67
56
  callData: YearnV2Calls.deposit(amount, recipient),
68
57
  };
69
- };
70
- YearnV2Multicaller.prototype.withdraw = function (maxShares, recipient, maxLoss) {
58
+ }
59
+ withdraw(maxShares, recipient, maxLoss) {
71
60
  return {
72
61
  target: this._address,
73
62
  callData: YearnV2Calls.withdraw(maxShares, recipient, maxLoss),
74
63
  };
75
- };
76
- return YearnV2Multicaller;
77
- }());
78
- exports.YearnV2Multicaller = YearnV2Multicaller;
79
- var YearnV2Strategies = /** @class */ (function () {
80
- function YearnV2Strategies() {
81
64
  }
82
- YearnV2Strategies.underlyingToYearn = function (data, network, yearnVault, underlyingAmount) {
83
- var calls = [];
84
- var vaultParams = contracts_1.contractParams[yearnVault];
85
- var yearnToken = vaultParams.shareToken;
86
- var yearnParams = token_1.supportedTokens[yearnToken];
65
+ }
66
+ exports.YearnV2Multicaller = YearnV2Multicaller;
67
+ class YearnV2Strategies {
68
+ static underlyingToYearn(data, network, yearnVault, underlyingAmount) {
69
+ let calls = [];
70
+ const vaultParams = contracts_1.contractParams[yearnVault];
71
+ const yearnToken = vaultParams.shareToken;
72
+ const yearnParams = token_1.supportedTokens[yearnToken];
87
73
  if (yearnParams.type === tokenType_1.TokenType.YEARN_ON_NORMAL_TOKEN) {
88
74
  if (data.underlyingToken.toLowerCase() !==
89
75
  token_1.tokenDataByNetwork[network][yearnParams.underlying].toLowerCase()) {
@@ -99,8 +85,8 @@ var YearnV2Strategies = /** @class */ (function () {
99
85
  }
100
86
  }
101
87
  else if (yearnParams.type === tokenType_1.TokenType.YEARN_ON_CURVE_TOKEN) {
102
- var curveTokenParams = token_1.supportedTokens[yearnParams.underlying];
103
- var curvePool = curveTokenParams.pool;
88
+ const curveTokenParams = token_1.supportedTokens[yearnParams.underlying];
89
+ const curvePool = curveTokenParams.pool;
104
90
  calls = curve_1.CurveStrategies.underlyingToCurveLP(data, network, curvePool, underlyingAmount);
105
91
  }
106
92
  else {
@@ -108,12 +94,12 @@ var YearnV2Strategies = /** @class */ (function () {
108
94
  }
109
95
  calls.push(YearnV2Multicaller.connect(data.adapters[contracts_1.contractsByNetwork[network][yearnVault].toLowerCase()]).deposit());
110
96
  return calls;
111
- };
112
- YearnV2Strategies.yearnToUnderlying = function (data, network, yearnVault, yearnSharesAmount) {
113
- var calls = [];
114
- var vaultParams = contracts_1.contractParams[yearnVault];
115
- var yearnToken = vaultParams.shareToken;
116
- var yearnParams = token_1.supportedTokens[yearnToken];
97
+ }
98
+ static yearnToUnderlying(data, network, yearnVault, yearnSharesAmount) {
99
+ let calls = [];
100
+ const vaultParams = contracts_1.contractParams[yearnVault];
101
+ const yearnToken = vaultParams.shareToken;
102
+ const yearnParams = token_1.supportedTokens[yearnToken];
117
103
  calls.push(YearnV2Multicaller.connect(data.adapters[contracts_1.contractsByNetwork[network][yearnVault].toLowerCase()]).withdraw(yearnSharesAmount));
118
104
  if (yearnParams.type === tokenType_1.TokenType.YEARN_ON_NORMAL_TOKEN) {
119
105
  if (data.underlyingToken.toLowerCase() !==
@@ -126,15 +112,17 @@ var YearnV2Strategies = /** @class */ (function () {
126
112
  }
127
113
  }
128
114
  else if (yearnParams.type === tokenType_1.TokenType.YEARN_ON_CURVE_TOKEN) {
129
- var curveTokenParams = token_1.supportedTokens[yearnParams.underlying];
130
- var curvePool = curveTokenParams.pool;
131
- calls = __spreadArray(__spreadArray([], calls, true), curve_1.CurveStrategies.allCurveLPToUnderlying(data, network, curvePool), true);
115
+ const curveTokenParams = token_1.supportedTokens[yearnParams.underlying];
116
+ const curvePool = curveTokenParams.pool;
117
+ calls = [
118
+ ...calls,
119
+ ...curve_1.CurveStrategies.allCurveLPToUnderlying(data, network, curvePool),
120
+ ];
132
121
  }
133
122
  else {
134
123
  throw new Error("Yearn vault type unknown");
135
124
  }
136
125
  return calls;
137
- };
138
- return YearnV2Strategies;
139
- }());
126
+ }
127
+ }
140
128
  exports.YearnV2Strategies = YearnV2Strategies;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isBalancerLPToken = exports.balancerLpTokens = void 0;
4
- var tradeTypes_1 = require("../pathfinder/tradeTypes");
5
- var tokenType_1 = require("./tokenType");
4
+ const tradeTypes_1 = require("../pathfinder/tradeTypes");
5
+ const tokenType_1 = require("./tokenType");
6
6
  exports.balancerLpTokens = {
7
7
  "50OHM_50DAI": {
8
8
  name: "Balancer 50OHM_50DAI",
@@ -47,7 +47,5 @@ exports.balancerLpTokens = {
47
47
  ],
48
48
  },
49
49
  };
50
- var isBalancerLPToken = function (t) {
51
- return typeof t === "string" && !!exports.balancerLpTokens[t];
52
- };
50
+ const isBalancerLPToken = (t) => typeof t === "string" && !!exports.balancerLpTokens[t];
53
51
  exports.isBalancerLPToken = isBalancerLPToken;
@@ -1,20 +1,9 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
3
  exports.convexLpTokenByPid = exports.convexPoolByPid = exports.isConvexStakedPhantomToken = exports.isConvexLPToken = exports.isConvexToken = exports.convexTokens = void 0;
15
- var tradeTypes_1 = require("../pathfinder/tradeTypes");
16
- var tokenType_1 = require("./tokenType");
17
- var convexLpTokens = {
4
+ const tradeTypes_1 = require("../pathfinder/tradeTypes");
5
+ const tokenType_1 = require("./tokenType");
6
+ const convexLpTokens = {
18
7
  cvx3Crv: {
19
8
  name: "Convex cvx3Crv",
20
9
  symbol: "cvx3Crv",
@@ -289,7 +278,7 @@ var convexLpTokens = {
289
278
  ],
290
279
  },
291
280
  };
292
- var convexStakedPhantomTokens = {
281
+ const convexStakedPhantomTokens = {
293
282
  stkcvx3Crv: {
294
283
  name: "Convex stkcvx3Crv",
295
284
  symbol: "stkcvx3Crv",
@@ -564,27 +553,23 @@ var convexStakedPhantomTokens = {
564
553
  ],
565
554
  },
566
555
  };
567
- exports.convexTokens = __assign(__assign({}, convexLpTokens), convexStakedPhantomTokens);
568
- var isConvexToken = function (t) {
569
- return typeof t === "string" &&
570
- !!exports.convexTokens[t];
556
+ exports.convexTokens = {
557
+ ...convexLpTokens,
558
+ ...convexStakedPhantomTokens,
571
559
  };
560
+ const isConvexToken = (t) => typeof t === "string" &&
561
+ !!exports.convexTokens[t];
572
562
  exports.isConvexToken = isConvexToken;
573
- var isConvexLPToken = function (t) {
574
- return typeof t === "string" && !!convexLpTokens[t];
575
- };
563
+ const isConvexLPToken = (t) => typeof t === "string" && !!convexLpTokens[t];
576
564
  exports.isConvexLPToken = isConvexLPToken;
577
- var isConvexStakedPhantomToken = function (t) {
578
- return typeof t === "string" &&
579
- !!convexStakedPhantomTokens[t];
580
- };
565
+ const isConvexStakedPhantomToken = (t) => typeof t === "string" &&
566
+ !!convexStakedPhantomTokens[t];
581
567
  exports.isConvexStakedPhantomToken = isConvexStakedPhantomToken;
582
- exports.convexPoolByPid = Object.values(convexLpTokens).reduce(function (acc, value) {
568
+ exports.convexPoolByPid = Object.values(convexLpTokens).reduce((acc, value) => {
583
569
  acc[value.pid] = value.pool;
584
570
  return acc;
585
571
  }, {});
586
- exports.convexLpTokenByPid = Object.entries(convexLpTokens).reduce(function (acc, _a) {
587
- var token = _a[0], data = _a[1];
572
+ exports.convexLpTokenByPid = Object.entries(convexLpTokens).reduce((acc, [token, data]) => {
588
573
  acc[data.pid] = token;
589
574
  return acc;
590
575
  }, {});
@@ -1,20 +1,9 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
3
  exports.isCurveMetaToken = exports.isCurveLPToken = exports.curveTokens = exports.curveMetaTokens = exports.Curve3CrvUnderlyingTokenIndex = void 0;
15
- var ethers_1 = require("ethers");
16
- var tradeTypes_1 = require("../pathfinder/tradeTypes");
17
- var tokenType_1 = require("./tokenType");
4
+ const ethers_1 = require("ethers");
5
+ const tradeTypes_1 = require("../pathfinder/tradeTypes");
6
+ const tokenType_1 = require("./tokenType");
18
7
  exports.Curve3CrvUnderlyingTokenIndex = {
19
8
  DAI: ethers_1.BigNumber.from(0),
20
9
  USDC: ethers_1.BigNumber.from(1),
@@ -128,7 +117,7 @@ exports.curveMetaTokens = {
128
117
  ],
129
118
  },
130
119
  };
131
- exports.curveTokens = __assign({
120
+ exports.curveTokens = {
132
121
  // CURVE LP TOKENS
133
122
  "3Crv": {
134
123
  name: "Curve 3Crv",
@@ -152,7 +141,8 @@ exports.curveTokens = __assign({
152
141
  tokenOut: "stkcvx3Crv",
153
142
  },
154
143
  ],
155
- }, crvFRAX: {
144
+ },
145
+ crvFRAX: {
156
146
  name: "Curve.fi FRAX/USDC",
157
147
  symbol: "crvFRAX",
158
148
  type: tokenType_1.TokenType.CURVE_LP_TOKEN,
@@ -174,7 +164,8 @@ exports.curveTokens = __assign({
174
164
  tokenOut: "stkcvxcrvFRAX",
175
165
  },
176
166
  ],
177
- }, steCRV: {
167
+ },
168
+ steCRV: {
178
169
  name: "Curve steCRV",
179
170
  symbol: "steCRV",
180
171
  type: tokenType_1.TokenType.CURVE_LP_TOKEN,
@@ -196,7 +187,8 @@ exports.curveTokens = __assign({
196
187
  tokenOut: "stkcvxsteCRV",
197
188
  },
198
189
  ],
199
- }, crvPlain3andSUSD: {
190
+ },
191
+ crvPlain3andSUSD: {
200
192
  name: "Curve crvPlain3andSUSD",
201
193
  symbol: "crvPlain3andSUSD",
202
194
  type: tokenType_1.TokenType.CURVE_LP_TOKEN,
@@ -219,7 +211,8 @@ exports.curveTokens = __assign({
219
211
  tokenOut: "stkcvxcrvPlain3andSUSD",
220
212
  },
221
213
  ],
222
- }, crvCRVETH: {
214
+ },
215
+ crvCRVETH: {
223
216
  name: "Curve CRV-ETH",
224
217
  symbol: "crvCRVETH",
225
218
  type: tokenType_1.TokenType.CURVE_LP_TOKEN,
@@ -241,7 +234,8 @@ exports.curveTokens = __assign({
241
234
  tokenOut: "stkcvxcrvCRVETH",
242
235
  },
243
236
  ],
244
- }, crvCVXETH: {
237
+ },
238
+ crvCVXETH: {
245
239
  name: "Curve CVX-ETH",
246
240
  symbol: "crvCVXETH",
247
241
  type: tokenType_1.TokenType.CURVE_LP_TOKEN,
@@ -263,7 +257,8 @@ exports.curveTokens = __assign({
263
257
  tokenOut: "stkcvxcrvCVXETH",
264
258
  },
265
259
  ],
266
- }, crvUSDTWBTCWETH: {
260
+ },
261
+ crvUSDTWBTCWETH: {
267
262
  name: "Curve USDT/WBTC/WETH",
268
263
  symbol: "crvUSDTWBTCWETH",
269
264
  type: tokenType_1.TokenType.CURVE_LP_TOKEN,
@@ -285,7 +280,8 @@ exports.curveTokens = __assign({
285
280
  tokenOut: "stkcvxcrvUSDTWBTCWETH",
286
281
  },
287
282
  ],
288
- }, LDOETH: {
283
+ },
284
+ LDOETH: {
289
285
  name: "Curve LDOETH",
290
286
  symbol: "LDOETH",
291
287
  type: tokenType_1.TokenType.CURVE_LP_TOKEN,
@@ -307,12 +303,10 @@ exports.curveTokens = __assign({
307
303
  tokenOut: "stkcvxLDOETH",
308
304
  },
309
305
  ],
310
- } }, exports.curveMetaTokens);
311
- var isCurveLPToken = function (t) {
312
- return typeof t === "string" && !!exports.curveTokens[t];
306
+ },
307
+ ...exports.curveMetaTokens,
313
308
  };
309
+ const isCurveLPToken = (t) => typeof t === "string" && !!exports.curveTokens[t];
314
310
  exports.isCurveLPToken = isCurveLPToken;
315
- var isCurveMetaToken = function (t) {
316
- return typeof t === "string" && !!exports.curveMetaTokens[t];
317
- };
311
+ const isCurveMetaToken = (t) => typeof t === "string" && !!exports.curveMetaTokens[t];
318
312
  exports.isCurveMetaToken = isCurveMetaToken;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.gearTokens = void 0;
4
- var tokenType_1 = require("./tokenType");
4
+ const tokenType_1 = require("./tokenType");
5
5
  exports.gearTokens = {
6
6
  // GEARBOX
7
7
  dDAI: {
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isNormalToken = exports.normalTokens = void 0;
4
- var tradeTypes_1 = require("../pathfinder/tradeTypes");
5
- var tokenType_1 = require("./tokenType");
4
+ const tradeTypes_1 = require("../pathfinder/tradeTypes");
5
+ const tokenType_1 = require("./tokenType");
6
6
  exports.normalTokens = {
7
7
  "1INCH": {
8
8
  name: "1INCH",
@@ -728,7 +728,5 @@ exports.normalTokens = {
728
728
  lpActions: [],
729
729
  },
730
730
  };
731
- var isNormalToken = function (t) {
732
- return typeof t === "string" && !!exports.normalTokens[t];
733
- };
731
+ const isNormalToken = (t) => typeof t === "string" && !!exports.normalTokens[t];
734
732
  exports.isNormalToken = isNormalToken;
@@ -1,27 +1,25 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
3
  exports.extractTokenData = exports.getDecimals = exports.isLPToken = exports.isSupportedToken = exports.tokenSymbolByAddress = exports.tokenDataByNetwork = exports.supportedTokens = exports.lpTokens = void 0;
15
- var mappers_1 = require("../utils/mappers");
16
- var balancer_1 = require("./balancer");
17
- var convex_1 = require("./convex");
18
- var curveLP_1 = require("./curveLP");
19
- var decimals_1 = require("./decimals");
20
- var gear_1 = require("./gear");
21
- var normal_1 = require("./normal");
22
- var yearn_1 = require("./yearn");
23
- exports.lpTokens = __assign(__assign(__assign(__assign({}, curveLP_1.curveTokens), convex_1.convexTokens), yearn_1.yearnTokens), balancer_1.balancerLpTokens);
24
- exports.supportedTokens = __assign(__assign(__assign({}, normal_1.normalTokens), exports.lpTokens), gear_1.gearTokens);
4
+ const mappers_1 = require("../utils/mappers");
5
+ const balancer_1 = require("./balancer");
6
+ const convex_1 = require("./convex");
7
+ const curveLP_1 = require("./curveLP");
8
+ const decimals_1 = require("./decimals");
9
+ const gear_1 = require("./gear");
10
+ const normal_1 = require("./normal");
11
+ const yearn_1 = require("./yearn");
12
+ exports.lpTokens = {
13
+ ...curveLP_1.curveTokens,
14
+ ...convex_1.convexTokens,
15
+ ...yearn_1.yearnTokens,
16
+ ...balancer_1.balancerLpTokens,
17
+ };
18
+ exports.supportedTokens = {
19
+ ...normal_1.normalTokens,
20
+ ...exports.lpTokens,
21
+ ...gear_1.gearTokens,
22
+ };
25
23
  exports.tokenDataByNetwork = {
26
24
  //
27
25
  // MAINNET NETWORK
@@ -215,32 +213,28 @@ exports.tokenDataByNetwork = {
215
213
  GEAR: "0x3321F5dA65165042903eDe71617F912942f4E70F",
216
214
  },
217
215
  };
218
- exports.tokenSymbolByAddress = (0, mappers_1.objectEntries)(exports.tokenDataByNetwork).reduce(function (acc, _a) {
219
- var tokens = _a[1];
220
- return (__assign(__assign({}, acc), (0, mappers_1.filterEmptyKeys)((0, mappers_1.keyToLowercase)((0, mappers_1.swapKeyValue)(tokens)))));
221
- }, {});
222
- var isSupportedToken = function (t) {
223
- return typeof t === "string" && !!exports.supportedTokens[t];
224
- };
216
+ exports.tokenSymbolByAddress = (0, mappers_1.objectEntries)(exports.tokenDataByNetwork).reduce((acc, [, tokens]) => ({
217
+ ...acc,
218
+ ...(0, mappers_1.filterEmptyKeys)((0, mappers_1.keyToLowercase)((0, mappers_1.swapKeyValue)(tokens))),
219
+ }), {});
220
+ const isSupportedToken = (t) => typeof t === "string" && !!exports.supportedTokens[t];
225
221
  exports.isSupportedToken = isSupportedToken;
226
- var isLPToken = function (t) {
227
- return typeof t === "string" && !!exports.lpTokens[t];
228
- };
222
+ const isLPToken = (t) => typeof t === "string" && !!exports.lpTokens[t];
229
223
  exports.isLPToken = isLPToken;
230
224
  function getDecimals(token) {
231
- var dec = decimals_1.decimals[token];
225
+ let dec = decimals_1.decimals[token];
232
226
  if (dec)
233
227
  return dec;
234
228
  dec = decimals_1.decimals[exports.tokenSymbolByAddress[token.toLowerCase()]];
235
229
  if (!dec) {
236
- throw new Error("Decimals for ".concat(token, " not found"));
230
+ throw new Error(`Decimals for ${token} not found`);
237
231
  }
238
232
  return dec;
239
233
  }
240
234
  exports.getDecimals = getDecimals;
241
235
  function extractTokenData(tokenAddress) {
242
- var underlyingSymbol = exports.tokenSymbolByAddress[tokenAddress.toLowerCase()];
243
- var underlyingDecimals = decimals_1.decimals[underlyingSymbol || ""];
236
+ const underlyingSymbol = exports.tokenSymbolByAddress[tokenAddress.toLowerCase()];
237
+ const underlyingDecimals = decimals_1.decimals[underlyingSymbol || ""];
244
238
  return [underlyingSymbol, underlyingDecimals];
245
239
  }
246
240
  exports.extractTokenData = extractTokenData;
@@ -1,4 +1,3 @@
1
- import { BigNumber } from "ethers";
2
1
  import { NetworkType } from "../core/chains";
3
2
  import { TokenDataPayload } from "../payload/token";
4
3
  import { SupportedToken } from "./token";
@@ -12,14 +11,6 @@ export declare class TokenData {
12
11
  constructor(payload: TokenDataPayload, symbolReplacements?: SymbolReplacements);
13
12
  compareBySymbol(b: TokenData): number;
14
13
  }
15
- export interface TokenBalance {
16
- id: string;
17
- balance: BigNumber;
18
- }
19
- export interface TokenAllowance {
20
- id: string;
21
- allowance: BigNumber;
22
- }
23
14
  export declare const connectors: Record<NetworkType, Array<SupportedToken>>;
24
15
  export declare function getConnectors(networkType: NetworkType): string[];
25
16
  export {};
@@ -1,27 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getConnectors = exports.connectors = exports.TokenData = void 0;
4
- var config_1 = require("../config");
5
- var token_1 = require("./token");
6
- var defaultSymbolReplacement = {
4
+ const config_1 = require("../config");
5
+ const token_1 = require("./token");
6
+ const defaultSymbolReplacement = {
7
7
  dWETH: "dETH",
8
8
  WETH: "ETH",
9
9
  };
10
- var TokenData = /** @class */ (function () {
11
- function TokenData(payload, symbolReplacements) {
12
- if (symbolReplacements === void 0) { symbolReplacements = defaultSymbolReplacement; }
13
- var _a;
10
+ class TokenData {
11
+ id;
12
+ symbol;
13
+ address;
14
+ decimals;
15
+ icon;
16
+ constructor(payload, symbolReplacements = defaultSymbolReplacement) {
14
17
  this.id = payload.addr.toLowerCase();
15
18
  this.address = payload.addr.toLowerCase();
16
19
  this.symbol = symbolReplacements[payload.symbol] || payload.symbol;
17
20
  this.decimals = payload.decimals;
18
- this.icon = "".concat(config_1.STATIC_TOKEN).concat((_a = payload.symbol) === null || _a === void 0 ? void 0 : _a.toLowerCase(), ".svg");
21
+ this.icon = `${config_1.STATIC_TOKEN}${payload.symbol?.toLowerCase()}.svg`;
19
22
  }
20
- TokenData.prototype.compareBySymbol = function (b) {
23
+ compareBySymbol(b) {
21
24
  return this.symbol > b.symbol ? 1 : -1;
22
- };
23
- return TokenData;
24
- }());
25
+ }
26
+ }
25
27
  exports.TokenData = TokenData;
26
28
  exports.connectors = {
27
29
  Mainnet: [
@@ -41,10 +43,10 @@ exports.connectors = {
41
43
  Goerli: ["WETH", "DAI", "USDC", "WBTC"],
42
44
  };
43
45
  function getConnectors(networkType) {
44
- return exports.connectors[networkType].map(function (e) {
45
- var result = token_1.tokenDataByNetwork[networkType][e];
46
+ return exports.connectors[networkType].map(e => {
47
+ const result = token_1.tokenDataByNetwork[networkType][e];
46
48
  if (!result) {
47
- throw new Error("connector token ".concat(e, " not found"));
49
+ throw new Error(`connector token ${e} not found`);
48
50
  }
49
51
  return result;
50
52
  });
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isYearnLPToken = exports.yearnTokens = void 0;
4
- var tradeTypes_1 = require("../pathfinder/tradeTypes");
5
- var tokenType_1 = require("./tokenType");
4
+ const tradeTypes_1 = require("../pathfinder/tradeTypes");
5
+ const tokenType_1 = require("./tokenType");
6
6
  exports.yearnTokens = {
7
7
  // YEARN TOKENS
8
8
  yvDAI: {
@@ -91,7 +91,5 @@ exports.yearnTokens = {
91
91
  ],
92
92
  },
93
93
  };
94
- var isYearnLPToken = function (t) {
95
- return typeof t === "string" && !!exports.yearnTokens[t];
96
- };
94
+ const isYearnLPToken = (t) => typeof t === "string" && !!exports.yearnTokens[t];
97
95
  exports.isYearnLPToken = isYearnLPToken;
@@ -4,8 +4,8 @@
4
4
  /* eslint-disable */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AggregatorInterface__factory = void 0;
7
- var ethers_1 = require("ethers");
8
- var _abi = [
7
+ const ethers_1 = require("ethers");
8
+ const _abi = [
9
9
  {
10
10
  anonymous: false,
11
11
  inputs: [
@@ -134,16 +134,13 @@ var _abi = [
134
134
  type: "function",
135
135
  },
136
136
  ];
137
- var AggregatorInterface__factory = /** @class */ (function () {
138
- function AggregatorInterface__factory() {
139
- }
140
- AggregatorInterface__factory.createInterface = function () {
137
+ class AggregatorInterface__factory {
138
+ static abi = _abi;
139
+ static createInterface() {
141
140
  return new ethers_1.utils.Interface(_abi);
142
- };
143
- AggregatorInterface__factory.connect = function (address, signerOrProvider) {
141
+ }
142
+ static connect(address, signerOrProvider) {
144
143
  return new ethers_1.Contract(address, _abi, signerOrProvider);
145
- };
146
- AggregatorInterface__factory.abi = _abi;
147
- return AggregatorInterface__factory;
148
- }());
144
+ }
145
+ }
149
146
  exports.AggregatorInterface__factory = AggregatorInterface__factory;
@@ -4,8 +4,8 @@
4
4
  /* eslint-disable */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AggregatorV2V3Interface__factory = void 0;
7
- var ethers_1 = require("ethers");
8
- var _abi = [
7
+ const ethers_1 = require("ethers");
8
+ const _abi = [
9
9
  {
10
10
  anonymous: false,
11
11
  inputs: [
@@ -245,16 +245,13 @@ var _abi = [
245
245
  type: "function",
246
246
  },
247
247
  ];
248
- var AggregatorV2V3Interface__factory = /** @class */ (function () {
249
- function AggregatorV2V3Interface__factory() {
250
- }
251
- AggregatorV2V3Interface__factory.createInterface = function () {
248
+ class AggregatorV2V3Interface__factory {
249
+ static abi = _abi;
250
+ static createInterface() {
252
251
  return new ethers_1.utils.Interface(_abi);
253
- };
254
- AggregatorV2V3Interface__factory.connect = function (address, signerOrProvider) {
252
+ }
253
+ static connect(address, signerOrProvider) {
255
254
  return new ethers_1.Contract(address, _abi, signerOrProvider);
256
- };
257
- AggregatorV2V3Interface__factory.abi = _abi;
258
- return AggregatorV2V3Interface__factory;
259
- }());
255
+ }
256
+ }
260
257
  exports.AggregatorV2V3Interface__factory = AggregatorV2V3Interface__factory;