Uncaught (in promise) Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"code":-32000,"message":"execution reverted"}, method="call" code=UNPREDICTABLE_GAS_LIMIT) error.
I am definitely calling a read-only function. The function is this:
function vaultSize(uint256 vaultId) public view virtual returns (uint256) {
return
store.isD2Vault(vaultId)
? store.d2Holdings(vaultId)
: store.holdingsLength(vaultId).add(
store.reservesLength(vaultId)
);
}
If that matters. I don't understand why this gas limit error is even happening or how to fix it and I feel like debugging is so hard when it's not my own contract because the revert reason is never obvious.
Here's how I'm calling it in javascript.
await contract.vaultSize(0)
I don't see why this is happening. This is public code in a contract that is obviously working with thousands of transactions a day.
The address is "0xdaa17a5f60E94d5f97968aa1E790c164e65c97Be"