morpho-org/morpho-blue

No way for liquidators or users to check position health

Closed this issue · 4 comments

The _isHealthy(MarketParams memory marketParams, Id id, address borrower) internal view returns (bool) function is internal, and only returns a bool.

That means that if users or liquidators want to monitor the health of their or other positions they will have to replicate most of the code in _isHealthy themselves.

I would recommend that _isHealthy returns a health factor, with > WAD being overcollateralized, and 2*WAD being 200% collateralized.

The _isHealthy(MarketParams memory marketParams, Id id, address borrower) internal view returns (bool) function is internal, and only returns a bool

True but even if we make it public the function would not be up to date since interest would not be accrued. So the returned value would be misleading.

There's a periphery subdirectory where we're adding methods to ease integrations.

They're not in the core contract for the sake of simplicity. Perhaps we could add an helper accruing the interest and returning the HF?

That means that if users or liquidators want to monitor the health of their or other positions they will have to replicate most of the code in _isHealthy themselves.

Most liquidators are doing this offchain in general to be more efficient and it does not seem to be a problem from the discussions we had. Perhaps it would be useful useful users but from the previous point maybe it's better to exposed an interface with the updated value instead of an outdated one?

If you have discussed this with liquidators and they are ok, then I'm happy to drop it on that angle. With regards to user dashboards (Zapper, etc), the periphery libraries would be just fine, even if probably integrators will build something for you.

If you have discussed this with liquidators and they are ok, then I'm happy to drop it on that angle. With regards to user dashboards (Zapper, etc), the periphery libraries would be just fine, even if probably integrators will build something for you.

We'll provide some specialized SDKs to query data, interact and perform computation on top of Morpho Blue. Not sure about the release date though but the aim is to offer turn-key product that integrators can reuse directly.

Marking it as not planned instead