Skip to main content

Getting Started

This guide helps you integrate Morpho Vaults into your project.

The onchain scripts are written in Solidity, and based on the Foundry toolkit. The offchain version is written in Typescript, and based on ethers-v6 library.

Installation

forge install morpho-org/metamorpho

Examples

An educational repository has been released for integrators and users:

Morpho Vaults Snippets Repository

It shows how to properly call the different Morpho Vaults functions from your own smart contract according to the operations you want to perform.

/// SETUP
...
// --- VIEW FUNCTIONS ---

/// @notice Returns the total assets deposited into a Morpho `vault`.
/// @param vault The address of the Morpho Vault.
function totalDepositVault(address vault) public view returns (uint256 totalAssets) {
totalAssets = IMetaMorpho(vault).totalAssets();
}