upshift-config 0.5.14

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 (316) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +349 -0
  3. package/lib/abis/AddressResolver.d.ts +28 -0
  4. package/lib/abis/AddressResolver.js +23 -0
  5. package/lib/abis/ChainlinkV3.d.ts +87 -0
  6. package/lib/abis/ChainlinkV3.js +117 -0
  7. package/lib/abis/ERC20.d.ts +168 -0
  8. package/lib/abis/ERC20.js +226 -0
  9. package/lib/abis/ERC20_Bytes32.d.ts +139 -0
  10. package/lib/abis/ERC20_Bytes32.js +196 -0
  11. package/lib/abis/ERC4626.d.ts +364 -0
  12. package/lib/abis/ERC4626.js +507 -0
  13. package/lib/abis/ERC721.d.ts +231 -0
  14. package/lib/abis/ERC721.js +321 -0
  15. package/lib/abis/FeeOracle.d.ts +120 -0
  16. package/lib/abis/FeeOracle.js +162 -0
  17. package/lib/abis/LendingPool.d.ts +1393 -0
  18. package/lib/abis/LendingPool.js +1807 -0
  19. package/lib/abis/LendingPoolV2.d.ts +1413 -0
  20. package/lib/abis/LendingPoolV2.js +1833 -0
  21. package/lib/abis/LendingPoolV3.d.ts +1677 -0
  22. package/lib/abis/LendingPoolV3.js +1160 -0
  23. package/lib/abis/Loan.d.ts +837 -0
  24. package/lib/abis/Loan.js +1080 -0
  25. package/lib/abis/MultiAssetNativeDepositWrapper.d.ts +137 -0
  26. package/lib/abis/MultiAssetNativeDepositWrapper.js +125 -0
  27. package/lib/abis/Multicall3.d.ts +30 -0
  28. package/lib/abis/Multicall3.js +97 -0
  29. package/lib/abis/OFT.d.ts +116 -0
  30. package/lib/abis/OFT.js +85 -0
  31. package/lib/abis/PoolAdapter.d.ts +36 -0
  32. package/lib/abis/PoolAdapter.js +51 -0
  33. package/lib/abis/RewardDistributor.d.ts +267 -0
  34. package/lib/abis/RewardDistributor.js +352 -0
  35. package/lib/abis/RwaRedeemSubaccount.d.ts +747 -0
  36. package/lib/abis/RwaRedeemSubaccount.js +548 -0
  37. package/lib/abis/SmartAccount.d.ts +17 -0
  38. package/lib/abis/SmartAccount.js +19 -0
  39. package/lib/abis/SwapRouter.d.ts +1043 -0
  40. package/lib/abis/SwapRouter.js +740 -0
  41. package/lib/abis/TextResolver.d.ts +16 -0
  42. package/lib/abis/TextResolver.js +16 -0
  43. package/lib/abis/TokenizedVaultV2.d.ts +1364 -0
  44. package/lib/abis/TokenizedVaultV2.js +1041 -0
  45. package/lib/abis/TokenizedVaultV2DepositWithPermit.d.ts +1456 -0
  46. package/lib/abis/TokenizedVaultV2DepositWithPermit.js +1878 -0
  47. package/lib/abis/TokenizedVaultV2Receipt.d.ts +1568 -0
  48. package/lib/abis/TokenizedVaultV2Receipt.js +1061 -0
  49. package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.d.ts +454 -0
  50. package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.js +327 -0
  51. package/lib/abis/TokenizedVaultV2WhitelistedAllocation.d.ts +1466 -0
  52. package/lib/abis/TokenizedVaultV2WhitelistedAllocation.js +1092 -0
  53. package/lib/abis/TokenizedVaultV2WhitelistedAssets.d.ts +274 -0
  54. package/lib/abis/TokenizedVaultV2WhitelistedAssets.js +167 -0
  55. package/lib/abis/UniversalResolverResolve.d.ts +69 -0
  56. package/lib/abis/UniversalResolverResolve.js +35 -0
  57. package/lib/abis/UniversalSignatureValidator.d.ts +17 -0
  58. package/lib/abis/UniversalSignatureValidator.js +30 -0
  59. package/lib/abis/WrapperAdapter.d.ts +71 -0
  60. package/lib/abis/WrapperAdapter.js +77 -0
  61. package/lib/abis/index.d.ts +34 -0
  62. package/lib/abis/index.js +51 -0
  63. package/lib/adapters/evm/getters.d.ts +19 -0
  64. package/lib/adapters/evm/getters.js +209 -0
  65. package/lib/adapters/evm/index.d.ts +353 -0
  66. package/lib/adapters/evm/index.js +434 -0
  67. package/lib/adapters/evm/utils.d.ts +8 -0
  68. package/lib/adapters/evm/utils.js +51 -0
  69. package/lib/adapters/solana/constants.d.ts +33 -0
  70. package/lib/adapters/solana/constants.js +52 -0
  71. package/lib/adapters/solana/getters.d.ts +11 -0
  72. package/lib/adapters/solana/getters.js +165 -0
  73. package/lib/adapters/solana/idl/vault-idl.d.ts +272 -0
  74. package/lib/adapters/solana/idl/vault-idl.js +1084 -0
  75. package/lib/adapters/solana/index.d.ts +233 -0
  76. package/lib/adapters/solana/index.js +291 -0
  77. package/lib/adapters/solana/types.d.ts +67 -0
  78. package/lib/adapters/solana/types.js +3 -0
  79. package/lib/adapters/solana/utils.d.ts +141 -0
  80. package/lib/adapters/solana/utils.js +595 -0
  81. package/lib/adapters/solana/vault.actions.d.ts +57 -0
  82. package/lib/adapters/solana/vault.actions.js +379 -0
  83. package/lib/adapters/stellar/actions.d.ts +28 -0
  84. package/lib/adapters/stellar/actions.js +77 -0
  85. package/lib/adapters/stellar/constants.d.ts +43 -0
  86. package/lib/adapters/stellar/constants.js +53 -0
  87. package/lib/adapters/stellar/getters.d.ts +68 -0
  88. package/lib/adapters/stellar/getters.js +290 -0
  89. package/lib/adapters/stellar/index.d.ts +114 -0
  90. package/lib/adapters/stellar/index.js +175 -0
  91. package/lib/adapters/stellar/soroban.d.ts +123 -0
  92. package/lib/adapters/stellar/soroban.js +613 -0
  93. package/lib/adapters/stellar/submit.d.ts +34 -0
  94. package/lib/adapters/stellar/submit.js +149 -0
  95. package/lib/adapters/stellar/types.d.ts +58 -0
  96. package/lib/adapters/stellar/types.js +6 -0
  97. package/lib/adapters/stellar/utils.d.ts +24 -0
  98. package/lib/adapters/stellar/utils.js +34 -0
  99. package/lib/adapters/sui/constants.d.ts +14 -0
  100. package/lib/adapters/sui/constants.js +29 -0
  101. package/lib/adapters/sui/getters.d.ts +9 -0
  102. package/lib/adapters/sui/getters.js +60 -0
  103. package/lib/adapters/sui/index.d.ts +45 -0
  104. package/lib/adapters/sui/index.js +101 -0
  105. package/lib/adapters/sui/transformer.d.ts +10 -0
  106. package/lib/adapters/sui/transformer.js +107 -0
  107. package/lib/adapters/sui/types.d.ts +66 -0
  108. package/lib/adapters/sui/types.js +3 -0
  109. package/lib/adapters/sui/utils.d.ts +10 -0
  110. package/lib/adapters/sui/utils.js +29 -0
  111. package/lib/core/analytics/chain-name.d.ts +9 -0
  112. package/lib/core/analytics/chain-name.js +34 -0
  113. package/lib/core/analytics/constants.d.ts +5 -0
  114. package/lib/core/analytics/constants.js +9 -0
  115. package/lib/core/analytics/env.d.ts +29 -0
  116. package/lib/core/analytics/env.js +59 -0
  117. package/lib/core/analytics/index.d.ts +36 -0
  118. package/lib/core/analytics/index.js +79 -0
  119. package/lib/core/analytics/instrumentation.d.ts +29 -0
  120. package/lib/core/analytics/instrumentation.js +277 -0
  121. package/lib/core/analytics/method-taxonomy.d.ts +19 -0
  122. package/lib/core/analytics/method-taxonomy.js +128 -0
  123. package/lib/core/analytics/metrics.d.ts +33 -0
  124. package/lib/core/analytics/metrics.js +116 -0
  125. package/lib/core/analytics/sanitize.d.ts +44 -0
  126. package/lib/core/analytics/sanitize.js +260 -0
  127. package/lib/core/analytics/sentry-runtime.d.ts +15 -0
  128. package/lib/core/analytics/sentry-runtime.js +97 -0
  129. package/lib/core/analytics/sentry.d.ts +67 -0
  130. package/lib/core/analytics/sentry.js +613 -0
  131. package/lib/core/analytics/types.d.ts +48 -0
  132. package/lib/core/analytics/types.js +3 -0
  133. package/lib/core/analytics/user-identity.d.ts +41 -0
  134. package/lib/core/analytics/user-identity.js +141 -0
  135. package/lib/core/analytics/version.d.ts +6 -0
  136. package/lib/core/analytics/version.js +10 -0
  137. package/lib/core/attribution.d.ts +111 -0
  138. package/lib/core/attribution.js +142 -0
  139. package/lib/core/auth/index.d.ts +1 -0
  140. package/lib/core/auth/index.js +18 -0
  141. package/lib/core/auth/verify.d.ts +2 -0
  142. package/lib/core/auth/verify.js +31 -0
  143. package/lib/core/base.class.d.ts +152 -0
  144. package/lib/core/base.class.js +172 -0
  145. package/lib/core/cache.d.ts +9 -0
  146. package/lib/core/cache.js +31 -0
  147. package/lib/core/constants/adapters.d.ts +103 -0
  148. package/lib/core/constants/adapters.js +180 -0
  149. package/lib/core/constants/core.d.ts +133 -0
  150. package/lib/core/constants/core.js +209 -0
  151. package/lib/core/constants/swap-router.d.ts +150 -0
  152. package/lib/core/constants/swap-router.js +169 -0
  153. package/lib/core/constants/vaults.d.ts +93 -0
  154. package/lib/core/constants/vaults.js +273 -0
  155. package/lib/core/constants/web3.d.ts +91 -0
  156. package/lib/core/constants/web3.js +229 -0
  157. package/lib/core/errors/index.d.ts +114 -0
  158. package/lib/core/errors/index.js +183 -0
  159. package/lib/core/fetcher.d.ts +198 -0
  160. package/lib/core/fetcher.js +903 -0
  161. package/lib/core/helpers/adapters.d.ts +13 -0
  162. package/lib/core/helpers/adapters.js +39 -0
  163. package/lib/core/helpers/chain-address.d.ts +13 -0
  164. package/lib/core/helpers/chain-address.js +47 -0
  165. package/lib/core/helpers/chain-error.d.ts +207 -0
  166. package/lib/core/helpers/chain-error.js +682 -0
  167. package/lib/core/helpers/chain-support.d.ts +80 -0
  168. package/lib/core/helpers/chain-support.js +115 -0
  169. package/lib/core/helpers/core.d.ts +68 -0
  170. package/lib/core/helpers/core.js +285 -0
  171. package/lib/core/helpers/explorer-link.d.ts +16 -0
  172. package/lib/core/helpers/explorer-link.js +26 -0
  173. package/lib/core/helpers/multicall.d.ts +68 -0
  174. package/lib/core/helpers/multicall.js +103 -0
  175. package/lib/core/helpers/revert-decode.d.ts +248 -0
  176. package/lib/core/helpers/revert-decode.js +515 -0
  177. package/lib/core/helpers/signer.d.ts +52 -0
  178. package/lib/core/helpers/signer.js +145 -0
  179. package/lib/core/helpers/swap-router.d.ts +211 -0
  180. package/lib/core/helpers/swap-router.js +480 -0
  181. package/lib/core/helpers/vault-version.d.ts +23 -0
  182. package/lib/core/helpers/vault-version.js +75 -0
  183. package/lib/core/helpers/vaults.d.ts +89 -0
  184. package/lib/core/helpers/vaults.js +235 -0
  185. package/lib/core/helpers/web3.d.ts +353 -0
  186. package/lib/core/helpers/web3.js +992 -0
  187. package/lib/core/index.d.ts +23 -0
  188. package/lib/core/index.js +40 -0
  189. package/lib/core/logger/index.d.ts +98 -0
  190. package/lib/core/logger/index.js +144 -0
  191. package/lib/core/logger/slack.d.ts +16 -0
  192. package/lib/core/logger/slack.js +57 -0
  193. package/lib/core/vault-metadata.d.ts +12 -0
  194. package/lib/core/vault-metadata.js +42 -0
  195. package/lib/core/version-check.d.ts +58 -0
  196. package/lib/core/version-check.js +182 -0
  197. package/lib/evm/index.d.ts +2 -0
  198. package/lib/evm/index.js +19 -0
  199. package/lib/evm/methods/crossChainVault.d.ts +128 -0
  200. package/lib/evm/methods/crossChainVault.js +853 -0
  201. package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
  202. package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
  203. package/lib/evm/methods/index.d.ts +2 -0
  204. package/lib/evm/methods/index.js +19 -0
  205. package/lib/evm/types/crossChain.d.ts +363 -0
  206. package/lib/evm/types/crossChain.js +20 -0
  207. package/lib/evm/types/index.d.ts +1 -0
  208. package/lib/evm/types/index.js +18 -0
  209. package/lib/index.d.ts +30 -0
  210. package/lib/index.js +52 -0
  211. package/lib/main.d.ts +527 -0
  212. package/lib/main.js +601 -0
  213. package/lib/modules/api/fetcher.d.ts +82 -0
  214. package/lib/modules/api/fetcher.js +150 -0
  215. package/lib/modules/api/index.d.ts +1 -0
  216. package/lib/modules/api/index.js +6 -0
  217. package/lib/modules/api/main.d.ts +313 -0
  218. package/lib/modules/api/main.js +479 -0
  219. package/lib/modules/sub-accounts/fetcher.d.ts +53 -0
  220. package/lib/modules/sub-accounts/fetcher.js +120 -0
  221. package/lib/modules/sub-accounts/index.d.ts +2 -0
  222. package/lib/modules/sub-accounts/index.js +19 -0
  223. package/lib/modules/sub-accounts/main.d.ts +243 -0
  224. package/lib/modules/sub-accounts/main.js +205 -0
  225. package/lib/modules/sub-accounts/utils.d.ts +106 -0
  226. package/lib/modules/sub-accounts/utils.js +112 -0
  227. package/lib/modules/vaults/adapter.helpers.d.ts +64 -0
  228. package/lib/modules/vaults/adapter.helpers.js +184 -0
  229. package/lib/modules/vaults/fetcher.d.ts +147 -0
  230. package/lib/modules/vaults/fetcher.js +368 -0
  231. package/lib/modules/vaults/getters.d.ts +570 -0
  232. package/lib/modules/vaults/getters.js +3051 -0
  233. package/lib/modules/vaults/index.d.ts +20 -0
  234. package/lib/modules/vaults/index.js +44 -0
  235. package/lib/modules/vaults/main.d.ts +601 -0
  236. package/lib/modules/vaults/main.js +1623 -0
  237. package/lib/modules/vaults/prefetch.d.ts +65 -0
  238. package/lib/modules/vaults/prefetch.js +120 -0
  239. package/lib/modules/vaults/read.actions.d.ts +225 -0
  240. package/lib/modules/vaults/read.actions.js +596 -0
  241. package/lib/modules/vaults/types.d.ts +71 -0
  242. package/lib/modules/vaults/types.js +3 -0
  243. package/lib/modules/vaults/utils/call-data-decoder.d.ts +61 -0
  244. package/lib/modules/vaults/utils/call-data-decoder.js +194 -0
  245. package/lib/modules/vaults/utils/date-utils.d.ts +50 -0
  246. package/lib/modules/vaults/utils/date-utils.js +84 -0
  247. package/lib/modules/vaults/utils.d.ts +140 -0
  248. package/lib/modules/vaults/utils.js +799 -0
  249. package/lib/modules/vaults/write.actions.d.ts +529 -0
  250. package/lib/modules/vaults/write.actions.js +1749 -0
  251. package/lib/polyfills.d.ts +1 -0
  252. package/lib/polyfills.js +12 -0
  253. package/lib/sdk.d.ts +26721 -0
  254. package/lib/services/coingecko/fetcher.d.ts +15 -0
  255. package/lib/services/coingecko/fetcher.js +67 -0
  256. package/lib/services/coingecko/index.d.ts +2 -0
  257. package/lib/services/coingecko/index.js +19 -0
  258. package/lib/services/coingecko/utils.d.ts +1 -0
  259. package/lib/services/coingecko/utils.js +24 -0
  260. package/lib/services/debank/fetcher.d.ts +126 -0
  261. package/lib/services/debank/fetcher.js +47 -0
  262. package/lib/services/debank/index.d.ts +2 -0
  263. package/lib/services/debank/index.js +19 -0
  264. package/lib/services/debank/utils.d.ts +38 -0
  265. package/lib/services/debank/utils.js +297 -0
  266. package/lib/services/layerzero/deposits.d.ts +49 -0
  267. package/lib/services/layerzero/deposits.js +166 -0
  268. package/lib/services/layerzero/redeems.d.ts +20 -0
  269. package/lib/services/layerzero/redeems.js +92 -0
  270. package/lib/services/layerzero/utils.d.ts +9 -0
  271. package/lib/services/layerzero/utils.js +22 -0
  272. package/lib/services/octavfi/fetcher.d.ts +9 -0
  273. package/lib/services/octavfi/fetcher.js +103 -0
  274. package/lib/services/octavfi/index.d.ts +3 -0
  275. package/lib/services/octavfi/index.js +20 -0
  276. package/lib/services/octavfi/types.d.ts +34 -0
  277. package/lib/services/octavfi/types.js +3 -0
  278. package/lib/services/octavfi/utils.d.ts +16 -0
  279. package/lib/services/octavfi/utils.js +212 -0
  280. package/lib/services/subgraph/fetcher.d.ts +2 -0
  281. package/lib/services/subgraph/fetcher.js +61 -0
  282. package/lib/services/subgraph/index.d.ts +2 -0
  283. package/lib/services/subgraph/index.js +19 -0
  284. package/lib/services/subgraph/schema.d.ts +45 -0
  285. package/lib/services/subgraph/schema.js +75 -0
  286. package/lib/services/subgraph/vaults.d.ts +25 -0
  287. package/lib/services/subgraph/vaults.js +1106 -0
  288. package/lib/services/swap-quotes/index.d.ts +105 -0
  289. package/lib/services/swap-quotes/index.js +77 -0
  290. package/lib/services/swap-quotes/paraswap.d.ts +51 -0
  291. package/lib/services/swap-quotes/paraswap.js +138 -0
  292. package/lib/types/api.d.ts +280 -0
  293. package/lib/types/api.js +3 -0
  294. package/lib/types/index.d.ts +12 -0
  295. package/lib/types/index.js +28 -0
  296. package/lib/types/points.d.ts +28 -0
  297. package/lib/types/points.js +3 -0
  298. package/lib/types/pools.d.ts +144 -0
  299. package/lib/types/pools.js +3 -0
  300. package/lib/types/staking.d.ts +28 -0
  301. package/lib/types/staking.js +3 -0
  302. package/lib/types/sub-accounts.d.ts +140 -0
  303. package/lib/types/sub-accounts.js +3 -0
  304. package/lib/types/subgraph.d.ts +74 -0
  305. package/lib/types/subgraph.js +3 -0
  306. package/lib/types/typed-contract.d.ts +102 -0
  307. package/lib/types/typed-contract.js +3 -0
  308. package/lib/types/user.d.ts +1 -0
  309. package/lib/types/user.js +3 -0
  310. package/lib/types/vaults.d.ts +714 -0
  311. package/lib/types/vaults.js +24 -0
  312. package/lib/types/web3.d.ts +51 -0
  313. package/lib/types/web3.js +14 -0
  314. package/lib/types/webserver.d.ts +698 -0
  315. package/lib/types/webserver.js +3 -0
  316. package/package.json +78 -0
