Rujira.Fin.Pair (rujira_ex v0.0.4)

Copy Markdown View Source

Trading pair for the FIN protocol.

Struct, construction, and queries. Use Rujira.Fin as the public API.

Summary

Functions

Memoized lookup of the preferred base denom for a ticker.

Memoized pair lookup by base + quote denom.

Memoized list of all configured FIN pairs.

Types

t()

@type t() :: %Rujira.Fin.Pair{
  address: String.t() | nil,
  book: :not_loaded | Rujira.Fin.Book.t(),
  fee_address: String.t() | nil,
  fee_maker: Decimal.t(),
  fee_taker: Decimal.t(),
  id: String.t() | nil,
  market_makers: [String.t()],
  oracle_base: Rujira.Thorchain.Oracle.t() | nil,
  oracle_quote: Rujira.Thorchain.Oracle.t() | nil,
  tick: integer(),
  token_base: String.t() | nil,
  token_quote: String.t() | nil
}

Functions

denom_for_ticker(t1)

@spec denom_for_ticker(String.t()) :: {:ok, String.t()} | {:error, :not_found}

Memoized lookup of the preferred base denom for a ticker.

Invalidate with Memoize.invalidate(Rujira.Fin.Pair, :denom_for_ticker, [ticker]).

find_by_denoms(t1, t2)

@spec find_by_denoms(String.t(), String.t()) :: {:ok, t()} | {:error, term()}

Memoized pair lookup by base + quote denom.

Invalidate with Memoize.invalidate(Rujira.Fin.Pair, :find_by_denoms, [base, quote]).

find_stable(base_denom)

@spec find_stable(String.t()) :: {:ok, t()} | {:error, term()}

from_id(address)

@spec from_id(String.t()) :: {:ok, t()} | {:error, term()}

get(address)

@spec get(String.t()) :: {:ok, t()} | {:error, term()}

list()

@spec list() :: {:ok, [t()]} | {:error, term()}

Memoized list of all configured FIN pairs.

Invalidate with Memoize.invalidate(Rujira.Fin.Pair, :list).

new(attrs)

@spec new(map()) :: {:ok, t()} | {:error, term()}

ticker_id!(pair)

@spec ticker_id!(t()) :: String.t()

tvl(address)

@spec tvl(String.t()) :: {:ok, non_neg_integer()} | {:error, term()}