@oydual31/more-vaults-sdk 0.3.3 → 0.4.1
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/dist/ethers/index.cjs +1794 -315
- package/dist/ethers/index.cjs.map +1 -1
- package/dist/ethers/index.d.cts +1147 -1
- package/dist/ethers/index.d.ts +1147 -1
- package/dist/ethers/index.js +1752 -317
- package/dist/ethers/index.js.map +1 -1
- package/dist/react/index.cjs +644 -0
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +111 -2
- package/dist/react/index.d.ts +111 -2
- package/dist/react/index.js +638 -3
- package/dist/react/index.js.map +1 -1
- package/dist/{spokeRoutes-BIafSbQ3.d.cts → spokeRoutes-B8Lnk-t4.d.cts} +191 -2
- package/dist/{spokeRoutes-BIafSbQ3.d.ts → spokeRoutes-B8Lnk-t4.d.ts} +191 -2
- package/dist/viem/index.d.cts +4 -192
- package/dist/viem/index.d.ts +4 -192
- package/package.json +1 -1
- package/src/ethers/abis.ts +92 -0
- package/src/ethers/chains.ts +191 -0
- package/src/ethers/crossChainFlows.ts +208 -0
- package/src/ethers/curatorMulticall.ts +195 -0
- package/src/ethers/curatorStatus.ts +319 -0
- package/src/ethers/curatorSwaps.ts +192 -0
- package/src/ethers/distribution.ts +156 -0
- package/src/ethers/index.ts +96 -1
- package/src/ethers/preflight.ts +225 -1
- package/src/ethers/redeemFlows.ts +160 -1
- package/src/ethers/spokeRoutes.ts +361 -0
- package/src/ethers/topology.ts +240 -0
- package/src/ethers/types.ts +95 -0
- package/src/ethers/userHelpers.ts +193 -0
- package/src/ethers/utils.ts +28 -0
- package/src/react/index.ts +25 -0
- package/src/react/useCuratorVaultStatus.ts +32 -0
- package/src/react/useExecuteActions.ts +23 -0
- package/src/react/useIsCurator.ts +30 -0
- package/src/react/usePendingActions.ts +33 -0
- package/src/react/useProtocolWhitelist.ts +30 -0
- package/src/react/useSubmitActions.ts +27 -0
- package/src/react/useVaultAnalysis.ts +32 -0
- package/src/react/useVaultAssetBreakdown.ts +32 -0
- package/src/react/useVetoActions.ts +23 -0
package/dist/viem/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { V as VaultAddresses, A as AsyncRequestResult, D as DepositResult, S as SpokeDepositResult, C as ComposeData, R as RedeemResult, a as CuratorVaultStatus, P as PendingAction, b as VaultAnalysis, c as VaultAssetBreakdown, d as CuratorAction, e as SubmitActionsResult } from '../spokeRoutes-B8Lnk-t4.js';
|
|
2
|
+
export { f as ActionType, g as ActionTypeValue, h as AssetBalance, i as AssetInfo, j as AsyncRequestFinalResult, k as AsyncRequestStatus, l as AsyncRequestStatusInfo, B as BatchSwapParams, m as BridgeParams, n as CrossChainRequestInfo, o as DepositBlockReason, p as DepositEligibility, I as InboundRoute, q as InboundRouteWithBalance, M as MaxWithdrawable, r as MultiChainUserPosition, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, s as OutboundRoute, t as SpokeBalance, u as SwapParams, U as UserBalances, v as UserPosition, w as VaultDistribution, x as VaultMetadata, y as VaultMode, z as VaultStatus, E as VaultSummary, F as VaultTopology, G as canDeposit, H as detectStargateOft, J as discoverVaultTopology, K as ensureAllowance, L as getAllVaultChainIds, Q as getAsyncRequestStatus, T as getAsyncRequestStatusLabel, W as getFullVaultTopology, X as getInboundRoutes, Y as getMaxWithdrawable, Z as getOutboundRoutes, _ as getUserBalances, $ as getUserBalancesForRoutes, a0 as getUserPosition, a1 as getUserPositionMultiChain, a2 as getVaultDistribution, a3 as getVaultDistributionWithTopology, a4 as getVaultMetadata, a5 as getVaultStatus, a6 as getVaultSummary, a7 as getVaultTopology, a8 as isAsyncMode, a9 as isOnHubChain, aa as previewDeposit, ab as previewRedeem, ac as quoteLzFee, ad as quoteRouteDepositFee, ae as waitForAsyncRequest, af as waitForTx } from '../spokeRoutes-B8Lnk-t4.js';
|
|
3
|
+
import { WalletClient, PublicClient, Address, Hash } from 'viem';
|
|
2
4
|
export { PublicClient as SdkPublicClient } from 'viem';
|
|
3
|
-
export { A as AsyncRequestFinalResult, a as AsyncRequestStatus, b as AsyncRequestStatusInfo, D as DepositBlockReason, c as DepositEligibility, I as InboundRoute, d as InboundRouteWithBalance, M as MaxWithdrawable, e as MultiChainUserPosition, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, f as OutboundRoute, S as SpokeBalance, U as UserBalances, g as UserPosition, V as VaultDistribution, h as VaultMetadata, i as VaultMode, j as VaultStatus, k as VaultSummary, l as VaultTopology, m as canDeposit, n as detectStargateOft, o as discoverVaultTopology, p as ensureAllowance, q as getAllVaultChainIds, r as getAsyncRequestStatus, s as getAsyncRequestStatusLabel, t as getFullVaultTopology, u as getInboundRoutes, v as getMaxWithdrawable, w as getOutboundRoutes, x as getUserBalances, y as getUserBalancesForRoutes, z as getUserPosition, B as getUserPositionMultiChain, C as getVaultDistribution, E as getVaultDistributionWithTopology, F as getVaultMetadata, G as getVaultStatus, H as getVaultSummary, J as getVaultTopology, K as isAsyncMode, L as isOnHubChain, P as previewDeposit, Q as previewRedeem, R as quoteLzFee, T as quoteRouteDepositFee, W as waitForAsyncRequest, X as waitForTx } from '../spokeRoutes-BIafSbQ3.js';
|
|
4
5
|
|
|
5
6
|
/** EVM Chain IDs for chains supported by MoreVaults */
|
|
6
7
|
declare const CHAIN_IDS: {
|
|
@@ -1613,195 +1614,6 @@ declare const LZ_ENDPOINT_ABI: readonly [{
|
|
|
1613
1614
|
readonly stateMutability: "payable";
|
|
1614
1615
|
}];
|
|
1615
1616
|
|
|
1616
|
-
interface VaultAddresses {
|
|
1617
|
-
/** Hub vault address (diamond proxy) */
|
|
1618
|
-
vault: Address;
|
|
1619
|
-
/** MoreVaultsEscrow — holds locked tokens during async cross-chain flows */
|
|
1620
|
-
escrow?: Address;
|
|
1621
|
-
/** OFTAdapter for vault shares (cross-chain redeem only) */
|
|
1622
|
-
shareOFT?: Address;
|
|
1623
|
-
/** OFT for USDC bridging (cross-chain deposits from spoke) */
|
|
1624
|
-
usdcOFT?: Address;
|
|
1625
|
-
/**
|
|
1626
|
-
* Expected EVM chain ID of the hub. When provided, SDK functions will
|
|
1627
|
-
* throw a clear WrongChainError if the walletClient is on a different chain.
|
|
1628
|
-
* Prevents silent failures when MetaMask is connected to the wrong network.
|
|
1629
|
-
*/
|
|
1630
|
-
hubChainId?: number;
|
|
1631
|
-
}
|
|
1632
|
-
interface DepositResult {
|
|
1633
|
-
txHash: Hash;
|
|
1634
|
-
shares: bigint;
|
|
1635
|
-
}
|
|
1636
|
-
interface RedeemResult {
|
|
1637
|
-
txHash: Hash;
|
|
1638
|
-
assets: bigint;
|
|
1639
|
-
}
|
|
1640
|
-
interface AsyncRequestResult {
|
|
1641
|
-
txHash: Hash;
|
|
1642
|
-
/** Cross-chain request GUID to track via getRequestInfo / getFinalizationResult */
|
|
1643
|
-
guid: `0x${string}`;
|
|
1644
|
-
}
|
|
1645
|
-
/**
|
|
1646
|
-
* ActionType enum values matching MoreVaultsLib.ActionType on-chain.
|
|
1647
|
-
* DEPOSIT=0, MINT=1, WITHDRAW=2, REDEEM=3, MULTI_ASSETS_DEPOSIT=4, ACCRUE_FEES=5
|
|
1648
|
-
*/
|
|
1649
|
-
declare const ActionType: {
|
|
1650
|
-
readonly DEPOSIT: 0;
|
|
1651
|
-
readonly MINT: 1;
|
|
1652
|
-
readonly WITHDRAW: 2;
|
|
1653
|
-
readonly REDEEM: 3;
|
|
1654
|
-
readonly MULTI_ASSETS_DEPOSIT: 4;
|
|
1655
|
-
readonly ACCRUE_FEES: 5;
|
|
1656
|
-
};
|
|
1657
|
-
type ActionTypeValue = (typeof ActionType)[keyof typeof ActionType];
|
|
1658
|
-
/**
|
|
1659
|
-
* Data needed to execute a pending LZ compose on the hub chain.
|
|
1660
|
-
* Returned by `depositFromSpoke` when the OFT is a Stargate V2 pool,
|
|
1661
|
-
* because Stargate cannot forward ETH to the compose executor.
|
|
1662
|
-
* The SDK user must call `executeCompose()` with this data as a second TX on the hub.
|
|
1663
|
-
*/
|
|
1664
|
-
interface ComposeData {
|
|
1665
|
-
/** LZ Endpoint address on the hub chain */
|
|
1666
|
-
endpoint: Address;
|
|
1667
|
-
/** The OFT/pool address that sent the compose (Stargate pool on hub) */
|
|
1668
|
-
from: Address;
|
|
1669
|
-
/** MoreVaultsComposer address on the hub */
|
|
1670
|
-
to: Address;
|
|
1671
|
-
/** LayerZero GUID from the original OFT.send() */
|
|
1672
|
-
guid: `0x${string}`;
|
|
1673
|
-
/** Compose index (always 0 for single-compose messages) */
|
|
1674
|
-
index: number;
|
|
1675
|
-
/** The full compose message bytes (reconstructed from composeMsg + OFT header) */
|
|
1676
|
-
message: `0x${string}`;
|
|
1677
|
-
/** Whether this is a Stargate OFT that requires a 2-TX flow */
|
|
1678
|
-
isStargate: boolean;
|
|
1679
|
-
/** Hub chain ID for creating the hub wallet/public client */
|
|
1680
|
-
hubChainId: number;
|
|
1681
|
-
/** Hub block number just before TX1 was sent — used as search start for ComposeSent events */
|
|
1682
|
-
hubBlockStart: bigint;
|
|
1683
|
-
}
|
|
1684
|
-
/**
|
|
1685
|
-
* Result from `depositFromSpoke`.
|
|
1686
|
-
* When `composeData` is present, the user must call `executeCompose()` on the hub chain.
|
|
1687
|
-
*/
|
|
1688
|
-
interface SpokeDepositResult {
|
|
1689
|
-
txHash: Hash;
|
|
1690
|
-
guid: `0x${string}`;
|
|
1691
|
-
/** Present when OFT is Stargate V2 — user must execute compose on hub as TX2 */
|
|
1692
|
-
composeData?: ComposeData;
|
|
1693
|
-
}
|
|
1694
|
-
interface CrossChainRequestInfo {
|
|
1695
|
-
initiator: Address;
|
|
1696
|
-
timestamp: bigint;
|
|
1697
|
-
actionType: number;
|
|
1698
|
-
actionCallData: `0x${string}`;
|
|
1699
|
-
fulfilled: boolean;
|
|
1700
|
-
finalized: boolean;
|
|
1701
|
-
refunded: boolean;
|
|
1702
|
-
totalAssets: bigint;
|
|
1703
|
-
finalizationResult: bigint;
|
|
1704
|
-
amountLimit: bigint;
|
|
1705
|
-
}
|
|
1706
|
-
interface SwapParams {
|
|
1707
|
-
targetContract: Address;
|
|
1708
|
-
tokenIn: Address;
|
|
1709
|
-
tokenOut: Address;
|
|
1710
|
-
maxAmountIn: bigint;
|
|
1711
|
-
minAmountOut: bigint;
|
|
1712
|
-
swapCallData: `0x${string}`;
|
|
1713
|
-
}
|
|
1714
|
-
interface BatchSwapParams {
|
|
1715
|
-
swaps: SwapParams[];
|
|
1716
|
-
}
|
|
1717
|
-
interface BridgeParams {
|
|
1718
|
-
oftToken: Address;
|
|
1719
|
-
dstEid: number;
|
|
1720
|
-
amount: bigint;
|
|
1721
|
-
dstVault: Address;
|
|
1722
|
-
refundAddress: Address;
|
|
1723
|
-
}
|
|
1724
|
-
interface PendingAction {
|
|
1725
|
-
nonce: bigint;
|
|
1726
|
-
actionsData: `0x${string}`[];
|
|
1727
|
-
pendingUntil: bigint;
|
|
1728
|
-
isExecutable: boolean;
|
|
1729
|
-
}
|
|
1730
|
-
interface SubmitActionsResult {
|
|
1731
|
-
txHash: `0x${string}`;
|
|
1732
|
-
nonce: bigint;
|
|
1733
|
-
}
|
|
1734
|
-
type CuratorAction = {
|
|
1735
|
-
type: 'swap';
|
|
1736
|
-
params: SwapParams;
|
|
1737
|
-
} | {
|
|
1738
|
-
type: 'batchSwap';
|
|
1739
|
-
params: BatchSwapParams;
|
|
1740
|
-
} | {
|
|
1741
|
-
type: 'erc4626Deposit';
|
|
1742
|
-
vault: Address;
|
|
1743
|
-
assets: bigint;
|
|
1744
|
-
} | {
|
|
1745
|
-
type: 'erc4626Redeem';
|
|
1746
|
-
vault: Address;
|
|
1747
|
-
shares: bigint;
|
|
1748
|
-
} | {
|
|
1749
|
-
type: 'erc7540RequestDeposit';
|
|
1750
|
-
vault: Address;
|
|
1751
|
-
assets: bigint;
|
|
1752
|
-
} | {
|
|
1753
|
-
type: 'erc7540Deposit';
|
|
1754
|
-
vault: Address;
|
|
1755
|
-
assets: bigint;
|
|
1756
|
-
} | {
|
|
1757
|
-
type: 'erc7540RequestRedeem';
|
|
1758
|
-
vault: Address;
|
|
1759
|
-
shares: bigint;
|
|
1760
|
-
} | {
|
|
1761
|
-
type: 'erc7540Redeem';
|
|
1762
|
-
vault: Address;
|
|
1763
|
-
shares: bigint;
|
|
1764
|
-
};
|
|
1765
|
-
interface CuratorVaultStatus {
|
|
1766
|
-
curator: Address;
|
|
1767
|
-
timeLockPeriod: bigint;
|
|
1768
|
-
maxSlippagePercent: bigint;
|
|
1769
|
-
currentNonce: bigint;
|
|
1770
|
-
availableAssets: Address[];
|
|
1771
|
-
lzAdapter: Address;
|
|
1772
|
-
paused: boolean;
|
|
1773
|
-
}
|
|
1774
|
-
interface AssetInfo {
|
|
1775
|
-
address: Address;
|
|
1776
|
-
symbol: string;
|
|
1777
|
-
name: string;
|
|
1778
|
-
decimals: number;
|
|
1779
|
-
}
|
|
1780
|
-
interface VaultAnalysis {
|
|
1781
|
-
/** All tokens the vault can hold/swap (curator-managed) */
|
|
1782
|
-
availableAssets: AssetInfo[];
|
|
1783
|
-
/** Tokens users can deposit */
|
|
1784
|
-
depositableAssets: AssetInfo[];
|
|
1785
|
-
/** Whether deposit whitelist is enabled (restricts who can deposit) */
|
|
1786
|
-
depositWhitelistEnabled: boolean;
|
|
1787
|
-
/** Registry address for global protocol whitelist checks */
|
|
1788
|
-
registryAddress: Address | null;
|
|
1789
|
-
}
|
|
1790
|
-
interface AssetBalance extends AssetInfo {
|
|
1791
|
-
/** Raw balance held by the vault */
|
|
1792
|
-
balance: bigint;
|
|
1793
|
-
}
|
|
1794
|
-
interface VaultAssetBreakdown {
|
|
1795
|
-
/** Per-asset balances held by the vault on the hub chain */
|
|
1796
|
-
assets: AssetBalance[];
|
|
1797
|
-
/** totalAssets() as reported by the vault (all positions converted to underlying) */
|
|
1798
|
-
totalAssets: bigint;
|
|
1799
|
-
/** totalSupply() of vault shares */
|
|
1800
|
-
totalSupply: bigint;
|
|
1801
|
-
/** Vault underlying token decimals */
|
|
1802
|
-
underlyingDecimals: number;
|
|
1803
|
-
}
|
|
1804
|
-
|
|
1805
1617
|
/**
|
|
1806
1618
|
* Typed error classes for the MoreVaults SDK.
|
|
1807
1619
|
*
|
|
@@ -2705,4 +2517,4 @@ declare function buildUniswapV3Swap(params: {
|
|
|
2705
2517
|
*/
|
|
2706
2518
|
declare function asSdkClient(client: unknown): PublicClient;
|
|
2707
2519
|
|
|
2708
|
-
export {
|
|
2520
|
+
export { AsyncRequestResult, BRIDGE_ABI, BRIDGE_FACET_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CURATOR_CONFIG_ABI, CapacityFullError, ComposeData, CuratorAction, CuratorVaultStatus, DEX_ABI, DepositResult, EID_TO_CHAIN_ID, ERC20_ABI, ERC4626_FACET_ABI, ERC7540_FACET_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_ADAPTER_ABI, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MULTICALL_ABI, MissingEscrowAddressError, MoreVaultsError, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, PendingAction, REGISTRY_ABI, RedeemResult, STARGATE_TAXI_CMD, SpokeDepositResult, type SpokeRedeemRoute, SubmitActionsResult, UNISWAP_V3_ROUTERS, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, VAULT_ANALYSIS_ABI, VaultAddresses, VaultAnalysis, VaultAssetBreakdown, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, buildCuratorBatch, buildUniswapV3Swap, checkProtocolWhitelist, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, encodeCuratorAction, encodeUniswapV3SwapCalldata, executeActions, executeCompose, getCuratorVaultStatus, getPendingActions, getVaultAnalysis, getVaultAssetBreakdown, getWithdrawalRequest, isCurator, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, quoteComposeFee, quoteDepositFromSpokeFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, submitActions, vetoActions, waitForCompose, withdrawAssets };
|
package/package.json
CHANGED
package/src/ethers/abis.ts
CHANGED
|
@@ -85,3 +85,95 @@ export const LZ_ENDPOINT_ABI = [
|
|
|
85
85
|
"function composeQueue(address from, address to, bytes32 guid, uint16 index) view returns (bytes32 messageHash)",
|
|
86
86
|
"function lzCompose(address _from, address _to, bytes32 _guid, uint16 _index, bytes _message, bytes _extraData) payable",
|
|
87
87
|
] as const;
|
|
88
|
+
|
|
89
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
90
|
+
// Curator Operations ABIs
|
|
91
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* MulticallFacet ABI — curator action submission and execution with timelock.
|
|
95
|
+
*/
|
|
96
|
+
export const MULTICALL_ABI = [
|
|
97
|
+
"function submitActions(bytes[] actionsData) returns (uint256 nonce)",
|
|
98
|
+
"function executeActions(uint256 actionsNonce)",
|
|
99
|
+
"function getPendingActions(uint256 actionsNonce) view returns (bytes[] actionsData, uint256 pendingUntil)",
|
|
100
|
+
"function getCurrentNonce() view returns (uint256)",
|
|
101
|
+
"function vetoActions(uint256[] actionsNonces)",
|
|
102
|
+
] as const;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* GenericDexFacet ABI — single and batch token swaps through any DEX aggregator.
|
|
106
|
+
*/
|
|
107
|
+
export const DEX_ABI = [
|
|
108
|
+
"function executeSwap(tuple(address targetContract, address tokenIn, address tokenOut, uint256 maxAmountIn, uint256 minAmountOut, bytes swapCallData) params) returns (uint256 amountOut)",
|
|
109
|
+
"function executeBatchSwap(tuple(tuple(address targetContract, address tokenIn, address tokenOut, uint256 maxAmountIn, uint256 minAmountOut, bytes swapCallData)[] swaps) params) returns (uint256[] amountsOut)",
|
|
110
|
+
] as const;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* BridgeFacet ABI — curator bridging and cross-chain request initiation.
|
|
114
|
+
*/
|
|
115
|
+
export const BRIDGE_FACET_ABI = [
|
|
116
|
+
"function executeBridging(address adapter, address token, uint256 amount, bytes bridgeSpecificParams) payable",
|
|
117
|
+
"function initVaultActionRequest(uint8 actionType, bytes actionCallData, uint256 amountLimit, bytes extraOptions) payable returns (bytes32 guid)",
|
|
118
|
+
"function executeRequest(bytes32 guid)",
|
|
119
|
+
] as const;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* ERC7540Facet ABI — async deposit and redeem operations on ERC7540 vaults.
|
|
123
|
+
*/
|
|
124
|
+
export const ERC7540_FACET_ABI = [
|
|
125
|
+
"function erc7540RequestDeposit(address vault, uint256 assets) returns (uint256 requestId)",
|
|
126
|
+
"function erc7540RequestRedeem(address vault, uint256 shares) returns (uint256 requestId)",
|
|
127
|
+
"function erc7540Deposit(address vault, uint256 assets) returns (uint256 shares)",
|
|
128
|
+
"function erc7540Redeem(address vault, uint256 shares) returns (uint256 assets)",
|
|
129
|
+
] as const;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* ERC4626Facet ABI — synchronous deposit and redeem into whitelisted ERC-4626 vaults.
|
|
133
|
+
*/
|
|
134
|
+
export const ERC4626_FACET_ABI = [
|
|
135
|
+
"function erc4626Deposit(address vault, uint256 assets) returns (uint256 shares)",
|
|
136
|
+
"function erc4626Redeem(address vault, uint256 shares) returns (uint256 assets)",
|
|
137
|
+
] as const;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* ConfigurationFacet ABI — extended with curator-relevant read functions.
|
|
141
|
+
*/
|
|
142
|
+
export const CURATOR_CONFIG_ABI = [
|
|
143
|
+
"function curator() view returns (address)",
|
|
144
|
+
"function timeLockPeriod() view returns (uint256)",
|
|
145
|
+
"function getAvailableAssets() view returns (address[])",
|
|
146
|
+
"function getMaxSlippagePercent() view returns (uint256)",
|
|
147
|
+
"function getCrossChainAccountingManager() view returns (address)",
|
|
148
|
+
"function paused() view returns (bool)",
|
|
149
|
+
] as const;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* LzAdapter ABI — fee quoting for bridge and LZ Read operations.
|
|
153
|
+
*/
|
|
154
|
+
export const LZ_ADAPTER_ABI = [
|
|
155
|
+
"function quoteBridgeFee(bytes bridgeSpecificParams) view returns (uint256 nativeFee)",
|
|
156
|
+
"function quoteReadFee(address[] vaults, uint32[] eids, bytes _extraOptions) view returns (tuple(uint256 nativeFee, uint256 lzTokenFee) fee)",
|
|
157
|
+
] as const;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Vault analysis ABIs — per-vault whitelist and registry reads.
|
|
161
|
+
*/
|
|
162
|
+
export const VAULT_ANALYSIS_ABI = [
|
|
163
|
+
"function getAvailableAssets() view returns (address[])",
|
|
164
|
+
"function getDepositableAssets() view returns (address[])",
|
|
165
|
+
"function isAssetAvailable(address asset) view returns (bool)",
|
|
166
|
+
"function isAssetDepositable(address asset) view returns (bool)",
|
|
167
|
+
"function isDepositWhitelistEnabled() view returns (bool)",
|
|
168
|
+
"function getAvailableToDeposit(address depositor) view returns (uint256)",
|
|
169
|
+
"function moreVaultsRegistry() view returns (address)",
|
|
170
|
+
] as const;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* MoreVaultsRegistry ABI — global protocol and bridge whitelist checks.
|
|
174
|
+
*/
|
|
175
|
+
export const REGISTRY_ABI = [
|
|
176
|
+
"function isWhitelisted(address protocol) view returns (bool)",
|
|
177
|
+
"function isBridgeAllowed(address bridge) view returns (bool)",
|
|
178
|
+
"function getAllowedFacets() view returns (address[])",
|
|
179
|
+
] as const;
|
package/src/ethers/chains.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { JsonRpcProvider } from "ethers";
|
|
2
|
+
import type { Provider } from "ethers";
|
|
3
|
+
|
|
1
4
|
/** EVM Chain IDs for chains supported by MoreVaults */
|
|
2
5
|
export const CHAIN_IDS = {
|
|
3
6
|
flowEVMMainnet: 747,
|
|
@@ -5,6 +8,9 @@ export const CHAIN_IDS = {
|
|
|
5
8
|
arbitrum: 42161,
|
|
6
9
|
base: 8453,
|
|
7
10
|
ethereum: 1,
|
|
11
|
+
optimism: 10,
|
|
12
|
+
sonic: 146,
|
|
13
|
+
bsc: 56,
|
|
8
14
|
} as const;
|
|
9
15
|
|
|
10
16
|
/**
|
|
@@ -18,6 +24,9 @@ export const LZ_EIDS = {
|
|
|
18
24
|
arbitrum: 30110,
|
|
19
25
|
base: 30184,
|
|
20
26
|
ethereum: 30101,
|
|
27
|
+
optimism: 30111,
|
|
28
|
+
sonic: 30332,
|
|
29
|
+
bsc: 30102,
|
|
21
30
|
} as const;
|
|
22
31
|
|
|
23
32
|
/** LayerZero EID → EVM Chain ID */
|
|
@@ -27,6 +36,9 @@ export const EID_TO_CHAIN_ID: Record<number, number> = {
|
|
|
27
36
|
[LZ_EIDS.arbitrum]: CHAIN_IDS.arbitrum,
|
|
28
37
|
[LZ_EIDS.base]: CHAIN_IDS.base,
|
|
29
38
|
[LZ_EIDS.ethereum]: CHAIN_IDS.ethereum,
|
|
39
|
+
[LZ_EIDS.optimism]: CHAIN_IDS.optimism,
|
|
40
|
+
[LZ_EIDS.sonic]: CHAIN_IDS.sonic,
|
|
41
|
+
[LZ_EIDS.bsc]: CHAIN_IDS.bsc,
|
|
30
42
|
};
|
|
31
43
|
|
|
32
44
|
/** EVM Chain ID → LayerZero EID */
|
|
@@ -36,8 +48,187 @@ export const CHAIN_ID_TO_EID: Record<number, number> = {
|
|
|
36
48
|
[CHAIN_IDS.arbitrum]: LZ_EIDS.arbitrum,
|
|
37
49
|
[CHAIN_IDS.base]: LZ_EIDS.base,
|
|
38
50
|
[CHAIN_IDS.ethereum]: LZ_EIDS.ethereum,
|
|
51
|
+
[CHAIN_IDS.optimism]: LZ_EIDS.optimism,
|
|
52
|
+
[CHAIN_IDS.sonic]: LZ_EIDS.sonic,
|
|
53
|
+
[CHAIN_IDS.bsc]: LZ_EIDS.bsc,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* LayerZero v2 OFT route config per asset symbol.
|
|
58
|
+
*
|
|
59
|
+
* Each entry maps chainId → { oft, token } where:
|
|
60
|
+
* - `oft` = OFT contract to call send() on (pass as `spokeOFT` to depositFromSpoke)
|
|
61
|
+
* - `token` = underlying ERC-20 the user approves before bridging
|
|
62
|
+
* (zero address = native ETH, no approval needed)
|
|
63
|
+
*
|
|
64
|
+
* All routes verified on-chain via quoteSend() or peers(). Issuers vary per asset.
|
|
65
|
+
*/
|
|
66
|
+
export const OFT_ROUTES = {
|
|
67
|
+
/**
|
|
68
|
+
* stgUSDC — USDC bridged via Stargate v2.
|
|
69
|
+
* Underlying on Eth/Arb/Base/Op: native USDC. On Flow: stgUSDC (Stargate's wrapped USDC).
|
|
70
|
+
*/
|
|
71
|
+
stgUSDC: {
|
|
72
|
+
[747 /* flowEVMMainnet */]: { oft: '0xAF54BE5B6eEc24d6BFACf1cce4eaF680A8239398', token: '0xF1815bd50389c46847f0Bda824eC8da914045D14' },
|
|
73
|
+
[1 /* ethereum */]: { oft: '0xc026395860Db2d07ee33e05fE50ed7bD583189C7', token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' },
|
|
74
|
+
[42161 /* arbitrum */]: { oft: '0xe8CDF27AcD73a434D661C84887215F7598e7d0d3', token: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' },
|
|
75
|
+
[8453 /* base */]: { oft: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26', token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' },
|
|
76
|
+
[10 /* optimism */]: { oft: '0xcE8CcA271Ebc0533920C83d39F417ED6A0abB7D0', token: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85' },
|
|
77
|
+
[146 /* sonic */]: { oft: '0xA272fFe20cFfe769CdFc4b63088DCD2C82a2D8F9', token: '0x29219dd400f2Bf60E5a23d13Be72B486D4038894' },
|
|
78
|
+
},
|
|
79
|
+
/**
|
|
80
|
+
* USDT — USDT bridged via Stargate v2.
|
|
81
|
+
*/
|
|
82
|
+
USDT: {
|
|
83
|
+
[747 /* flowEVMMainnet */]: { oft: '0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6', token: '0x674843C06FF83502ddb4D37c2E09C01cdA38cbc8' },
|
|
84
|
+
[1 /* ethereum */]: { oft: '0x933597a323Eb81cAe705C5bC29985172fd5A3973', token: '0xdAC17F958D2ee523a2206206994597C13D831ec7' },
|
|
85
|
+
[42161 /* arbitrum */]: { oft: '0xcE8CcA271Ebc0533920C83d39F417ED6A0abB7D0', token: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9' },
|
|
86
|
+
[10 /* optimism */]: { oft: '0x19cFCE47eD54a88614648DC3f19A5980097007dD', token: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58' },
|
|
87
|
+
},
|
|
88
|
+
/**
|
|
89
|
+
* USDF — USD Flow OFT. Bridges PYUSD (Ethereum) ↔ USDF (Flow EVM).
|
|
90
|
+
*/
|
|
91
|
+
USDF: {
|
|
92
|
+
[747 /* flowEVMMainnet */]: { oft: '0x2aabea2058b5ac2d339b163c6ab6f2b6d53aabed', token: '0x2aabea2058b5ac2d339b163c6ab6f2b6d53aabed' },
|
|
93
|
+
[1 /* ethereum */]: { oft: '0xfa0e06b54986ad96de87a8c56fea76fbd8d493f8', token: '0x6c3ea9036406852006290770BEdFcAbA0e23A0e8' },
|
|
94
|
+
},
|
|
95
|
+
/**
|
|
96
|
+
* PYUSD — PayPal USD bridged via OFTAdapter (Paxos / LayerZero).
|
|
97
|
+
*/
|
|
98
|
+
PYUSD: {
|
|
99
|
+
[747 /* flowEVMMainnet */]: { oft: '0x26d27d5AF2F6f1c14F40013C8619d97aaf015509', token: '0x99aF3EeA856556646C98c8B9b2548Fe815240750' },
|
|
100
|
+
[42161 /* arbitrum */]: { oft: '0x3CD2b89C49D130C08f1d683225b2e5DeB63ff876', token: '0x46850aD61C2B7d64d08c9C754F45254596696984' },
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* WFLOW — Wrapped FLOW NativeOFTAdapter (issued by Flow Foundation).
|
|
104
|
+
*/
|
|
105
|
+
WFLOW: {
|
|
106
|
+
[747 /* flowEVMMainnet */]: { oft: '0xd296588850bee2770136464ffdddd78c32f2a07c', token: '0xd296588850bee2770136464ffdddd78c32f2a07c' },
|
|
107
|
+
[1 /* ethereum */]: { oft: '0xc1b45896b5fc9422a8f779653808297bb4f546f9', token: '0x5c147e74D63B1D31AA3Fd78Eb229B65161983B2b' },
|
|
108
|
+
},
|
|
109
|
+
/**
|
|
110
|
+
* WETH — ETH OFT via Stargate v2. underlying = native ETH (no approval needed).
|
|
111
|
+
*/
|
|
112
|
+
WETH: {
|
|
113
|
+
[747 /* flowEVMMainnet */]: { oft: '0x45f1A95A4D3f3836523F5c83673c797f4d4d263B', token: '0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590' },
|
|
114
|
+
[1 /* ethereum */]: { oft: '0x77b2043768d28E9C9aB44E1aBfC95944bcE57931', token: '0x0000000000000000000000000000000000000000' },
|
|
115
|
+
[42161 /* arbitrum */]: { oft: '0xA45B5130f36CDcA45667738e2a258AB09f4A5f7F', token: '0x0000000000000000000000000000000000000000' },
|
|
116
|
+
[8453 /* base */]: { oft: '0xdc181Bd607330aeeBEF6ea62e03e5e1Fb4B6F7C7', token: '0x0000000000000000000000000000000000000000' },
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* sUSDe — Ethena staked USDe (yield-bearing stablecoin).
|
|
120
|
+
*/
|
|
121
|
+
sUSDe: {
|
|
122
|
+
[1 /* ethereum */]: { oft: '0x211cc4dd073734da055fbf44a2b4667d5e5fe5d2', token: '0x9D39A5DE30e57443BfF2A8307A4256c8797A3497' },
|
|
123
|
+
[42161 /* arbitrum */]: { oft: '0x211cc4dd073734da055fbf44a2b4667d5e5fe5d2', token: '0x211cc4dd073734da055fbf44a2b4667d5e5fe5d2' },
|
|
124
|
+
[8453 /* base */]: { oft: '0x211cc4dd073734da055fbf44a2b4667d5e5fe5d2', token: '0x211cc4dd073734da055fbf44a2b4667d5e5fe5d2' },
|
|
125
|
+
[10 /* optimism */]: { oft: '0x211cc4dd073734da055fbf44a2b4667d5e5fe5d2', token: '0x211cc4dd073734da055fbf44a2b4667d5e5fe5d2' },
|
|
126
|
+
[56 /* bsc */]: { oft: '0x211cc4dd073734da055fbf44a2b4667d5e5fe5d2', token: '0x211cc4dd073734da055fbf44a2b4667d5e5fe5d2' },
|
|
127
|
+
},
|
|
128
|
+
/**
|
|
129
|
+
* USDe — Ethena USD stablecoin.
|
|
130
|
+
*/
|
|
131
|
+
USDe: {
|
|
132
|
+
[1 /* ethereum */]: { oft: '0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34', token: '0x4c9EDD5852cd905f086C759E8383e09bff1E68B3' },
|
|
133
|
+
[42161 /* arbitrum */]: { oft: '0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34', token: '0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34' },
|
|
134
|
+
[8453 /* base */]: { oft: '0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34', token: '0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34' },
|
|
135
|
+
[10 /* optimism */]: { oft: '0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34', token: '0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34' },
|
|
136
|
+
[56 /* bsc */]: { oft: '0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34', token: '0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34' },
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* weETH — Ether.Fi liquid restaking token.
|
|
140
|
+
*/
|
|
141
|
+
weETH: {
|
|
142
|
+
[1 /* ethereum */]: { oft: '0xcd2eb13d6831d4602d80e5db9230a57596cdca63', token: '0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee' },
|
|
143
|
+
[8453 /* base */]: { oft: '0x04c0599ae5a44757c0af6f9ec3b93da8976c150a', token: '0x04c0599ae5a44757c0af6f9ec3b93da8976c150a' },
|
|
144
|
+
[10 /* optimism */]: { oft: '0x5a7facb970d094b6c7ff1df0ea68d99e6e73cbff', token: '0x5a7facb970d094b6c7ff1df0ea68d99e6e73cbff' },
|
|
145
|
+
[56 /* bsc */]: { oft: '0x04c0599ae5a44757c0af6f9ec3b93da8976c150a', token: '0x04c0599ae5a44757c0af6f9ec3b93da8976c150a' },
|
|
146
|
+
[146 /* sonic */]: { oft: '0xa3d68b74bf0528fdd07263c60d6488749044914b', token: '0xa3d68b74bf0528fdd07263c60d6488749044914b' },
|
|
147
|
+
},
|
|
148
|
+
/**
|
|
149
|
+
* rsETH — Kelp DAO liquid restaking token.
|
|
150
|
+
*/
|
|
151
|
+
rsETH: {
|
|
152
|
+
[1 /* ethereum */]: { oft: '0x85d456b2dff1fd8245387c0bfb64dfb700e98ef3', token: '0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7' },
|
|
153
|
+
[42161 /* arbitrum */]: { oft: '0x4186bfc76e2e237523cbc30fd220fe055156b41f', token: '0x4186bfc76e2e237523cbc30fd220fe055156b41f' },
|
|
154
|
+
[8453 /* base */]: { oft: '0x1bc71130a0e39942a7658878169764bbd8a45993', token: '0x1bc71130a0e39942a7658878169764bbd8a45993' },
|
|
155
|
+
[10 /* optimism */]: { oft: '0x4186bfc76e2e237523cbc30fd220fe055156b41f', token: '0x4186bfc76e2e237523cbc30fd220fe055156b41f' },
|
|
156
|
+
[146 /* sonic */]: { oft: '0xd75787ba9aba324420d522bda84c08c87e5099b1', token: '0xd75787ba9aba324420d522bda84c08c87e5099b1' },
|
|
157
|
+
},
|
|
158
|
+
/**
|
|
159
|
+
* rswETH — Swell Network liquid restaking token.
|
|
160
|
+
*/
|
|
161
|
+
rswETH: {
|
|
162
|
+
[1 /* ethereum */]: { oft: '0x1486d39646cdee84619bd05997319545a8575079', token: '0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0' },
|
|
163
|
+
[42161 /* arbitrum */]: { oft: '0xb1fe27b32ffb5ce54e272c096547f1e86c19e72f', token: '0xb1fe27b32ffb5ce54e272c096547f1e86c19e72f' },
|
|
164
|
+
[8453 /* base */]: { oft: '0x850cdf416668210ed0c36bfff5d21921c7ada3b8', token: '0x850cdf416668210ed0c36bfff5d21921c7ada3b8' },
|
|
165
|
+
},
|
|
166
|
+
/**
|
|
167
|
+
* USR — Resolv Labs USD stablecoin.
|
|
168
|
+
*/
|
|
169
|
+
USR: {
|
|
170
|
+
[1 /* ethereum */]: { oft: '0xd2ee2776f34ef4e7325745b06e6d464b08d4be0e', token: '0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110' },
|
|
171
|
+
[42161 /* arbitrum */]: { oft: '0x2492d0006411af6c8bbb1c8afc1b0197350a79e9', token: '0x2492d0006411af6c8bbb1c8afc1b0197350a79e9' },
|
|
172
|
+
[8453 /* base */]: { oft: '0x35e5db674d8e93a03d814fa0ada70731efe8a4b9', token: '0x35e5db674d8e93a03d814fa0ada70731efe8a4b9' },
|
|
173
|
+
[56 /* bsc */]: { oft: '0x2492d0006411af6c8bbb1c8afc1b0197350a79e9', token: '0x2492d0006411af6c8bbb1c8afc1b0197350a79e9' },
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* wstUSR — Resolv Labs wrapped staked USR (yield-bearing).
|
|
177
|
+
*/
|
|
178
|
+
wstUSR: {
|
|
179
|
+
[1 /* ethereum */]: { oft: '0xab17c1fe647c37ceb9b96d1c27dd189bf8451978', token: '0x1202F5C7b4B9E47a1A484E8B270be34dbbC75055' },
|
|
180
|
+
[42161 /* arbitrum */]: { oft: '0x66cfbd79257dc5217903a36293120282548e2254', token: '0x66cfbd79257dc5217903a36293120282548e2254' },
|
|
181
|
+
[8453 /* base */]: { oft: '0xb67675158b412d53fe6b68946483ba920b135ba1', token: '0xb67675158b412d53fe6b68946483ba920b135ba1' },
|
|
182
|
+
[56 /* bsc */]: { oft: '0x4254813524695def4163a169e901f3d7a1a55429', token: '0x4254813524695def4163a169e901f3d7a1a55429' },
|
|
183
|
+
},
|
|
184
|
+
/**
|
|
185
|
+
* USDtb — Ethena treasury-backed stablecoin.
|
|
186
|
+
*/
|
|
187
|
+
USDtb: {
|
|
188
|
+
[1 /* ethereum */]: { oft: '0xc708b6887db46005da033501f8aebee72d191a5d', token: '0xC139190F447e929f090Edeb554D95AbB8b18aC1C' },
|
|
189
|
+
[42161 /* arbitrum */]: { oft: '0xc708b6887db46005da033501f8aebee72d191a5d', token: '0xc708b6887db46005da033501f8aebee72d191a5d' },
|
|
190
|
+
[8453 /* base */]: { oft: '0xc708b6887db46005da033501f8aebee72d191a5d', token: '0xc708b6887db46005da033501f8aebee72d191a5d' },
|
|
191
|
+
},
|
|
192
|
+
} as const;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Uniswap V3 SwapRouter addresses per chain.
|
|
196
|
+
* Used by curator swap helpers to build calldata for on-chain swaps.
|
|
197
|
+
*
|
|
198
|
+
* Note on struct differences:
|
|
199
|
+
* - SwapRouter (Eth/Arb/Op, 0xE592...): exactInputSingle struct includes `deadline`
|
|
200
|
+
* - SwapRouter02 (Base, 0x2626...): exactInputSingle struct does NOT include `deadline`
|
|
201
|
+
* - FlowSwap V3 (Flow EVM, 0xeEDC...): derived from original UniV3, includes `deadline`
|
|
202
|
+
*/
|
|
203
|
+
export const UNISWAP_V3_ROUTERS: Record<number, string> = {
|
|
204
|
+
[8453]: '0x2626664c2603336E57B271c5C0b26F421741e481', // Base — SwapRouter02 (no deadline)
|
|
205
|
+
[1]: '0xE592427A0AEce92De3Edee1F18E0157C05861564', // Ethereum — SwapRouter
|
|
206
|
+
[42161]: '0xE592427A0AEce92De3Edee1F18E0157C05861564', // Arbitrum — SwapRouter
|
|
207
|
+
[10]: '0xE592427A0AEce92De3Edee1F18E0157C05861564', // Optimism — SwapRouter
|
|
208
|
+
[747]: '0xeEDC6Ff75e1b10B903D9013c358e446a73d35341', // Flow EVM — FlowSwap V3 SwapRouter
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/** Public RPC endpoints per chain for cross-chain reads */
|
|
212
|
+
const PUBLIC_RPCS: Record<number, string[]> = {
|
|
213
|
+
1: ['https://ethereum-rpc.publicnode.com', 'https://eth.drpc.org', 'https://eth.llamarpc.com'],
|
|
214
|
+
10: ['https://mainnet.optimism.io', 'https://optimism-rpc.publicnode.com'],
|
|
215
|
+
42161: ['https://arbitrum-one-rpc.publicnode.com', 'https://arbitrum.publicnode.com'],
|
|
216
|
+
8453: ['https://base-rpc.publicnode.com', 'https://base.llamarpc.com', 'https://mainnet.base.org'],
|
|
217
|
+
747: ['https://mainnet.evm.nodes.onflow.org'],
|
|
218
|
+
146: ['https://rpc.soniclabs.com'],
|
|
219
|
+
56: ['https://bsc-dataseed1.binance.org', 'https://bsc-dataseed2.binance.org'],
|
|
39
220
|
};
|
|
40
221
|
|
|
222
|
+
/**
|
|
223
|
+
* Create a read-only ethers Provider for a given chain ID using public RPCs.
|
|
224
|
+
* Returns null if no public RPC is configured for that chain.
|
|
225
|
+
*/
|
|
226
|
+
export function createChainProvider(chainId: number): Provider | null {
|
|
227
|
+
const rpcs = PUBLIC_RPCS[chainId];
|
|
228
|
+
if (!rpcs?.length) return null;
|
|
229
|
+
return new JsonRpcProvider(rpcs[0], chainId, { staticNetwork: true });
|
|
230
|
+
}
|
|
231
|
+
|
|
41
232
|
/**
|
|
42
233
|
* Recommended timeouts for cross-chain operations (milliseconds).
|
|
43
234
|
* UIs should show a progress indicator and NOT timeout before these values.
|