@oydual31/more-vaults-sdk 1.1.20 → 1.1.22
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/ethers/index.cjs +8 -3
- package/dist/ethers/index.cjs.map +1 -1
- package/dist/ethers/index.js +8 -3
- package/dist/ethers/index.js.map +1 -1
- package/dist/react/index.cjs +14 -11
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +14 -11
- package/dist/react/index.js.map +1 -1
- package/dist/viem/index.cjs +17 -14
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +4 -3
- package/dist/viem/index.d.ts +4 -3
- package/dist/viem/index.js +17 -14
- package/dist/viem/index.js.map +1 -1
- package/package.json +1 -1
- package/src/ethers/utils.ts +23 -8
- package/src/viem/adminActions.ts +2 -2
- package/src/viem/chains.ts +3 -2
- package/src/viem/curatorMulticall.ts +1 -1
- package/src/viem/curatorStatus.ts +4 -4
- package/src/viem/curatorSubVaults.ts +3 -3
- package/src/viem/curatorSwaps.ts +4 -2
- package/src/viem/utils.ts +18 -7
- package/src/viem/vaultConfig.ts +1 -1
package/dist/ethers/index.cjs
CHANGED
|
@@ -850,6 +850,7 @@ async function waitForAsyncRequest(provider, vault, guid, pollInterval = 3e4, ti
|
|
|
850
850
|
async function getVaultStatus(provider, vault) {
|
|
851
851
|
const mc = new ethers.Contract(MULTICALL3_ADDRESS, MULTICALL3_ABI, provider);
|
|
852
852
|
const configIface = new ethers.Interface(CONFIG_ABI);
|
|
853
|
+
const adminConfigIface = new ethers.Interface(ADMIN_CONFIG_ABI);
|
|
853
854
|
const bridgeIface = new ethers.Interface(BRIDGE_ABI);
|
|
854
855
|
const vaultIface = new ethers.Interface(VAULT_ABI);
|
|
855
856
|
const decimalsIface = new ethers.Interface(["function decimals() view returns (uint8)"]);
|
|
@@ -866,7 +867,9 @@ async function getVaultStatus(provider, vault) {
|
|
|
866
867
|
{ target: vault, allowFailure: false, callData: vaultIface.encodeFunctionData("asset") },
|
|
867
868
|
{ target: vault, allowFailure: false, callData: vaultIface.encodeFunctionData("totalAssets") },
|
|
868
869
|
{ target: vault, allowFailure: false, callData: vaultIface.encodeFunctionData("totalSupply") },
|
|
869
|
-
{ target: vault, allowFailure: false, callData: decimalsIface.encodeFunctionData("decimals") }
|
|
870
|
+
{ target: vault, allowFailure: false, callData: decimalsIface.encodeFunctionData("decimals") },
|
|
871
|
+
// allowFailure=true: older vaults may not have depositCapacity
|
|
872
|
+
{ target: vault, allowFailure: true, callData: adminConfigIface.encodeFunctionData("depositCapacity") }
|
|
870
873
|
];
|
|
871
874
|
const b1 = await mc.aggregate3.staticCall(b1Calls);
|
|
872
875
|
const isHub = configIface.decodeFunctionResult("isHub", b1[0].returnData)[0];
|
|
@@ -883,6 +886,7 @@ async function getVaultStatus(provider, vault) {
|
|
|
883
886
|
const decimalsRaw = decimalsIface.decodeFunctionResult("decimals", b1[11].returnData)[0];
|
|
884
887
|
const decimalsNum = Number(decimalsRaw);
|
|
885
888
|
const oneShare = 10n ** BigInt(decimalsNum);
|
|
889
|
+
const depositCapacity = b1[12].success ? adminConfigIface.decodeFunctionResult("depositCapacity", b1[12].returnData)[0] : 0n;
|
|
886
890
|
const erc20Iface = new ethers.Interface(ERC20_ABI);
|
|
887
891
|
const b2Calls = [
|
|
888
892
|
{ target: underlying, allowFailure: false, callData: erc20Iface.encodeFunctionData("balanceOf", [vault]) },
|
|
@@ -896,10 +900,11 @@ async function getVaultStatus(provider, vault) {
|
|
|
896
900
|
const isCrossChainAsync = isHub && !oraclesEnabled;
|
|
897
901
|
const depositAccessRestricted = maxDepositRaw === null && !isCrossChainAsync;
|
|
898
902
|
const effectiveCapacity = maxDepositRaw === null ? MAX_UINT256 : maxDepositRaw;
|
|
903
|
+
const isTrulyFull = effectiveCapacity === 0n && !isCrossChainAsync && (depositCapacity > 0n && totalAssets >= depositCapacity);
|
|
899
904
|
let mode;
|
|
900
905
|
if (isPaused) {
|
|
901
906
|
mode = "paused";
|
|
902
|
-
} else if (
|
|
907
|
+
} else if (isTrulyFull) {
|
|
903
908
|
mode = "full";
|
|
904
909
|
} else if (!isHub) {
|
|
905
910
|
mode = "local";
|
|
@@ -924,7 +929,7 @@ async function getVaultStatus(provider, vault) {
|
|
|
924
929
|
if (isPaused) {
|
|
925
930
|
issues.push("Vault is paused \u2014 no deposits or redeems are possible.");
|
|
926
931
|
}
|
|
927
|
-
if (
|
|
932
|
+
if (isTrulyFull) {
|
|
928
933
|
issues.push(
|
|
929
934
|
"Deposit capacity is full \u2014 increase depositCapacity via setDepositCapacity()."
|
|
930
935
|
);
|