ClearDAO FAQ
  • Getting Started
    • How it Works
    • Product
    • Roadmap
    • Team
    • ClearDAO Token
    • ClearDAO Token Bridge
    • Contact
  • Development Resources
    • SDK
      • ClearDAO Developer Guide
      • Deploy Contracts
        • Options and Notes
          • Quick Start
          • Configure Contract
          • Contract Upgrade
          • Contract Address
        • TRS
      • Configure Contract Parameters
      • Interact With Contracts
        • Options
        • Notes
        • TRS
        • CDS
          • README
          • CDS Buyer
          • Challenger
          • Liquidity Provider
          • Ticket
          • Ticket Market
          • Ticket Sale
          • Seller
      • Contract Reference
        • Oracle
        • Index Contract
        • Option Contract
        • Market Maker Contract
        • Note Contract
      • APIs
        • CDS
          • Config
          • Ticket
          • Ticket Sale
          • Transaction
          • CDS Market
          • Issue CDS
          • CDS Category
          • Ticket Market
        • Options and Notes
          • Configure
          • Price
          • User
          • Index
          • Option Parameter Configuration
          • Faucet
          • Market Maker
        • TRS
        • CLEARIndex
    • Barrier Options
    • NFT Marketplace
    • ClearIndex
  • Governance
    • CLH Staking Module
Powered by GitBook
On this page
  • Market Maker
  • 1.Deposit/withdraw the margin
  • 2.Liquidate the knockout orders
  • 3.Liquidate orders due to exercise
  • User
  • 1. Buy options
  • 2.Sell options
  • 3. Exercise options at maturity
  • 4.Knock out
  1. Development Resources
  2. SDK
  3. Interact With Contracts

Options

PreviousInteract With ContractsNextNotes

Last updated 1 year ago

Market Maker

1.Deposit/withdraw the margin

Calling OptionOptionV2Maker->makerDeposit method, market makers can deposit margin. makerWithdraw for market makers to withdraw the unfrozen margin。

2.Liquidate the knockout orders

For orders that have been knocked out, both users and market maker can execute OptionV2->makerKnockout settle funds to the market maker. (This operation should be performed by the platform). When the user’s share is knocked out, the pledged margin is returned to the market maker’s margin balance, and the user’s premium is issued to the market maker’s margin balance in proportion to the pledged margin.

3.Liquidate orders due to exercise

For orders that have expired, any user can execute OptionV2->makerExercise to settle funds to the market maker. (This operation should be performed by the platform) When the option expires and is liquidated, if the user makes a profit, the pledged margin of the market maker will be transferred to the user's account. If the market maker makes a profit, the margin pledged by the market maker will be returned to the margin balance of the market maker, and the user's premiums will be issued to the margin balance of the market maker in proportion to the pledged margin.

[TOC]

User

1. Buy options

The user calls OptionV2->buyOption() , requesting parameters:

  • uint256 _indexNo index ID,

  • uint8 _poolId option pool ID,

  • uint256 _position The position of options purchased,,

  • bool _isCall call:true,put:false,

  • uint256 _price option purchase price,

  • uint256 _datetime signature valid time,

  • bytes calldata _signData signature data

2.Sell options

  • uint256 _orderNo sell option contract ID

  • uint256 _position sell quantity

  • uint256 _price selling price

  • uint256 _datetime Signature valid time

  • bytes calldata _signData signature data

Close price rule

_price is calculated by the option pricing formula, and the final selling price needs to be multiplied by the OptionV2->sellPriceRate rate. The pledged margin is returned to the market maker's margin balance.

3. Exercise options at maturity

The user callsOptionV2->userExercise()to calculate the user profit and obtain it. If the share is a call option, the profit =position * (exercise_price-open_price), if it is a put option, the profit = position (exercise_price-open_price). The user's profit will be issued to the user in real time, and the market maker will liquidate through OptionV2->makerExercise()

4.Knock out

The user calls OptionV2->userKnockOut() for knockout liquidation. If OptionV2->knockoutRebate>0, user profit = buy_price * knockoutRebate /1.

Before the user purchases, request the interfacebuy-sign After requesting the interface, the return parameterssignsignData ,price ,datetime passed into the contract, and the user selects the option product to buy call/putoption to obtain index_no, poolId. _payToken, which needs to be configured inaallowPayToken, and _signData obtained through the interface/api/defi/option/order/buy-sign link . Please note that the signature is only valid within 2 minutes, after it is generated.

The user callsOptionV2->sellOption() to sell the user share back to the market maker, parameter list:

Before selling, the user requests the interface sell-sign to obtain the parameters signData ,price ,datetime ;

link
link
link
link