impermax-sdk 1.2.112 → 2.0.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 (357) hide show
  1. package/lib/abis/ImpermaxABI.d.ts +2 -2
  2. package/lib/abis/ImpermaxABI.js +3 -3
  3. package/lib/abis/contracts/ClaimAggregator.json +2015 -2015
  4. package/lib/abis/contracts/IAllowanceTransfer.json +3772 -0
  5. package/lib/abis/contracts/IBorrowable.json +13207 -13207
  6. package/lib/abis/contracts/IClaimable.json +406 -406
  7. package/lib/abis/contracts/ICollateral.json +9052 -9052
  8. package/lib/abis/contracts/IERC20.json +2376 -2376
  9. package/lib/abis/contracts/IERC721.json +3515 -0
  10. package/lib/abis/contracts/IFactory.json +3660 -3660
  11. package/lib/abis/contracts/IFarmingPool.json +3584 -3584
  12. package/lib/abis/contracts/ILendingVaultV1.json +8358 -8358
  13. package/lib/abis/contracts/IMerkleDistributor.json +1134 -1134
  14. package/lib/abis/contracts/IRouter02.json +7283 -7283
  15. package/lib/abis/contracts/ISimpleUniswapOracle.json +1469 -1469
  16. package/lib/abis/contracts/IStakedLPToken.json +7309 -7309
  17. package/lib/abis/contracts/IStakingRewards.json +1036 -1036
  18. package/lib/abis/contracts/ITokenizedUniswapV2Position.json +4167 -0
  19. package/lib/abis/contracts/ITokenizedUniswapV3Position.json +5539 -0
  20. package/lib/abis/contracts/IUniswapV2Factory.json +1690 -1690
  21. package/lib/abis/contracts/IUniswapV2Pair.json +6761 -6761
  22. package/lib/abis/contracts/IUniswapV3Pool.json +6606 -0
  23. package/lib/abis/contracts/ImpermaxChef.json +20945 -20945
  24. package/lib/abis/contracts/ImpermaxConfigManager.json +31595 -31595
  25. package/lib/abis/contracts/ImpermaxV3Borrowable.json +22131 -0
  26. package/lib/abis/contracts/ImpermaxV3Collateral.json +22988 -0
  27. package/lib/abis/contracts/ImpermaxV3Factory.json +17645 -0
  28. package/lib/abis/contracts/ImpermaxV3UniV2Router01.json +32488 -0
  29. package/lib/abis/contracts/ImpermaxV3UniV3Router01.json +37742 -0
  30. package/lib/abis/contracts/LendingVaultWatcher01.json +4076 -4076
  31. package/lib/abis/contracts/PoolTokenRouter01.json +9058 -0
  32. package/lib/config/amms.d.ts +102 -104
  33. package/lib/config/amms.js +433 -436
  34. package/lib/config/chainId.d.ts +2 -0
  35. package/lib/config/chainId.js +26 -0
  36. package/lib/config/contracts/claim-aggregators.d.ts +2 -2
  37. package/lib/config/contracts/claim-aggregators.js +26 -26
  38. package/lib/config/contracts/impermax-chef.d.ts +2 -2
  39. package/lib/config/contracts/impermax-chef.js +27 -27
  40. package/lib/config/contracts/impermax-config-manager.d.ts +2 -2
  41. package/lib/config/contracts/impermax-config-manager.js +26 -26
  42. package/lib/config/contracts/impermax-factories.d.ts +4 -4
  43. package/lib/config/contracts/impermax-factories.js +87 -87
  44. package/lib/config/contracts/imxes.d.ts +2 -2
  45. package/lib/config/contracts/imxes.js +26 -26
  46. package/lib/config/contracts/lending-vault-watcher.d.ts +2 -2
  47. package/lib/config/contracts/lending-vault-watcher.js +26 -26
  48. package/lib/config/contracts/merkle-distributors.d.ts +4 -4
  49. package/lib/config/contracts/merkle-distributors.js +70 -70
  50. package/lib/config/contracts/routers.d.ts +4 -3
  51. package/lib/config/contracts/routers.js +118 -94
  52. package/lib/config/contracts/simple-uniswap-oracles.d.ts +2 -2
  53. package/lib/config/contracts/simple-uniswap-oracles.js +49 -49
  54. package/lib/config/contracts/weths.d.ts +2 -2
  55. package/lib/config/contracts/weths.js +27 -27
  56. package/lib/config/debank-ids.d.ts +2 -2
  57. package/lib/config/debank-ids.js +26 -26
  58. package/lib/config/endpoints/merkle-distributors.d.ts +4 -4
  59. package/lib/config/endpoints/merkle-distributors.js +70 -70
  60. package/lib/config/eth.d.ts +3 -3
  61. package/lib/config/eth.js +48 -48
  62. package/lib/config/factories.d.ts +7 -7
  63. package/lib/config/factories.js +31 -30
  64. package/lib/config/farms.d.ts +109 -111
  65. package/lib/config/farms.js +207 -210
  66. package/lib/config/general.d.ts +5 -5
  67. package/lib/config/general.js +8 -8
  68. package/lib/config/subgraphs.d.ts +45 -45
  69. package/lib/config/subgraphs.js +187 -187
  70. package/lib/config/types.d.ts +85 -72
  71. package/lib/config/types.js +72 -58
  72. package/lib/index.d.ts +36 -35
  73. package/lib/index.js +159 -152
  74. package/lib/offchain/account/index.d.ts +9 -7
  75. package/lib/offchain/account/index.js +43 -39
  76. package/lib/offchain/account/lendingPool/borrowable.d.ts +14 -0
  77. package/lib/offchain/account/lendingPool/borrowable.js +73 -0
  78. package/lib/offchain/account/lendingPool/collateral.d.ts +12 -0
  79. package/lib/offchain/account/lendingPool/collateral.js +42 -0
  80. package/lib/offchain/account/lendingPool/index.d.ts +6 -5
  81. package/lib/offchain/account/lendingPool/index.js +14 -12
  82. package/lib/offchain/account/lendingPool/offchainAccountBorrowable.d.ts +14 -17
  83. package/lib/offchain/account/lendingPool/offchainAccountBorrowable.js +45 -71
  84. package/lib/offchain/account/lendingPool/offchainAccountCollateral.d.ts +11 -13
  85. package/lib/offchain/account/lendingPool/offchainAccountCollateral.js +31 -43
  86. package/lib/offchain/account/lendingPool/offchainAccountLendingPool.d.ts +28 -21
  87. package/lib/offchain/account/lendingPool/offchainAccountLendingPool.js +69 -68
  88. package/lib/offchain/account/lendingPool/offchainLeveragedPosition.d.ts +25 -0
  89. package/lib/offchain/account/lendingPool/offchainLeveragedPosition.js +116 -0
  90. package/lib/offchain/account/lendingVault.d.ts +11 -0
  91. package/lib/offchain/account/lendingVault.js +38 -0
  92. package/lib/offchain/account/offchainAccount.d.ts +25 -25
  93. package/lib/offchain/account/offchainAccount.js +129 -129
  94. package/lib/offchain/account/offchainAccountLendingVault.d.ts +16 -16
  95. package/lib/offchain/account/offchainAccountLendingVault.js +64 -64
  96. package/lib/offchain/account/offchainAccountPoolToken.d.ts +7 -7
  97. package/lib/offchain/account/offchainAccountPoolToken.js +24 -24
  98. package/lib/offchain/account/offchainMultichainAccount.d.ts +34 -0
  99. package/lib/offchain/account/offchainMultichainAccount.js +66 -0
  100. package/lib/offchain/account/poolToken.d.ts +6 -0
  101. package/lib/offchain/account/poolToken.js +21 -0
  102. package/lib/offchain/account/vault/index.d.ts +3 -0
  103. package/lib/offchain/account/vault/index.js +7 -0
  104. package/lib/offchain/account/vault/offchainAccountVault.d.ts +16 -0
  105. package/lib/offchain/account/vault/offchainAccountVault.js +64 -0
  106. package/lib/offchain/configManager/index.d.ts +5 -5
  107. package/lib/offchain/configManager/index.js +12 -12
  108. package/lib/offchain/configManager/offchainConfigManager.d.ts +25 -25
  109. package/lib/offchain/configManager/offchainConfigManager.js +76 -76
  110. package/lib/offchain/configManager/offchainConfigManagerInitializer.d.ts +6 -6
  111. package/lib/offchain/configManager/offchainConfigManagerInitializer.js +53 -53
  112. package/lib/offchain/configManager/offchainPairConfig.d.ts +40 -40
  113. package/lib/offchain/configManager/offchainPairConfig.js +86 -86
  114. package/lib/offchain/configManager/offchainProposal.d.ts +17 -17
  115. package/lib/offchain/configManager/offchainProposal.js +53 -53
  116. package/lib/offchain/index.d.ts +15 -14
  117. package/lib/offchain/index.js +55 -53
  118. package/lib/offchain/initializer.d.ts +32 -0
  119. package/lib/offchain/initializer.js +627 -0
  120. package/lib/offchain/lendingPool/borrowable.d.ts +55 -0
  121. package/lib/offchain/lendingPool/borrowable.js +351 -0
  122. package/lib/offchain/lendingPool/collateral.d.ts +17 -0
  123. package/lib/offchain/lendingPool/collateral.js +72 -0
  124. package/lib/offchain/lendingPool/index.d.ts +5 -5
  125. package/lib/offchain/lendingPool/index.js +12 -12
  126. package/lib/offchain/lendingPool/offchainBorrowable.d.ts +59 -59
  127. package/lib/offchain/lendingPool/offchainBorrowable.js +366 -366
  128. package/lib/offchain/lendingPool/offchainCollateral.d.ts +20 -19
  129. package/lib/offchain/lendingPool/offchainCollateral.js +81 -75
  130. package/lib/offchain/lendingPool/offchainLendingPool.d.ts +60 -47
  131. package/lib/offchain/lendingPool/offchainLendingPool.js +277 -230
  132. package/lib/offchain/lendingVault.d.ts +22 -0
  133. package/lib/offchain/lendingVault.js +115 -0
  134. package/lib/offchain/offchain.d.ts +106 -113
  135. package/lib/offchain/offchain.js +248 -251
  136. package/lib/offchain/offchainAPRHelper.d.ts +45 -45
  137. package/lib/offchain/offchainAPRHelper.js +239 -239
  138. package/lib/offchain/offchainEndpointManager.d.ts +25 -25
  139. package/lib/offchain/offchainEndpointManager.js +126 -126
  140. package/lib/offchain/offchainInitializer.d.ts +52 -52
  141. package/lib/offchain/offchainInitializer.js +792 -792
  142. package/lib/offchain/offchainLendingVault.d.ts +25 -25
  143. package/lib/offchain/offchainLendingVault.js +114 -114
  144. package/lib/offchain/offchainMultichain.d.ts +50 -0
  145. package/lib/offchain/offchainMultichain.js +75 -0
  146. package/lib/offchain/offchainPoolToken.d.ts +21 -21
  147. package/lib/offchain/offchainPoolToken.js +128 -128
  148. package/lib/offchain/offchainPriceHelper.d.ts +22 -22
  149. package/lib/offchain/offchainPriceHelper.js +364 -364
  150. package/lib/offchain/offchainSolidexHelper.d.ts +16 -16
  151. package/lib/offchain/offchainSolidexHelper.js +58 -58
  152. package/lib/offchain/offchainTypes.d.ts +212 -212
  153. package/lib/offchain/offchainTypes.js +3 -3
  154. package/lib/offchain/poolToken.d.ts +20 -0
  155. package/lib/offchain/poolToken.js +120 -0
  156. package/lib/offchain/priceHelper.d.ts +21 -0
  157. package/lib/offchain/priceHelper.js +195 -0
  158. package/lib/offchain/queries/apis/ponder/index.d.ts +14 -14
  159. package/lib/offchain/queries/apis/ponder/index.js +281 -281
  160. package/lib/offchain/queries/apis/thegraph/index.d.ts +19 -19
  161. package/lib/offchain/queries/apis/thegraph/index.js +355 -355
  162. package/lib/offchain/queries/index.d.ts +20 -20
  163. package/lib/offchain/queries/index.js +51 -51
  164. package/lib/offchain/queries/interfaces/query-builder.d.ts +19 -19
  165. package/lib/offchain/queries/interfaces/query-builder.js +2 -2
  166. package/lib/offchain/queries/interfaces/transformers.js +9 -9
  167. package/lib/offchain/query.d.ts +15 -0
  168. package/lib/offchain/query.js +323 -0
  169. package/lib/offchain/solidexHelper.d.ts +16 -0
  170. package/lib/offchain/solidexHelper.js +58 -0
  171. package/lib/offchain/types.d.ts +150 -0
  172. package/lib/offchain/types.js +3 -0
  173. package/lib/offchain/vault/index.d.ts +6 -0
  174. package/lib/offchain/vault/index.js +14 -0
  175. package/lib/offchain/vault/offchainHedgedVault.d.ts +9 -0
  176. package/lib/offchain/vault/offchainHedgedVault.js +57 -0
  177. package/lib/offchain/vault/offchainLendingVault.d.ts +16 -0
  178. package/lib/offchain/vault/offchainLendingVault.js +73 -0
  179. package/lib/offchain/vault/offchainLeveragedVault.d.ts +9 -0
  180. package/lib/offchain/vault/offchainLeveragedVault.js +57 -0
  181. package/lib/offchain/vault/offchainVault.d.ts +34 -0
  182. package/lib/offchain/vault/offchainVault.js +130 -0
  183. package/lib/onchain/account/index.d.ts +6 -6
  184. package/lib/onchain/account/index.js +38 -38
  185. package/lib/onchain/account/interactions/index.d.ts +28 -0
  186. package/lib/onchain/account/interactions/index.js +158 -0
  187. package/lib/onchain/account/interactions/lendingPool/borrowable.d.ts +16 -0
  188. package/lib/onchain/account/interactions/lendingPool/borrowable.js +49 -0
  189. package/lib/onchain/account/interactions/lendingPool/collateral.d.ts +15 -0
  190. package/lib/onchain/account/interactions/lendingPool/collateral.js +33 -0
  191. package/lib/onchain/account/interactions/lendingPool/index.d.ts +41 -0
  192. package/lib/onchain/account/interactions/lendingPool/index.js +120 -0
  193. package/lib/onchain/account/interactions/lendingVault.d.ts +10 -0
  194. package/lib/onchain/account/interactions/lendingVault.js +12 -0
  195. package/lib/onchain/account/interactions/poolToken.d.ts +33 -0
  196. package/lib/onchain/account/interactions/poolToken.js +180 -0
  197. package/lib/onchain/account/lendingPool/borrowable.d.ts +29 -0
  198. package/lib/onchain/account/lendingPool/borrowable.js +135 -0
  199. package/lib/onchain/account/lendingPool/collateral.d.ts +15 -0
  200. package/lib/onchain/account/lendingPool/collateral.js +66 -0
  201. package/lib/onchain/account/lendingPool/index.d.ts +12 -5
  202. package/lib/onchain/account/lendingPool/index.js +49 -12
  203. package/lib/onchain/account/lendingPool/nftlp/index.d.ts +4 -0
  204. package/lib/onchain/account/lendingPool/nftlp/index.js +11 -0
  205. package/lib/onchain/account/lendingPool/nftlp/onchainAccountNftlp.d.ts +7 -0
  206. package/lib/onchain/account/lendingPool/nftlp/onchainAccountNftlp.js +12 -0
  207. package/lib/onchain/account/lendingPool/nftlp/onchainAccountNftlpUniswapV3.d.ts +4 -0
  208. package/lib/onchain/account/lendingPool/nftlp/onchainAccountNftlpUniswapV3.js +13 -0
  209. package/lib/onchain/account/lendingPool/onchainAccountBorrowable.d.ts +39 -34
  210. package/lib/onchain/account/lendingPool/onchainAccountBorrowable.js +131 -176
  211. package/lib/onchain/account/lendingPool/onchainAccountBorrowableV2.d.ts +10 -0
  212. package/lib/onchain/account/lendingPool/onchainAccountBorrowableV2.js +55 -0
  213. package/lib/onchain/account/lendingPool/onchainAccountBorrowableV3.d.ts +10 -0
  214. package/lib/onchain/account/lendingPool/onchainAccountBorrowableV3.js +28 -0
  215. package/lib/onchain/account/lendingPool/onchainAccountCollateral.d.ts +10 -23
  216. package/lib/onchain/account/lendingPool/onchainAccountCollateral.js +26 -109
  217. package/lib/onchain/account/lendingPool/onchainAccountCollateralV2.d.ts +25 -0
  218. package/lib/onchain/account/lendingPool/onchainAccountCollateralV2.js +99 -0
  219. package/lib/onchain/account/lendingPool/onchainAccountCollateralV3.d.ts +18 -0
  220. package/lib/onchain/account/lendingPool/onchainAccountCollateralV3.js +44 -0
  221. package/lib/onchain/account/lendingPool/onchainAccountLendingPool.d.ts +42 -57
  222. package/lib/onchain/account/lendingPool/onchainAccountLendingPool.js +142 -352
  223. package/lib/onchain/account/lendingPool/onchainAccountLendingPoolV2.d.ts +44 -0
  224. package/lib/onchain/account/lendingPool/onchainAccountLendingPoolV2.js +285 -0
  225. package/lib/onchain/account/lendingPool/onchainAccountLendingPoolV3.d.ts +27 -0
  226. package/lib/onchain/account/lendingPool/onchainAccountLendingPoolV3.js +32 -0
  227. package/lib/onchain/account/lendingVault.d.ts +10 -0
  228. package/lib/onchain/account/lendingVault.js +35 -0
  229. package/lib/onchain/account/onchainAccount.d.ts +32 -32
  230. package/lib/onchain/account/onchainAccount.js +166 -167
  231. package/lib/onchain/account/onchainAccountLendingVault.d.ts +19 -19
  232. package/lib/onchain/account/onchainAccountLendingVault.js +48 -48
  233. package/lib/onchain/account/onchainAccountPoolToken.d.ts +30 -30
  234. package/lib/onchain/account/onchainAccountPoolToken.js +86 -86
  235. package/lib/onchain/account/poolToken.d.ts +24 -0
  236. package/lib/onchain/account/poolToken.js +84 -0
  237. package/lib/onchain/configManager/index.d.ts +5 -5
  238. package/lib/onchain/configManager/index.js +12 -12
  239. package/lib/onchain/configManager/onchainConfigManager.d.ts +12 -12
  240. package/lib/onchain/configManager/onchainConfigManager.js +38 -38
  241. package/lib/onchain/configManager/onchainPairConfig.d.ts +38 -38
  242. package/lib/onchain/configManager/onchainPairConfig.js +85 -85
  243. package/lib/onchain/configManager/onchainProposal.d.ts +17 -17
  244. package/lib/onchain/configManager/onchainProposal.js +55 -55
  245. package/lib/onchain/contractsHelper.d.ts +29 -0
  246. package/lib/onchain/contractsHelper.js +52 -0
  247. package/lib/onchain/impermaxFactory/index.d.ts +7 -5
  248. package/lib/onchain/impermaxFactory/index.js +39 -35
  249. package/lib/onchain/impermaxFactory/lendingPool/borrowable.d.ts +36 -0
  250. package/lib/onchain/impermaxFactory/lendingPool/borrowable.js +153 -0
  251. package/lib/onchain/impermaxFactory/lendingPool/collateral.d.ts +17 -0
  252. package/lib/onchain/impermaxFactory/lendingPool/collateral.js +59 -0
  253. package/lib/onchain/impermaxFactory/lendingPool/index.d.ts +12 -5
  254. package/lib/onchain/impermaxFactory/lendingPool/index.js +50 -12
  255. package/lib/onchain/impermaxFactory/lendingPool/nftlp/index.d.ts +4 -0
  256. package/lib/onchain/impermaxFactory/lendingPool/nftlp/index.js +11 -0
  257. package/lib/onchain/impermaxFactory/lendingPool/nftlp/onchainNftlp.d.ts +22 -0
  258. package/lib/onchain/impermaxFactory/lendingPool/nftlp/onchainNftlp.js +19 -0
  259. package/lib/onchain/impermaxFactory/lendingPool/nftlp/onchainNftlpUniswapV3.d.ts +24 -0
  260. package/lib/onchain/impermaxFactory/lendingPool/nftlp/onchainNftlpUniswapV3.js +90 -0
  261. package/lib/onchain/impermaxFactory/lendingPool/onchainBorrowable.d.ts +38 -34
  262. package/lib/onchain/impermaxFactory/lendingPool/onchainBorrowable.js +137 -156
  263. package/lib/onchain/impermaxFactory/lendingPool/onchainBorrowableV2.d.ts +9 -0
  264. package/lib/onchain/impermaxFactory/lendingPool/onchainBorrowableV2.js +36 -0
  265. package/lib/onchain/impermaxFactory/lendingPool/onchainBorrowableV3.d.ts +7 -0
  266. package/lib/onchain/impermaxFactory/lendingPool/onchainBorrowableV3.js +23 -0
  267. package/lib/onchain/impermaxFactory/lendingPool/onchainCollateral.d.ts +8 -19
  268. package/lib/onchain/impermaxFactory/lendingPool/onchainCollateral.js +24 -61
  269. package/lib/onchain/impermaxFactory/lendingPool/onchainCollateralV2.d.ts +20 -0
  270. package/lib/onchain/impermaxFactory/lendingPool/onchainCollateralV2.js +58 -0
  271. package/lib/onchain/impermaxFactory/lendingPool/onchainCollateralV3.d.ts +13 -0
  272. package/lib/onchain/impermaxFactory/lendingPool/onchainCollateralV3.js +36 -0
  273. package/lib/onchain/impermaxFactory/lendingPool/onchainLendingPool.d.ts +43 -58
  274. package/lib/onchain/impermaxFactory/lendingPool/onchainLendingPool.js +81 -367
  275. package/lib/onchain/impermaxFactory/lendingPool/onchainLendingPoolV2.d.ts +76 -0
  276. package/lib/onchain/impermaxFactory/lendingPool/onchainLendingPoolV2.js +338 -0
  277. package/lib/onchain/impermaxFactory/lendingPool/onchainLendingPoolV3.d.ts +42 -0
  278. package/lib/onchain/impermaxFactory/lendingPool/onchainLendingPoolV3.js +39 -0
  279. package/lib/onchain/impermaxFactory/onchainImpermaxFactory.d.ts +26 -16
  280. package/lib/onchain/impermaxFactory/onchainImpermaxFactory.js +42 -52
  281. package/lib/onchain/impermaxFactory/onchainImpermaxFactoryV2.d.ts +16 -0
  282. package/lib/onchain/impermaxFactory/onchainImpermaxFactoryV2.js +81 -0
  283. package/lib/onchain/impermaxFactory/onchainImpermaxFactoryV3.d.ts +16 -0
  284. package/lib/onchain/impermaxFactory/onchainImpermaxFactoryV3.js +88 -0
  285. package/lib/onchain/index.d.ts +10 -10
  286. package/lib/onchain/index.js +49 -49
  287. package/lib/onchain/interactions/index.d.ts +8 -8
  288. package/lib/onchain/interactions/index.js +41 -41
  289. package/lib/onchain/interactions/lendingPool/borrowable.d.ts +14 -0
  290. package/lib/onchain/interactions/lendingPool/borrowable.js +47 -0
  291. package/lib/onchain/interactions/lendingPool/collateral.d.ts +13 -0
  292. package/lib/onchain/interactions/lendingPool/collateral.js +31 -0
  293. package/lib/onchain/interactions/lendingPool/index.d.ts +12 -5
  294. package/lib/onchain/interactions/lendingPool/index.js +49 -12
  295. package/lib/onchain/interactions/lendingPool/nftlp/index.d.ts +4 -0
  296. package/lib/onchain/interactions/lendingPool/nftlp/index.js +11 -0
  297. package/lib/onchain/interactions/lendingPool/nftlp/onchainInteractionsNftlp.d.ts +7 -0
  298. package/lib/onchain/interactions/lendingPool/nftlp/onchainInteractionsNftlp.js +12 -0
  299. package/lib/onchain/interactions/lendingPool/nftlp/onchainInteractionsNftlpUniswapV3.d.ts +4 -0
  300. package/lib/onchain/interactions/lendingPool/nftlp/onchainInteractionsNftlpUniswapV3.js +13 -0
  301. package/lib/onchain/interactions/lendingPool/onchainInteractionsBorrowable.d.ts +17 -21
  302. package/lib/onchain/interactions/lendingPool/onchainInteractionsBorrowable.js +24 -56
  303. package/lib/onchain/interactions/lendingPool/onchainInteractionsBorrowableV2.d.ts +15 -0
  304. package/lib/onchain/interactions/lendingPool/onchainInteractionsBorrowableV2.js +63 -0
  305. package/lib/onchain/interactions/lendingPool/onchainInteractionsBorrowableV3.d.ts +9 -0
  306. package/lib/onchain/interactions/lendingPool/onchainInteractionsBorrowableV3.js +14 -0
  307. package/lib/onchain/interactions/lendingPool/onchainInteractionsCollateral.d.ts +7 -19
  308. package/lib/onchain/interactions/lendingPool/onchainInteractionsCollateral.js +11 -43
  309. package/lib/onchain/interactions/lendingPool/onchainInteractionsCollateralV2.d.ts +20 -0
  310. package/lib/onchain/interactions/lendingPool/onchainInteractionsCollateralV2.js +48 -0
  311. package/lib/onchain/interactions/lendingPool/onchainInteractionsCollateralV3.d.ts +13 -0
  312. package/lib/onchain/interactions/lendingPool/onchainInteractionsCollateralV3.js +20 -0
  313. package/lib/onchain/interactions/lendingPool/onchainInteractionsLendingPool.d.ts +31 -46
  314. package/lib/onchain/interactions/lendingPool/onchainInteractionsLendingPool.js +53 -135
  315. package/lib/onchain/interactions/lendingPool/onchainInteractionsLendingPoolV2.d.ts +42 -0
  316. package/lib/onchain/interactions/lendingPool/onchainInteractionsLendingPoolV2.js +114 -0
  317. package/lib/onchain/interactions/lendingPool/onchainInteractionsLendingPoolV3.d.ts +27 -0
  318. package/lib/onchain/interactions/lendingPool/onchainInteractionsLendingPoolV3.js +32 -0
  319. package/lib/onchain/interactions/lendingVault.d.ts +8 -0
  320. package/lib/onchain/interactions/lendingVault.js +15 -0
  321. package/lib/onchain/interactions/onchainInteractions.d.ts +31 -31
  322. package/lib/onchain/interactions/onchainInteractions.js +136 -137
  323. package/lib/onchain/interactions/onchainInteractionsConfigManager.d.ts +17 -17
  324. package/lib/onchain/interactions/onchainInteractionsConfigManager.js +44 -44
  325. package/lib/onchain/interactions/onchainInteractionsLendingVault.d.ts +14 -14
  326. package/lib/onchain/interactions/onchainInteractionsLendingVault.js +21 -21
  327. package/lib/onchain/interactions/onchainInteractionsPoolToken.d.ts +35 -35
  328. package/lib/onchain/interactions/onchainInteractionsPoolToken.js +134 -186
  329. package/lib/onchain/interactions/poolToken.d.ts +31 -0
  330. package/lib/onchain/interactions/poolToken.js +181 -0
  331. package/lib/onchain/lendingVault.d.ts +17 -0
  332. package/lib/onchain/lendingVault.js +56 -0
  333. package/lib/onchain/onchain.d.ts +38 -35
  334. package/lib/onchain/onchain.js +78 -70
  335. package/lib/onchain/onchainContractsHelper.d.ts +42 -31
  336. package/lib/onchain/onchainContractsHelper.js +90 -56
  337. package/lib/onchain/onchainLendingVault.d.ts +22 -22
  338. package/lib/onchain/onchainLendingVault.js +69 -69
  339. package/lib/onchain/onchainPermitHelper.d.ts +21 -0
  340. package/lib/onchain/onchainPermitHelper.js +198 -0
  341. package/lib/onchain/onchainPoolToken.d.ts +35 -35
  342. package/lib/onchain/onchainPoolToken.js +129 -129
  343. package/lib/onchain/onchainTypes.d.ts +70 -64
  344. package/lib/onchain/onchainTypes.js +14 -14
  345. package/lib/onchain/poolToken.d.ts +32 -0
  346. package/lib/onchain/poolToken.js +121 -0
  347. package/lib/onchain/types.d.ts +45 -0
  348. package/lib/onchain/types.js +14 -0
  349. package/lib/utils/ether-utils.d.ts +5 -5
  350. package/lib/utils/ether-utils.js +26 -26
  351. package/lib/utils/index.d.ts +3 -3
  352. package/lib/utils/index.js +16 -16
  353. package/lib/utils/lliquidity-math.d.ts +30 -30
  354. package/lib/utils/lliquidity-math.js +139 -139
  355. package/lib/utils/price-from-reserves.d.ts +2 -0
  356. package/lib/utils/price-from-reserves.js +19 -0
  357. package/package.json +36 -36
