Skip to content

Architecture

Thomas Spofford edited this page May 22, 2020 · 8 revisions

Mix aspires to quickly integrate new protocols as they emerge, and quickly support changes to existing protocols as they develop.

How to reduce the amount of work to add new integrations?

  • Have a markup / config file that can define as much as possible, without over-engineering
  • New integrations should require no or minimal changes to shared files - isolate the new content to the extent possible
  • Re-use common UI for different protocols with the same 'action'. All integrated DeFi/Mixer services will share a common design language

A helpful resource: Zerion DeFi SDK

Blog Explainer

Zerions' general approach is to have a standardized way to interpret value within DeFi protocols and complex derivative tokens, via on-chain reader contracts. It also features an on-chain registry of protocols and assets, that maintains some metadata.

Anyone can create a token adapter for their protocol and anyone can maintain their own registry for their wallet or dApp.

Standardizing the way complex derivatives get integrated across wallets and protocols means that you can easily fetch key information such as user balance, protocol metadata, derivative token metadata, etc. Doing this is as easy as running a single function on the Registry.

It's fundamentally about smart contracts called Adapters that provide the standard interface to getting balances of assets & debt within protocols, as well as for interpreting the value of complex derivative tokens.

ProtocolAdapters have these functions: TokenAdapters have these functions: The Registry has this data:

This very much aligns with Mix' architecture goal. We'll utilize the DeFi SDK value reading capabilities and expand upon it's 'Adapter' paradigm to provide a standard interface for write actions.

Each protocol adapter will have it's functionality mapped to standardized actions like invest(), withdraw(), etc..

Widgets

Mix functionality is grouped into 'Widgets'. Most added protocols & assets should be automatically useable with widgets it is compatible with with just the config file & adapter.

Portfolio Widget

Earn Interest Widget

The user will simply select an asset + protocol, and the UI component will perform the correct actions based on the appropriate ProtocolAdapter.

Mix Assets Widget

Withdraw Widget?

dxDAO: Decentralized Config

The Zerion SDK on-chain 'metadata registry' could be expanded to essentially serve as a TCR for supported protocols and tokens within Mix. This is an alternative to just updating a config file and pushing a new version of the website out.

The dxDAO may be interested in this approach so that its' governance mechanism can explicitly give approval to adding protocols and assets. This could be also just be done via signal proposals, and have the developers add to normal config files to execute the DAO's will.

Software updates (pushing new website versions) will still need to happen in any case.

Clone this wiki locally