Kujira.Ghost (kujira v0.1.10)
Kujira's lending platform.
It has a vault-market architecture, where multiple Market can draw down from a single Vault. A Market must be whitelisted, as the repayment is guaranteed by its own execution logic, e.g. being over-collateralised and having a connection to Orca to liquidate collateral when needed
Summary
Functions
Fetches the Market contract and its current config from the chain.
Fetches the Vault contract and its current config from the chain.
Fetches all Liquidation Markets. This will only change when config changes or new Markets are added. It's Memoized, clearing every 24h.
Fetches all Liquidation Vaults. This will only change when config changes or new Vaults are added. It's Memoized, clearing every 24h.
Loads the current Status into the Market
Loads the Market into a format that Orca can consume for health reporting.
It's Memoized due to the call to Contract.query_state_all
, clearing every 10m.
Loads the current Status into the Vault
Functions
get_market(channel, address)
@spec get_market(GRPC.Channel.t(), String.t()) :: {:ok, Kujira.Ghost.Market.t()} | {:error, :not_found}
Fetches the Market contract and its current config from the chain.
Config is very very rarely changed, if ever, and so this function is Memoized by default.
Clear with Memoize.invalidate(Kujira.Ghost, :get_market, [address])
get_vault(channel, address)
@spec get_vault(GRPC.Channel.t(), String.t()) :: {:ok, Kujira.Ghost.Vault.t()} | {:error, :not_found}
Fetches the Vault contract and its current config from the chain.
Config is very very rarely changed, if ever, and so this function is Memoized by default.
Clear with Memoize.invalidate(Kujira.Ghost, :get_vault, [address])
list_markets(channel, code_ids \\ [136, 186])
@spec list_markets(GRPC.Channel.t(), [integer()]) :: {:ok, [Kujira.Ghost.Market.t()]} | :error
Fetches all Liquidation Markets. This will only change when config changes or new Markets are added. It's Memoized, clearing every 24h.
Manually clear with Memoize.invalidate(Kujira.Ghost, :list_markets)
list_vaults(channel, code_ids \\ [140])
@spec list_vaults(GRPC.Channel.t(), [integer()]) :: {:ok, [Kujira.Ghost.Vault.t()]} | :error
Fetches all Liquidation Vaults. This will only change when config changes or new Vaults are added. It's Memoized, clearing every 24h.
Manually clear with Memoize.invalidate(Kujira.Ghost, :list_vaults)
load_market(channel, market)
@spec load_market(GRPC.Channel.t(), Kujira.Ghost.Market.t()) :: {:ok, Kujira.Ghost.Market.t()} | :error
Loads the current Status into the Market
load_orca_market(channel, market, precision \\ 3)
@spec load_orca_market(GRPC.Channel.t(), Kujira.Ghost.Market.t(), integer() | nil) :: {:ok, Kujira.Orca.Market.t()} | :error
Loads the Market into a format that Orca can consume for health reporting.
It's Memoized due to the call to Contract.query_state_all
, clearing every 10m.
Manually clear with Memoize.invalidate(Kujira.Contract, :query_state_all, [market.address])
load_vault(channel, vault)
@spec load_vault(GRPC.Channel.t(), Kujira.Ghost.Vault.t()) :: {:ok, Kujira.Ghost.Vault.t()} | :error
Loads the current Status into the Vault