Options
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()
link , 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
Before the user purchases, request the interfacebuy-sign
link After requesting the interface, the return parameterssignsignData
,price
,datetime
passed into the contract, and the user selects the option product to buy call/put
option 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.
2.Sell options
The user callsOptionV2->sellOption()
link to sell the user share back to the market maker, parameter list:
uint256 _orderNo sell option contract ID
uint256 _position sell quantity
uint256 _price selling price
uint256 _datetime Signature valid time
bytes calldata _signData signature data
Before selling, the user requests the interface sell-sign
link to obtain the parameters signData
,price
,datetime
;
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.
Last updated