-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ jobs: | |
- Reentrancy | ||
- Reverts | ||
- Roles | ||
- SupplyCap | ||
- Timelock | ||
- Tokens | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"files": [ | ||
"lib/morpho-blue/certora/harness/MorphoHarness.sol", | ||
"certora/helpers/MetaMorphoHarness.sol", | ||
"certora/helpers/Util.sol", | ||
], | ||
"link": [ | ||
"MetaMorphoHarness:MORPHO=MorphoHarness", | ||
], | ||
"solc_map": { | ||
"MorphoHarness": "solc-0.8.19", | ||
"MetaMorphoHarness": "solc-0.8.21", | ||
"Util": "solc-0.8.21", | ||
}, | ||
"verify": "MetaMorphoHarness:certora/specs/SupplyCap.spec", | ||
"loop_iter": "2", | ||
"optimistic_loop": true, | ||
"rule_sanity": "basic", | ||
"server": "production", | ||
"msg": "MetaMorpho Supply Cap", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
using MorphoHarness as Morpho; | ||
|
||
methods { | ||
function Morpho.supplyShares(MorphoHarness.Id, address) external returns(uint256) envfree; | ||
function Morpho.totalSupplyAssets(MorphoHarness.Id) external returns(uint256) envfree; | ||
function Morpho.totalSupplyShares(MorphoHarness.Id) external returns(uint256) envfree; | ||
|
||
function Util.accrueInterest(address, MorphoHarness.Id) external returns(uint256) envfree; | ||
function Util.supplyAssets(address, MorphoHarness.Id, address) external envfree; | ||
|
||
function MORPHO() external returns(address) envfree; | ||
} | ||
|
||
methods { | ||
function config_(MetaMorphoHarness.Id) external returns(MetaMorphoHarness.MarketConfig) envfree; | ||
} | ||
|
||
rule respectSupplyCap(method f, env e, calldataarg args) | ||
{ | ||
MetaMorphoHarness.Id id; | ||
address morpho = MORPHO(); | ||
uint256 cap = config_(id).cap; | ||
|
||
Util.accrueInterest(morpho, id); | ||
require Util.supplyAssets(morpho, id, currentContract) < cap; | ||
|
||
f(e, args); | ||
require config_(id).cap == cap; | ||
|
||
assert Util.supplyAssets(morpho, id, currentContract) < cap; | ||
} |