Skip to content

Commit

Permalink
add the get/set rules for EMode
Browse files Browse the repository at this point in the history
  • Loading branch information
nisnislevi committed Sep 23, 2024
1 parent 67b7e19 commit f04eef0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/workflows/certora-basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
- VariableDebtToken.conf
- NEW-pool-no-summarizations.conf
- stableRemoved.conf
- EModeConfiguration.conf
- NEW-pool-simple-properties.conf --rule cannotDepositInInactiveReserve --msg "cannotDepositInInactiveReserve"
- NEW-pool-simple-properties.conf --rule cannotDepositInFrozenReserve --msg "cannotDepositInFrozenReserve"
- NEW-pool-simple-properties.conf --rule cannotDepositZeroAmount --msg "cannotDepositZeroAmount"
Expand Down
17 changes: 8 additions & 9 deletions certora/basic/harness/EModeConfigurationHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,23 @@ import {DataTypes} from '../munged/contracts/protocol/libraries/types/DataTypes.
contract EModeConfigurationHarness {
DataTypes.EModeCategory public eModeCategory;

function setCollateral(uint256 reserveIndex,bool collateral) public {
function setCollateral(uint256 reserveIndex, bool enabled) public {
DataTypes.EModeCategory memory emode_new = eModeCategory;
EModeConfiguration.setCollateral(emode_new, reserveIndex, collateral);
eModeCategory.isCollateralBitmap = emode_new.isCollateralBitmap;
eModeCategory.collateralBitmap = EModeConfiguration.setReserveBitmapBit(emode_new.collateralBitmap, reserveIndex, enabled);
}

function isCollateralAsset(uint256 reserveIndex) public returns (bool) {
return EModeConfiguration.isCollateralAsset(eModeCategory.isCollateralBitmap, reserveIndex);
return EModeConfiguration.isReserveEnabledOnBitmap(eModeCategory.collateralBitmap, reserveIndex);
}


function setBorrowable(uint256 reserveIndex,bool borrowable) public {

function setBorrowable(uint256 reserveIndex,bool enabled) public {
DataTypes.EModeCategory memory emode_new = eModeCategory;
EModeConfiguration.setBorrowable(emode_new, reserveIndex, borrowable);
eModeCategory.isBorrowableBitmap = emode_new.isBorrowableBitmap;
eModeCategory.borrowableBitmap = EModeConfiguration.setReserveBitmapBit(emode_new.borrowableBitmap, reserveIndex, enabled);
}

function isBorrowableAsset(uint256 reserveIndex) public returns (bool) {
return EModeConfiguration.isBorrowableAsset(eModeCategory.isBorrowableBitmap, reserveIndex);
return EModeConfiguration.isReserveEnabledOnBitmap(eModeCategory.borrowableBitmap, reserveIndex);
}
}
10 changes: 5 additions & 5 deletions certora/basic/scripts/run-all.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#CMN="--compilation_steps_only"
CMN="--compilation_steps_only"
#CMN="--typecheck_only"


Expand Down Expand Up @@ -32,10 +32,10 @@ echo "******** Running: 6 Stable fields are un-touched ***************"
certoraRun $CMN certora/basic/conf/stableRemoved.conf \
--msg "6: Stable fields are un-touched"

#echo
#echo "******** Running: 6 EModeConfiguration ***************"
#certoraRun $CMN certora/basic/conf/EModeConfiguration.conf \
# --msg "6: EModeConfiguration"
echo
echo "******** Running: 6 EModeConfiguration ***************"
certoraRun $CMN certora/basic/conf/EModeConfiguration.conf \
--msg "6: EModeConfiguration"


echo
Expand Down
4 changes: 2 additions & 2 deletions certora/basic/specs/EModeConfiguration.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
methods {
function setCollateral(uint256 reserveIndex,bool collateral) external envfree;
function setCollateral(uint256 reserveIndex,bool enabled) external envfree;
function isCollateralAsset(uint256 reserveIndex) external returns (bool) envfree;
function setBorrowable(uint256 reserveIndex,bool borrowable) external envfree;
function setBorrowable(uint256 reserveIndex,bool enabled) external envfree;
function isBorrowableAsset(uint256 reserveIndex) external returns (bool) envfree;
}

Expand Down

0 comments on commit f04eef0

Please sign in to comment.