Articles on: Blockchain and Tokenomics

Smart Contracts

The Morpher protocol is a set of smart contracts on the Ethereum blockchain empowering users to gain exposure to the price development of various markets. Supported markets range from traditional exchange-traded assets like stocks and commodities to alternative asset classes for which markets do not yet exist such as corporate fundamentals (e.g., price-earnings ratios) or Bitcoin transaction costs.

Users interact with the Morpher protocol via MPH tokens, a standard ERC20 tokens on the Ethereum blockchain issued by Morpher. Users select the number of MPH tokens they want to stake on the price development of an underlying market. If the market develops as predicted, new tokens are minted by the protocol and added to the user’s stake. If a prediction is incorrect, a portion of the staked tokens are burned. The process of staking assets on the blockchain is referred to as a Virtual Future. Virtual Futures replicate the economics of trading the Apple stock without trading the underlying.

Unlike regular Futures, Virtual Futures do not expire and track the price development of the underlying until the Virtual Future is either closed by the user or gets liquidated. Virtual Futures are always denominated and settled in MPH Tokens. Just like with regular trading, a user benefits from rising market prices by buying (going long) with their Virtual Future. The reverse is true for falling prices, users that created sell (short) positions benefit.

A key feature of the protocol is the lack of a counterparty. Traditional marketplaces like exchanges are platforms where buyers and sellers meet and transact via intermediaries like brokers. The Morpher protocol eliminates the need for intermediaries along with the need for a counterparty of a trade.

Check out our Whitepaper to learn more about the protocol architecture.


Smart Contracts



The Morpher Protocol consists of six main smart contracts and several auxiliary contracts that are deployed both on Ethereum and the Morpher sidechain.

MorpherToken: the basic ERC20 token functionality (transfer tokens, approve transfer, token balance, etc.).
MorpherState: the smart contract that contains the eternal storage of the Protocol (i.e. all balances, trades, and stakes).
MorpherOracle: an oracle smart contract.
MorpherTradeEngine: a smart contract that computes the state transitions (staking/unstaking/minting/burning).
MorpherGovernance: a smart contract that allows for on-chain governance of the Protocol.
MorpherBridge: a smart contract that allows the side chain operator to write the root hash of a Merkle tree containing the complete state of the side chain to the main chain.

The Sidechain is linked with Ethereum by updating its merkelized state on Ethereum in periodic intervals (Ethereum Plasma scaling approach), see MorpherBridge.

MorpherToken


Sidechain: 0xC44628734a9432a3DAA302E11AfbdFa8361424A5
Mainchain: 0x6369c3DadfC00054A42BA8B2c09c48131dd4Aa38
The MorpherToken contract provides the ERC20 token functionality for Morpher’s MPH token. It is based on the ERC20 token from OpenZeppelin. Kudos to OpenZeppelin for their contributions to the development of the Ethereum ecosystem!

MPH token cannot be transferred between accounts on the sidechain. MPH token can be burned by their owner on both chains.

MorpherState


Sidechain: 0xB4881186b9E52F8BD6EC5F19708450cE57b24370
Mainchain: 0x1f426C51F0Ef7655A6f4c3Eb58017d2F1c381bfF
MorpherState is the eternal storage of the Morpher Protocol. Anyone can read from MorpherState, but only explicitly whitelisted addresses are eligible to write. MorpherState saves token balances, Virtual Futures, and relevant protocol addresses and roles. The protocol is designed to be upgradable via separation of storage and logic. MorpherState contains the protocol storage, and the other contracts contai the logic link to MorpherState and can be upgraded to newer versions without losing the protocol state.

MorpherOracle


Sidechain: 0x434C8915D68f98F956A6Fd5d7e0cA6a2b6516590
Mainchain: 0x3CBC7e439FD0A98182622136d38EBa03Aac17A72
Via the MorpherOracle contract, users can create and close Virtual Futures. The Oracle records the user’s orders for creating or closing Virtual Futures and fires an associated event that is read by the Oracle Operator. The Operator requests the latest market data for an order from a trusted source and signs a callback function to write the market data on the blockchain, where the order is subsequently processed by MorpherTradeEngine.

MorpherTradeEngine


Sidechain: 0x9de9773A77a9b51330736E73429622CC32F51926
Mainchain: 0xB4881186b9E52F8BD6EC5F19708450cE57b24370
MorpherTradeEngine computes transitions between MPH token and Virtual Futures. Upon creation of a Virtual Future, MorpherTradeEngine calculates how many units the Virtual Future consists of, its liquidation price, and creates it in MorpherState. Upon closing a Virtual Future, MorpherTradeEngine calculates its current value in MPH token, mints the MPH token, and deletes the Virtual Future from MorpherState.

MorpherGovernance


Mainchain: 0x9de9773a77a9b51330736e73429622cc32f51926
MorpherGovernance lets protocol validators vote on the MorpherOracle and the protocol Administrator. To become a validator, it is required to lock MPH token in the MorpherGovernance contract. The first validator locks 10m MPH token, the second validator 20m MPH token, and so forth. It becomes progressively harder to become a validator. When stepping down, validators receive 99% of their staked token back, while 1% is burned. Voting for MorpherOracle allows a simple majority of validators to replace the protocol oracle with another smart contract. By voting for the administrator, a simple majority of validators can also replace the Protocol Administrator address.

MorpherBridge


Mainchain: 0xC44628734a9432a3DAA302E11AfbdFa8361424A5
MorpherBridge moves token between the Sidechain and Ethereum mainchain. Token can be transferred by burning them on one chain and claiming them on the other. Both chains track the number of destroyed/claimed token on both chains. All positions and balances of the sidechain are merkelized, and the root hash of the Merkle Tree is written to Ethereum in periodic intervals (initially: 1 hour). Users can use the root hash to prove the existence of their positions on sidechain. This allows full recovery of positions on Ethereum if the sidechain ceases to operate for over 72 hours.

Adminstrator Role


Sidechain: 0x32deB065F8f4863BAc2c0a8931aAE8Ae46a88E67
Mainchain (temporary): 0x082Bc2c3697f6E84A876613A2bde873D904e0256
The Administrator of the Morpher Protocol is an account that can be voted for by MorpherGovernance. The Administrator has the power to enable/disable markets for trading, to set the maximum allowed leverage, and to pause token transfers.

Security and Audits



Several security audits have been performed on the Morpher Protocol before the smart contracts were deployed to production on June 4, 2020. The smart contracts were thoroughly examined for their robustness against known exploits like contract reentrancy (dForce and TheDAO hack) and the delegatecall exploit (Parity Multisig) by third-party auditors. The most recent audit was done by Capacity.at.

Security Audit: Github

Updated on: 27/07/2021

Was this article helpful?

Share your feedback

Cancel

Thank you!