Smart contract structure within the Dopex platform
Dopex makes use of a number of existing protocols within it's architecture:
Uniswap - To re-purchase assets for pools after each epoch.
Chainlink - To retrieve last prices and IV data 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.
Stores collateral and allows for exercising of options by depositing underlying. Generates doTokens on addition of collateral. 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 5% discount 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.
Used to generate whitelisted synths using DPX tokens as collateral. Contains mint and generation mechanisms by utilizing the UMA 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.