Configure Contract Parameters

Smart contract

CLEAR smart contracts are mainly composed of option contracts and fund contracts. Option contracts are composed of oracle contracts, main option contracts, and index contracts, which are responsible for the option trading module. The fund manager contracts are responsible for the fund trading module.

Oracle contract oracle

Reference document

The oracle contract integrates chainlink,and bandprotoco ltwo oracles, and configures the price influence coefficient according to a certain ratio to ensure data accuracy and stability. Adjustable parameters:

  • (chainLinkWeight,bandWeight,)oracle ratio The platform administrator account calls thesetWeightmethod to modify the ratio. The default ratio is 4:4:2.

  • tokenSetList[TOKEN_ADDRESS]token oracle information The tokens that the index requires need to be configured with the information required by the oracle through theupdateTokenSetbefore adding an index.

chainlink Oracle link:https://docs.chain.link/docs/tutorials/ bandprotocol Oracle link:https://docs.bandchain.org/technical-specifications/owasm.html#

Index contract OptionIndex

Reference document

An index contract is a contract that provides the price of an option subject. The authorized address can specify several tokens to generate a new index according to a specified ratio, and specify the starting value. The tokens must be added in the oracle contract. Index price = (token price 1 circulation quantity 1 ratio 1 + token price 2 circulation quantity 2 ratio 2...)/K. The token price is obtained through the oracle contract to ensure fairness. The circulating quantity is updated once a year and only takes effect for the later generated index. K is calculated based on the formula and the initial value. After an index is generated, the K value cannot be modified.

  • indexList[INDEX_NO] index Before adding the index, make sure that the tokens have been configured in the oracle.

Main option contract OptionV2

Reference document

Option contracts are responsible for users to trade, record and exercise options. Each index corresponds to 16 option pools automatically, and the exercise period and knockout ratio of each option pool are fixed. After the market maker deposits funds into the fund pool, users can purchase options. The index price at the time of purchasing the option is the exercise price after the end.

  • knockoutRebateRebate ratio to the user when knocking out Rebate amount =knockoutRebate / 10000*open_price

  • signersigner address

  • feeReceiver Fee receiver address

  • sellPriceRate When selling, the discount based on the option price formula,selling price=sell_price*sellPriceRate/10000

  • allowPayToken Underlying tokens paid by users and market makers

  • userRate[5] User fees userRate[0]:fees when the user buys the call option userRate[1]:fees when the user buys the put option userRate[2]:fees when the user sells the call option userRate[3]:fees when the user sells the put option userRate[4]:fees when the user exercises options

Market maker contract OptionV2Maker OptionV2Maker

Reference document

The market maker contract manages the list of market maker addresses, and the market maker deposits funds in the fund pool. The margin corresponding to each order traded by the user is subtracted from the fund pool. The market maker funds in the existing option pool allocate margin according to the fund balance. After the order ends, profit will be returned to the market maker and the returned profit is placed in the fund pool. rate market maker bid fee

Fund contract

Reference document

Fund contract manages fund manager whitelist. After the fund manager of the whitelist issues fund products, users can subscribe after the fund product enters the purchase period, and users can redeem the subscribed funds at any time before the closed period (the commission cannot be returned). When the closed period started, the fund manager can use the funds to trade option products or invest in compounds,venus or Dforce (based on different network). After maturity, the fund manager will withdraw all investments will , and the fund users will be redeemed all their shares based on the fund's profit and loss.

  • cycleDay[3] expiration date, the default number is 30, 60, 9030,60,90

  • allowPayToken[TOKEN] Optional underlying payment token, at least one

Last updated