Kujira.Usk (kujira v0.1.80)
Kujira's decentralized stablecoin
Users deposit collateral and mint USK up to the maximum LTV permitted by the individual market
Summary
Functions
Fetches the Controller contract and its current config from the chain
Fetches the Margin contract and its current config from the chain
Fetches the Market contract and its current config from the chain
Fetches all Margins
Fetches all Markets
Loads all positions via query_state_all, inheriting the same memoization
Loads the current Status into the Margin.market
Loads the current Status into the Market
Loads the Market into a format that Orca can consume for health reporting. Default Memoization to 10 mins
Loads a Position by borrower address
Creates a lazy stream for fetching all positions for a Market
Functions
get_controller(channel)
@spec get_controller(GRPC.Channel.t()) :: {:ok, Kujira.Usk.Controller.t()} | {:error, :not_found}
Fetches the Controller contract and its current config from the chain
get_margin(channel, address)
@spec get_margin(GRPC.Channel.t(), String.t()) :: {:ok, Kujira.Usk.Margin.t()} | {:error, :not_found}
Fetches the Margin contract and its current config from the chain
get_market(channel, address)
@spec get_market(GRPC.Channel.t(), String.t()) :: {:ok, Kujira.Usk.Market.t()} | {:error, :not_found}
Fetches the Market contract and its current config from the chain
list_margins(channel, code_ids \\ 'W')
@spec list_margins(GRPC.Channel.t(), [integer()]) :: {:ok, [Kujira.Usk.Margin.t()]} | {:error, GRPC.RPCError.t()}
Fetches all Margins
list_markets(channel, code_ids \\ 'I')
@spec list_markets(GRPC.Channel.t(), [integer()]) :: {:ok, [Kujira.Usk.Market.t()]} | {:error, GRPC.RPCError.t()}
Fetches all Markets
list_positions(channel, market)
@spec list_positions(GRPC.Channel.t(), Kujira.Usk.Market.t()) :: [ Kujira.Usk.Position.t() ]
Loads all positions via query_state_all, inheriting the same memoization
load_margin(channel, margin)
@spec load_margin(GRPC.Channel.t(), Kujira.Usk.Margin.t()) :: {:ok, Kujira.Usk.Margin.t()} | {:error, GRPC.RPCError.t()}
Loads the current Status into the Margin.market
load_market(channel, market)
@spec load_market(GRPC.Channel.t(), Kujira.Usk.Market.t()) :: {:ok, Kujira.Usk.Market.t()} | {:error, GRPC.RPCError.t()}
Loads the current Status into the Market
load_orca_market(channel, market, precision \\ 3)
@spec load_orca_market( GRPC.Channel.t(), Kujira.Usk.Market.t() | Kujira.Usk.Margin.t(), integer() | nil ) :: {:ok, Kujira.Orca.Market.t()} | {:error, GRPC.RPCError.t()}
Loads the Market into a format that Orca can consume for health reporting. Default Memoization to 10 mins
Can be used for both a Ghost.Market and Ghost.Margin.market, as they both use the same underlying state schema
load_position(channel, market, borrower)
@spec load_position(GRPC.Channel.t(), Kujira.Usk.Market.t(), String.t()) :: {:ok, Kujira.Usk.Position.t()} | {:error, GRPC.RPCError.t()}
Loads a Position by borrower address
stream_positions(channel, market)
@spec stream_positions(GRPC.Channel.t(), Kujira.Usk.Market.t()) :: %Stream{ accs: term(), done: term(), enum: term(), funs: term() }
Creates a lazy stream for fetching all positions for a Market