Architecture

๐Ÿ—๏ธ The mStable protocol is built with a focus on security, modularity and composibility

How does it all work?

The protocol exists as open-access Smart Contracts on the Ethereum blockchain. The architecture is reasonably straightforward (shown in the below depiction of Phase 3), and consists of a number of modules, some of which are upgradable and some of which are completely immutable. Each module provides useful interfaces or support to each other, ultimately facilitating the protection and operation of the mAsset(s).

Phase 3 System Modules

What are all these modules?

mStable

  • Nexus (Immutable): Acts as a system registry from which each module address can be read. Governance has the ability to upgrade these addresses, or lock them into place.

  • Manager: Acts as a gateway, facilitating communication and action throughout the system, particularly during Re-collateralisation.

  • Recol: This is the Re-collateralisation contract, and is responsible for hosting the two-phased auction process described here.

  • OracleHub: The Oracle implementation

  • Systok (Immutable): MTA a.k.a Meta a.k.a System token is used throughout the system in redemption fees, re-collateralisation and staking. This is a custom MiniMe token to support the Aragon toolkit in maturity.

  • Masset (Immutable): This is the mAsset contract, of which there will be multiple - one for each mAsset.

Governor

See Governance Roadmapโ€‹

How do we upgrade components?

Upgrading of components, while simply updating an address, should not be taken lightly. In addition to the comprehensive measures put in place by the proposed Governance implementations, we employ a multitude of processes to ensure that upgrades go smoothly and the system remains fully robust.

โฐ Delayed Upgrades

Module upgrades through the Nexus come in a 2 step process. Step 1 is a successful governance proposal to upgrade the module. In order to confirm this upgrade the system must wait a predefined length of time (circa 1 week). This allows users to opt-out of the upgrade, should they no longer wish to hold mAssets and/or MTA. Only after this time has elapsed can the upgrade be locked in.

๐Ÿค 2-way Handshakes

Each upgrade to Governance will require a two way handshake, in addition to the above Delayed upgrade. This makes absolutely certain that we are passing the baton to the correct address. A two way handshake is basically a confirmation that both parties (Governance modules) have opted in to swap permissions, shown by a transaction to propose and consequently accept the new role as Governor.

โ›ท๏ธ Testnet dry runs

Every system upgrade will first be simulated on the Ethereum testnet to ensure that the resulting state acts as it should.

Locking modules

System modules can be locked for perpetuity, should the current implementation be deemed final. This allows us to gradually transition into a completely immutable system, over time.

How are decisions made?

The decisions are made according to project timelines, and executed by the current governance implementation. See the Governance roadmap for more specific details.

Is mStable compatible with my Smart Contract?

Yes, mStable Smart Contracts will be permissionless, with the interfaces exposed and well documented, and the code open sourced. Continuing in the spirit of DeFi, our contracts are composable and so leave open the doorway to innovation and integrations. We encourage and facilitate integrations both on-chain and off-chain.

Where can I see the code?

Upon Mainnet release, code will be accessible on our Github and verified on Etherscan.

Got a question about the code? Check out who wrote it or talk to us directly on Discorโ€‹โ€‹dโ€‹