Sell Trades

Purpose

The Sell function allows users to sell their shares of a specific outcome in exchange for a selected coin. The AMM dynamically adjusts the price based on the remaining pool liquidity.

Workflow

  1. Input Parameters:

  • Market ID.

  • Outcome to sell.

  • Number of shares the user wants to sell.

  1. Price Calculation:

  • The AMM calculates the amount of collateral the user will receive for the shares sold

  1. pool Update:

  • Shares are added back to the pool.

  • Collateral is removed to maintain the constant product.

  1. Collateral Transfer:

  • The calculated collateral is transferred to the user.

  1. Fee Deduction:

  • A small fee is deducted and distributed to liquidity providers or the platform treasury.

Last updated