Credit Manager

The Credit Manager Contract is the centerpiece of the Mars Protocol v2. It serves as a proxy between the user, the Red Bank, the liquidation engine, and the Perps contracts.

Deployments

Neutron: neutron1qdzn3l4kn7gsjna2tfpg3g3mwd6kunx4p50lfya59k02846xas6qslgs3r

Osmosis: osmo1f2m24wktq0sw3c0lexlg7fv4kngwyttvzws3a3r3al9ld2s2pvds87jqvf


Types

The types of the Credit Manager Contract can be found here.

For reference on the Queries and Methods:

Base Types
type AccountKind =
  | ('default' | 'high_levered_strategy')
  | {
      fund_manager: {
        vault_addr: string
      }
    }
type ActionKind = 'default' | 'liquidation'
type Expiration =
  | {
      at_height: number
    }
  | {
      at_time: Timestamp
    }
  | {
      never: {}
    }
type HealthState =
  | 'healthy'
  | {
      unhealthy: {
        max_ltv_health_factor: Decimal
      }
    }
type Int128 = string    
type Uint128 = string

Conditions

Conditions are used to create triggers for trigger orders. They are referenced as the Condition type in the Methods below.

health_factor

oracle_price

relative_price


Actions

A central part of the Credit Manager are the Actions. Actions can be combined into powerful sequences by lining them up in an array (they will be executed in a top to down maner). They are referenced via the Action type in the Methods below.

borrow

claim_astro_lp_rewards

claim_rewards

create_trigger_order

delete_trigger_order

deposit

deposit_to_perp_vault

enter_vault

execute_perp_order

exit_vault

exit_vault_unlocked

lend

liquidate

provide_liquidity

reclaim

refund_all_coin_balances

repay

request_vault_unlock

stake_astro_lp

swap_exact_in

unlock_from_perp_vault

unstake_astro_lp

withdraw

withdraw_from_perp_vault

withdraw_liquidity

withdraw_to_wallet


Queries

account_kind

Returns the AccountKind of a specific account_id.

accounts

all_account_trigger_orders

all_coin_balances

all_debt_shares

all_total_debt_shares

all_trigger_orders

all_vault_positions

all_vault_utilizations

config

estimate_provide_liquidity

estimate_withdraw_liquidity

positions

total_debt_shares

vault_bindings

vault_position_value

vault_utilization

Methods

create_credit_account

execute_trigger_order

repay_from_wallet

update_balances_after_deleverage

update_credit_account

Last updated