@oydual31/more-vaults-sdk 1.1.20 → 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.
@@ -848,6 +848,7 @@ async function waitForAsyncRequest(provider, vault, guid, pollInterval = 3e4, ti
848
848
  async function getVaultStatus(provider, vault) {
849
849
  const mc = new Contract(MULTICALL3_ADDRESS, MULTICALL3_ABI, provider);
850
850
  const configIface = new Interface(CONFIG_ABI);
851
+ const adminConfigIface = new Interface(ADMIN_CONFIG_ABI);
851
852
  const bridgeIface = new Interface(BRIDGE_ABI);
852
853
  const vaultIface = new Interface(VAULT_ABI);
853
854
  const decimalsIface = new Interface(["function decimals() view returns (uint8)"]);
@@ -864,7 +865,9 @@ async function getVaultStatus(provider, vault) {
864
865
  { target: vault, allowFailure: false, callData: vaultIface.encodeFunctionData("asset") },
865
866
  { target: vault, allowFailure: false, callData: vaultIface.encodeFunctionData("totalAssets") },
866
867
  { target: vault, allowFailure: false, callData: vaultIface.encodeFunctionData("totalSupply") },
867
- { target: vault, allowFailure: false, callData: decimalsIface.encodeFunctionData("decimals") }
868
+ { target: vault, allowFailure: false, callData: decimalsIface.encodeFunctionData("decimals") },
869
+ // allowFailure=true: older vaults may not have depositCapacity
870
+ { target: vault, allowFailure: true, callData: adminConfigIface.encodeFunctionData("depositCapacity") }
868
871
  ];
869
872
  const b1 = await mc.aggregate3.staticCall(b1Calls);
870
873
  const isHub = configIface.decodeFunctionResult("isHub", b1[0].returnData)[0];
@@ -881,6 +884,7 @@ async function getVaultStatus(provider, vault) {
881
884
  const decimalsRaw = decimalsIface.decodeFunctionResult("decimals", b1[11].returnData)[0];
882
885
  const decimalsNum = Number(decimalsRaw);
883
886
  const oneShare = 10n ** BigInt(decimalsNum);
887
+ const depositCapacity = b1[12].success ? adminConfigIface.decodeFunctionResult("depositCapacity", b1[12].returnData)[0] : 0n;
884
888
  const erc20Iface = new Interface(ERC20_ABI);
885
889
  const b2Calls = [
886
890
  { target: underlying, allowFailure: false, callData: erc20Iface.encodeFunctionData("balanceOf", [vault]) },
@@ -894,10 +898,11 @@ async function getVaultStatus(provider, vault) {
894
898
  const isCrossChainAsync = isHub && !oraclesEnabled;
895
899
  const depositAccessRestricted = maxDepositRaw === null && !isCrossChainAsync;
896
900
  const effectiveCapacity = maxDepositRaw === null ? MAX_UINT256 : maxDepositRaw;
901
+ const isTrulyFull = effectiveCapacity === 0n && !isCrossChainAsync && (depositCapacity > 0n && totalAssets >= depositCapacity);
897
902
  let mode;
898
903
  if (isPaused) {
899
904
  mode = "paused";
900
- } else if (effectiveCapacity === 0n) {
905
+ } else if (isTrulyFull) {
901
906
  mode = "full";
902
907
  } else if (!isHub) {
903
908
  mode = "local";
@@ -922,7 +927,7 @@ async function getVaultStatus(provider, vault) {
922
927
  if (isPaused) {
923
928
  issues.push("Vault is paused \u2014 no deposits or redeems are possible.");
924
929
  }
925
- if (effectiveCapacity === 0n && !isPaused) {
930
+ if (isTrulyFull) {
926
931
  issues.push(
927
932
  "Deposit capacity is full \u2014 increase depositCapacity via setDepositCapacity()."
928
933
  );