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