@oydual31/more-vaults-sdk 1.1.19 → 1.1.20

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.
@@ -2172,10 +2172,27 @@ async function previewRedeem(provider, vault, shares) {
2172
2172
  }
2173
2173
  async function canDeposit(provider, vault, user) {
2174
2174
  const config = new ethers.Contract(vault, CONFIG_ABI, provider);
2175
+ const analysis = new ethers.Contract(vault, VAULT_ANALYSIS_ABI, provider);
2175
2176
  const isPaused = await config.paused();
2176
2177
  if (isPaused) {
2177
2178
  return { allowed: false, reason: "paused" };
2178
2179
  }
2180
+ let whitelistEnabled = false;
2181
+ try {
2182
+ whitelistEnabled = await analysis.isDepositWhitelistEnabled();
2183
+ } catch {
2184
+ }
2185
+ if (whitelistEnabled) {
2186
+ let available = 0n;
2187
+ try {
2188
+ available = await analysis.getAvailableToDeposit(user);
2189
+ } catch {
2190
+ return { allowed: false, reason: "not-whitelisted" };
2191
+ }
2192
+ if (available === 0n) {
2193
+ return { allowed: false, reason: "not-whitelisted" };
2194
+ }
2195
+ }
2179
2196
  let maxDepositAmount;
2180
2197
  try {
2181
2198
  maxDepositAmount = await config.maxDeposit(user);