Concentrated liquidity position (range) for the FIN protocol.
Struct, construction, and queries. Use Rujira.Fin as the public API.
Summary
Functions
Parses a range from a contract query response.
Memoized fetch of a single range by idx on a contract.
Memoized full fetch of ranges on a contract, optionally filtered by owner.
Types
@type t() :: %Rujira.Fin.Range{ ask: Decimal.t(), base: Rujira.Amount.t(), bid: Decimal.t(), fee: Decimal.t(), fees_base: Rujira.Amount.t(), fees_quote: Rujira.Amount.t(), high: Decimal.t(), id: String.t() | nil, idx: integer() | nil, low: Decimal.t(), owner: String.t() | nil, pair: String.t() | nil, price: Decimal.t(), quote: Rujira.Amount.t(), skew: Decimal.t(), spread: Decimal.t(), value_usd: Rujira.Amount.t() }
Functions
@spec list(Rujira.Fin.Pair.t(), String.t() | nil, integer() | nil) :: {:ok, [t()]} | {:error, term()}
@spec load(Rujira.Fin.Pair.t(), integer()) :: {:ok, t()} | {:error, term()}
@spec new(Rujira.Fin.Pair.t(), map()) :: {:ok, t()} | {:error, term()}
Parses a range from a contract query response.
When called with a string address and integer index, creates a minimal range struct for subscription edge responses.
Memoized fetch of a single range by idx on a contract.
Invalidate with Memoize.invalidate(Rujira.Fin.Range, :query, [address, idx]).
Memoized full fetch of ranges on a contract, optionally filtered by owner.
Returns the flat list of raw range maps from the chain, paginated internally.
Invalidate with Memoize.invalidate(Rujira.Fin.Range, :query_ranges, [contract, owner]).
@spec total_tvl() :: {:ok, non_neg_integer()} | {:error, term()}
@spec tvl(Rujira.Fin.Pair.t()) :: {:ok, non_neg_integer()} | {:error, term()}