mars-protocol / rover

Smart contracts for Rover
GNU General Public License v3.0
1 stars 1 forks source link

Add health state query #154

Closed grod220 closed 1 year ago

grod220 commented 1 year ago

The motivation for this PR was to ensure we can query health and not query the oracle if a user has zero debts. This is relevant for liquidations where it needs to avoid the conservative oracle circuit breakers.

This is solved by adding a new message HealthState that the credit manager calls. It simply replies with Healthy or Unhealthy(max_ltv). This is the only things that credit manager needs to know about. Which means it can skip doing the queries/calculations if there are no debts now.

Also, the Health contract needed a manually setting of the Params contract address. The health contract is already querying the config for Credit Manager. So this is unnecessary. Removed!