Contracts Overview

A bright overview of how the Morpho protocol's contracts interact with each others.
The Morpho protocol contracts source code is publicly available on the morpho-core-v1 GitHub repository.
Morpho protocol is designed at its core with a set of contracts acting as a proxy and communicating with upgradeable pieces of logic via calls (to implementation contracts) and delegate calls (to delegation contracts). Here is a brief overview of Morpho protocol's contracts interactions:
Morpho protocol's contracts interactions overview
The storage layout located at Morpho's main contract Morpho is defined in the MorphoStorage contract and is used by every delegation contract.
Having this overview in mind, Morpho protocol contracts typically fall under the following 4 main categories:
  • Core features (supply, borrow, withdraw, repay, liquidate)
  • Underlying logic (peer-to-peer matching, positions management)
  • Peripheral contracts (lending/borrowing incentives, underlying protocol rewards management)
  • Miscellaneous (maths, solidity calls, types)

Core features contracts

Morpho Protocol exposes its main entry-points (supply, borrow, withdraw, repay, liquidate, claimRewards) via this master contract, which delegates logic via delegatecall (but keeps the storage located at the master contract). This allows to overcome the EVM's contract size limit easily reached with a proxy-based implementation.


Acts as an address registry which allows the Morpho DAO to update delegation & implementation contracts (thus the logic they contain) and adjusts Morpho's protocol-wise parameters as well as each individual market parameters, through a governance-based mechanism.


Computes and updates high-level information (such as supply & borrow exchange rates via calls to the InterestRatesManager, current & maximum debt value allowed, among others) used in the main entry-points to prevent unauthorized interactions with the protocol (such as asking for an under-collateralized loan).


Handles the storage layout used by the main Morpho contract's implementation. Also used by delegation contracts such as PositionsManager, to characterize the execution context's storage layout. By defining state variables in a unique place, it also allows to manage storage issues related to inheritance & upgrades described here.

Underlying logic

Delegation contract managing the logic of Morpho's main entry-points (supply, borrow, withdraw, repay, liquidate), assuming that their requirements have been successfully checked upstream by Morpho's main contract. Inherits from MatchingEngine and MorphoStorage to respectively apply the matching logic and store/update user positions.
Implementation contract handling the logic behind Morpho's peer-to-peer matching, which essentially is a set of on-chain priority queues:
  • Matches & unmatches a borrower's asked liquidity with the maximum number of suppliers' given liquidity, within a gas consumption constraint (functions _matchSuppliers and _unmatchSuppliers).
  • Matches & unmatches a supplier's given liquidity with the maximum number of borrowers' asked liquidity, within a gas consumption constraint (functions _matchBorrowers and _unmatchBorrowers).
Delegation contract responsible for the computation of Morpho's interest rates model. It allows controlling rates to manage the delta mechanism as well as the reserve factor.

Peripheral contracts

Implementation contract keeping track of Morpho's users' rewards accrued from the underlying protocol pools' rewards.
Independent contract storing the Merkle root of the rewards distribution Merkle tree updated every epoch (1 month at the beginning) by the Morpho DAO. Users can submit and verify proof of their claimable rewards accrued by using the Morpho protocol.
Implementation contract allowing users to trade their reward tokens for Morpho tokens, with a premium amount set by governance.


Library used to implement the data structure managing the priority queue used in Morpho's matching engine. It will be replaced by a modified heap in later versions of Morpho to improve efficiency.
Simplified library used to reproduce Compound's fixed-point arithmetic (using WAD = 1e18 as the unit, giving 18 decimals precision). Enables precise decimal calculations based on the EVM's integer arithmetic.
Lightweight library used to bubble up error messages of a delegatecall from the callee contract to the caller contract. It is mainly based on the OpenZeppelin’s library.
Library containing all the struct definitions used by the Morpho protocol.