@@ -0,0 +1,235 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultSubgraphUrl = exports.SUBGRAPH_POOL_URLS = exports.AVAX_PRICE_FEED_ADDRESS = exports.REWARD_DISTRIBUTOR_ADDRESS = exports.getVaultVersionV2 = exports.getVaultVersion = exports.getAddressChainType = exports.isBadVault = exports.isBadTransaction = void 0;
4
+ exports.getVaultSymbol = getVaultSymbol;
5
+ exports.resolveFeeWaived = resolveFeeWaived;
6
+ const ethers_1 = require("ethers");
7
+ const vaults_1 = require("../constants/vaults");
8
+ const web3_1 = require("./web3");
9
+ const chain_address_1 = require("./chain-address");
10
+ const vault_metadata_1 = require("../vault-metadata");
11
+ const logger_1 = require("../logger");
12
+ /** @internal */
13
+ const VAULT_SYMBOLS_LOWERCASE = Object.fromEntries(Object.entries(vaults_1.VAULT_SYMBOLS).map(([k, v]) => [k.toLowerCase(), v]));
14
+ /**
15
+ * Bad transactions that should be ignored
16
+ * these transactions are usually from tests and can skew data
17
+ */
18
+ const isBadTransaction = (hash, chainId) => {
19
+ const badTxs = {
20
+ 1: [
21
+ // farmBOLD deposit test tx due to a decimal error
22
+ '0xaba75b16e74a7a2457bfdcded853edd2bb4d3b305919baf84fb1f6b54b864889',
23
+ '0xc4c30185198672cbc91a95520d1bf91634ece37c199b2f1f15d29e8290c7ed4b',
24
+ '0x8e319576413897d1750f16bb93c7f59759b5bbafcb5bd9ef956f6bc0b0314aef',
25
+ '0x49057f8ea86b84a21808269558474686c9de02d31dc9e03a201b61104afbcdd3',
26
+ '0x7146dd528423705e225dd508f06cc6b4dab490c767400652ef82e7c96031359d',
27
+ '0x826340b2f376e71795177e9d68fee07e0c45263b45d22c36327db81db36d70a6',
28
+ '0xd79f4cf16dd4a794809448bf021bb64b6bfd22fb42094403baad4da5664b7519',
29
+ ],
30
+ };
31
+ if (chainId in badTxs) {
32
+ return badTxs[chainId].includes(hash);
33
+ }
34
+ return false;
35
+ };
36
+ exports.isBadTransaction = isBadTransaction;
37
+ const isBadVault = (address) => {
38
+ if (!address)
39
+ return false;
40
+ if ((0, vault_version_1.getAddressChainType)(address) !== 'evm')
41
+ return false;
42
+ switch ((0, ethers_1.getAddress)(address)) {
43
+ case (0, ethers_1.getAddress)('0x706162790b601A8514c18718d0c63C9D1268e89C'):
44
+ return true;
45
+ case (0, ethers_1.getAddress)('0xd684AF965b1c17D628ee0d77cae94259c41260F4'):
46
+ return true; // ETH: sUSDe
47
+ case (0, ethers_1.getAddress)('0xB78dAf3fD674B81ebeaaa88d711506fa069E1C5E'):
48
+ return true; // ETH: ETH Optimizer
49
+ case (0, ethers_1.getAddress)('0x4e2D90f0307A93b54ACA31dc606F93FE6b9132d2'):
50
+ return true; // Base: LBTC
51
+ case (0, ethers_1.getAddress)('0x18a5a3D575F34e5eBa92ac99B0976dBe26f9F869'):
52
+ return true; // ETH: LBTC
53
+ case (0, ethers_1.getAddress)('0xD0b717ef23817b1a127139830Cf0FcD449ef74F0'):
54
+ return true; // BNB: Sienna USDT Tulipa
55
+ case (0, ethers_1.getAddress)('0xeb402fc96C7ed2f889d837C9976D6d821c1B5f01'):
56
+ return true; // ETH: Kelp TAC Vault
57
+ case (0, ethers_1.getAddress)('0xEBac5e50003d4B17Be422ff9775043cD61002f7f'):
58
+ return true; // ETH: Upshift BTC
59
+ case (0, ethers_1.getAddress)('0x419386E3Ef42368e602720CC458e00c0B28c47A7'):
60
+ return true; // ETH: Kelp TAC Vault
61
+ default:
62
+ return false;
63
+ }
64
+ };
65
+ exports.isBadVault = isBadVault;
66
+ const vault_version_1 = require("./vault-version");
67
+ Object.defineProperty(exports, "getAddressChainType", { enumerable: true, get: function () { return vault_version_1.getAddressChainType; } });
68
+ Object.defineProperty(exports, "getVaultVersion", { enumerable: true, get: function () { return vault_version_1.getVaultVersion; } });
69
+ Object.defineProperty(exports, "getVaultVersionV2", { enumerable: true, get: function () { return vault_version_1.getVaultVersionV2; } });
70
+ // Used for Upshift
71
+ const REWARD_DISTRIBUTOR_ADDRESS = (chainId) => {
72
+ switch (chainId) {
73
+ case 43114:
74
+ return [
75
+ '0xAeAc5f82B140c0f7309f7E9Ec43019062A5e5BE2',
76
+ '0xd3e653A9f6F3d96B26Dd4487a53D151140B697C4',
77
+ ];
78
+ default:
79
+ return ['0x0000000000000000000000000000000000000000'];
80
+ }
81
+ };
82
+ exports.REWARD_DISTRIBUTOR_ADDRESS = REWARD_DISTRIBUTOR_ADDRESS;
83
+ // Used for Upshift
84
+ const AVAX_PRICE_FEED_ADDRESS = (chainId) => {
85
+ switch (chainId) {
86
+ case 1:
87
+ return '0xFF3EEb22B5E3dE6e705b44749C2559d704923FD7';
88
+ default:
89
+ return '0x';
90
+ }
91
+ };
92
+ exports.AVAX_PRICE_FEED_ADDRESS = AVAX_PRICE_FEED_ADDRESS;
93
+ async function getVaultSymbol(vault, provider) {
94
+ if ((0, chain_address_1.isStellarAddress)(vault)) {
95
+ logger_1.Logger.log.warn('getVaultSymbol', `Vault symbol lookup is not yet supported for Stellar vaults: ${vault}`);
96
+ return undefined;
97
+ }
98
+ const address = (0, ethers_1.getAddress)(vault);
99
+ let vaultsMetadata = {};
100
+ try {
101
+ vaultsMetadata = await (0, vault_metadata_1.fetchVaultMetadata)();
102
+ }
103
+ catch (e) {
104
+ logger_1.Logger.log.error('getVaultSymbol:fetchMetadata', e, { vault });
105
+ }
106
+ const entries = Object.entries(vaultsMetadata);
107
+ for (const [_, metadata] of entries) {
108
+ if (metadata.address.toLowerCase() === address.toLowerCase()) {
109
+ return metadata.symbol;
110
+ }
111
+ }
112
+ const hardcodedSymbol = vaults_1.VAULT_SYMBOLS[address] ??
113
+ VAULT_SYMBOLS_LOWERCASE[address.toLowerCase()];
114
+ if (hardcodedSymbol) {
115
+ return hardcodedSymbol;
116
+ }
117
+ const symbol = await (0, web3_1.getSymbol)(provider, vault);
118
+ return symbol;
119
+ }
120
+ /**
121
+ * @deprecated
122
+ * Replaced by SUBGRAPH_VAULT_URLS which are subgraphs deployed on Goldsky.
123
+ */
124
+ const SUBGRAPH_POOL_URLS = (apiKey, chainId, pool) => {
125
+ if (chainId === 999) {
126
+ if (!pool) {
127
+ throw new Error(`Pool address is required for chainId ${chainId}`);
128
+ }
129
+ switch (pool) {
130
+ // hbHYPE
131
+ case '0x96C6cBB6251Ee1c257b2162ca0f39AA5Fa44B1FB':
132
+ return {
133
+ 999: 'https://api.goldsky.com/api/public/project_cm9g0xy3o4j6v01vd34r3hvv9/subgraphs/august-hyperevm-hyperbeat/1.0.0/gn',
134
+ };
135
+ // hbBTC
136
+ case '0xc061d38903b99aC12713B550C2CB44B221674F94':
137
+ return {
138
+ 999: 'https://api.goldsky.com/api/public/project_cm9g0xy3o4j6v01vd34r3hvv9/subgraphs/august-hyperevm-hbBTC/1.0.0/gn',
139
+ };
140
+ default:
141
+ throw new Error(`Unsupported pool for chainId ${chainId}: ${pool}`);
142
+ }
143
+ }
144
+ const urls = {
145
+ 1: `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/BtbHLe7XtX2x9Ude9PKv2uagNHj6JYhjjFcimxvk7NPD`,
146
+ 8453: `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/E96gN4ZAmtCwLfsYccy3TqCTBbizGPWssFFeZfJ5QSQP`,
147
+ 43114: `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/Ho15f2DBGndTMAYx9bPxJzasQRsAd5oLdci4oZvWs2u6`,
148
+ 42161: `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/BrqNoj6FWm678yFRKdVWBncwt3zUnpbA3u4n9A9puUSg`,
149
+ 56: `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/4BDCXZvSBuNGX3ck6C6nTGos7Dg5SxjfHMjrKnQz4YE2`,
150
+ };
151
+ if (chainId && !(chainId in urls)) {
152
+ throw new Error(`Unsupported chainId: ${chainId}. Supported chains: ${Object.keys(urls).join(', ')}`);
153
+ }
154
+ return urls;
155
+ };
156
+ exports.SUBGRAPH_POOL_URLS = SUBGRAPH_POOL_URLS;
157
+ /**
158
+ * Previously fabricated a Goldsky subgraph URL from the chain name and vault
159
+ * symbol. That guess is unreliable and produced dead endpoints:
160
+ * - The path segment `/v1/subgraphs/name/goldsky/` is legacy hosted-service
161
+ * syntax, not Goldsky's current scheme (cf. {@link SUBGRAPH_VAULT_URLS}).
162
+ * - The chain name isn't the subgraph slug — ethers reports Citrea's network as
163
+ * `unknown`, and mainnet as `mainnet` where the subgraph uses `eth`.
164
+ * - A vault's symbol isn't its subgraph name — e.g. on-chain `EctUSD` vs the
165
+ * deployed `earn-ctusd`.
166
+ *
167
+ * A fabricated URL 404s silently, so a missing subgraph reads as "no data"
168
+ * rather than an error (this masked the Citrea Earn ctUSD outage). Subgraph URLs
169
+ * must now come from backend vault metadata (`fetchVaultMetadata → subgraph`).
170
+ * This returns `undefined` so callers hit their existing "Missing Subgraph"
171
+ * branch (warn + Slack alert) instead of querying a dead endpoint.
172
+ *
173
+ * @param _network - Unused. Kept for call-site compatibility.
174
+ * @param _symbol - Unused. Kept for call-site compatibility.
175
+ * @returns `undefined` — the SDK no longer guesses subgraph URLs.
176
+ * @deprecated Resolve subgraph URLs from `fetchVaultMetadata`; do not rely on a
177
+ * generated fallback.
178
+ */
179
+ const getDefaultSubgraphUrl = (_network, _symbol) => {
180
+ return undefined;
181
+ };
182
+ exports.getDefaultSubgraphUrl = getDefaultSubgraphUrl;
183
+ /**
184
+ * Resolve whether a single fee (management or performance) is currently waived.
185
+ *
186
+ * Backend-driven, per AUGUST-5584. This centralizes logic that previously lived —
187
+ * and diverged — across two upshift-app components. The resolution is deliberately
188
+ * split between the backend and the SDK:
189
+ *
190
+ * - The backend `isFeeWaivedToggle` (`platform_fee_override.is_fee_waived`) is both
191
+ * the master enable AND the TVL latch. Retool config takes precedence over live
192
+ * TVL, and the backend flips this flag `false` once live TVL crosses the
193
+ * configured threshold. That flip is one-way: if TVL later falls back below the
194
+ * threshold the waiver does NOT re-apply. The SDK therefore does no TVL math and
195
+ * never reads `latest_reported_tvl` here — trusting the flag preserves the latch.
196
+ * - The **date** window is time-dependent, so it cannot be a static DB flag; the SDK
197
+ * evaluates it live against the clock.
198
+ *
199
+ * Resolution:
200
+ * - Toggle off → never waived (also the only "hide" path once TVL trips the latch).
201
+ * - Toggle on, both date and TVL blank → indefinite manual waiver → waived.
202
+ * - Toggle on with a date window → waived while `now < waivedUntilDate`.
203
+ * - Toggle on with a TVL threshold configured → waived (the backend keeps the toggle
204
+ * on only while live TVL is under the threshold).
205
+ *
206
+ * @param isFeeWaivedToggle - Backend master/TVL-latch flag. `false` ⇒ never waived.
207
+ * @param waivedUntilDate - ISO datetime string the waiver runs until, or `null` for
208
+ * no date window. An unparseable string yields `NaN`, which is never `> now`, so
209
+ * it correctly contributes no date-based waiver.
210
+ * @param waivedUntilTvl - Configured TVL threshold in whole USD, or `null`. Used only
211
+ * to detect that a TVL-based waiver was set (values `<= 0` are treated as unset);
212
+ * the threshold comparison itself is owned by the backend.
213
+ * @param now - Clock, injected for deterministic testing. Defaults to `new Date()`.
214
+ * @returns `true` if the UI should present this fee as "Fee Waived" right now.
215
+ * @example
216
+ * ```ts
217
+ * // Toggle on, 30-day window still open → waived.
218
+ * resolveFeeWaived(true, '2099-01-01T00:00:00Z', null); // true
219
+ * // Toggle off overrides everything → not waived.
220
+ * resolveFeeWaived(false, '2099-01-01T00:00:00Z', 10_000_000); // false
221
+ * ```
222
+ */
223
+ function resolveFeeWaived(isFeeWaivedToggle, waivedUntilDate, waivedUntilTvl, now = new Date()) {
224
+ // Master toggle off ⇒ never waived. Also satisfies the one-way TVL latch: the
225
+ // backend has already flipped this false when live TVL crossed the threshold.
226
+ if (!isFeeWaivedToggle)
227
+ return false;
228
+ const isDateActive = waivedUntilDate != null && new Date(waivedUntilDate) > now;
229
+ const isTvlConfigured = waivedUntilTvl != null && waivedUntilTvl > 0;
230
+ // Toggle on but neither trigger configured ⇒ indefinite manual waiver.
231
+ if (waivedUntilDate == null && !isTvlConfigured)
232
+ return true;
233
+ return isDateActive || isTvlConfigured;
234
+ }
235
+ //# sourceMappingURL=vaults.js.map
@@ -0,0 +1,353 @@
1
+ import { ethers, Interface, type InterfaceAbi, JsonRpcProvider } from 'ethers';
2
+ import type { Abi } from 'abitype';
3
+ import type { TypedContract } from '../../types/typed-contract';
4
+ import type { IAddress, IContractRunner, IInfuraOptions } from '../../types';
5
+ /**
6
+ * Web3 Helper Utilities
7
+ *
8
+ * Core utilities for blockchain interaction:
9
+ * - Provider Management: createProvider, getInfuraProvider, getChainId
10
+ * - Contract Helpers: createContract, getDecimals, getSymbol, getTokenMetadata
11
+ * - Transaction Utilities: simulateTransaction, checkAddress
12
+ * - Historical Queries: getHistoricalContractData, getHistoricalContractDataByDate
13
+ * - Oracle Integration: getLoanOracleFeeRate
14
+ * - Block Utilities: determineBlockCutoff, determineBlockSkipInternal
15
+ */
16
+ /**
17
+ * Get maximum block range for historical queries per chain.
18
+ * Prevents RPC timeouts by limiting lookback window.
19
+ * @param chain Chain ID
20
+ * @returns Maximum number of blocks to query
21
+ */
22
+ export declare const determineBlockCutoff: (chain: number) => 120000 | 3456000 | 150000;
23
+ /**
24
+ * Approximate block time in seconds per chain.
25
+ * Used to estimate time ranges from block counts.
26
+ * @param chain - Chain ID
27
+ * @returns Seconds per block
28
+ */
29
+ export declare const determineSecondsPerBlock: (chain: number) => number;
30
+ /**
31
+ * Get block interval for paginated historical queries per chain.
32
+ * Respects RPC eth_getLogs range limits.
33
+ * @param chain Chain ID
34
+ * @returns Block interval for pagination
35
+ */
36
+ export declare const determineBlockSkipInternal: (chain: number) => 1000 | 8000 | 10000;
37
+ /**
38
+ * Maximum JSON-RPC calls ethers may coalesce into a single batched HTTP
39
+ * request for a given endpoint.
40
+ *
41
+ * Providers advertise wildly different batch limits and reject the whole batch
42
+ * — not the excess — when exceeded, so one oversized batch fails every call
43
+ * inside it. dRPC's free tier caps batches at 3, which made every Mezo read
44
+ * fail with `server response 500 … "Batch of more than 3 requests are not
45
+ * allowed"` (the single highest-volume SDK error in production).
46
+ *
47
+ * Detection is host-based rather than chain-based because the limit is a
48
+ * property of the endpoint, not the chain: the same chain served by a
49
+ * self-hosted node has no such cap.
50
+ *
51
+ * @param rpcUrl - The RPC endpoint URL. Unparseable values fall back to the
52
+ * conservative default rather than throwing.
53
+ * @returns Batch size cap to pass to ethers as `batchMaxCount`.
54
+ */
55
+ export declare const determineRpcBatchMaxCount: (rpcUrl: string) => number;
56
+ /**
57
+ * Retrieve chain ID from web3 provider.
58
+ * Handles both initialized and uninitialized provider states.
59
+ * @param provider Web3 provider instance
60
+ * @returns Numeric chain ID
61
+ */
62
+ export declare const getChainId: (provider: IContractRunner) => Promise<number>;
63
+ /**
64
+ * Create ethers contract instance with address validation.
65
+ * @param provider Web3 provider for contract calls
66
+ * @param address Contract address (must be checksummed)
67
+ * @param abi Contract ABI (must be declared with `as const`)
68
+ * @returns Strongly-typed contract instance or undefined if address invalid
69
+ */
70
+ export declare function createContract<const TAbi extends Abi>({ provider, address, abi, }: {
71
+ address: string;
72
+ provider: IContractRunner;
73
+ abi: TAbi;
74
+ }): TypedContract<TAbi> | undefined;
75
+ /**
76
+ * Create or reuse a cached JSON-RPC provider.
77
+ * Passing `chainId` enables ethers' `staticNetwork` to skip the `eth_chainId`
78
+ * round-trip on first use.
79
+ *
80
+ * @param rpcUrl RPC endpoint URL — must be a non-empty string.
81
+ * @param chainId Optional chain ID — enables staticNetwork
82
+ * @throws Error with a clear, remediable message when `rpcUrl` is missing or
83
+ * empty. Without this guard, ethers v6 silently defaults to
84
+ * `http://localhost:8545` and surfaces a cryptic
85
+ * `network is not available yet (NETWORK_ERROR)` on the first RPC call.
86
+ */
87
+ export declare const createProvider: (rpcUrl: string, chainId?: number) => JsonRpcProvider;
88
+ /**
89
+ * Create or reuse a cached Infura provider for the specified chain.
90
+ * @param infura Configuration with chain ID and API key
91
+ */
92
+ export declare const getInfuraProvider: (infura: IInfuraOptions) => JsonRpcProvider;
93
+ export { explorerLink } from './explorer-link';
94
+ /**
95
+ * Fetch token decimals from contract or Solana mint.
96
+ * Results are cached to minimize RPC calls.
97
+ *
98
+ * **Never throws** — a failed read logs at error level and resolves
99
+ * `undefined`. Callers that must not silently proceed on an unknown scale (any
100
+ * path that encodes an amount) should use {@link getDecimalsOrThrow} instead:
101
+ * feeding `undefined` into `toNormalizedBn` silently defaults to 18 decimals.
102
+ *
103
+ * @param provider Web3 provider
104
+ * @param address Token contract address or Solana mint
105
+ * @param isVault Resolve `address` as a vault (evm-2 vaults redirect to the
106
+ * receipt token) rather than reading it as a plain ERC-20. Defaults to `true`.
107
+ * @returns Number of decimals for the token, or `undefined` when the read failed.
108
+ */
109
+ export declare const getDecimals: (provider: IContractRunner, address: IAddress, isVault?: boolean) => Promise<number>;
110
+ /**
111
+ * Read a token's `decimals()` with the **same cache and stampede protection as
112
+ * {@link getDecimals}**, but surfacing failures instead of swallowing them, and
113
+ * retrying the transient ones.
114
+ *
115
+ * Two reasons this exists rather than a flag on `getDecimals`:
116
+ *
117
+ * 1. **`getDecimals` must keep returning `undefined` on failure** — a dozen
118
+ * read paths depend on that. Amount-encoding paths need the opposite: an
119
+ * `undefined` reaching `toNormalizedBn` silently means 18 decimals, which
120
+ * misencodes the transaction. Here the original error propagates, so the
121
+ * caller's `AugustSDKError` keeps its cause and its Sentry grouping.
122
+ * 2. **Retry.** Providers intermittently return an empty response to
123
+ * `decimals()`, which ethers reports as
124
+ * `missing revert data (action="call", data="0x313ce567", …)` — a shape a
125
+ * deployed ERC-20 cannot legitimately produce, since `decimals()` takes no
126
+ * arguments. That is retried here via {@link isEmptyViewResponse} scoped to
127
+ * this exact selector, alongside ordinary transport faults
128
+ * ({@link isRetryableRpcError}). The empty-view widening applies **only**
129
+ * here; everywhere else the strict transport definition stands. A genuine
130
+ * revert (`CALL_EXCEPTION` carrying revert data) is never retried.
131
+ *
132
+ * Cache is shared with `getDecimals`, so a read-then-write flow against the
133
+ * same token costs one `decimals()` RPC in total, and N concurrent callers for
134
+ * an uncached token collapse to one.
135
+ *
136
+ * **Exception — an unresolvable chain scope bypasses the cache entirely.** When
137
+ * {@link resolveProviderScope} cannot determine the chain (a runner with no
138
+ * resolved network and no connection URL, e.g. a browser provider before its
139
+ * first request), the only available key is the shared `unknown` bucket. Read
140
+ * paths happily use that bucket, and this function deliberately does not: the
141
+ * two paths have different blast radii. A wrong cached `decimals` on a read
142
+ * renders a wrong number on screen; on a write it misencodes an amount the user
143
+ * then *signs*. The collision needed — the same address being a different token
144
+ * with different decimals on two chains, within one process, across a
145
+ * mid-session chain switch — is narrow, but "no worse than the read path" is
146
+ * not the bar for a value that ends up in a transaction. In that case the read
147
+ * is neither served from nor written to the cache, and it also skips the
148
+ * in-flight dedup map, since joining another caller under an untrusted key
149
+ * would reintroduce exactly the collision being avoided. Retries still apply;
150
+ * the only thing forgone is the RPC saving.
151
+ *
152
+ * RPC cost: 1 on a cache miss, 0 on a hit, up to 3 on a miss that keeps
153
+ * faulting (~750ms of added latency in the worst case before it gives up).
154
+ * Always ≥1 when the chain scope is unresolvable.
155
+ *
156
+ * @param runner - Provider or signer to read through. A signer is unwrapped to
157
+ * its provider for cache scoping, so it shares entries with reads on the
158
+ * same chain.
159
+ * @param address - Token address. Read directly as an ERC-20 — pass the
160
+ * receipt-token address yourself for an `evm-2` vault's share scale.
161
+ * @param tag - Low-cardinality label for retry breadcrumbs (e.g.
162
+ * `'vaultDeposit:poolDecimals'`).
163
+ * @returns The token's decimals.
164
+ * @throws The underlying read error once retries are exhausted, or immediately
165
+ * when the failure is neither a transport fault nor an empty view response.
166
+ *
167
+ * @example
168
+ * ```ts
169
+ * // Amount encoding must not proceed on a guessed scale.
170
+ * const decimals = await getDecimalsOrThrow(signer, token, 'deposit:decimals');
171
+ * const amount = toNormalizedBn(userInput, decimals);
172
+ * ```
173
+ */
174
+ export declare const getDecimalsOrThrow: (runner: IContractRunner, address: IAddress, tag: string) => Promise<number>;
175
+ /**
176
+ * Fetch the whitelisted deposit-asset addresses from a vault's whitelist
177
+ * contract. Cached with a 5-minute TTL; a fresh fetch fans out into N
178
+ * decimals/symbol reads downstream.
179
+ * @internal
180
+ */
181
+ export declare const getWhitelistedAssets: (provider: IContractRunner, whitelistAddress: IAddress) => Promise<IAddress[]>;
182
+ /**
183
+ * Read an `evm-2` vault's receipt (LP) token address via `lpTokenAddress()`,
184
+ * retrying only the transient transport faults and surfacing everything else
185
+ * unchanged.
186
+ *
187
+ * Why this exists: `lpTokenAddress()` sits immediately before the receipt-token
188
+ * `decimals()` read on every `evm-2` write path (approve / deposit / request
189
+ * redeem / swap-router deposit). Those `decimals()` reads were hardened against
190
+ * provider blips ({@link getDecimalsOrThrow}); the `lpTokenAddress()` read one
191
+ * line above them was not, so a single truncated `eth_call` response still
192
+ * failed the whole write with
193
+ * `missing revert data (action="call", data="0xf5ae497a", …)` — observed in
194
+ * production against a mainnet vault whose `lpTokenAddress()` demonstrably
195
+ * returns a real address when the provider is healthy.
196
+ *
197
+ * **This must never hide a misrouted vault, and does not.** `lpTokenAddress()`
198
+ * exists *only* on `evm-2` vaults. A vault wrongly classified as `evm-2` returns
199
+ * empty returndata for it, deterministically and forever, and that empty
200
+ * response is byte-identical to the transient one — it is the *only* signal the
201
+ * SDK gets that its version routing was wrong. So the retry here is deliberately
202
+ * shaped to preserve that signal:
203
+ *
204
+ * - it is **bounded** (3 attempts, ~750ms of backoff in total — see
205
+ * `retryOnTransientRpc`), never open-ended;
206
+ * - on exhaustion it **rethrows the original error object**, with its identity,
207
+ * message, `code` and `transaction.data` intact, so the caller's
208
+ * `AugustSDKError` cause and Sentry grouping are exactly what they are today;
209
+ * - it has **no fallback**: it never substitutes another address, never resolves
210
+ * the vault address itself, and never resolves `null`/`undefined`. It either
211
+ * returns a real receipt-token address or throws.
212
+ *
213
+ * Net effect: a blip costs a retry, a misroute costs three `eth_call`s and then
214
+ * fails exactly as loudly as before.
215
+ *
216
+ * **Deliberately not cached.** Unlike `decimals()`, the vault→receipt-token
217
+ * mapping is not memoized here. Caching it would make a misroute's first
218
+ * (failed) probe and every subsequent one diverge, and would put a
219
+ * vault-identity mapping in the cache on the money path. The lenient, cached
220
+ * reader is {@link getReceiptTokenAddress} — use that on read paths that can
221
+ * tolerate `undefined`.
222
+ *
223
+ * RPC cost: exactly 1 `eth_call` on success; at most 3 when the provider keeps
224
+ * faulting.
225
+ *
226
+ * @param runner - Provider or signer to read through.
227
+ * @param vault - Address of the `evm-2` tokenized vault.
228
+ * @param tag - Low-cardinality label for retry breadcrumbs (e.g.
229
+ * `'vaultRequestRedeem:receiptToken'`).
230
+ * @returns The vault's receipt (LP) token address. Never `null`/`undefined`.
231
+ * @throws The underlying read error, unmodified, once the bounded retries are
232
+ * exhausted — or immediately when the failure is neither a transport fault nor
233
+ * an empty response to this exact selector (e.g. a genuine revert carrying
234
+ * revert data).
235
+ *
236
+ * @example
237
+ * ```ts
238
+ * const receiptToken = await getReceiptTokenAddressOrThrow(
239
+ * signer,
240
+ * vault,
241
+ * 'vaultRequestRedeem:receiptToken',
242
+ * );
243
+ * const decimals = await getDecimalsOrThrow(signer, receiptToken, 'tag');
244
+ * ```
245
+ */
246
+ export declare const getReceiptTokenAddressOrThrow: (runner: IContractRunner, vault: IAddress, tag: string) => Promise<IAddress>;
247
+ /**
248
+ * Fetch receipt token address from tokenized vault contract.
249
+ * Results are cached to minimize RPC calls.
250
+ *
251
+ * **Never throws** — a failed read logs at error level and resolves
252
+ * `undefined`, which several read paths depend on. The underlying
253
+ * `lpTokenAddress()` call is made through
254
+ * {@link getReceiptTokenAddressOrThrow}, so a transient provider blip is
255
+ * absorbed by a bounded retry before that happens; a deterministic failure (a
256
+ * vault that has no `lpTokenAddress()` because it is not `evm-2`) still resolves
257
+ * `undefined` after the attempts are spent, exactly as before. Callers on a
258
+ * money path must use {@link getReceiptTokenAddressOrThrow} directly instead —
259
+ * an `undefined` receipt-token address there would silently mis-address a
260
+ * `decimals()` read.
261
+ *
262
+ * @param provider Web3 provider
263
+ * @param address Tokenized vault contract address
264
+ * @returns Receipt token address, or `undefined` when the read failed.
265
+ */
266
+ export declare const getReceiptTokenAddress: (provider: IContractRunner, address: IAddress) => Promise<`0x${string}`>;
267
+ /**
268
+ * Fetch token symbol from contract.
269
+ * Results are cached to minimize RPC calls.
270
+ * @param provider Web3 provider
271
+ * @param address Token contract address
272
+ * @returns Token symbol string
273
+ */
274
+ export declare const getSymbol: (provider: IContractRunner, address: IAddress | undefined, isVault?: boolean) => Promise<string>;
275
+ /**
276
+ * Batch fetch multiple token metadata fields in a single call.
277
+ * Efficiently retrieves name, symbol, decimals, and totalSupply.
278
+ * @param provider Web3 provider
279
+ * @param asset Token contract address
280
+ * @param meta Array of metadata fields to fetch
281
+ * @returns Array of metadata values in same order as requested
282
+ */
283
+ export declare function getTokenMetadata(provider: IContractRunner, asset: IAddress, meta: ('symbol' | 'decimals' | 'name' | 'totalSupply')[]): Promise<any[]>;
284
+ /**
285
+ * Fetch management fee percentage from vault contract.
286
+ * Performs static call first to check if method exists.
287
+ * @todo fix so that when lending pool does not have "managementFeePercent", to not break everything
288
+ * @param provider Web3 provider
289
+ * @param address Vault contract address
290
+ * @returns Management fee as percentage or undefined if not supported
291
+ */
292
+ export declare const getManagementFeePercent: (provider: IContractRunner, address: IAddress) => Promise<number>;
293
+ /**
294
+ * Simulate contract transaction without executing on-chain.
295
+ * Useful for testing transaction viability before sending.
296
+ * @param provider Web3 provider
297
+ * @param abi Contract ABI
298
+ * @param functionName Function to simulate
299
+ * @param options Transaction parameters including args, from, to
300
+ * @returns Decoded function result or false if simulation fails
301
+ */
302
+ export declare function simulateTransaction(provider: IContractRunner, abi: string[] | any, functionName: string, options?: {
303
+ args?: (string | number | bigint)[][];
304
+ from?: string;
305
+ to?: string;
306
+ }): Promise<boolean | ethers.Result>;
307
+ /**
308
+ * Validate Ethereum address format and checksum.
309
+ * @param address Address string to validate
310
+ * @param logger Optional logger for error messages
311
+ * @param type Context type for logging
312
+ * @returns True if address is valid and checksummed
313
+ */
314
+ export declare function checkAddress(address: string, logger?: any, type?: 'wallet' | 'contract'): boolean;
315
+ type ILoanOracleFeeCategories = 'LOAN.REPAY.INTERESTS';
316
+ /**
317
+ * Fetch dynamic fee rate from on-chain oracle contract.
318
+ * Used for calculating loan interest repayment fees.
319
+ * @param provider Web3 provider
320
+ * @param category_id Fee category identifier
321
+ * @param address Context address for fee calculation
322
+ * @param chainId Optional chain ID (auto-detected if not provided)
323
+ * @returns Fee rate as decimal number
324
+ */
325
+ export declare function getLoanOracleFeeRate(provider: IContractRunner, category_id: ILoanOracleFeeCategories, address: IAddress, chainId?: number): Promise<number>;
326
+ /**
327
+ * Query historical contract state across a block range.
328
+ * Useful for reconstructing historical data like TVL over time.
329
+ * @param provider Web3 provider
330
+ * @param contractAddress Target contract address
331
+ * @param abi Contract ABI
332
+ * @param methodName View function to call
333
+ * @param args Function arguments
334
+ * @param startBlock Starting block number
335
+ * @param endBlock Ending block number (current block if not specified)
336
+ * @param blockInterval Blocks between each query
337
+ * @returns Array of results with block numbers and timestamps
338
+ */
339
+ export declare function getHistoricalContractData(provider: IContractRunner, contractAddress: IAddress, abi: Interface | InterfaceAbi, methodName: string, args: (string | number | bigint | boolean)[], startBlock: number, endBlock: number, blockInterval?: number): Promise<any[]>;
340
+ /**
341
+ * Query historical contract state at regular time intervals.
342
+ * Uses binary search to find blocks closest to target timestamps.
343
+ * @param provider Web3 provider
344
+ * @param contractAddress Target contract address
345
+ * @param abi Contract ABI
346
+ * @param methodName View function to call
347
+ * @param args Function arguments
348
+ * @param startDate Start date (string or timestamp)
349
+ * @param endDate End date (string or timestamp)
350
+ * @param intervalHours Hours between each query
351
+ * @returns Array of results with dates, blocks, and values
352
+ */
353
+ export declare function getHistoricalContractDataByDate(provider: IContractRunner, contractAddress: IAddress, abi: Interface | InterfaceAbi, methodName: string, args: (string | number | bigint | boolean)[], startDate: string | number, endDate: string | number, intervalHours?: number): Promise<any[]>;