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.
- package/LICENSE +21 -0
- package/README.md +349 -0
- package/lib/abis/AddressResolver.d.ts +28 -0
- package/lib/abis/AddressResolver.js +23 -0
- package/lib/abis/ChainlinkV3.d.ts +87 -0
- package/lib/abis/ChainlinkV3.js +117 -0
- package/lib/abis/ERC20.d.ts +168 -0
- package/lib/abis/ERC20.js +226 -0
- package/lib/abis/ERC20_Bytes32.d.ts +139 -0
- package/lib/abis/ERC20_Bytes32.js +196 -0
- package/lib/abis/ERC4626.d.ts +364 -0
- package/lib/abis/ERC4626.js +507 -0
- package/lib/abis/ERC721.d.ts +231 -0
- package/lib/abis/ERC721.js +321 -0
- package/lib/abis/FeeOracle.d.ts +120 -0
- package/lib/abis/FeeOracle.js +162 -0
- package/lib/abis/LendingPool.d.ts +1393 -0
- package/lib/abis/LendingPool.js +1807 -0
- package/lib/abis/LendingPoolV2.d.ts +1413 -0
- package/lib/abis/LendingPoolV2.js +1833 -0
- package/lib/abis/LendingPoolV3.d.ts +1677 -0
- package/lib/abis/LendingPoolV3.js +1160 -0
- package/lib/abis/Loan.d.ts +837 -0
- package/lib/abis/Loan.js +1080 -0
- package/lib/abis/MultiAssetNativeDepositWrapper.d.ts +137 -0
- package/lib/abis/MultiAssetNativeDepositWrapper.js +125 -0
- package/lib/abis/Multicall3.d.ts +30 -0
- package/lib/abis/Multicall3.js +97 -0
- package/lib/abis/OFT.d.ts +116 -0
- package/lib/abis/OFT.js +85 -0
- package/lib/abis/PoolAdapter.d.ts +36 -0
- package/lib/abis/PoolAdapter.js +51 -0
- package/lib/abis/RewardDistributor.d.ts +267 -0
- package/lib/abis/RewardDistributor.js +352 -0
- package/lib/abis/RwaRedeemSubaccount.d.ts +747 -0
- package/lib/abis/RwaRedeemSubaccount.js +548 -0
- package/lib/abis/SmartAccount.d.ts +17 -0
- package/lib/abis/SmartAccount.js +19 -0
- package/lib/abis/SwapRouter.d.ts +1043 -0
- package/lib/abis/SwapRouter.js +740 -0
- package/lib/abis/TextResolver.d.ts +16 -0
- package/lib/abis/TextResolver.js +16 -0
- package/lib/abis/TokenizedVaultV2.d.ts +1364 -0
- package/lib/abis/TokenizedVaultV2.js +1041 -0
- package/lib/abis/TokenizedVaultV2DepositWithPermit.d.ts +1456 -0
- package/lib/abis/TokenizedVaultV2DepositWithPermit.js +1878 -0
- package/lib/abis/TokenizedVaultV2Receipt.d.ts +1568 -0
- package/lib/abis/TokenizedVaultV2Receipt.js +1061 -0
- package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.d.ts +454 -0
- package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.js +327 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAllocation.d.ts +1466 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAllocation.js +1092 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAssets.d.ts +274 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAssets.js +167 -0
- package/lib/abis/UniversalResolverResolve.d.ts +69 -0
- package/lib/abis/UniversalResolverResolve.js +35 -0
- package/lib/abis/UniversalSignatureValidator.d.ts +17 -0
- package/lib/abis/UniversalSignatureValidator.js +30 -0
- package/lib/abis/WrapperAdapter.d.ts +71 -0
- package/lib/abis/WrapperAdapter.js +77 -0
- package/lib/abis/index.d.ts +34 -0
- package/lib/abis/index.js +51 -0
- package/lib/adapters/evm/getters.d.ts +19 -0
- package/lib/adapters/evm/getters.js +209 -0
- package/lib/adapters/evm/index.d.ts +353 -0
- package/lib/adapters/evm/index.js +434 -0
- package/lib/adapters/evm/utils.d.ts +8 -0
- package/lib/adapters/evm/utils.js +51 -0
- package/lib/adapters/solana/constants.d.ts +33 -0
- package/lib/adapters/solana/constants.js +52 -0
- package/lib/adapters/solana/getters.d.ts +11 -0
- package/lib/adapters/solana/getters.js +165 -0
- package/lib/adapters/solana/idl/vault-idl.d.ts +272 -0
- package/lib/adapters/solana/idl/vault-idl.js +1084 -0
- package/lib/adapters/solana/index.d.ts +233 -0
- package/lib/adapters/solana/index.js +291 -0
- package/lib/adapters/solana/types.d.ts +67 -0
- package/lib/adapters/solana/types.js +3 -0
- package/lib/adapters/solana/utils.d.ts +141 -0
- package/lib/adapters/solana/utils.js +595 -0
- package/lib/adapters/solana/vault.actions.d.ts +57 -0
- package/lib/adapters/solana/vault.actions.js +379 -0
- package/lib/adapters/stellar/actions.d.ts +28 -0
- package/lib/adapters/stellar/actions.js +77 -0
- package/lib/adapters/stellar/constants.d.ts +43 -0
- package/lib/adapters/stellar/constants.js +53 -0
- package/lib/adapters/stellar/getters.d.ts +68 -0
- package/lib/adapters/stellar/getters.js +290 -0
- package/lib/adapters/stellar/index.d.ts +114 -0
- package/lib/adapters/stellar/index.js +175 -0
- package/lib/adapters/stellar/soroban.d.ts +123 -0
- package/lib/adapters/stellar/soroban.js +613 -0
- package/lib/adapters/stellar/submit.d.ts +34 -0
- package/lib/adapters/stellar/submit.js +149 -0
- package/lib/adapters/stellar/types.d.ts +58 -0
- package/lib/adapters/stellar/types.js +6 -0
- package/lib/adapters/stellar/utils.d.ts +24 -0
- package/lib/adapters/stellar/utils.js +34 -0
- package/lib/adapters/sui/constants.d.ts +14 -0
- package/lib/adapters/sui/constants.js +29 -0
- package/lib/adapters/sui/getters.d.ts +9 -0
- package/lib/adapters/sui/getters.js +60 -0
- package/lib/adapters/sui/index.d.ts +45 -0
- package/lib/adapters/sui/index.js +101 -0
- package/lib/adapters/sui/transformer.d.ts +10 -0
- package/lib/adapters/sui/transformer.js +107 -0
- package/lib/adapters/sui/types.d.ts +66 -0
- package/lib/adapters/sui/types.js +3 -0
- package/lib/adapters/sui/utils.d.ts +10 -0
- package/lib/adapters/sui/utils.js +29 -0
- package/lib/core/analytics/chain-name.d.ts +9 -0
- package/lib/core/analytics/chain-name.js +34 -0
- package/lib/core/analytics/constants.d.ts +5 -0
- package/lib/core/analytics/constants.js +9 -0
- package/lib/core/analytics/env.d.ts +29 -0
- package/lib/core/analytics/env.js +59 -0
- package/lib/core/analytics/index.d.ts +36 -0
- package/lib/core/analytics/index.js +79 -0
- package/lib/core/analytics/instrumentation.d.ts +29 -0
- package/lib/core/analytics/instrumentation.js +277 -0
- package/lib/core/analytics/method-taxonomy.d.ts +19 -0
- package/lib/core/analytics/method-taxonomy.js +128 -0
- package/lib/core/analytics/metrics.d.ts +33 -0
- package/lib/core/analytics/metrics.js +116 -0
- package/lib/core/analytics/sanitize.d.ts +44 -0
- package/lib/core/analytics/sanitize.js +260 -0
- package/lib/core/analytics/sentry-runtime.d.ts +15 -0
- package/lib/core/analytics/sentry-runtime.js +97 -0
- package/lib/core/analytics/sentry.d.ts +67 -0
- package/lib/core/analytics/sentry.js +613 -0
- package/lib/core/analytics/types.d.ts +48 -0
- package/lib/core/analytics/types.js +3 -0
- package/lib/core/analytics/user-identity.d.ts +41 -0
- package/lib/core/analytics/user-identity.js +141 -0
- package/lib/core/analytics/version.d.ts +6 -0
- package/lib/core/analytics/version.js +10 -0
- package/lib/core/attribution.d.ts +111 -0
- package/lib/core/attribution.js +142 -0
- package/lib/core/auth/index.d.ts +1 -0
- package/lib/core/auth/index.js +18 -0
- package/lib/core/auth/verify.d.ts +2 -0
- package/lib/core/auth/verify.js +31 -0
- package/lib/core/base.class.d.ts +152 -0
- package/lib/core/base.class.js +172 -0
- package/lib/core/cache.d.ts +9 -0
- package/lib/core/cache.js +31 -0
- package/lib/core/constants/adapters.d.ts +103 -0
- package/lib/core/constants/adapters.js +180 -0
- package/lib/core/constants/core.d.ts +133 -0
- package/lib/core/constants/core.js +209 -0
- package/lib/core/constants/swap-router.d.ts +150 -0
- package/lib/core/constants/swap-router.js +169 -0
- package/lib/core/constants/vaults.d.ts +93 -0
- package/lib/core/constants/vaults.js +273 -0
- package/lib/core/constants/web3.d.ts +91 -0
- package/lib/core/constants/web3.js +229 -0
- package/lib/core/errors/index.d.ts +114 -0
- package/lib/core/errors/index.js +183 -0
- package/lib/core/fetcher.d.ts +198 -0
- package/lib/core/fetcher.js +903 -0
- package/lib/core/helpers/adapters.d.ts +13 -0
- package/lib/core/helpers/adapters.js +39 -0
- package/lib/core/helpers/chain-address.d.ts +13 -0
- package/lib/core/helpers/chain-address.js +47 -0
- package/lib/core/helpers/chain-error.d.ts +207 -0
- package/lib/core/helpers/chain-error.js +682 -0
- package/lib/core/helpers/chain-support.d.ts +80 -0
- package/lib/core/helpers/chain-support.js +115 -0
- package/lib/core/helpers/core.d.ts +68 -0
- package/lib/core/helpers/core.js +285 -0
- package/lib/core/helpers/explorer-link.d.ts +16 -0
- package/lib/core/helpers/explorer-link.js +26 -0
- package/lib/core/helpers/multicall.d.ts +68 -0
- package/lib/core/helpers/multicall.js +103 -0
- package/lib/core/helpers/revert-decode.d.ts +248 -0
- package/lib/core/helpers/revert-decode.js +515 -0
- package/lib/core/helpers/signer.d.ts +52 -0
- package/lib/core/helpers/signer.js +145 -0
- package/lib/core/helpers/swap-router.d.ts +211 -0
- package/lib/core/helpers/swap-router.js +480 -0
- package/lib/core/helpers/vault-version.d.ts +23 -0
- package/lib/core/helpers/vault-version.js +75 -0
- package/lib/core/helpers/vaults.d.ts +89 -0
- package/lib/core/helpers/vaults.js +235 -0
- package/lib/core/helpers/web3.d.ts +353 -0
- package/lib/core/helpers/web3.js +992 -0
- package/lib/core/index.d.ts +23 -0
- package/lib/core/index.js +40 -0
- package/lib/core/logger/index.d.ts +98 -0
- package/lib/core/logger/index.js +144 -0
- package/lib/core/logger/slack.d.ts +16 -0
- package/lib/core/logger/slack.js +57 -0
- package/lib/core/vault-metadata.d.ts +12 -0
- package/lib/core/vault-metadata.js +42 -0
- package/lib/core/version-check.d.ts +58 -0
- package/lib/core/version-check.js +182 -0
- package/lib/evm/index.d.ts +2 -0
- package/lib/evm/index.js +19 -0
- package/lib/evm/methods/crossChainVault.d.ts +128 -0
- package/lib/evm/methods/crossChainVault.js +853 -0
- package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
- package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
- package/lib/evm/methods/index.d.ts +2 -0
- package/lib/evm/methods/index.js +19 -0
- package/lib/evm/types/crossChain.d.ts +363 -0
- package/lib/evm/types/crossChain.js +20 -0
- package/lib/evm/types/index.d.ts +1 -0
- package/lib/evm/types/index.js +18 -0
- package/lib/index.d.ts +30 -0
- package/lib/index.js +52 -0
- package/lib/main.d.ts +527 -0
- package/lib/main.js +601 -0
- package/lib/modules/api/fetcher.d.ts +82 -0
- package/lib/modules/api/fetcher.js +150 -0
- package/lib/modules/api/index.d.ts +1 -0
- package/lib/modules/api/index.js +6 -0
- package/lib/modules/api/main.d.ts +313 -0
- package/lib/modules/api/main.js +479 -0
- package/lib/modules/sub-accounts/fetcher.d.ts +53 -0
- package/lib/modules/sub-accounts/fetcher.js +120 -0
- package/lib/modules/sub-accounts/index.d.ts +2 -0
- package/lib/modules/sub-accounts/index.js +19 -0
- package/lib/modules/sub-accounts/main.d.ts +243 -0
- package/lib/modules/sub-accounts/main.js +205 -0
- package/lib/modules/sub-accounts/utils.d.ts +106 -0
- package/lib/modules/sub-accounts/utils.js +112 -0
- package/lib/modules/vaults/adapter.helpers.d.ts +64 -0
- package/lib/modules/vaults/adapter.helpers.js +184 -0
- package/lib/modules/vaults/fetcher.d.ts +147 -0
- package/lib/modules/vaults/fetcher.js +368 -0
- package/lib/modules/vaults/getters.d.ts +570 -0
- package/lib/modules/vaults/getters.js +3051 -0
- package/lib/modules/vaults/index.d.ts +20 -0
- package/lib/modules/vaults/index.js +44 -0
- package/lib/modules/vaults/main.d.ts +601 -0
- package/lib/modules/vaults/main.js +1623 -0
- package/lib/modules/vaults/prefetch.d.ts +65 -0
- package/lib/modules/vaults/prefetch.js +120 -0
- package/lib/modules/vaults/read.actions.d.ts +225 -0
- package/lib/modules/vaults/read.actions.js +596 -0
- package/lib/modules/vaults/types.d.ts +71 -0
- package/lib/modules/vaults/types.js +3 -0
- package/lib/modules/vaults/utils/call-data-decoder.d.ts +61 -0
- package/lib/modules/vaults/utils/call-data-decoder.js +194 -0
- package/lib/modules/vaults/utils/date-utils.d.ts +50 -0
- package/lib/modules/vaults/utils/date-utils.js +84 -0
- package/lib/modules/vaults/utils.d.ts +140 -0
- package/lib/modules/vaults/utils.js +799 -0
- package/lib/modules/vaults/write.actions.d.ts +529 -0
- package/lib/modules/vaults/write.actions.js +1749 -0
- package/lib/polyfills.d.ts +1 -0
- package/lib/polyfills.js +12 -0
- package/lib/sdk.d.ts +26721 -0
- package/lib/services/coingecko/fetcher.d.ts +15 -0
- package/lib/services/coingecko/fetcher.js +67 -0
- package/lib/services/coingecko/index.d.ts +2 -0
- package/lib/services/coingecko/index.js +19 -0
- package/lib/services/coingecko/utils.d.ts +1 -0
- package/lib/services/coingecko/utils.js +24 -0
- package/lib/services/debank/fetcher.d.ts +126 -0
- package/lib/services/debank/fetcher.js +47 -0
- package/lib/services/debank/index.d.ts +2 -0
- package/lib/services/debank/index.js +19 -0
- package/lib/services/debank/utils.d.ts +38 -0
- package/lib/services/debank/utils.js +297 -0
- package/lib/services/layerzero/deposits.d.ts +49 -0
- package/lib/services/layerzero/deposits.js +166 -0
- package/lib/services/layerzero/redeems.d.ts +20 -0
- package/lib/services/layerzero/redeems.js +92 -0
- package/lib/services/layerzero/utils.d.ts +9 -0
- package/lib/services/layerzero/utils.js +22 -0
- package/lib/services/octavfi/fetcher.d.ts +9 -0
- package/lib/services/octavfi/fetcher.js +103 -0
- package/lib/services/octavfi/index.d.ts +3 -0
- package/lib/services/octavfi/index.js +20 -0
- package/lib/services/octavfi/types.d.ts +34 -0
- package/lib/services/octavfi/types.js +3 -0
- package/lib/services/octavfi/utils.d.ts +16 -0
- package/lib/services/octavfi/utils.js +212 -0
- package/lib/services/subgraph/fetcher.d.ts +2 -0
- package/lib/services/subgraph/fetcher.js +61 -0
- package/lib/services/subgraph/index.d.ts +2 -0
- package/lib/services/subgraph/index.js +19 -0
- package/lib/services/subgraph/schema.d.ts +45 -0
- package/lib/services/subgraph/schema.js +75 -0
- package/lib/services/subgraph/vaults.d.ts +25 -0
- package/lib/services/subgraph/vaults.js +1106 -0
- package/lib/services/swap-quotes/index.d.ts +105 -0
- package/lib/services/swap-quotes/index.js +77 -0
- package/lib/services/swap-quotes/paraswap.d.ts +51 -0
- package/lib/services/swap-quotes/paraswap.js +138 -0
- package/lib/types/api.d.ts +280 -0
- package/lib/types/api.js +3 -0
- package/lib/types/index.d.ts +12 -0
- package/lib/types/index.js +28 -0
- package/lib/types/points.d.ts +28 -0
- package/lib/types/points.js +3 -0
- package/lib/types/pools.d.ts +144 -0
- package/lib/types/pools.js +3 -0
- package/lib/types/staking.d.ts +28 -0
- package/lib/types/staking.js +3 -0
- package/lib/types/sub-accounts.d.ts +140 -0
- package/lib/types/sub-accounts.js +3 -0
- package/lib/types/subgraph.d.ts +74 -0
- package/lib/types/subgraph.js +3 -0
- package/lib/types/typed-contract.d.ts +102 -0
- package/lib/types/typed-contract.js +3 -0
- package/lib/types/user.d.ts +1 -0
- package/lib/types/user.js +3 -0
- package/lib/types/vaults.d.ts +714 -0
- package/lib/types/vaults.js +24 -0
- package/lib/types/web3.d.ts +51 -0
- package/lib/types/web3.js +14 -0
- package/lib/types/webserver.d.ts +698 -0
- package/lib/types/webserver.js +3 -0
- package/package.json +78 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-Chain Vault Registry
|
|
3
|
+
*
|
|
4
|
+
* Address-keyed registry of August's LayerZero OVault deployments plus the
|
|
5
|
+
* resolver helpers that turn a vault address into the
|
|
6
|
+
* {@link ICrossChainVaultConfig} consumed by `buildCrossChainVaultTx`,
|
|
7
|
+
* `crossChainVaultDeposit`, and `quoteCrossChainDeposit`.
|
|
8
|
+
*
|
|
9
|
+
* This is the cross-chain analogue of the SwapRouter registry
|
|
10
|
+
* (`VAULTS_USING_SWAP_ROUTER` / `getSwapRouterAddress`): consumers resolve a
|
|
11
|
+
* full config by vault address instead of hand-assembling the per-chain
|
|
12
|
+
* contract maps and LayerZero EIDs. Without it, every consuming app would
|
|
13
|
+
* re-encode the same address book.
|
|
14
|
+
*
|
|
15
|
+
* Addresses are ported verbatim from upshift-app `src/config/ovault.ts` and
|
|
16
|
+
* cross-checked against the read-side `LAYERZERO_VAULTS` registry in
|
|
17
|
+
* `services/layerzero/deposits.ts`. Verify against the deployed contracts
|
|
18
|
+
* before adding or editing an entry — a wrong address silently routes funds
|
|
19
|
+
* to the wrong chain.
|
|
20
|
+
*
|
|
21
|
+
* Return convention (deliberate, mirrors the SwapRouter helpers): lookups that
|
|
22
|
+
* resolve a single optional value (`getCrossChainVaultConfig`,
|
|
23
|
+
* `getOVaultChains`) return `undefined` for an unregistered vault, while
|
|
24
|
+
* list-returning helpers (`getWithdrawDestinationChains`) return `[]` so
|
|
25
|
+
* callers can iterate without a null-check.
|
|
26
|
+
*
|
|
27
|
+
* @module evm/methods/crossChainVaultRegistry
|
|
28
|
+
*/
|
|
29
|
+
import type { IAddress } from '../../types';
|
|
30
|
+
import type { ICrossChainVaultConfig } from '../types/crossChain';
|
|
31
|
+
/**
|
|
32
|
+
* August's LayerZero OVault deployments, keyed by lowercase hub-chain vault
|
|
33
|
+
* address. Resolve entries with {@link getCrossChainVaultConfig} rather than
|
|
34
|
+
* indexing directly — the helper handles address-casing for you.
|
|
35
|
+
*
|
|
36
|
+
* @see {@link getCrossChainVaultConfig} for the typed, case-insensitive lookup.
|
|
37
|
+
*/
|
|
38
|
+
export declare const CROSS_CHAIN_VAULT_CONFIGS: Readonly<Record<string, ICrossChainVaultConfig>>;
|
|
39
|
+
/**
|
|
40
|
+
* Resolve the full cross-chain config for a vault. Address comparison is
|
|
41
|
+
* case-insensitive.
|
|
42
|
+
*
|
|
43
|
+
* @param vault - Hub-chain vault contract address.
|
|
44
|
+
* @returns The {@link ICrossChainVaultConfig} to pass to
|
|
45
|
+
* `crossChainVaultDeposit` / `quoteCrossChainDeposit`, or `undefined` when
|
|
46
|
+
* the vault is not a registered OVault deployment.
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const config = getCrossChainVaultConfig('0xE9B725010A9E419412ed67d0fA5f3A5f40159D32');
|
|
50
|
+
* if (config) await quoteCrossChainDeposit({ config, ...rest });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function getCrossChainVaultConfig(vault: IAddress): ICrossChainVaultConfig | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Whether a vault is a registered LayerZero OVault and should route deposits
|
|
56
|
+
* through the cross-chain flow. Address comparison is case-insensitive.
|
|
57
|
+
*
|
|
58
|
+
* @param vault - Vault contract address.
|
|
59
|
+
* @returns `true` when the vault has an entry in
|
|
60
|
+
* {@link CROSS_CHAIN_VAULT_CONFIGS}.
|
|
61
|
+
*/
|
|
62
|
+
export declare function isCrossChainVault(vault: IAddress): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Get the hub and spoke chain IDs a vault is deployed across — the set of
|
|
65
|
+
* chains a user can deposit from.
|
|
66
|
+
*
|
|
67
|
+
* @param vault - Vault contract address.
|
|
68
|
+
* @returns `{ hub, spokes }` chain IDs, or `undefined` when the vault is not a
|
|
69
|
+
* registered OVault deployment.
|
|
70
|
+
*/
|
|
71
|
+
export declare function getOVaultChains(vault: IAddress): {
|
|
72
|
+
hub: number;
|
|
73
|
+
spokes: number[];
|
|
74
|
+
} | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Whether a vault's receipt token is hub-only (no cross-chain withdraw).
|
|
77
|
+
* The deposit UI must not offer a spoke share destination for these vaults.
|
|
78
|
+
*
|
|
79
|
+
* @param vault - Vault contract address.
|
|
80
|
+
* @returns `true` for vaults whose shares cannot leave the hub chain
|
|
81
|
+
* (AUGUST-6300).
|
|
82
|
+
*/
|
|
83
|
+
export declare function isHubOnlyReceipt(vault: IAddress): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Chains a user can receive the underlying asset on when withdrawing.
|
|
86
|
+
* Hub-only-receipt vaults redeem to the hub chain only (AUGUST-6300); all
|
|
87
|
+
* other OVault vaults can redeem to the hub or any spoke.
|
|
88
|
+
*
|
|
89
|
+
* @param vault - Vault contract address.
|
|
90
|
+
* @returns Destination chain IDs, or an empty array when the vault is not a
|
|
91
|
+
* registered OVault deployment.
|
|
92
|
+
*/
|
|
93
|
+
export declare function getWithdrawDestinationChains(vault: IAddress): number[];
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Cross-Chain Vault Registry
|
|
4
|
+
*
|
|
5
|
+
* Address-keyed registry of August's LayerZero OVault deployments plus the
|
|
6
|
+
* resolver helpers that turn a vault address into the
|
|
7
|
+
* {@link ICrossChainVaultConfig} consumed by `buildCrossChainVaultTx`,
|
|
8
|
+
* `crossChainVaultDeposit`, and `quoteCrossChainDeposit`.
|
|
9
|
+
*
|
|
10
|
+
* This is the cross-chain analogue of the SwapRouter registry
|
|
11
|
+
* (`VAULTS_USING_SWAP_ROUTER` / `getSwapRouterAddress`): consumers resolve a
|
|
12
|
+
* full config by vault address instead of hand-assembling the per-chain
|
|
13
|
+
* contract maps and LayerZero EIDs. Without it, every consuming app would
|
|
14
|
+
* re-encode the same address book.
|
|
15
|
+
*
|
|
16
|
+
* Addresses are ported verbatim from upshift-app `src/config/ovault.ts` and
|
|
17
|
+
* cross-checked against the read-side `LAYERZERO_VAULTS` registry in
|
|
18
|
+
* `services/layerzero/deposits.ts`. Verify against the deployed contracts
|
|
19
|
+
* before adding or editing an entry — a wrong address silently routes funds
|
|
20
|
+
* to the wrong chain.
|
|
21
|
+
*
|
|
22
|
+
* Return convention (deliberate, mirrors the SwapRouter helpers): lookups that
|
|
23
|
+
* resolve a single optional value (`getCrossChainVaultConfig`,
|
|
24
|
+
* `getOVaultChains`) return `undefined` for an unregistered vault, while
|
|
25
|
+
* list-returning helpers (`getWithdrawDestinationChains`) return `[]` so
|
|
26
|
+
* callers can iterate without a null-check.
|
|
27
|
+
*
|
|
28
|
+
* @module evm/methods/crossChainVaultRegistry
|
|
29
|
+
*/
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.CROSS_CHAIN_VAULT_CONFIGS = void 0;
|
|
32
|
+
exports.getCrossChainVaultConfig = getCrossChainVaultConfig;
|
|
33
|
+
exports.isCrossChainVault = isCrossChainVault;
|
|
34
|
+
exports.getOVaultChains = getOVaultChains;
|
|
35
|
+
exports.isHubOnlyReceipt = isHubOnlyReceipt;
|
|
36
|
+
exports.getWithdrawDestinationChains = getWithdrawDestinationChains;
|
|
37
|
+
const crossChainVault_1 = require("./crossChainVault");
|
|
38
|
+
// EVM chain IDs for the chains carrying OVault deployments. Plain literals
|
|
39
|
+
// (not `viem/chains`) keep viem an optional peer dependency — importing viem
|
|
40
|
+
// at module load would break SDK consumers that do not install it.
|
|
41
|
+
const ETHEREUM = 1;
|
|
42
|
+
const ARBITRUM = 42161;
|
|
43
|
+
const AVALANCHE = 43114;
|
|
44
|
+
const BASE = 8453;
|
|
45
|
+
const SONIC = 146;
|
|
46
|
+
const MONAD = 143;
|
|
47
|
+
const CONFIGS = [
|
|
48
|
+
{
|
|
49
|
+
vaultName: 'Upshift Core USDC',
|
|
50
|
+
vaultSymbol: 'coreUSDC',
|
|
51
|
+
hubChainId: ETHEREUM,
|
|
52
|
+
vaultAddress: '0xE9B725010A9E419412ed67d0fA5f3A5f40159D32',
|
|
53
|
+
spokeChainIds: [ARBITRUM, AVALANCHE, BASE, SONIC],
|
|
54
|
+
contracts: {
|
|
55
|
+
assetToken: {
|
|
56
|
+
[ETHEREUM]: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
57
|
+
[ARBITRUM]: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
|
|
58
|
+
[AVALANCHE]: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E',
|
|
59
|
+
[BASE]: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
60
|
+
[SONIC]: '0x29219dd400f2Bf60E5a23d13Be72B486D4038894',
|
|
61
|
+
},
|
|
62
|
+
assetOFT: {
|
|
63
|
+
[ETHEREUM]: '0xc026395860Db2d07ee33e05fE50ed7bD583189C7',
|
|
64
|
+
[ARBITRUM]: '0xe8CDF27AcD73a434D661C84887215F7598e7d0d3',
|
|
65
|
+
[AVALANCHE]: '0x5634c4a5FEd09819E3c46D86A965Dd9447d86e47',
|
|
66
|
+
[BASE]: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26',
|
|
67
|
+
[SONIC]: '0xA272fFe20cFfe769CdFc4b63088DCD2C82a2D8F9',
|
|
68
|
+
},
|
|
69
|
+
shareOFTAdapter: '0x4a21dcba38c3816c78144f33bb42d8fa17f38067',
|
|
70
|
+
composerSync: '0xc2637d7721791cc9cb196628d1e5e06887b1d4b9',
|
|
71
|
+
shareOFT: {
|
|
72
|
+
[ARBITRUM]: '0x50a31ff4d57841681011837c17aa201c6a34203c',
|
|
73
|
+
[AVALANCHE]: '0x1FA931Bf85248aD2eDf0004DD9A284698358e708',
|
|
74
|
+
[BASE]: '0x1fa931bf85248ad2edf0004dd9a284698358e708',
|
|
75
|
+
[SONIC]: '0x4bdd224fe59a3ae0b249125ad4c5b3126074c71b',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
layerZeroEids: {
|
|
79
|
+
hub: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.ETHEREUM,
|
|
80
|
+
spokes: {
|
|
81
|
+
[ARBITRUM]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.ARBITRUM,
|
|
82
|
+
[AVALANCHE]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.AVALANCHE,
|
|
83
|
+
[BASE]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.BASE,
|
|
84
|
+
[SONIC]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.SONIC,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
hubOnlyReceipt: true,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
vaultName: 'Upshift USDC',
|
|
91
|
+
vaultSymbol: 'upUSDC',
|
|
92
|
+
hubChainId: ETHEREUM,
|
|
93
|
+
vaultAddress: '0x80E1048eDE66ec4c364b4F22C8768fc657FF6A42',
|
|
94
|
+
spokeChainIds: [ARBITRUM, AVALANCHE, BASE, SONIC],
|
|
95
|
+
contracts: {
|
|
96
|
+
assetToken: {
|
|
97
|
+
[ETHEREUM]: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
98
|
+
[ARBITRUM]: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
|
|
99
|
+
[AVALANCHE]: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E',
|
|
100
|
+
[BASE]: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
101
|
+
[SONIC]: '0x29219dd400f2Bf60E5a23d13Be72B486D4038894',
|
|
102
|
+
},
|
|
103
|
+
assetOFT: {
|
|
104
|
+
[ETHEREUM]: '0xc026395860Db2d07ee33e05fE50ed7bD583189C7',
|
|
105
|
+
[ARBITRUM]: '0xe8CDF27AcD73a434D661C84887215F7598e7d0d3',
|
|
106
|
+
[AVALANCHE]: '0x5634c4a5FEd09819E3c46D86A965Dd9447d86e47',
|
|
107
|
+
[BASE]: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26',
|
|
108
|
+
[SONIC]: '0xA272fFe20cFfe769CdFc4b63088DCD2C82a2D8F9',
|
|
109
|
+
},
|
|
110
|
+
shareOFTAdapter: '0x81971a3c359cfe74259cff1b46fb5f2112ddde34',
|
|
111
|
+
composerSync: '0xbe82134b95a8e9370e6759f3c8f44087cd9a52be',
|
|
112
|
+
shareOFT: {
|
|
113
|
+
[ARBITRUM]: '0x81971a3c359cfe74259cff1b46fb5f2112ddde34',
|
|
114
|
+
[AVALANCHE]: '0x81971A3C359cFE74259CfF1b46FB5f2112ddDE34',
|
|
115
|
+
[BASE]: '0x81971a3c359cfe74259cff1b46fb5f2112ddde34',
|
|
116
|
+
[SONIC]: '0x81971a3c359cfe74259cff1b46fb5f2112ddde34',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
layerZeroEids: {
|
|
120
|
+
hub: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.ETHEREUM,
|
|
121
|
+
spokes: {
|
|
122
|
+
[ARBITRUM]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.ARBITRUM,
|
|
123
|
+
[AVALANCHE]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.AVALANCHE,
|
|
124
|
+
[BASE]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.BASE,
|
|
125
|
+
[SONIC]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.SONIC,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
hubOnlyReceipt: true,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
vaultName: 'earnAUSD',
|
|
132
|
+
vaultSymbol: 'earnAUSD',
|
|
133
|
+
hubChainId: MONAD,
|
|
134
|
+
vaultAddress: '0x36eDbF0C834591BFdfCaC0Ef9605528c75c406aA',
|
|
135
|
+
spokeChainIds: [ETHEREUM],
|
|
136
|
+
contracts: {
|
|
137
|
+
assetToken: {
|
|
138
|
+
[MONAD]: '0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a',
|
|
139
|
+
[ETHEREUM]: '0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a',
|
|
140
|
+
},
|
|
141
|
+
assetOFT: {
|
|
142
|
+
[MONAD]: '0x9CaB7Ede13dc56652E44D2404E969C212f22689b',
|
|
143
|
+
[ETHEREUM]: '0x9CaB7Ede13dc56652E44D2404E969C212f22689b',
|
|
144
|
+
},
|
|
145
|
+
shareOFTAdapter: '0x9549Fa3DF579Cca9F3e328695382675F7f1f0F34',
|
|
146
|
+
composerSync: '0xd1B1b12533E12BADB8ea6D63AeDd11922cAE5580',
|
|
147
|
+
shareOFT: {
|
|
148
|
+
[ETHEREUM]: '0xa6916b65c5e3fEdf46c0a2F59bff776e872C8992',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
layerZeroEids: {
|
|
152
|
+
hub: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.MONAD,
|
|
153
|
+
spokes: {
|
|
154
|
+
[ETHEREUM]: crossChainVault_1.LAYERZERO_ENDPOINT_IDS.ETHEREUM,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
multiAsset: {
|
|
158
|
+
hubAssetAddress: '0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a',
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
];
|
|
162
|
+
/**
|
|
163
|
+
* August's LayerZero OVault deployments, keyed by lowercase hub-chain vault
|
|
164
|
+
* address. Resolve entries with {@link getCrossChainVaultConfig} rather than
|
|
165
|
+
* indexing directly — the helper handles address-casing for you.
|
|
166
|
+
*
|
|
167
|
+
* @see {@link getCrossChainVaultConfig} for the typed, case-insensitive lookup.
|
|
168
|
+
*/
|
|
169
|
+
exports.CROSS_CHAIN_VAULT_CONFIGS = Object.freeze(Object.fromEntries(CONFIGS.map((config) => [config.vaultAddress.toLowerCase(), config])));
|
|
170
|
+
/**
|
|
171
|
+
* Resolve the full cross-chain config for a vault. Address comparison is
|
|
172
|
+
* case-insensitive.
|
|
173
|
+
*
|
|
174
|
+
* @param vault - Hub-chain vault contract address.
|
|
175
|
+
* @returns The {@link ICrossChainVaultConfig} to pass to
|
|
176
|
+
* `crossChainVaultDeposit` / `quoteCrossChainDeposit`, or `undefined` when
|
|
177
|
+
* the vault is not a registered OVault deployment.
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
180
|
+
* const config = getCrossChainVaultConfig('0xE9B725010A9E419412ed67d0fA5f3A5f40159D32');
|
|
181
|
+
* if (config) await quoteCrossChainDeposit({ config, ...rest });
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
function getCrossChainVaultConfig(vault) {
|
|
185
|
+
return exports.CROSS_CHAIN_VAULT_CONFIGS[vault.toLowerCase()];
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Whether a vault is a registered LayerZero OVault and should route deposits
|
|
189
|
+
* through the cross-chain flow. Address comparison is case-insensitive.
|
|
190
|
+
*
|
|
191
|
+
* @param vault - Vault contract address.
|
|
192
|
+
* @returns `true` when the vault has an entry in
|
|
193
|
+
* {@link CROSS_CHAIN_VAULT_CONFIGS}.
|
|
194
|
+
*/
|
|
195
|
+
function isCrossChainVault(vault) {
|
|
196
|
+
return getCrossChainVaultConfig(vault) !== undefined;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Get the hub and spoke chain IDs a vault is deployed across — the set of
|
|
200
|
+
* chains a user can deposit from.
|
|
201
|
+
*
|
|
202
|
+
* @param vault - Vault contract address.
|
|
203
|
+
* @returns `{ hub, spokes }` chain IDs, or `undefined` when the vault is not a
|
|
204
|
+
* registered OVault deployment.
|
|
205
|
+
*/
|
|
206
|
+
function getOVaultChains(vault) {
|
|
207
|
+
const config = getCrossChainVaultConfig(vault);
|
|
208
|
+
if (!config)
|
|
209
|
+
return undefined;
|
|
210
|
+
return { hub: config.hubChainId, spokes: config.spokeChainIds };
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Whether a vault's receipt token is hub-only (no cross-chain withdraw).
|
|
214
|
+
* The deposit UI must not offer a spoke share destination for these vaults.
|
|
215
|
+
*
|
|
216
|
+
* @param vault - Vault contract address.
|
|
217
|
+
* @returns `true` for vaults whose shares cannot leave the hub chain
|
|
218
|
+
* (AUGUST-6300).
|
|
219
|
+
*/
|
|
220
|
+
function isHubOnlyReceipt(vault) {
|
|
221
|
+
return getCrossChainVaultConfig(vault)?.hubOnlyReceipt === true;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Chains a user can receive the underlying asset on when withdrawing.
|
|
225
|
+
* Hub-only-receipt vaults redeem to the hub chain only (AUGUST-6300); all
|
|
226
|
+
* other OVault vaults can redeem to the hub or any spoke.
|
|
227
|
+
*
|
|
228
|
+
* @param vault - Vault contract address.
|
|
229
|
+
* @returns Destination chain IDs, or an empty array when the vault is not a
|
|
230
|
+
* registered OVault deployment.
|
|
231
|
+
*/
|
|
232
|
+
function getWithdrawDestinationChains(vault) {
|
|
233
|
+
const config = getCrossChainVaultConfig(vault);
|
|
234
|
+
if (!config)
|
|
235
|
+
return [];
|
|
236
|
+
if (isHubOnlyReceipt(vault))
|
|
237
|
+
return [config.hubChainId];
|
|
238
|
+
return [config.hubChainId, ...config.spokeChainIds];
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=crossChainVaultRegistry.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./crossChainVault"), exports);
|
|
18
|
+
__exportStar(require("./crossChainVaultRegistry"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|