Documentation
SocialsStatisticsLaunch App
  • Welcome to Mars Protocol
  • Getting Started
    • How to set up a Wallet
    • Connect your wallet
    • Using a Credit Account
  • Credit Accounts
  • Perpetual Futures (Perps)
    • Perps Vault (Counterparty Vault)
    • Funding Rate Mechanism
    • Price Impact
    • Open Interest Caps
    • Vault Solvency Protection
    • Health Factor
    • Liquidations
  • Spot & Margin Trading
  • Lending & Borrowing
  • Leveraged Yield Farming
  • High Leverage Strategies
  • Managed Vaults
    • Creating a Vault
      • How to Resume Vault Creation After Failed Transaction
    • Managing a Vault
    • Depositing into Vault
  • Risk Methodology
    • Asset Listing
    • Protocol Risk Framework
    • Perps Risk Framework
      • Maximum Leverage & LTVs
      • SkewScale
      • Open Interest Caps
      • Maximum Funding Velocity
      • Mitigating Risks of Static Parameters
    • Deposit Caps Risk Framework
  • Governance
    • MARS Token
  • Smart Contracts
    • Address Provider
    • Account NFT
    • Credit Manager
    • Health
    • Incentives
    • Oracle
    • Params
    • Red Bank
    • Rewards Collector
    • Swapper
    • Zapper
    • Perps
  • Brand kit
    • The Mars Brand
  • Legal
    • Mars FUD Bible
    • Terms of Service
    • Privacy Policy
    • Cookie Policy
Powered by GitBook
On this page
  • Deployments
  • Types
  • Queries
Edit on GitHub
Export as PDF
  1. Smart Contracts

Health

The Health Contract calculates the health factor of user positions. It is used to enable and disable the liquidation by the Credit Manager.

Last updated 25 days ago

Deployments

Neutron:

Osmosis:


Types

The types of the Health Contract can be found .


Queries

config

Returns the contracts configuration.

Query message
{
    config: {}
}
Return output
{
    data: {
        credit_manager: string | null
        owner_response: {
            abolished: boolean
            emergency_owner: string | null
            initialized: boolean
            owner: string | null
            proposed: string | null
        }
    }
}

health_state

Query message
{
    health_state: {
        account_id: string
        action: ActionKind
    }
}
Return output
{
    data: 'healthy' | {
        unhealthy: {
            max_ltv_health_factor: Decimal
        }
    }
}

health_values

Query message
{
    health_values: {
        account_id: string
        action: ActionKind
    }
}
Return output
{
    data: {
        above_max_ltv: boolean
        has_perps: boolean
        liquidatable: boolean
        liquidation_health_factor?: Decimal | null
        liquidation_threshold_adjusted_collateral: Uint128
        max_ltv_adjusted_collateral: Uint128
        max_ltv_health_factor?: Decimal | null
        perps_pnl_loss: Uint128
        perps_pnl_profit: Uint128
        total_collateral_value: Uint128
        total_debt_value: Uint128
    }
}
neutron17ktfwsr7ghlxzzma0gw0hke3j3rnssd58q87jv2wzfrk6uhawa3sv8xxtm
osmo1pdc49qlyhpkzx4j24uuw97kk6hv7e9xvrdjlww8qj6al53gmu49sge4g79
here