View Source Hyperliquid.Api.Exchange.UserOutcome (hyperliquid v0.3.0)

Split, merge and negate HIP-4 prediction market outcome positions.

The four variants are:

  • split_outcome/3 - mint one YES and one NO token of an outcome by locking collateral
  • merge_outcome/3 - burn matched YES/NO pairs of an outcome back into collateral
  • merge_question/3 - burn one token of every named outcome of a question back into collateral
  • negate_outcome/4 - convert a named outcome's NO token into the remaining named outcomes of its question

Amounts are decimal strings. A nil amount on the merge variants means "as much as possible".

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/hip-4-deployer-actions

Summary

Functions

Burn matched YES/NO pairs of outcome back into collateral.

Burn one token of every named outcome of question back into collateral.

Convert a named outcome's NO token into the remaining named outcomes of its question.

Mint one YES and one NO token of outcome by locking collateral.

Functions

Link to this function

merge_outcome(outcome, amount \\ nil, opts \\ [])

View Source
@spec merge_outcome(non_neg_integer(), String.t() | nil, keyword()) ::
  {:ok, map()} | {:error, term()}

Burn matched YES/NO pairs of outcome back into collateral.

Parameters

  • outcome: Outcome identifier
  • amount: Amount as a decimal string, or nil for the maximum available
  • opts: Optional parameters

Returns

  • {:ok, response} / {:error, term()}

Examples

{:ok, result} = UserOutcome.merge_outcome(7, "0.5")
{:ok, result} = UserOutcome.merge_outcome(7, nil)
Link to this function

merge_question(question, amount \\ nil, opts \\ [])

View Source
@spec merge_question(non_neg_integer(), String.t() | nil, keyword()) ::
  {:ok, map()} | {:error, term()}

Burn one token of every named outcome of question back into collateral.

Parameters

  • question: Question identifier
  • amount: Amount as a decimal string, or nil for the maximum available
  • opts: Optional parameters

Returns

  • {:ok, response} / {:error, term()}

Examples

{:ok, result} = UserOutcome.merge_question(3, "1")
Link to this function

negate_outcome(question, outcome, amount, opts \\ [])

View Source
@spec negate_outcome(non_neg_integer(), non_neg_integer(), String.t(), keyword()) ::
  {:ok, map()} | {:error, term()}

Convert a named outcome's NO token into the remaining named outcomes of its question.

Parameters

  • question: Question identifier
  • outcome: Named outcome identifier within that question
  • amount: Amount as a decimal string
  • opts: Optional parameters

Returns

  • {:ok, response} / {:error, term()}

Examples

{:ok, result} = UserOutcome.negate_outcome(3, 7, "1")
Link to this function

split_outcome(outcome, amount, opts \\ [])

View Source
@spec split_outcome(non_neg_integer(), String.t(), keyword()) ::
  {:ok, map()} | {:error, term()}

Mint one YES and one NO token of outcome by locking collateral.

Parameters

  • outcome: Outcome identifier
  • amount: Amount as a decimal string
  • opts: Optional parameters

Returns

  • {:ok, response} / {:error, term()}

Examples

{:ok, result} = UserOutcome.split_outcome(7, "1")