Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion certora/harness/MorphoHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ pragma solidity 0.8.19;

import "../../src/Morpho.sol";
import "../../src/libraries/SharesMathLib.sol";
import "../../src/libraries/MarketLib.sol";

contract MorphoHarness is Morpho {
using MarketLib for Market;

constructor(address newOwner) Morpho(newOwner) {}

function getVirtualTotalSupply(Id id) external view returns (uint256) {
Expand Down
11 changes: 11 additions & 0 deletions certora/specs/Blue.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ methods {
function totalSupplyShares(MorphoHarness.Id) external returns uint256 envfree;
function totalBorrowShares(MorphoHarness.Id) external returns uint256 envfree;

function lastUpdate(MorphoHarness.Id) external returns uint256 envfree;
function isLltvEnabled(uint256) external returns bool envfree;
function isIrmEnabled(address) external returns bool envfree;

function _.borrowRate(MorphoHarness.Market) external => DISPATCHER(true);

function getMarketId(MorphoHarness.Market) external returns MorphoHarness.Id envfree;
// function _.safeTransfer(address, uint256) internal => DISPATCHER(true);
// function _.safeTransferFrom(address, address, uint256) internal => DISPATCHER(true);

Expand Down Expand Up @@ -58,3 +63,9 @@ rule supplyRevertZero(MorphoHarness.Market market) {

assert lastReverted;
}

invariant invOnlyEnabledLltv(MorphoHarness.Market market)
lastUpdate(getMarketId(market)) != 0 => isLltvEnabled(market.lltv);

invariant invOnlyEnabledIrm(MorphoHarness.Market market)
lastUpdate(getMarketId(market)) != 0 => isIrmEnabled(market.irm);