@@ -1,364 +1,364 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- // coingecko has priority over debank for initialized tokens
13
- const coingecko_ids = {
14
- //Polygon
15
- "0x40379a439d4f6795b6fc9aa5687db461677a2dba": "real-usd",
16
- "0x00e8c0e92eb3ad88189e7125ec8825edc03ab265": "wrapped-usdr",
17
- "0x49e6a20f1bbdfeec2a8222e052000bbb14ee6007": "tangible",
18
- "0x7238390d5f6f64e67c3211c343a410e2a3dec142": "pearl",
19
- "0x6ae96cc93331c19148541d4d2f31363684917092": "caviar",
20
- // Arbitrum
21
- "0xb348b87b23d5977e2948e6f36ca07e1ec94d7328": "swapfish",
22
- "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f": "wrapped-bitcoin",
23
- "0x463913d3a3d3d291667d53b8325c598eb88d3b0e": "solidlizard",
24
- "0xaaa6c1e32c55a7bfa8066a6fae9b42650f262418": "ramses-exchange",
25
- "0xd5954c3084a1ccd70b4da011e67760b8e78aee84": "arbitrum-exchange",
26
- "0xff191514a9baba76bfd19e3943a4d37e8ec9a111": "auragi",
27
- "0x15b2fb8f08e4ac1ce019eadae02ee92aedf06851": "chronos-finance",
28
- "0xaae0c3856e665ff9b3e2872b6d75939d810b7e40": "yieldfarming-index",
29
- "0xe80772eaf6e2e18b651f160bc9158b2a5cafca65": "usd",
30
- // Avalanche
31
- "0x3712871408a829c5cd4e86da1f4ce727efcd28f6": "glacier",
32
- // ZkSync
33
- "0x503234f203fc7eb888eec8513210612a43cf6115": "liquity-usd",
34
- "0x85d84c774cf8e9ff85342684b0e795df72a24908": "velocore",
35
- "0x5756a28e2aae01f600fc2c01358395f5c1f8ad3a": "vesync",
36
- "0x160e07e42adbc1fce92d505b579bcd8a3fbea77d": "dracula-fi",
37
- // Scroll
38
- "0x1a2fcb585b327fadec91f55d45829472b15f17a4": "tokan",
39
- "0x188b158caf5ea252012dbd6030afc030329c4961": "zen",
40
- "0xf610a9dfb7c89644979b4a0f27063e9e7d7cda32": "wrapped-steth",
41
- "0xa25b25548b4c98b0c7d3d27dca5d5ca743d68b7f": "wrapped-rseth",
42
- "0x80137510979822322193fc997d400d5a6c747bf7": "stakestone-ether",
43
- "0x2b6a85cd35d15691357eea61d88cb3f401a92fc3": "surveyor-dao",
44
- "0x7dbd14115baf4240aab8c4ef31bf71f76c708420": "uk-real-estate",
45
- "0x25ea98ac87a38142561ea70143fd44c4772a16b6": "stack-2",
46
- "0xd29687c813d741e2f938f4ac377128810e217b1b": "scroll",
47
- // base
48
- "0x940181a94a35a4569e4529a3cdfb74e38fd98631": "aerodrome-finance",
49
- "0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed": "degen-base",
50
- "0x4200000000000000000000000000000000000006": "ethereum",
51
- "0x54016a4848a38f257b6e96331f7404073fd9c32c": "equalizer-base",
52
- "0xa3d1a8deb97b111454b294e2324efad13a9d8396": "overnight-finance",
53
- "0x4154550f4db74dc38d1fe98e1f3f28ed6dad627d": "jarvis-synthetic-euro",
54
- "0xa61beb4a3d02decb01039e378237032b351125b4": "eura",
55
- "0x7002458b1df59eccb57387bc79ffc7c29e22e6f7": "origin-protocol",
56
- "0xdbfefd2e8460a6ee4955a68582f85708baea60a3": "super-oeth",
57
- "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf": "coinbase-wrapped-btc",
58
- "0x576bca23dcb6d94ff8e537d88b0d3e1bead444a2": "base-carbon-tonne",
59
- "0x36912b5cf63e509f18e53ac98b3012fa79e77bf5": "fuego",
60
- "0x9b8df6e244526ab5f6e6400d331db28c8fdddb55": "wrapped-solana-universal",
61
- // optimism
62
- "0x9560e827af36c94d2ac33a39bce1fe78631088db": "velodrome-finance",
63
- "0x4200000000000000000000000000000000000042": "optimism",
64
- "0x1f32b1c2345538c0c6f582fcb022739c4a194ebb": "wrapped-steth",
65
- "0x55027a5b06f4340cc4c82dcc74c90ca93dcb173e": "tadpole",
66
- // re.al
67
- "0xce1581d7b4ba40176f0e219b2cac30088ad50c7a": "pearl",
68
- // blast
69
- "0x52f847356b38720b55ee18cb3e094ca11c85a192": "fenix",
70
- };
71
- const dexscreener_ids = {
72
- // ibex on scroll
73
- "0x78ab77f7d590fb101aa18affc238cbfea31ead5b": "scroll",
74
- // ibex on polygon
75
- "0xf972daced7c6b03223710c11413036d17eb298f6": "polygon",
76
- // ibex on arb
77
- "0x56659245931cb6920e39c189d2a0e7dd0da2d57b": "arbitrum",
78
- // ibex on zksync
79
- "0xbe9f8c0d6f0fd7e46cdacca340747ea2f247991d": "zksync",
80
- // preon on scroll
81
- "0x135f9b3d5dec9d73c042cf380adfff95f4fe9e35": "scroll,blast",
82
- // wstRWA on scroll
83
- "0x154f5db4950d2cd4a7af425e11865215f90ddb07": "scroll",
84
- // axlOP on base
85
- "0x994ac01750047B9d35431a7Ae4Ed312ee955E030": "base",
86
- // opxvelo on op
87
- "0xc38464250f51123078bbd7ea574e185f6623d037": "optimism",
88
- // fantom-bomb on scroll (removed from coingecko)
89
- "0x6b6882f7642ee1c15f12b51f1a4988b3e7e29f5c": "scroll",
90
- };
91
- const fantom_ids = {
92
- // uponly on ftm
93
- "0x28f1d1c509495e5afc23fb47acf6cc5b217ab598": "fantom",
94
- // plus-bet on ftm
95
- "0x39551b1c26ce03714e4661833b0fa730174bd7e9": "fantom",
96
- // tango on ftm
97
- "0xee9ff3efd508741492b5bd45269aa45a43be59c8": "fantom",
98
- // fantomsonicinu
99
- "0x05e31a691405d06708a355c029599c12d5da8b28": "fantom",
100
- //sonic goat
101
- "0x43f9a13675e352154f745d6402e853fecc388aa5": "fantom",
102
- // fantom eco
103
- "0xb8a32897016c1b2ee0797090162eafe58f032795": "fantom",
104
- // hoops
105
- "0x431516e478d73cfab034229c4d7a94a2cbf5787f": "fantom",
106
- // moon bay on ftm
107
- "0xd361474bb19c8b98870bb67f5759cdf277dee7f9": "fantom",
108
- // thc on fantom
109
- "0x479673391b3818f5e3ed2fa69a58e13d685becf6": "fantom",
110
- // equal
111
- "0x3fd3a0c85b70754efc07ac9ac0cbbdce664865a6": "equalizer-dex",
112
- // wftm
113
- "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83": "wrapped-fantom",
114
- // mftm
115
- "0x62227c75908b7d358a9d70ea4670f57f8b012ccc": "fantom",
116
- // fiery
117
- "0xc36cae799b758d04dac9b3a1fd59755c4a8ae721": "fantom",
118
- // Skitty
119
- "0xad531012c0651a85a212f10fc97b3ec15684548a": "fantom",
120
- // fBomb
121
- "0x74ccbe53f77b08632ce0cb91d3a545bf6b8e0979": "fantom",
122
- // mclb
123
- "0x5deb27e51dbeef691ba1175a2e563870499c2acb": "fantom",
124
- // hedgy
125
- "0x16c22105301cfd85fd0f911920d282d18cc175c1": "fantom"
126
- };
127
- class OffchainPriceHelper {
128
- ;
129
- constructor(offchain) {
130
- this.coingeckoInitialized = null;
131
- this.offchain = offchain;
132
- this.debankTokensPrice = {};
133
- }
134
- cleanCache() {
135
- this.subgraphTokensPrice = null;
136
- this.debankTokensPrice = {};
137
- }
138
- // First source of token price: Offchain (less accurate, faster)
139
- addPriceIfMissing(offchainTokenPrice, token) {
140
- if (offchainTokenPrice[token.id])
141
- return;
142
- offchainTokenPrice[token.id] = parseFloat(token.derivedUSD);
143
- }
144
- initializeSubgraphTokenPrice() {
145
- return __awaiter(this, void 0, void 0, function* () {
146
- const lendingPoolsData = yield this.offchain.getLendingPoolsData();
147
- const offchainTokenPrice = {};
148
- for (const factory in lendingPoolsData) {
149
- for (const id in lendingPoolsData[factory]) {
150
- const lendingPool = lendingPoolsData[factory][id];
151
- this.addPriceIfMissing(offchainTokenPrice, lendingPool.borrowable0.underlying);
152
- this.addPriceIfMissing(offchainTokenPrice, lendingPool.borrowable1.underlying);
153
- for (const reward of lendingPool.pair.rewards) {
154
- this.addPriceIfMissing(offchainTokenPrice, reward.rewardsToken);
155
- }
156
- }
157
- }
158
- //fix for IMX
159
- offchainTokenPrice["0x9c67ee39e3c4954396b9142010653f17257dd39c"] = 0;
160
- offchainTokenPrice["0x7b35ce522cb72e4077baeb96cb923a5529764a00"] = 0;
161
- offchainTokenPrice["0xea6887e4a9cda1b77e70129e5fba830cdb5cddef"] = 0;
162
- offchainTokenPrice["0x60bb3d364b765c497c8ce50ae0ae3f0882c5bd05"] = 0;
163
- offchainTokenPrice["0x900f1ec5819fa087d368877cd03b265bf1802667"] = 0;
164
- offchainTokenPrice["0xea38f1ccf77bf43f352636241b05dd8f6f5f52b2"] = 0;
165
- offchainTokenPrice["0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83"] = 0;
166
- offchainTokenPrice["0xc19669a405067927865b40ea045a2baabbbe57f5"] = 0;
167
- offchainTokenPrice["0x3fd3a0c85b70754efc07ac9ac0cbbdce664865a6"] = 0;
168
- //offchainTokenPrice["0xad531012c0651a85a212f10fc97b3ec15684548a"] = 0;
169
- return offchainTokenPrice;
170
- });
171
- }
172
- getSubgraphTokensPrice() {
173
- return __awaiter(this, void 0, void 0, function* () {
174
- if (!this.subgraphTokensPrice)
175
- this.subgraphTokensPrice = this.initializeSubgraphTokenPrice();
176
- return this.subgraphTokensPrice;
177
- });
178
- }
179
- getAllCoingeckoPrices() {
180
- return __awaiter(this, void 0, void 0, function* () {
181
- // Remove duplicates just in case, get the unique coingecko token ids
182
- const tokenIds = Object.values(coingecko_ids);
183
- const uniqueIds = [...new Set(tokenIds)].join(",");
184
- try {
185
- // Get all token prices from gecko
186
- const response = yield fetch("https://api.coingecko.com/api/v3/simple/price?ids=" + uniqueIds + "&vs_currencies=usd");
187
- if (response.status != 200)
188
- return;
189
- const data = yield response.json();
190
- if (!data)
191
- return;
192
- // Record of: { 'address_0': price, 'address_1': price }
193
- this.coingeckoTokenPrices = Object.keys(coingecko_ids).reduce((prices, address) => {
194
- var _a;
195
- const tokenId = coingecko_ids[address];
196
- prices[address] = ((_a = data[tokenId]) === null || _a === void 0 ? void 0 : _a.usd) || 0;
197
- return prices;
198
- }, {});
199
- }
200
- catch (err) {
201
- console.log("Gecko API fail");
202
- this.coingeckoTokenPrices = {};
203
- }
204
- });
205
- }
206
- getCoingeckoTokenPrice(tokenAddress) {
207
- return __awaiter(this, void 0, void 0, function* () {
208
- if (!this.coingeckoInitialized)
209
- this.coingeckoInitialized = this.getAllCoingeckoPrices();
210
- yield this.coingeckoInitialized;
211
- const geckoPrice = this.coingeckoTokenPrices[tokenAddress];
212
- return geckoPrice || 0;
213
- });
214
- }
215
- getDexscreenerTokenPrice(tokenAddress) {
216
- return __awaiter(this, void 0, void 0, function* () {
217
- try {
218
- const chainId = dexscreener_ids[tokenAddress];
219
- const response = yield fetch("https://api.dexscreener.com/latest/dex/search?q=" + tokenAddress);
220
- if (response.status != 200)
221
- return 0;
222
- const data = yield response.json();
223
- if (!data || !data.pairs || data.pairs.length === 0)
224
- return 0;
225
- const pairs = data.pairs;
226
- const pairItem = pairs.filter((pair) => chainId.includes(pair.chainId) && (pair.baseToken.address.toLowerCase() == tokenAddress || pair.quoteToken.address.toLowerCase() == tokenAddress));
227
- return pairItem.length > 0 ? pairItem[0].priceUsd : 0;
228
- }
229
- catch (_a) {
230
- return 0;
231
- }
232
- });
233
- }
234
- getFantomTokenPrice(tokenAddress) {
235
- return __awaiter(this, void 0, void 0, function* () {
236
- try {
237
- const response = yield fetch("https://eqapi-beta-8868m.ondigitalocean.app/fantom/v4/tokens");
238
- if (response.status != 200)
239
- return 0;
240
- const data = yield response.json();
241
- if (!data || !data.data)
242
- return 0;
243
- const priceData = data.data;
244
- const priceItem = Object.keys(priceData).filter((keyId) => keyId.toLowerCase() == tokenAddress);
245
- return priceItem.length > 0 ? Number(priceData[priceItem[0]].priceUsd) : 0;
246
- }
247
- catch (_a) {
248
- return 0;
249
- }
250
- });
251
- }
252
- initializeDebankTokenPrice(tokenAddress) {
253
- return __awaiter(this, void 0, void 0, function* () {
254
- if (Object.keys(fantom_ids).includes(tokenAddress.toLowerCase())) {
255
- const result = yield this.getFantomTokenPrice(tokenAddress);
256
- if (result)
257
- return result;
258
- }
259
- if (Object.keys(dexscreener_ids).includes(tokenAddress.toLowerCase())) {
260
- const result = yield this.getDexscreenerTokenPrice(tokenAddress.toLowerCase());
261
- if (result)
262
- return result;
263
- }
264
- if (Object.keys(coingecko_ids).includes(tokenAddress.toLowerCase())) {
265
- const result = yield this.getCoingeckoTokenPrice(tokenAddress.toLowerCase());
266
- if (result)
267
- return result;
268
- }
269
- return 0;
270
- });
271
- }
272
- getDebankTokenPrice(tokenAddress) {
273
- return __awaiter(this, void 0, void 0, function* () {
274
- if (tokenAddress.toLowerCase() === '0xf28164a485b0b2c90639e47b0f377b4a438a16b1') { // fix for dQuick
275
- return (yield this.getDebankTokenPrice('0x831753dd7087cac61ab5644b308642cc1c33dc13')) * 1.68;
276
- }
277
- if (tokenAddress.toLowerCase() === '0x63468133ed352e602beb61dd254d6060ad2fe419') { // fix for sTHO
278
- return (yield this.getDebankTokenPrice('0xae4aa155d2987b454c29450ef4f862cf00907b61')) * 1.1;
279
- }
280
- if (tokenAddress.toLowerCase() === '0xfcef8a994209d6916eb2c86cdd2afd60aa6f54b1') { // fix for fBEETS
281
- return (yield this.getDebankTokenPrice('0xf24bcf4d1e507740041c9cfd2dddb29585adce1e')) * 0.93;
282
- }
283
- if (tokenAddress.toLowerCase() === '0x5979d7b546e38e414f7e9822514be443a4800529') { // TEMPORARY fix for WSTETH
284
- return (yield this.getDebankTokenPrice('0x82af49447d8a07e3bd95bd0d56f35241523fbab1')) / 0.92;
285
- }
286
- if (tokenAddress.toLowerCase() === '0x3f56e0c36d275367b8c502090edf38289b3dea0d') { // TEMPORARY fix for MAI
287
- return 1;
288
- }
289
- if (tokenAddress.toLowerCase() === '0x2fc5cf65fd0a660801f119832b2158756968266d') { // TEMPORARY fix for CHI
290
- return 1;
291
- }
292
- if (tokenAddress.toLowerCase() === '0xc19669a405067927865b40ea045a2baabbbe57f5') { // TEMPORARY fix for STAR
293
- return 1;
294
- }
295
- if (tokenAddress.toLowerCase() === '0xb79dd08ea68a908a97220c76d19a6aa9cbde4376') { // TEMPORARY fix for usd+
296
- return 1;
297
- }
298
- if (tokenAddress.toLowerCase() === '0xc518a88c67ceca8b3f24c4562cb71deeb2af86b7') { // TEMPORARY fix for re.al usdc
299
- return 1;
300
- }
301
- if (tokenAddress.toLowerCase() === '0xaec9e50e3397f9ddc635c6c429c8c7eca418a143') { // TEMPORARY fix for re.al arcUSD
302
- return 1;
303
- }
304
- if (tokenAddress.toLowerCase() === '0xc71aaf8e486e3f33841bb56ca3fd2ac3fa8d29a8') { // TEMPORARY fix for WSTETH Canto
305
- return (yield this.getDebankTokenPrice('0x5fd55a1b9fc24967c4db09c513c3ba0dfa7ff687')) * 1.12;
306
- }
307
- if (tokenAddress.toLowerCase() === '0x152b9d0fdc40c096757f570a51e494bd4b943e50') { // TEMPORARY fix for BTC.b AVAX
308
- return (yield this.getDebankTokenPrice('0x50b7545627a5162f82a992c33b87adc75187b218'));
309
- }
310
- if (tokenAddress.toLowerCase() === '0x9fc3104f6fc188fee65c85bbc4b94a48282ae76d') { // TEMPORARY fix for SATIN
311
- return 0;
312
- }
313
- if ([
314
- "0x9c67ee39e3c4954396b9142010653f17257dd39c",
315
- "0x7b35ce522cb72e4077baeb96cb923a5529764a00",
316
- "0xea6887e4a9cda1b77e70129e5fba830cdb5cddef",
317
- "0x60bb3d364b765c497c8ce50ae0ae3f0882c5bd05",
318
- "0x900f1ec5819fa087d368877cd03b265bf1802667",
319
- "0xea38f1ccf77bf43f352636241b05dd8f6f5f52b2"
320
- ].includes(tokenAddress.toLowerCase())) { // fix for IMX
321
- return 0;
322
- }
323
- if (tokenAddress.toLowerCase() === '0xda0053f0befcbcac208a3f867bb243716734d809') { // TEMPORARY fix for oxSOLID
324
- return (yield this.getDebankTokenPrice('0x888ef71766ca594ded1f0fa3ae64ed2941740a20')) * 0.88;
325
- }
326
- if (tokenAddress.toLowerCase() === '0x431d5dff03120afa4bdf332c61a6e1766ef37bdb') { // TEMPORARY fix for JPYCv2
327
- return (yield this.getDebankTokenPrice('0x6ae7dfc73e0dde2aa99ac063dcf7e8a63265108c'));
328
- }
329
- if (!this.debankTokensPrice[tokenAddress])
330
- this.debankTokensPrice[tokenAddress] = this.initializeDebankTokenPrice(tokenAddress);
331
- const tokenPrice = yield this.debankTokensPrice[tokenAddress];
332
- if (tokenPrice === 0) {
333
- //manual fallback
334
- if (tokenAddress.toLowerCase() === '0xaaa6c1e32c55a7bfa8066a6fae9b42650f262418') { // fix for RAM
335
- return 0.02;
336
- }
337
- if (tokenAddress.toLowerCase() === '0xd5954c3084a1ccd70b4da011e67760b8e78aee84') { // fix for ARX
338
- return 0.5;
339
- }
340
- if (tokenAddress.toLowerCase() === '0xe80772eaf6e2e18b651f160bc9158b2a5cafca65') { // fix for USD+
341
- return 1;
342
- }
343
- if (tokenAddress.toLowerCase() === '0x3712871408a829c5cd4e86da1f4ce727efcd28f6') { // fix for GLCR
344
- return 0.011;
345
- }
346
- if (tokenAddress.toLowerCase() === '0x5756a28e2aae01f600fc2c01358395f5c1f8ad3a') { // fix for VS
347
- return 0.05;
348
- }
349
- if (tokenAddress.toLowerCase() === '0x160e07e42adbc1fce92d505b579bcd8a3fbea77d') { // fix for FANG
350
- return 0.1;
351
- }
352
- if (tokenAddress.toLowerCase() === '0x1c28edf9e0d66f3124f141a3cf3ef1217f7019c4') { // fix for SLNA
353
- return 0.00045;
354
- }
355
- // try fallback on offchain
356
- const subgraphTokensPrice = yield this.getSubgraphTokensPrice();
357
- const subgraphTokenPrice = subgraphTokensPrice[tokenAddress];
358
- return subgraphTokenPrice ? subgraphTokenPrice : 0;
359
- }
360
- return tokenPrice;
361
- });
362
- }
363
- }
364
- exports.default = OffchainPriceHelper;
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ // coingecko has priority over debank for initialized tokens
13
+ const coingecko_ids = {
14
+ //Polygon
15
+ "0x40379a439d4f6795b6fc9aa5687db461677a2dba": "real-usd",
16
+ "0x00e8c0e92eb3ad88189e7125ec8825edc03ab265": "wrapped-usdr",
17
+ "0x49e6a20f1bbdfeec2a8222e052000bbb14ee6007": "tangible",
18
+ "0x7238390d5f6f64e67c3211c343a410e2a3dec142": "pearl",
19
+ "0x6ae96cc93331c19148541d4d2f31363684917092": "caviar",
20
+ // Arbitrum
21
+ "0xb348b87b23d5977e2948e6f36ca07e1ec94d7328": "swapfish",
22
+ "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f": "wrapped-bitcoin",
23
+ "0x463913d3a3d3d291667d53b8325c598eb88d3b0e": "solidlizard",
24
+ "0xaaa6c1e32c55a7bfa8066a6fae9b42650f262418": "ramses-exchange",
25
+ "0xd5954c3084a1ccd70b4da011e67760b8e78aee84": "arbitrum-exchange",
26
+ "0xff191514a9baba76bfd19e3943a4d37e8ec9a111": "auragi",
27
+ "0x15b2fb8f08e4ac1ce019eadae02ee92aedf06851": "chronos-finance",
28
+ "0xaae0c3856e665ff9b3e2872b6d75939d810b7e40": "yieldfarming-index",
29
+ "0xe80772eaf6e2e18b651f160bc9158b2a5cafca65": "usd",
30
+ // Avalanche
31
+ "0x3712871408a829c5cd4e86da1f4ce727efcd28f6": "glacier",
32
+ // ZkSync
33
+ "0x503234f203fc7eb888eec8513210612a43cf6115": "liquity-usd",
34
+ "0x85d84c774cf8e9ff85342684b0e795df72a24908": "velocore",
35
+ "0x5756a28e2aae01f600fc2c01358395f5c1f8ad3a": "vesync",
36
+ "0x160e07e42adbc1fce92d505b579bcd8a3fbea77d": "dracula-fi",
37
+ // Scroll
38
+ "0x1a2fcb585b327fadec91f55d45829472b15f17a4": "tokan",
39
+ "0x188b158caf5ea252012dbd6030afc030329c4961": "zen",
40
+ "0xf610a9dfb7c89644979b4a0f27063e9e7d7cda32": "wrapped-steth",
41
+ "0xa25b25548b4c98b0c7d3d27dca5d5ca743d68b7f": "wrapped-rseth",
42
+ "0x80137510979822322193fc997d400d5a6c747bf7": "stakestone-ether",
43
+ "0x2b6a85cd35d15691357eea61d88cb3f401a92fc3": "surveyor-dao",
44
+ "0x7dbd14115baf4240aab8c4ef31bf71f76c708420": "uk-real-estate",
45
+ "0x25ea98ac87a38142561ea70143fd44c4772a16b6": "stack-2",
46
+ "0xd29687c813d741e2f938f4ac377128810e217b1b": "scroll",
47
+ // base
48
+ "0x940181a94a35a4569e4529a3cdfb74e38fd98631": "aerodrome-finance",
49
+ "0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed": "degen-base",
50
+ "0x4200000000000000000000000000000000000006": "ethereum",
51
+ "0x54016a4848a38f257b6e96331f7404073fd9c32c": "equalizer-base",
52
+ "0xa3d1a8deb97b111454b294e2324efad13a9d8396": "overnight-finance",
53
+ "0x4154550f4db74dc38d1fe98e1f3f28ed6dad627d": "jarvis-synthetic-euro",
54
+ "0xa61beb4a3d02decb01039e378237032b351125b4": "eura",
55
+ "0x7002458b1df59eccb57387bc79ffc7c29e22e6f7": "origin-protocol",
56
+ "0xdbfefd2e8460a6ee4955a68582f85708baea60a3": "super-oeth",
57
+ "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf": "coinbase-wrapped-btc",
58
+ "0x576bca23dcb6d94ff8e537d88b0d3e1bead444a2": "base-carbon-tonne",
59
+ "0x36912b5cf63e509f18e53ac98b3012fa79e77bf5": "fuego",
60
+ "0x9b8df6e244526ab5f6e6400d331db28c8fdddb55": "wrapped-solana-universal",
61
+ // optimism
62
+ "0x9560e827af36c94d2ac33a39bce1fe78631088db": "velodrome-finance",
63
+ "0x4200000000000000000000000000000000000042": "optimism",
64
+ "0x1f32b1c2345538c0c6f582fcb022739c4a194ebb": "wrapped-steth",
65
+ "0x55027a5b06f4340cc4c82dcc74c90ca93dcb173e": "tadpole",
66
+ // re.al
67
+ "0xce1581d7b4ba40176f0e219b2cac30088ad50c7a": "pearl",
68
+ // blast
69
+ "0x52f847356b38720b55ee18cb3e094ca11c85a192": "fenix",
70
+ };
71
+ const dexscreener_ids = {
72
+ // ibex on scroll
73
+ "0x78ab77f7d590fb101aa18affc238cbfea31ead5b": "scroll",
74
+ // ibex on polygon
75
+ "0xf972daced7c6b03223710c11413036d17eb298f6": "polygon",
76
+ // ibex on arb
77
+ "0x56659245931cb6920e39c189d2a0e7dd0da2d57b": "arbitrum",
78
+ // ibex on zksync
79
+ "0xbe9f8c0d6f0fd7e46cdacca340747ea2f247991d": "zksync",
80
+ // preon on scroll
81
+ "0x135f9b3d5dec9d73c042cf380adfff95f4fe9e35": "scroll,blast",
82
+ // wstRWA on scroll
83
+ "0x154f5db4950d2cd4a7af425e11865215f90ddb07": "scroll",
84
+ // axlOP on base
85
+ "0x994ac01750047B9d35431a7Ae4Ed312ee955E030": "base",
86
+ // opxvelo on op
87
+ "0xc38464250f51123078bbd7ea574e185f6623d037": "optimism",
88
+ // fantom-bomb on scroll (removed from coingecko)
89
+ "0x6b6882f7642ee1c15f12b51f1a4988b3e7e29f5c": "scroll",
90
+ };
91
+ const fantom_ids = {
92
+ // uponly on ftm
93
+ "0x28f1d1c509495e5afc23fb47acf6cc5b217ab598": "fantom",
94
+ // plus-bet on ftm
95
+ "0x39551b1c26ce03714e4661833b0fa730174bd7e9": "fantom",
96
+ // tango on ftm
97
+ "0xee9ff3efd508741492b5bd45269aa45a43be59c8": "fantom",
98
+ // fantomsonicinu
99
+ "0x05e31a691405d06708a355c029599c12d5da8b28": "fantom",
100
+ //sonic goat
101
+ "0x43f9a13675e352154f745d6402e853fecc388aa5": "fantom",
102
+ // fantom eco
103
+ "0xb8a32897016c1b2ee0797090162eafe58f032795": "fantom",
104
+ // hoops
105
+ "0x431516e478d73cfab034229c4d7a94a2cbf5787f": "fantom",
106
+ // moon bay on ftm
107
+ "0xd361474bb19c8b98870bb67f5759cdf277dee7f9": "fantom",
108
+ // thc on fantom
109
+ "0x479673391b3818f5e3ed2fa69a58e13d685becf6": "fantom",
110
+ // equal
111
+ "0x3fd3a0c85b70754efc07ac9ac0cbbdce664865a6": "equalizer-dex",
112
+ // wftm
113
+ "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83": "wrapped-fantom",
114
+ // mftm
115
+ "0x62227c75908b7d358a9d70ea4670f57f8b012ccc": "fantom",
116
+ // fiery
117
+ "0xc36cae799b758d04dac9b3a1fd59755c4a8ae721": "fantom",
118
+ // Skitty
119
+ "0xad531012c0651a85a212f10fc97b3ec15684548a": "fantom",
120
+ // fBomb
121
+ "0x74ccbe53f77b08632ce0cb91d3a545bf6b8e0979": "fantom",
122
+ // mclb
123
+ "0x5deb27e51dbeef691ba1175a2e563870499c2acb": "fantom",
124
+ // hedgy
125
+ "0x16c22105301cfd85fd0f911920d282d18cc175c1": "fantom"
126
+ };
127
+ class OffchainPriceHelper {
128
+ ;
129
+ constructor(offchain) {
130
+ this.coingeckoInitialized = null;
131
+ this.offchain = offchain;
132
+ this.debankTokensPrice = {};
133
+ }
134
+ cleanCache() {
135
+ this.subgraphTokensPrice = null;
136
+ this.debankTokensPrice = {};
137
+ }
138
+ // First source of token price: Offchain (less accurate, faster)
139
+ addPriceIfMissing(offchainTokenPrice, token) {
140
+ if (offchainTokenPrice[token.id])
141
+ return;
142
+ offchainTokenPrice[token.id] = parseFloat(token.derivedUSD);
143
+ }
144
+ initializeSubgraphTokenPrice() {
145
+ return __awaiter(this, void 0, void 0, function* () {
146
+ const lendingPoolsData = yield this.offchain.getLendingPoolsData();
147
+ const offchainTokenPrice = {};
148
+ for (const factory in lendingPoolsData) {
149
+ for (const id in lendingPoolsData[factory]) {
150
+ const lendingPool = lendingPoolsData[factory][id];
151
+ this.addPriceIfMissing(offchainTokenPrice, lendingPool.borrowable0.underlying);
152
+ this.addPriceIfMissing(offchainTokenPrice, lendingPool.borrowable1.underlying);
153
+ for (const reward of lendingPool.pair.rewards) {
154
+ this.addPriceIfMissing(offchainTokenPrice, reward.rewardsToken);
155
+ }
156
+ }
157
+ }
158
+ //fix for IMX
159
+ offchainTokenPrice["0x9c67ee39e3c4954396b9142010653f17257dd39c"] = 0;
160
+ offchainTokenPrice["0x7b35ce522cb72e4077baeb96cb923a5529764a00"] = 0;
161
+ offchainTokenPrice["0xea6887e4a9cda1b77e70129e5fba830cdb5cddef"] = 0;
162
+ offchainTokenPrice["0x60bb3d364b765c497c8ce50ae0ae3f0882c5bd05"] = 0;
163
+ offchainTokenPrice["0x900f1ec5819fa087d368877cd03b265bf1802667"] = 0;
164
+ offchainTokenPrice["0xea38f1ccf77bf43f352636241b05dd8f6f5f52b2"] = 0;
165
+ offchainTokenPrice["0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83"] = 0;
166
+ offchainTokenPrice["0xc19669a405067927865b40ea045a2baabbbe57f5"] = 0;
167
+ offchainTokenPrice["0x3fd3a0c85b70754efc07ac9ac0cbbdce664865a6"] = 0;
168
+ //offchainTokenPrice["0xad531012c0651a85a212f10fc97b3ec15684548a"] = 0;
169
+ return offchainTokenPrice;
170
+ });
171
+ }
172
+ getSubgraphTokensPrice() {
173
+ return __awaiter(this, void 0, void 0, function* () {
174
+ if (!this.subgraphTokensPrice)
175
+ this.subgraphTokensPrice = this.initializeSubgraphTokenPrice();
176
+ return this.subgraphTokensPrice;
177
+ });
178
+ }
179
+ getAllCoingeckoPrices() {
180
+ return __awaiter(this, void 0, void 0, function* () {
181
+ // Remove duplicates just in case, get the unique coingecko token ids
182
+ const tokenIds = Object.values(coingecko_ids);
183
+ const uniqueIds = [...new Set(tokenIds)].join(",");
184
+ try {
185
+ // Get all token prices from gecko
186
+ const response = yield fetch("https://api.coingecko.com/api/v3/simple/price?ids=" + uniqueIds + "&vs_currencies=usd");
187
+ if (response.status != 200)
188
+ return;
189
+ const data = yield response.json();
190
+ if (!data)
191
+ return;
192
+ // Record of: { 'address_0': price, 'address_1': price }
193
+ this.coingeckoTokenPrices = Object.keys(coingecko_ids).reduce((prices, address) => {
194
+ var _a;
195
+ const tokenId = coingecko_ids[address];
196
+ prices[address] = ((_a = data[tokenId]) === null || _a === void 0 ? void 0 : _a.usd) || 0;
197
+ return prices;
198
+ }, {});
199
+ }
200
+ catch (err) {
201
+ console.log("Gecko API fail");
202
+ this.coingeckoTokenPrices = {};
203
+ }
204
+ });
205
+ }
206
+ getCoingeckoTokenPrice(tokenAddress) {
207
+ return __awaiter(this, void 0, void 0, function* () {
208
+ if (!this.coingeckoInitialized)
209
+ this.coingeckoInitialized = this.getAllCoingeckoPrices();
210
+ yield this.coingeckoInitialized;
211
+ const geckoPrice = this.coingeckoTokenPrices[tokenAddress];
212
+ return geckoPrice || 0;
213
+ });
214
+ }
215
+ getDexscreenerTokenPrice(tokenAddress) {
216
+ return __awaiter(this, void 0, void 0, function* () {
217
+ try {
218
+ const chainId = dexscreener_ids[tokenAddress];
219
+ const response = yield fetch("https://api.dexscreener.com/latest/dex/search?q=" + tokenAddress);
220
+ if (response.status != 200)
221
+ return 0;
222
+ const data = yield response.json();
223
+ if (!data || !data.pairs || data.pairs.length === 0)
224
+ return 0;
225
+ const pairs = data.pairs;
226
+ const pairItem = pairs.filter((pair) => chainId.includes(pair.chainId) && (pair.baseToken.address.toLowerCase() == tokenAddress || pair.quoteToken.address.toLowerCase() == tokenAddress));
227
+ return pairItem.length > 0 ? pairItem[0].priceUsd : 0;
228
+ }
229
+ catch (_a) {
230
+ return 0;
231
+ }
232
+ });
233
+ }
234
+ getFantomTokenPrice(tokenAddress) {
235
+ return __awaiter(this, void 0, void 0, function* () {
236
+ try {
237
+ const response = yield fetch("https://eqapi-beta-8868m.ondigitalocean.app/fantom/v4/tokens");
238
+ if (response.status != 200)
239
+ return 0;
240
+ const data = yield response.json();
241
+ if (!data || !data.data)
242
+ return 0;
243
+ const priceData = data.data;
244
+ const priceItem = Object.keys(priceData).filter((keyId) => keyId.toLowerCase() == tokenAddress);
245
+ return priceItem.length > 0 ? Number(priceData[priceItem[0]].priceUsd) : 0;
246
+ }
247
+ catch (_a) {
248
+ return 0;
249
+ }
250
+ });
251
+ }
252
+ initializeDebankTokenPrice(tokenAddress) {
253
+ return __awaiter(this, void 0, void 0, function* () {
254
+ if (Object.keys(fantom_ids).includes(tokenAddress.toLowerCase())) {
255
+ const result = yield this.getFantomTokenPrice(tokenAddress);
256
+ if (result)
257
+ return result;
258
+ }
259
+ if (Object.keys(dexscreener_ids).includes(tokenAddress.toLowerCase())) {
260
+ const result = yield this.getDexscreenerTokenPrice(tokenAddress.toLowerCase());
261
+ if (result)
262
+ return result;
263
+ }
264
+ if (Object.keys(coingecko_ids).includes(tokenAddress.toLowerCase())) {
265
+ const result = yield this.getCoingeckoTokenPrice(tokenAddress.toLowerCase());
266
+ if (result)
267
+ return result;
268
+ }
269
+ return 0;
270
+ });
271
+ }
272
+ getDebankTokenPrice(tokenAddress) {
273
+ return __awaiter(this, void 0, void 0, function* () {
274
+ if (tokenAddress.toLowerCase() === '0xf28164a485b0b2c90639e47b0f377b4a438a16b1') { // fix for dQuick
275
+ return (yield this.getDebankTokenPrice('0x831753dd7087cac61ab5644b308642cc1c33dc13')) * 1.68;
276
+ }
277
+ if (tokenAddress.toLowerCase() === '0x63468133ed352e602beb61dd254d6060ad2fe419') { // fix for sTHO
278
+ return (yield this.getDebankTokenPrice('0xae4aa155d2987b454c29450ef4f862cf00907b61')) * 1.1;
279
+ }
280
+ if (tokenAddress.toLowerCase() === '0xfcef8a994209d6916eb2c86cdd2afd60aa6f54b1') { // fix for fBEETS
281
+ return (yield this.getDebankTokenPrice('0xf24bcf4d1e507740041c9cfd2dddb29585adce1e')) * 0.93;
282
+ }
283
+ if (tokenAddress.toLowerCase() === '0x5979d7b546e38e414f7e9822514be443a4800529') { // TEMPORARY fix for WSTETH
284
+ return (yield this.getDebankTokenPrice('0x82af49447d8a07e3bd95bd0d56f35241523fbab1')) / 0.92;
285
+ }
286
+ if (tokenAddress.toLowerCase() === '0x3f56e0c36d275367b8c502090edf38289b3dea0d') { // TEMPORARY fix for MAI
287
+ return 1;
288
+ }
289
+ if (tokenAddress.toLowerCase() === '0x2fc5cf65fd0a660801f119832b2158756968266d') { // TEMPORARY fix for CHI
290
+ return 1;
291
+ }
292
+ if (tokenAddress.toLowerCase() === '0xc19669a405067927865b40ea045a2baabbbe57f5') { // TEMPORARY fix for STAR
293
+ return 1;
294
+ }
295
+ if (tokenAddress.toLowerCase() === '0xb79dd08ea68a908a97220c76d19a6aa9cbde4376') { // TEMPORARY fix for usd+
296
+ return 1;
297
+ }
298
+ if (tokenAddress.toLowerCase() === '0xc518a88c67ceca8b3f24c4562cb71deeb2af86b7') { // TEMPORARY fix for re.al usdc
299
+ return 1;
300
+ }
301
+ if (tokenAddress.toLowerCase() === '0xaec9e50e3397f9ddc635c6c429c8c7eca418a143') { // TEMPORARY fix for re.al arcUSD
302
+ return 1;
303
+ }
304
+ if (tokenAddress.toLowerCase() === '0xc71aaf8e486e3f33841bb56ca3fd2ac3fa8d29a8') { // TEMPORARY fix for WSTETH Canto
305
+ return (yield this.getDebankTokenPrice('0x5fd55a1b9fc24967c4db09c513c3ba0dfa7ff687')) * 1.12;
306
+ }
307
+ if (tokenAddress.toLowerCase() === '0x152b9d0fdc40c096757f570a51e494bd4b943e50') { // TEMPORARY fix for BTC.b AVAX
308
+ return (yield this.getDebankTokenPrice('0x50b7545627a5162f82a992c33b87adc75187b218'));
309
+ }
310
+ if (tokenAddress.toLowerCase() === '0x9fc3104f6fc188fee65c85bbc4b94a48282ae76d') { // TEMPORARY fix for SATIN
311
+ return 0;
312
+ }
313
+ if ([
314
+ "0x9c67ee39e3c4954396b9142010653f17257dd39c",
315
+ "0x7b35ce522cb72e4077baeb96cb923a5529764a00",
316
+ "0xea6887e4a9cda1b77e70129e5fba830cdb5cddef",
317
+ "0x60bb3d364b765c497c8ce50ae0ae3f0882c5bd05",
318
+ "0x900f1ec5819fa087d368877cd03b265bf1802667",
319
+ "0xea38f1ccf77bf43f352636241b05dd8f6f5f52b2"
320
+ ].includes(tokenAddress.toLowerCase())) { // fix for IMX
321
+ return 0;
322
+ }
323
+ if (tokenAddress.toLowerCase() === '0xda0053f0befcbcac208a3f867bb243716734d809') { // TEMPORARY fix for oxSOLID
324
+ return (yield this.getDebankTokenPrice('0x888ef71766ca594ded1f0fa3ae64ed2941740a20')) * 0.88;
325
+ }
326
+ if (tokenAddress.toLowerCase() === '0x431d5dff03120afa4bdf332c61a6e1766ef37bdb') { // TEMPORARY fix for JPYCv2
327
+ return (yield this.getDebankTokenPrice('0x6ae7dfc73e0dde2aa99ac063dcf7e8a63265108c'));
328
+ }
329
+ if (!this.debankTokensPrice[tokenAddress])
330
+ this.debankTokensPrice[tokenAddress] = this.initializeDebankTokenPrice(tokenAddress);
331
+ const tokenPrice = yield this.debankTokensPrice[tokenAddress];
332
+ if (tokenPrice === 0) {
333
+ //manual fallback
334
+ if (tokenAddress.toLowerCase() === '0xaaa6c1e32c55a7bfa8066a6fae9b42650f262418') { // fix for RAM
335
+ return 0.02;
336
+ }
337
+ if (tokenAddress.toLowerCase() === '0xd5954c3084a1ccd70b4da011e67760b8e78aee84') { // fix for ARX
338
+ return 0.5;
339
+ }
340
+ if (tokenAddress.toLowerCase() === '0xe80772eaf6e2e18b651f160bc9158b2a5cafca65') { // fix for USD+
341
+ return 1;
342
+ }
343
+ if (tokenAddress.toLowerCase() === '0x3712871408a829c5cd4e86da1f4ce727efcd28f6') { // fix for GLCR
344
+ return 0.011;
345
+ }
346
+ if (tokenAddress.toLowerCase() === '0x5756a28e2aae01f600fc2c01358395f5c1f8ad3a') { // fix for VS
347
+ return 0.05;
348
+ }
349
+ if (tokenAddress.toLowerCase() === '0x160e07e42adbc1fce92d505b579bcd8a3fbea77d') { // fix for FANG
350
+ return 0.1;
351
+ }
352
+ if (tokenAddress.toLowerCase() === '0x1c28edf9e0d66f3124f141a3cf3ef1217f7019c4') { // fix for SLNA
353
+ return 0.00045;
354
+ }
355
+ // try fallback on offchain
356
+ const subgraphTokensPrice = yield this.getSubgraphTokensPrice();
357
+ const subgraphTokenPrice = subgraphTokensPrice[tokenAddress];
358
+ return subgraphTokenPrice ? subgraphTokenPrice : 0;
359
+ }
360
+ return tokenPrice;
361
+ });
362
+ }
363
+ }
364
+ exports.default = OffchainPriceHelper;