@oydual31/more-vaults-sdk 0.3.0 → 0.3.2
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/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/{spokeRoutes-FgKCJQYa.d.cts → spokeRoutes-DK7cIW4z.d.cts} +4 -0
- package/dist/{spokeRoutes-FgKCJQYa.d.ts → spokeRoutes-DK7cIW4z.d.ts} +4 -0
- package/dist/viem/index.cjs +450 -5
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +396 -3
- package/dist/viem/index.d.ts +396 -3
- package/dist/viem/index.js +438 -7
- package/dist/viem/index.js.map +1 -1
- package/package.json +1 -1
- package/src/viem/abis.ts +51 -0
- package/src/viem/chains.ts +17 -0
- package/src/viem/curatorMulticall.ts +299 -0
- package/src/viem/curatorStatus.ts +197 -2
- package/src/viem/curatorSwaps.ts +239 -0
- package/src/viem/index.ts +22 -1
- package/src/viem/types.ts +38 -0
- package/src/viem/userHelpers.ts +22 -6
package/dist/viem/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAddress, zeroAddress, pad, encodeAbiParameters, createPublicClient, http, fallback } from 'viem';
|
|
1
|
+
import { getAddress, zeroAddress, pad, encodeAbiParameters, encodeFunctionData, createPublicClient, http, fallback } from 'viem';
|
|
2
2
|
|
|
3
3
|
// src/viem/chains.ts
|
|
4
4
|
var CHAIN_IDS = {
|
|
@@ -385,6 +385,18 @@ var LZ_TIMEOUTS = {
|
|
|
385
385
|
FULL_SPOKE_REDEEM: 36e5
|
|
386
386
|
// 60 min
|
|
387
387
|
};
|
|
388
|
+
var UNISWAP_V3_ROUTERS = {
|
|
389
|
+
[8453]: "0x2626664c2603336E57B271c5C0b26F421741e481",
|
|
390
|
+
// Base — SwapRouter02 (no deadline)
|
|
391
|
+
[1]: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
|
|
392
|
+
// Ethereum — SwapRouter
|
|
393
|
+
[42161]: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
|
|
394
|
+
// Arbitrum — SwapRouter
|
|
395
|
+
[10]: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
|
|
396
|
+
// Optimism — SwapRouter
|
|
397
|
+
[747]: "0xeEDC6Ff75e1b10B903D9013c358e446a73d35341"
|
|
398
|
+
// Flow EVM — FlowSwap V3 SwapRouter
|
|
399
|
+
};
|
|
388
400
|
var USDC_STARGATE_OFT = Object.fromEntries(
|
|
389
401
|
Object.entries(OFT_ROUTES.stgUSDC).map(([k, v]) => [k, v.oft])
|
|
390
402
|
);
|
|
@@ -1075,6 +1087,45 @@ var LZ_ADAPTER_ABI = [
|
|
|
1075
1087
|
stateMutability: "view"
|
|
1076
1088
|
}
|
|
1077
1089
|
];
|
|
1090
|
+
var ERC4626_FACET_ABI = [
|
|
1091
|
+
{
|
|
1092
|
+
type: "function",
|
|
1093
|
+
name: "erc4626Deposit",
|
|
1094
|
+
inputs: [
|
|
1095
|
+
{ name: "vault", type: "address" },
|
|
1096
|
+
{ name: "assets", type: "uint256" }
|
|
1097
|
+
],
|
|
1098
|
+
outputs: [{ name: "shares", type: "uint256" }],
|
|
1099
|
+
stateMutability: "nonpayable"
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
type: "function",
|
|
1103
|
+
name: "erc4626Redeem",
|
|
1104
|
+
inputs: [
|
|
1105
|
+
{ name: "vault", type: "address" },
|
|
1106
|
+
{ name: "shares", type: "uint256" }
|
|
1107
|
+
],
|
|
1108
|
+
outputs: [{ name: "assets", type: "uint256" }],
|
|
1109
|
+
stateMutability: "nonpayable"
|
|
1110
|
+
}
|
|
1111
|
+
];
|
|
1112
|
+
var VAULT_ANALYSIS_ABI = [
|
|
1113
|
+
// Asset management reads
|
|
1114
|
+
{ type: "function", name: "getAvailableAssets", inputs: [], outputs: [{ type: "address[]" }], stateMutability: "view" },
|
|
1115
|
+
{ type: "function", name: "getDepositableAssets", inputs: [], outputs: [{ type: "address[]" }], stateMutability: "view" },
|
|
1116
|
+
{ type: "function", name: "isAssetAvailable", inputs: [{ name: "asset", type: "address" }], outputs: [{ type: "bool" }], stateMutability: "view" },
|
|
1117
|
+
{ type: "function", name: "isAssetDepositable", inputs: [{ name: "asset", type: "address" }], outputs: [{ type: "bool" }], stateMutability: "view" },
|
|
1118
|
+
// Deposit whitelist
|
|
1119
|
+
{ type: "function", name: "isDepositWhitelistEnabled", inputs: [], outputs: [{ type: "bool" }], stateMutability: "view" },
|
|
1120
|
+
{ type: "function", name: "getAvailableToDeposit", inputs: [{ name: "depositor", type: "address" }], outputs: [{ type: "uint256" }], stateMutability: "view" },
|
|
1121
|
+
// Registry
|
|
1122
|
+
{ type: "function", name: "moreVaultsRegistry", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" }
|
|
1123
|
+
];
|
|
1124
|
+
var REGISTRY_ABI = [
|
|
1125
|
+
{ type: "function", name: "isWhitelisted", inputs: [{ name: "protocol", type: "address" }], outputs: [{ type: "bool" }], stateMutability: "view" },
|
|
1126
|
+
{ type: "function", name: "isBridgeAllowed", inputs: [{ name: "bridge", type: "address" }], outputs: [{ type: "bool" }], stateMutability: "view" },
|
|
1127
|
+
{ type: "function", name: "getAllowedFacets", inputs: [], outputs: [{ type: "address[]" }], stateMutability: "view" }
|
|
1128
|
+
];
|
|
1078
1129
|
var LZ_ENDPOINT_ABI = [
|
|
1079
1130
|
{
|
|
1080
1131
|
type: "function",
|
|
@@ -3084,12 +3135,21 @@ async function canDeposit(publicClient, vault, user) {
|
|
|
3084
3135
|
],
|
|
3085
3136
|
allowFailure: false
|
|
3086
3137
|
});
|
|
3138
|
+
let whitelistEnabled = false;
|
|
3139
|
+
try {
|
|
3140
|
+
whitelistEnabled = await publicClient.readContract({
|
|
3141
|
+
address: v,
|
|
3142
|
+
abi: VAULT_ANALYSIS_ABI,
|
|
3143
|
+
functionName: "isDepositWhitelistEnabled"
|
|
3144
|
+
});
|
|
3145
|
+
} catch {
|
|
3146
|
+
}
|
|
3087
3147
|
if (isPaused) {
|
|
3088
|
-
return { allowed: false, reason: "paused" };
|
|
3148
|
+
return { allowed: false, reason: "paused", whitelistEnabled };
|
|
3089
3149
|
}
|
|
3090
3150
|
const isCrossChainAsync = isHub && !oraclesEnabled;
|
|
3091
3151
|
if (isCrossChainAsync) {
|
|
3092
|
-
return { allowed: true, reason: "ok" };
|
|
3152
|
+
return { allowed: true, reason: "ok", whitelistEnabled };
|
|
3093
3153
|
}
|
|
3094
3154
|
let maxDepositAmount;
|
|
3095
3155
|
try {
|
|
@@ -3100,12 +3160,12 @@ async function canDeposit(publicClient, vault, user) {
|
|
|
3100
3160
|
args: [getAddress(user)]
|
|
3101
3161
|
});
|
|
3102
3162
|
} catch {
|
|
3103
|
-
return { allowed: false, reason: "not-whitelisted" };
|
|
3163
|
+
return { allowed: false, reason: "not-whitelisted", maxDeposit: 0n, whitelistEnabled };
|
|
3104
3164
|
}
|
|
3105
3165
|
if (maxDepositAmount === 0n) {
|
|
3106
|
-
return { allowed: false, reason: "capacity-full" };
|
|
3166
|
+
return { allowed: false, reason: "capacity-full", maxDeposit: 0n, whitelistEnabled };
|
|
3107
3167
|
}
|
|
3108
|
-
return { allowed: true, reason: "ok" };
|
|
3168
|
+
return { allowed: true, reason: "ok", maxDeposit: maxDepositAmount, whitelistEnabled };
|
|
3109
3169
|
}
|
|
3110
3170
|
async function getVaultMetadata(publicClient, vault) {
|
|
3111
3171
|
const v = getAddress(vault);
|
|
@@ -3509,6 +3569,377 @@ async function isCurator(publicClient, vault, address) {
|
|
|
3509
3569
|
});
|
|
3510
3570
|
return getAddress(curatorAddress) === getAddress(address);
|
|
3511
3571
|
}
|
|
3572
|
+
async function getVaultAnalysis(publicClient, vault) {
|
|
3573
|
+
const v = getAddress(vault);
|
|
3574
|
+
const [availableRaw, depositableRaw, depositWhitelistEnabled, registryResult] = await Promise.all([
|
|
3575
|
+
publicClient.readContract({
|
|
3576
|
+
address: v,
|
|
3577
|
+
abi: VAULT_ANALYSIS_ABI,
|
|
3578
|
+
functionName: "getAvailableAssets"
|
|
3579
|
+
}),
|
|
3580
|
+
publicClient.readContract({
|
|
3581
|
+
address: v,
|
|
3582
|
+
abi: VAULT_ANALYSIS_ABI,
|
|
3583
|
+
functionName: "getDepositableAssets"
|
|
3584
|
+
}),
|
|
3585
|
+
publicClient.readContract({
|
|
3586
|
+
address: v,
|
|
3587
|
+
abi: VAULT_ANALYSIS_ABI,
|
|
3588
|
+
functionName: "isDepositWhitelistEnabled"
|
|
3589
|
+
}),
|
|
3590
|
+
publicClient.readContract({
|
|
3591
|
+
address: v,
|
|
3592
|
+
abi: VAULT_ANALYSIS_ABI,
|
|
3593
|
+
functionName: "moreVaultsRegistry"
|
|
3594
|
+
}).catch(() => null)
|
|
3595
|
+
]);
|
|
3596
|
+
const availableAddresses = availableRaw.map(getAddress);
|
|
3597
|
+
const depositableAddresses = depositableRaw.map(getAddress);
|
|
3598
|
+
const allAddresses = Array.from(/* @__PURE__ */ new Set([...availableAddresses, ...depositableAddresses]));
|
|
3599
|
+
const metadataCalls = allAddresses.flatMap((addr) => [
|
|
3600
|
+
{ address: addr, abi: METADATA_ABI, functionName: "name" },
|
|
3601
|
+
{ address: addr, abi: METADATA_ABI, functionName: "symbol" },
|
|
3602
|
+
{ address: addr, abi: METADATA_ABI, functionName: "decimals" }
|
|
3603
|
+
]);
|
|
3604
|
+
const metadataResults = allAddresses.length > 0 ? await publicClient.multicall({ contracts: metadataCalls, allowFailure: true }) : [];
|
|
3605
|
+
const assetInfoMap = /* @__PURE__ */ new Map();
|
|
3606
|
+
for (let i = 0; i < allAddresses.length; i++) {
|
|
3607
|
+
const addr = allAddresses[i];
|
|
3608
|
+
const nameResult = metadataResults[i * 3];
|
|
3609
|
+
const symbolResult = metadataResults[i * 3 + 1];
|
|
3610
|
+
const decimalsResult = metadataResults[i * 3 + 2];
|
|
3611
|
+
assetInfoMap.set(addr, {
|
|
3612
|
+
address: addr,
|
|
3613
|
+
name: nameResult?.status === "success" ? nameResult.result : "",
|
|
3614
|
+
symbol: symbolResult?.status === "success" ? symbolResult.result : "",
|
|
3615
|
+
decimals: decimalsResult?.status === "success" ? decimalsResult.result : 18
|
|
3616
|
+
});
|
|
3617
|
+
}
|
|
3618
|
+
const registryAddress = registryResult ? getAddress(registryResult) : null;
|
|
3619
|
+
return {
|
|
3620
|
+
availableAssets: availableAddresses.map((a) => assetInfoMap.get(a)),
|
|
3621
|
+
depositableAssets: depositableAddresses.map((a) => assetInfoMap.get(a)),
|
|
3622
|
+
depositWhitelistEnabled,
|
|
3623
|
+
registryAddress
|
|
3624
|
+
};
|
|
3625
|
+
}
|
|
3626
|
+
async function checkProtocolWhitelist(publicClient, vault, protocols) {
|
|
3627
|
+
const v = getAddress(vault);
|
|
3628
|
+
const registryRaw = await publicClient.readContract({
|
|
3629
|
+
address: v,
|
|
3630
|
+
abi: VAULT_ANALYSIS_ABI,
|
|
3631
|
+
functionName: "moreVaultsRegistry"
|
|
3632
|
+
});
|
|
3633
|
+
const registry = getAddress(registryRaw);
|
|
3634
|
+
if (protocols.length === 0) return {};
|
|
3635
|
+
const results = await publicClient.multicall({
|
|
3636
|
+
contracts: protocols.map((protocol) => ({
|
|
3637
|
+
address: registry,
|
|
3638
|
+
abi: REGISTRY_ABI,
|
|
3639
|
+
functionName: "isWhitelisted",
|
|
3640
|
+
args: [getAddress(protocol)]
|
|
3641
|
+
})),
|
|
3642
|
+
allowFailure: true
|
|
3643
|
+
});
|
|
3644
|
+
const out = {};
|
|
3645
|
+
for (let i = 0; i < protocols.length; i++) {
|
|
3646
|
+
const r = results[i];
|
|
3647
|
+
out[getAddress(protocols[i])] = r?.status === "success" ? r.result : false;
|
|
3648
|
+
}
|
|
3649
|
+
return out;
|
|
3650
|
+
}
|
|
3651
|
+
async function getVaultAssetBreakdown(publicClient, vault) {
|
|
3652
|
+
const v = getAddress(vault);
|
|
3653
|
+
const availableRaw = await publicClient.readContract({
|
|
3654
|
+
address: v,
|
|
3655
|
+
abi: VAULT_ANALYSIS_ABI,
|
|
3656
|
+
functionName: "getAvailableAssets"
|
|
3657
|
+
});
|
|
3658
|
+
const addresses = availableRaw.map(getAddress);
|
|
3659
|
+
const results = await publicClient.multicall({
|
|
3660
|
+
contracts: [
|
|
3661
|
+
// Per-asset: balanceOf, name, symbol, decimals
|
|
3662
|
+
...addresses.flatMap((addr) => [
|
|
3663
|
+
{ address: addr, abi: ERC20_ABI, functionName: "balanceOf", args: [v] },
|
|
3664
|
+
{ address: addr, abi: METADATA_ABI, functionName: "name" },
|
|
3665
|
+
{ address: addr, abi: METADATA_ABI, functionName: "symbol" },
|
|
3666
|
+
{ address: addr, abi: METADATA_ABI, functionName: "decimals" }
|
|
3667
|
+
]),
|
|
3668
|
+
// Vault totals
|
|
3669
|
+
{ address: v, abi: VAULT_ABI, functionName: "totalAssets" },
|
|
3670
|
+
{ address: v, abi: VAULT_ABI, functionName: "totalSupply" },
|
|
3671
|
+
{ address: v, abi: METADATA_ABI, functionName: "decimals" }
|
|
3672
|
+
],
|
|
3673
|
+
allowFailure: true
|
|
3674
|
+
});
|
|
3675
|
+
const perAssetFields = 4;
|
|
3676
|
+
const assets = addresses.map((addr, i) => {
|
|
3677
|
+
const base = i * perAssetFields;
|
|
3678
|
+
const balance = results[base]?.status === "success" ? results[base].result : 0n;
|
|
3679
|
+
const name = results[base + 1]?.status === "success" ? results[base + 1].result : "";
|
|
3680
|
+
const symbol = results[base + 2]?.status === "success" ? results[base + 2].result : "";
|
|
3681
|
+
const decimals = results[base + 3]?.status === "success" ? results[base + 3].result : 18;
|
|
3682
|
+
return { address: addr, name, symbol, decimals, balance };
|
|
3683
|
+
});
|
|
3684
|
+
const totalsBase = addresses.length * perAssetFields;
|
|
3685
|
+
const totalAssets = results[totalsBase]?.status === "success" ? results[totalsBase].result : 0n;
|
|
3686
|
+
const totalSupply = results[totalsBase + 1]?.status === "success" ? results[totalsBase + 1].result : 0n;
|
|
3687
|
+
const underlyingDecimals = results[totalsBase + 2]?.status === "success" ? results[totalsBase + 2].result : 6;
|
|
3688
|
+
return { assets, totalAssets, totalSupply, underlyingDecimals };
|
|
3689
|
+
}
|
|
3690
|
+
function encodeCuratorAction(action) {
|
|
3691
|
+
switch (action.type) {
|
|
3692
|
+
case "swap":
|
|
3693
|
+
return encodeFunctionData({
|
|
3694
|
+
abi: DEX_ABI,
|
|
3695
|
+
functionName: "executeSwap",
|
|
3696
|
+
args: [
|
|
3697
|
+
{
|
|
3698
|
+
targetContract: getAddress(action.params.targetContract),
|
|
3699
|
+
tokenIn: getAddress(action.params.tokenIn),
|
|
3700
|
+
tokenOut: getAddress(action.params.tokenOut),
|
|
3701
|
+
maxAmountIn: action.params.maxAmountIn,
|
|
3702
|
+
minAmountOut: action.params.minAmountOut,
|
|
3703
|
+
swapCallData: action.params.swapCallData
|
|
3704
|
+
}
|
|
3705
|
+
]
|
|
3706
|
+
});
|
|
3707
|
+
case "batchSwap":
|
|
3708
|
+
return encodeFunctionData({
|
|
3709
|
+
abi: DEX_ABI,
|
|
3710
|
+
functionName: "executeBatchSwap",
|
|
3711
|
+
args: [
|
|
3712
|
+
{
|
|
3713
|
+
swaps: action.params.swaps.map((s) => ({
|
|
3714
|
+
targetContract: getAddress(s.targetContract),
|
|
3715
|
+
tokenIn: getAddress(s.tokenIn),
|
|
3716
|
+
tokenOut: getAddress(s.tokenOut),
|
|
3717
|
+
maxAmountIn: s.maxAmountIn,
|
|
3718
|
+
minAmountOut: s.minAmountOut,
|
|
3719
|
+
swapCallData: s.swapCallData
|
|
3720
|
+
}))
|
|
3721
|
+
}
|
|
3722
|
+
]
|
|
3723
|
+
});
|
|
3724
|
+
case "erc4626Deposit":
|
|
3725
|
+
return encodeFunctionData({
|
|
3726
|
+
abi: ERC4626_FACET_ABI,
|
|
3727
|
+
functionName: "erc4626Deposit",
|
|
3728
|
+
args: [getAddress(action.vault), action.assets]
|
|
3729
|
+
});
|
|
3730
|
+
case "erc4626Redeem":
|
|
3731
|
+
return encodeFunctionData({
|
|
3732
|
+
abi: ERC4626_FACET_ABI,
|
|
3733
|
+
functionName: "erc4626Redeem",
|
|
3734
|
+
args: [getAddress(action.vault), action.shares]
|
|
3735
|
+
});
|
|
3736
|
+
case "erc7540RequestDeposit":
|
|
3737
|
+
return encodeFunctionData({
|
|
3738
|
+
abi: ERC7540_FACET_ABI,
|
|
3739
|
+
functionName: "erc7540RequestDeposit",
|
|
3740
|
+
args: [getAddress(action.vault), action.assets]
|
|
3741
|
+
});
|
|
3742
|
+
case "erc7540Deposit":
|
|
3743
|
+
return encodeFunctionData({
|
|
3744
|
+
abi: ERC7540_FACET_ABI,
|
|
3745
|
+
functionName: "erc7540Deposit",
|
|
3746
|
+
args: [getAddress(action.vault), action.assets]
|
|
3747
|
+
});
|
|
3748
|
+
case "erc7540RequestRedeem":
|
|
3749
|
+
return encodeFunctionData({
|
|
3750
|
+
abi: ERC7540_FACET_ABI,
|
|
3751
|
+
functionName: "erc7540RequestRedeem",
|
|
3752
|
+
args: [getAddress(action.vault), action.shares]
|
|
3753
|
+
});
|
|
3754
|
+
case "erc7540Redeem":
|
|
3755
|
+
return encodeFunctionData({
|
|
3756
|
+
abi: ERC7540_FACET_ABI,
|
|
3757
|
+
functionName: "erc7540Redeem",
|
|
3758
|
+
args: [getAddress(action.vault), action.shares]
|
|
3759
|
+
});
|
|
3760
|
+
default: {
|
|
3761
|
+
const _exhaustive = action;
|
|
3762
|
+
throw new Error(`[MoreVaults] Unknown CuratorAction type: ${_exhaustive.type}`);
|
|
3763
|
+
}
|
|
3764
|
+
}
|
|
3765
|
+
}
|
|
3766
|
+
function buildCuratorBatch(actions) {
|
|
3767
|
+
return actions.map(encodeCuratorAction);
|
|
3768
|
+
}
|
|
3769
|
+
async function submitActions(walletClient, publicClient, vault, actions) {
|
|
3770
|
+
const account = walletClient.account;
|
|
3771
|
+
const v = getAddress(vault);
|
|
3772
|
+
await publicClient.simulateContract({
|
|
3773
|
+
address: v,
|
|
3774
|
+
abi: MULTICALL_ABI,
|
|
3775
|
+
functionName: "submitActions",
|
|
3776
|
+
args: [actions],
|
|
3777
|
+
account: account.address
|
|
3778
|
+
});
|
|
3779
|
+
const txHash = await walletClient.writeContract({
|
|
3780
|
+
address: v,
|
|
3781
|
+
abi: MULTICALL_ABI,
|
|
3782
|
+
functionName: "submitActions",
|
|
3783
|
+
args: [actions],
|
|
3784
|
+
account,
|
|
3785
|
+
chain: walletClient.chain
|
|
3786
|
+
});
|
|
3787
|
+
const nextNonce = await publicClient.readContract({
|
|
3788
|
+
address: v,
|
|
3789
|
+
abi: MULTICALL_ABI,
|
|
3790
|
+
functionName: "getCurrentNonce"
|
|
3791
|
+
});
|
|
3792
|
+
const nonce = nextNonce - 1n;
|
|
3793
|
+
return { txHash, nonce };
|
|
3794
|
+
}
|
|
3795
|
+
async function executeActions(walletClient, publicClient, vault, nonce) {
|
|
3796
|
+
const account = walletClient.account;
|
|
3797
|
+
const v = getAddress(vault);
|
|
3798
|
+
await publicClient.simulateContract({
|
|
3799
|
+
address: v,
|
|
3800
|
+
abi: MULTICALL_ABI,
|
|
3801
|
+
functionName: "executeActions",
|
|
3802
|
+
args: [nonce],
|
|
3803
|
+
account: account.address
|
|
3804
|
+
});
|
|
3805
|
+
const txHash = await walletClient.writeContract({
|
|
3806
|
+
address: v,
|
|
3807
|
+
abi: MULTICALL_ABI,
|
|
3808
|
+
functionName: "executeActions",
|
|
3809
|
+
args: [nonce],
|
|
3810
|
+
account,
|
|
3811
|
+
chain: walletClient.chain
|
|
3812
|
+
});
|
|
3813
|
+
return { txHash };
|
|
3814
|
+
}
|
|
3815
|
+
async function vetoActions(walletClient, publicClient, vault, nonces) {
|
|
3816
|
+
const account = walletClient.account;
|
|
3817
|
+
const v = getAddress(vault);
|
|
3818
|
+
await publicClient.simulateContract({
|
|
3819
|
+
address: v,
|
|
3820
|
+
abi: MULTICALL_ABI,
|
|
3821
|
+
functionName: "vetoActions",
|
|
3822
|
+
args: [nonces],
|
|
3823
|
+
account: account.address
|
|
3824
|
+
});
|
|
3825
|
+
const txHash = await walletClient.writeContract({
|
|
3826
|
+
address: v,
|
|
3827
|
+
abi: MULTICALL_ABI,
|
|
3828
|
+
functionName: "vetoActions",
|
|
3829
|
+
args: [nonces],
|
|
3830
|
+
account,
|
|
3831
|
+
chain: walletClient.chain
|
|
3832
|
+
});
|
|
3833
|
+
return { txHash };
|
|
3834
|
+
}
|
|
3835
|
+
var UNISWAP_V3_SWAP_ROUTER_ABI = [
|
|
3836
|
+
{
|
|
3837
|
+
type: "function",
|
|
3838
|
+
name: "exactInputSingle",
|
|
3839
|
+
inputs: [
|
|
3840
|
+
{
|
|
3841
|
+
type: "tuple",
|
|
3842
|
+
name: "params",
|
|
3843
|
+
components: [
|
|
3844
|
+
{ name: "tokenIn", type: "address" },
|
|
3845
|
+
{ name: "tokenOut", type: "address" },
|
|
3846
|
+
{ name: "fee", type: "uint24" },
|
|
3847
|
+
{ name: "recipient", type: "address" },
|
|
3848
|
+
{ name: "deadline", type: "uint256" },
|
|
3849
|
+
{ name: "amountIn", type: "uint256" },
|
|
3850
|
+
{ name: "amountOutMinimum", type: "uint256" },
|
|
3851
|
+
{ name: "sqrtPriceLimitX96", type: "uint160" }
|
|
3852
|
+
]
|
|
3853
|
+
}
|
|
3854
|
+
],
|
|
3855
|
+
outputs: [{ name: "amountOut", type: "uint256" }],
|
|
3856
|
+
stateMutability: "payable"
|
|
3857
|
+
}
|
|
3858
|
+
];
|
|
3859
|
+
var UNISWAP_V3_SWAP_ROUTER02_ABI = [
|
|
3860
|
+
{
|
|
3861
|
+
type: "function",
|
|
3862
|
+
name: "exactInputSingle",
|
|
3863
|
+
inputs: [
|
|
3864
|
+
{
|
|
3865
|
+
type: "tuple",
|
|
3866
|
+
name: "params",
|
|
3867
|
+
components: [
|
|
3868
|
+
{ name: "tokenIn", type: "address" },
|
|
3869
|
+
{ name: "tokenOut", type: "address" },
|
|
3870
|
+
{ name: "fee", type: "uint24" },
|
|
3871
|
+
{ name: "recipient", type: "address" },
|
|
3872
|
+
{ name: "amountIn", type: "uint256" },
|
|
3873
|
+
{ name: "amountOutMinimum", type: "uint256" },
|
|
3874
|
+
{ name: "sqrtPriceLimitX96", type: "uint160" }
|
|
3875
|
+
]
|
|
3876
|
+
}
|
|
3877
|
+
],
|
|
3878
|
+
outputs: [{ name: "amountOut", type: "uint256" }],
|
|
3879
|
+
stateMutability: "payable"
|
|
3880
|
+
}
|
|
3881
|
+
];
|
|
3882
|
+
var SWAP_ROUTER02_CHAINS = /* @__PURE__ */ new Set([8453]);
|
|
3883
|
+
function encodeUniswapV3SwapCalldata(params) {
|
|
3884
|
+
const { chainId, tokenIn, tokenOut, fee, amountIn, minAmountOut, recipient } = params;
|
|
3885
|
+
const router = UNISWAP_V3_ROUTERS[chainId];
|
|
3886
|
+
if (!router) {
|
|
3887
|
+
throw new Error(
|
|
3888
|
+
`[MoreVaults] No Uniswap V3 router configured for chainId ${chainId}. Supported chains: ${Object.keys(UNISWAP_V3_ROUTERS).join(", ")}`
|
|
3889
|
+
);
|
|
3890
|
+
}
|
|
3891
|
+
let swapCallData;
|
|
3892
|
+
if (SWAP_ROUTER02_CHAINS.has(chainId)) {
|
|
3893
|
+
swapCallData = encodeFunctionData({
|
|
3894
|
+
abi: UNISWAP_V3_SWAP_ROUTER02_ABI,
|
|
3895
|
+
functionName: "exactInputSingle",
|
|
3896
|
+
args: [
|
|
3897
|
+
{
|
|
3898
|
+
tokenIn,
|
|
3899
|
+
tokenOut,
|
|
3900
|
+
fee,
|
|
3901
|
+
recipient,
|
|
3902
|
+
amountIn,
|
|
3903
|
+
amountOutMinimum: minAmountOut,
|
|
3904
|
+
sqrtPriceLimitX96: 0n
|
|
3905
|
+
}
|
|
3906
|
+
]
|
|
3907
|
+
});
|
|
3908
|
+
} else {
|
|
3909
|
+
const deadline = BigInt(Math.floor(Date.now() / 1e3) + 1200);
|
|
3910
|
+
swapCallData = encodeFunctionData({
|
|
3911
|
+
abi: UNISWAP_V3_SWAP_ROUTER_ABI,
|
|
3912
|
+
functionName: "exactInputSingle",
|
|
3913
|
+
args: [
|
|
3914
|
+
{
|
|
3915
|
+
tokenIn,
|
|
3916
|
+
tokenOut,
|
|
3917
|
+
fee,
|
|
3918
|
+
recipient,
|
|
3919
|
+
deadline,
|
|
3920
|
+
amountIn,
|
|
3921
|
+
amountOutMinimum: minAmountOut,
|
|
3922
|
+
sqrtPriceLimitX96: 0n
|
|
3923
|
+
}
|
|
3924
|
+
]
|
|
3925
|
+
});
|
|
3926
|
+
}
|
|
3927
|
+
return { targetContract: router, swapCallData };
|
|
3928
|
+
}
|
|
3929
|
+
function buildUniswapV3Swap(params) {
|
|
3930
|
+
const { targetContract, swapCallData } = encodeUniswapV3SwapCalldata(params);
|
|
3931
|
+
return {
|
|
3932
|
+
type: "swap",
|
|
3933
|
+
params: {
|
|
3934
|
+
targetContract,
|
|
3935
|
+
tokenIn: params.tokenIn,
|
|
3936
|
+
tokenOut: params.tokenOut,
|
|
3937
|
+
maxAmountIn: params.amountIn,
|
|
3938
|
+
minAmountOut: params.minAmountOut,
|
|
3939
|
+
swapCallData
|
|
3940
|
+
}
|
|
3941
|
+
};
|
|
3942
|
+
}
|
|
3512
3943
|
|
|
3513
3944
|
// src/viem/wagmiCompat.ts
|
|
3514
3945
|
function asSdkClient(client) {
|
|
@@ -3516,6 +3947,6 @@ function asSdkClient(client) {
|
|
|
3516
3947
|
return client;
|
|
3517
3948
|
}
|
|
3518
3949
|
|
|
3519
|
-
export { ActionType, BRIDGE_ABI, BRIDGE_FACET_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CURATOR_CONFIG_ABI, CapacityFullError, DEX_ABI, EID_TO_CHAIN_ID, ERC20_ABI, ERC7540_FACET_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_ADAPTER_ABI, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MULTICALL_ABI, MissingEscrowAddressError, MoreVaultsError, NATIVE_SYMBOL, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, OMNI_FACTORY_ADDRESS, STARGATE_TAXI_CMD, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, canDeposit, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, discoverVaultTopology, ensureAllowance, executeCompose, getAllVaultChainIds, getAsyncRequestStatus, getAsyncRequestStatusLabel, getCuratorVaultStatus, getFullVaultTopology, getInboundRoutes, getMaxWithdrawable, getOutboundRoutes, getPendingActions, getUserBalances, getUserBalancesForRoutes, getUserPosition, getUserPositionMultiChain, getVaultDistribution, getVaultDistributionWithTopology, getVaultMetadata, getVaultStatus, getVaultSummary, getVaultTopology, getWithdrawalRequest, isAsyncMode, isCurator, isOnHubChain, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, previewDeposit, previewRedeem, quoteComposeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, waitForAsyncRequest, waitForCompose, waitForTx, withdrawAssets };
|
|
3950
|
+
export { ActionType, BRIDGE_ABI, BRIDGE_FACET_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CURATOR_CONFIG_ABI, CapacityFullError, DEX_ABI, 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, NATIVE_SYMBOL, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, OMNI_FACTORY_ADDRESS, REGISTRY_ABI, STARGATE_TAXI_CMD, UNISWAP_V3_ROUTERS, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, VAULT_ANALYSIS_ABI, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, buildCuratorBatch, buildUniswapV3Swap, canDeposit, checkProtocolWhitelist, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, discoverVaultTopology, encodeCuratorAction, encodeUniswapV3SwapCalldata, ensureAllowance, executeActions, executeCompose, getAllVaultChainIds, getAsyncRequestStatus, getAsyncRequestStatusLabel, getCuratorVaultStatus, getFullVaultTopology, getInboundRoutes, getMaxWithdrawable, getOutboundRoutes, getPendingActions, getUserBalances, getUserBalancesForRoutes, getUserPosition, getUserPositionMultiChain, getVaultAnalysis, getVaultAssetBreakdown, getVaultDistribution, getVaultDistributionWithTopology, getVaultMetadata, getVaultStatus, getVaultSummary, getVaultTopology, getWithdrawalRequest, isAsyncMode, isCurator, isOnHubChain, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, previewDeposit, previewRedeem, quoteComposeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, submitActions, vetoActions, waitForAsyncRequest, waitForCompose, waitForTx, withdrawAssets };
|
|
3520
3951
|
//# sourceMappingURL=index.js.map
|
|
3521
3952
|
//# sourceMappingURL=index.js.map
|