View Source Hyperliquid.Api.Exchange.UserOutcome (hyperliquid v0.3.1)
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 collateralmerge_outcome/3- burn matched YES/NO pairs of an outcome back into collateralmerge_question/3- burn one token of every named outcome of a question back into collateralnegate_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
@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 identifieramount: Amount as a decimal string, ornilfor the maximum availableopts: Optional parameters
Returns
{:ok, response}/{:error, term()}
Examples
{:ok, result} = UserOutcome.merge_outcome(7, "0.5")
{:ok, result} = UserOutcome.merge_outcome(7, nil)
@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 identifieramount: Amount as a decimal string, ornilfor the maximum availableopts: Optional parameters
Returns
{:ok, response}/{:error, term()}
Examples
{:ok, result} = UserOutcome.merge_question(3, "1")
@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 identifieroutcome: Named outcome identifier within that questionamount: Amount as a decimal stringopts: Optional parameters
Returns
{:ok, response}/{:error, term()}
Examples
{:ok, result} = UserOutcome.negate_outcome(3, 7, "1")
@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 identifieramount: Amount as a decimal stringopts: Optional parameters
Returns
{:ok, response}/{:error, term()}
Examples
{:ok, result} = UserOutcome.split_outcome(7, "1")