@oydual31/more-vaults-sdk 1.1.19 → 1.1.21

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.
@@ -1517,7 +1517,8 @@ async function getVaultStatus(publicClient, vault) {
1517
1517
  { address: v, abi: VAULT_ABI, functionName: "asset" },
1518
1518
  { address: v, abi: VAULT_ABI, functionName: "totalAssets" },
1519
1519
  { address: v, abi: VAULT_ABI, functionName: "totalSupply" },
1520
- { address: v, abi: METADATA_ABI, functionName: "decimals" }
1520
+ { address: v, abi: METADATA_ABI, functionName: "decimals" },
1521
+ { address: v, abi: ADMIN_CONFIG_ABI, functionName: "depositCapacity" }
1521
1522
  ],
1522
1523
  allowFailure: true
1523
1524
  });
@@ -1533,6 +1534,7 @@ async function getVaultStatus(publicClient, vault) {
1533
1534
  const totalAssets = b1[9].status === "success" ? b1[9].result : 0n;
1534
1535
  const totalSupply = b1[10].status === "success" ? b1[10].result : 0n;
1535
1536
  const decimals = b1[11].status === "success" ? Number(b1[11].result) : 18;
1537
+ const depositCapacity = b1[12].status === "success" ? b1[12].result : 0n;
1536
1538
  const oneShare = 10n ** BigInt(decimals);
1537
1539
  const b2 = await publicClient.multicall({
1538
1540
  contracts: [
@@ -1548,10 +1550,11 @@ async function getVaultStatus(publicClient, vault) {
1548
1550
  const isCrossChainAsync = isHub && !oraclesEnabled;
1549
1551
  const depositAccessRestricted = maxDepositRaw === null && !isCrossChainAsync;
1550
1552
  const effectiveCapacity = maxDepositRaw === null ? MAX_UINT256 : maxDepositRaw;
1553
+ const isTrulyFull = effectiveCapacity === 0n && !isCrossChainAsync && (depositCapacity > 0n && totalAssets >= depositCapacity);
1551
1554
  let mode;
1552
1555
  if (isPaused) {
1553
1556
  mode = "paused";
1554
- } else if (effectiveCapacity === 0n) {
1557
+ } else if (isTrulyFull) {
1555
1558
  mode = "full";
1556
1559
  } else if (!isHub) {
1557
1560
  mode = "local";
@@ -3916,6 +3919,9 @@ async function canDeposit(publicClient, vault, user) {
3916
3919
  ],
3917
3920
  allowFailure: false
3918
3921
  });
3922
+ if (isPaused) {
3923
+ return { allowed: false, reason: "paused", whitelistEnabled: false };
3924
+ }
3919
3925
  let whitelistEnabled = false;
3920
3926
  try {
3921
3927
  whitelistEnabled = await publicClient.readContract({
@@ -3925,8 +3931,21 @@ async function canDeposit(publicClient, vault, user) {
3925
3931
  });
3926
3932
  } catch {
3927
3933
  }
3928
- if (isPaused) {
3929
- return { allowed: false, reason: "paused", whitelistEnabled };
3934
+ if (whitelistEnabled) {
3935
+ let available = 0n;
3936
+ try {
3937
+ available = await publicClient.readContract({
3938
+ address: v,
3939
+ abi: VAULT_ANALYSIS_ABI,
3940
+ functionName: "getAvailableToDeposit",
3941
+ args: [viem.getAddress(user)]
3942
+ });
3943
+ } catch {
3944
+ return { allowed: false, reason: "not-whitelisted", maxDeposit: 0n, whitelistEnabled };
3945
+ }
3946
+ if (available === 0n) {
3947
+ return { allowed: false, reason: "not-whitelisted", maxDeposit: 0n, whitelistEnabled };
3948
+ }
3930
3949
  }
3931
3950
  const isCrossChainAsync = isHub && !oraclesEnabled;
3932
3951
  if (isCrossChainAsync) {