Smart contract structure within the Dopex platform
Dopex makes use of a number of existing protocols within its architecture:
Sushiswap - To re-purchase assets for pools after each epoch.
Chainlink - To retrieve last prices from external APIs.
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
Main contract which contains a registry of all other contracts to be used by the Dopex protocol.
Factory contract to create option pool contracts and maintain a whitelist of option pool contracts.
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.
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.
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.
Used for option purchases, exercises, swaps and liquidations across all option pools within the dopex protocol.
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.
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.
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.
Used to determine last price and implied volatility values via Chainlink adapters. These values are referred to throughout the protocol.
Vanilla ERC20 representing the Dopex Governance token, DPX.
Vanilla ERC20 representing the Dopex rebate token, rDPX.
Used to calculate and distribute rebates as rDPX claimable after epochs for whitelisted option pools.
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.
Used to vote on and pass proposals for the Dopex protocol using DPX tokens.