Morpho Optimizers improve the capital efficiency of positions on existing lending pools by seamlessly matching users peer-to-peer.
- Morpho's rates stay between the supply rate and the borrow rate of the pool, reducing the interest paid by the borrowers while increasing the interest earned by the suppliers. It means that you are getting boosted peer-to-peer rates or, in the worst-case scenario, the APY of the pool.
- Morpho also preserves the same experience, the same liquidity, and the same parameters (collateral factors, oracles, …) as the underlying pool.
TL;DR: Instead of borrowing or lending on your favorite AaveV3 pool, you would be better off using Morpho-AaveV3.
The Morpho protocol is designed at its core, with the main Morpho contract delegating calls to the PositionsManager implementation contract (to overcome the contract size limit).
The main user's entry points are exposed in the Morpho
contract. It inherits from MorphoGetters
, which contains all the functions used to query Morpho-AaveV3, MorphoSetters
, which contains all the functions used by the governance to manage the protocol, MorphoInternal
, and MorphoStorage
, where the protocol's internal logic & storage is located. This contract delegates call to the PositionsManager
, that has the same storage layout: this contract inherits from PositionsManagerInternal
, which contains all the internal accounting logic and in turn inherits from MatchingEngine
, which contains the matching engine internal functions.
It also interacts with RewardsManager
, which manages AaveV3's rewards, if any.
All audits are stored in the audits' folder.
A bug bounty is open on Immunefi. The rewards and scope are defined here. You can also email security@morpho.org if you find something worrying.
- Morpho Proxy: 0x33333aea097c193e66081e930c33020272b33333
- Morpho Implementation: 0xf835456cb1de3e39ab50a8a9fbb07ebec3a8ff67
- PositionsManager: 0xcecc755730904b3a6c20ce9aaba181aa4593f869
- ProxyAdmin: 0x99917ca0426fbc677e84f873fb0b726bb4799cd8
Using forge:
forge install morpho-dao/morpho-aave-v3
- Install Foundry.
- Run
make install
to initialize the repository. - Create a
.env
file according to the.env.example
file.
Testing with Foundry 🔨
Tests are run against a fork of Ethereum, which allows us to interact directly with AaveV3. Note that you need an RPC provider with access to Ethereum.
For testing, make sure foundry
is installed and install dependencies (git submodules) with:
make install
To run tests on different protocols, navigate a Unix terminal to the root folder of the project and run the command of your choice:
To run the whole test suite:
make test
Or to run only tests matching an input:
make test-Borrow
Or to run only unit, internal, integration, or invariant tests:
make test-[unit/internal/integration/invariant]
For the other commands, check the Makefile.
Configure your VSCode to automatically format a file on save, using forge fmt
:
- Install emeraldwalk.runonsave
- Update your
settings.json
:
{
"[solidity]": {
"editor.formatOnSave": false
},
"emeraldwalk.runonsave": {
"commands": [
{
"match": ".sol",
"isAsync": true,
"cmd": "forge fmt ${file}"
}
]
}
}
Test coverage is reported using foundry coverage with lcov report formatting (and optionally, genhtml transformer).
To generate the lcov
report, run:
make coverage
The report is then usable either:
- via Coverage Gutters following this tutorial
- via html, using
make lcov-html
to transform the report and openingcoverage/index.html
foundry-storage-check is currently running on every PR to check that the changes introduced are not modifying the storage layout of proxied smart contracts in an unsafe way.
For any questions or feedback, you can send an email to contact@morpho.org.
The code is under the GNU AFFERO GENERAL PUBLIC LICENSE v3.0, see LICENSE
.