Architecture

Brief overview of every component that is required for the Optio marketplace to work.

Optio operates on the cutting edge StarkNet environment, a leading ZK-Rollup for Ethereum, and is comprised of a number of smart contracts that operate together to match traders with LPs to provide traders with the ability to both buy and sell options to the Optio, as well as providing LPs a delta hedged platform to provide liquidity for both collateral and premiums for the options traded.

Protocol Contracts

Optio Controller

modules/core

Optio Controller is a special actor in the system that has the authority to control all activities within the Optio ecosystem, including but not limited to:

  • Minting and burning tokens of different types (ERC20, ERC721, ERC1155)

  • Adding and updating parameters for other components of the system

  • Acting as a required proxy for conducting certain actions (e.g. matching logic)

Pricer

modules/pricer

The pricer contract implements mathematical functions related to the computation of option prices using the Black-Scholes pricing model. It implements both core mathematical functions (e.g. sqrt) as well as functions specific to Black-Scholes (d1d2, optionPrices, delta, vega). Beyond that, it also listens to pricing requests coming in from the Optio Controller.

Vault

modules/core/vaults

The Vault contract allows the system to deposit quote assets to receive special Optio type tokens which represent different capabilities within the Optio ecosystem according to the context. These funds are used both as collateral for the options and for hedging risks.

  • Partially follows ERC-4626 Tokenized Vault standard for lowering the integration efforts.

  • Contains the logic for settling options.

Pool

modules/core/pools

The Pool contract is acting similar to Vaults with the only difference that it holds a user's collateral before the user entering into any obligations and also doesn't participate in settling options.

Why separate Vaults and Pools?

— They serve different purposes. The separation between them is done intentionally to not affect the accounting and settling, since initially there is no trade yet, thus no seller’s obligation yet, and LP share tokens in contrast represent only obligations.

Libraries

TWAP

The TWAP is constructed by reading the cumulative price at the beginning and at the end of the desired interval. The difference in this cumulative price can then be divided by the length of the interval to create a TWAP for that period. You can learn more about TWAP algorithm here.

Last updated