Skip to content

Commit

Permalink
refactor: base now has common selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
QGarchery committed Nov 24, 2024
1 parent fed35cb commit bbb41ae
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
9 changes: 9 additions & 0 deletions test/forge/invariant/BaseMorphoInvariantTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ contract BaseMorphoInvariantTest is InvariantTest {
}

function setUp() public virtual override {
_weightSelector(this.supplyAssetsOnBehalfNoRevert.selector, 15);
_weightSelector(this.supplySharesOnBehalfNoRevert.selector, 5);
_weightSelector(this.withdrawAssetsOnBehalfNoRevert.selector, 10);
_weightSelector(this.borrowAssetsOnBehalfNoRevert.selector, 15);
_weightSelector(this.repayAssetsOnBehalfNoRevert.selector, 10);
_weightSelector(this.repaySharesOnBehalfNoRevert.selector, 10);
_weightSelector(this.supplyCollateralOnBehalfNoRevert.selector, 15);
_weightSelector(this.withdrawCollateralOnBehalfNoRevert.selector, 10);

super.setUp();

allMarketParams.push(marketParams);
Expand Down
8 changes: 0 additions & 8 deletions test/forge/invariant/MorphoDynamicInvariantTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ contract MorphoDynamicInvariantTest is BaseMorphoInvariantTest {
uint256 internal immutable MAX_PRICE = ORACLE_PRICE_SCALE * 10;

function setUp() public virtual override {
_weightSelector(this.supplyAssetsOnBehalfNoRevert.selector, 15);
_weightSelector(this.supplySharesOnBehalfNoRevert.selector, 5);
_weightSelector(this.withdrawAssetsOnBehalfNoRevert.selector, 10);
_weightSelector(this.borrowAssetsOnBehalfNoRevert.selector, 15);
_weightSelector(this.repayAssetsOnBehalfNoRevert.selector, 10);
_weightSelector(this.repaySharesOnBehalfNoRevert.selector, 10);
_weightSelector(this.supplyCollateralOnBehalfNoRevert.selector, 15);
_weightSelector(this.withdrawCollateralOnBehalfNoRevert.selector, 10);
_weightSelector(this.liquidateSeizedAssetsNoRevert.selector, 2);
_weightSelector(this.liquidateRepaidSharesNoRevert.selector, 2);
_weightSelector(this.setFeeNoRevert.selector, 1);
Expand Down
14 changes: 0 additions & 14 deletions test/forge/invariant/MorphoStaticInvariantTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,6 @@ contract MorphoStaticInvariantTest is BaseMorphoInvariantTest {
using MorphoBalancesLib for IMorpho;
using MarketParamsLib for MarketParams;

function setUp() public virtual override {
_weightSelector(this.supplyAssetsOnBehalfNoRevert.selector, 12);
_weightSelector(this.supplySharesOnBehalfNoRevert.selector, 5);
_weightSelector(this.withdrawAssetsOnBehalfNoRevert.selector, 12);
_weightSelector(this.borrowAssetsOnBehalfNoRevert.selector, 17);
_weightSelector(this.repayAssetsOnBehalfNoRevert.selector, 12);
_weightSelector(this.repaySharesOnBehalfNoRevert.selector, 10);
_weightSelector(this.supplyCollateralOnBehalfNoRevert.selector, 15);
_weightSelector(this.withdrawCollateralOnBehalfNoRevert.selector, 10);
_weightSelector(this.setFeeNoRevert.selector, 2);

super.setUp();
}

/* INVARIANTS */

function invariantHealthy() public {
Expand Down

0 comments on commit bbb41ae

Please sign in to comment.