Dopex makes use of a number of existing protocols within its architecture:
1.
Sushiswap - To re-purchase assets for pools after each epoch.
2.
Chainlink - To retrieve last prices from external APIs.
3.
UMA - Synthetic derivatives minted on Dopex will be based on the UMA protocol.
The overall architecture and flow of smart contracts that make up the protocol is displayed below:
Dopex protocol architecture
Dopex
Main contract which contains a registry of all other contracts to be used by the Dopex protocol.
OptionPoolFactory
Factory contract to create option pool contracts and maintain a whitelist of option pool contracts.
OptionPool
Allows for passive participation in option liquidity pools for a specified base and quote asset pair (eg. ETH-USD) where users passively write options. Deposits (profits included) can be withdrawn at the end of an epoch for active pool participants.
OptionsFactory
Factory contract to create option contracts based on given base/quote asset, strike and expiry combination. This can only be called by the Broker contract.
OptionsContract
Generates doTokens (which are ERC20 tokens reperesenting the type of option) on request of the OptionPoolBroker. New options contracts can only be created by OptionsFactory.
OptionPoolBroker
Used for option purchases, exercises, swaps and liquidations across all option pools within the dopex protocol.
VolumePool
Pool that holds funds prior to a global epoch allowing depositors to access an instant x% discount (the exact % of discount remains variable and is decided by governance) on option purchases for that epoch across all dopex option pools.
Margin
Used to allow purchasers to borrow USD from margin pool deposits by using existing doTokens/rDPX as collateral. This would be used to leverage option positions in the future.
AssetSwapper
Asset swapper uses funds from option exercises and option sales in option pools to replenish base/quote assets required for option pools in whitelisted OptionPool contracts.
PriceOracle
Used to determine last price and implied volatility values via Chainlink adapters. These values are referred to throughout the protocol.
DPXToken
Vanilla ERC20 representing the Dopex Governance token, DPX.
RDPXToken
Vanilla ERC20 representing the Dopex rebate token, rDPX.
OptionPoolRebates
Used to calculate and distribute rebates as rDPX claimable after epochs for whitelisted option pools.
OptionPoolRewards
Reward contract which distributes DPX tokens for function calls and actions performed within the protocol based on the token emission curve for all whitelisted option pools.
Governance
Used to vote on and pass proposals for the Dopex protocol using DPX tokens.