Kujira.Bow (kujira v0.1.22)

Kujira's on-chain Market Maker for FIN.

Summary

Functions

Fetches the Leverage contract and its current config from the chain.

Fetches an XYK algorithm pool and its current config from the chain.

Fetches all Leverage markets. This will only change when config changes or new markets are added. It's Memoized, clearing every 24h.

Loads the current pool status onto the pool

Functions

Link to this function

get_leverage(channel, address)

@spec get_leverage(Channel.t(), String.t()) ::
  {:ok, Kujira.Bow.Leverage.t()} | {:error, :not_found}

Fetches the Leverage contract and its current config from the chain.

Config is very very rarely changed, if ever, and so this function is Memoized by default.

Manually clear with Kujira.Bow.invalidate(:get_leverage, address)

Link to this function

get_pool_xyk(channel, address)

@spec get_pool_xyk(Channel.t(), String.t()) ::
  {:ok, Kujira.Bow.Leverage.t()} | {:error, :not_found}

Fetches an XYK algorithm pool and its current config from the chain.

Config is very very rarely changed, if ever, and so this function is Memoized by default.

Manually clear with Kujira.Bow.invalidate(:get_pool_xyk, address)

Link to this function

list_leverage(channel, code_ids \\ [188])

@spec list_leverage(GRPC.Channel.t(), [integer()]) ::
  {:ok, [Kujira.Bow.Leverage.t()]} | {:error, GRPC.RPCError.t()}

Fetches all Leverage markets. This will only change when config changes or new markets are added. It's Memoized, clearing every 24h.

Manually clear with Kujira.Bow.invalidate(:list_leverage)

Link to this function

load_orca_market(channel, market, precision \\ 3)

@spec load_orca_market(Channel.t(), Kujira.Bow.Leverage.t(), integer() | nil) ::
  {:ok, Kujira.Orca.Market.t()} | {:error, GRPC.RPCError.t()}

WIP

Loads the Leverage Market into a format that Orca can consume for health reporting. Default Memoization to 10 mins

Manually clear with Kujira.Bow.invalidate(:load_orca_market, market)

Link to this function

load_pool(channel, pool)

@spec load_pool(Channel.t(), Kujira.Bow.Xyk.t()) ::
  {:ok, Kujira.Bow.Xyk.t()} | {:error, :not_found}
@spec load_pool(Channel.t(), Kujira.Bow.Stable.t()) ::
  {:ok, Kujira.Bow.Stable.t()} | {:error, :not_found}
@spec load_pool(Channel.t(), Kujira.Bow.Lsd.t()) ::
  {:ok, Kujira.Bow.Lsd.t()} | {:error, :not_found}

Loads the current pool status onto the pool

It's Memoized, clearing every 2 seconds.

Manually clear with Kujira.Bow.invalidate(:load_pool, address)