Skip to content

Commit c8a4c84

Browse files
committed
fix: add additional validations
1 parent 9afc666 commit c8a4c84

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/contracts/extensions/v3-config-engine/libraries/EModeEngine.sol

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,19 @@ library EModeEngine {
1919
) external {
2020
require(updates.length != 0, 'AT_LEAST_ONE_UPDATE_REQUIRED');
2121

22-
_configAssetsEMode(engineConstants.poolConfigurator, updates);
22+
_configAssetsEMode(engineConstants.poolConfigurator, engineConstants.pool, updates);
2323
}
2424

2525
function executeEModeCategoriesCreate(
2626
IEngine.EngineConstants calldata engineConstants,
2727
IEngine.EModeCategoryCreation[] memory creations
2828
) external {
2929
for (uint256 i; i < creations.length; i++) {
30+
require(
31+
keccak256(abi.encode(creations[i].label)) !=
32+
keccak256(abi.encode(EngineFlags.KEEP_CURRENT_STRING)),
33+
'INVALID_LABEL'
34+
);
3035
uint8 categoryId = _findFirstUnusedEmodeCategory(engineConstants.pool);
3136
engineConstants.poolConfigurator.setEModeCategory(
3237
categoryId,
@@ -65,9 +70,14 @@ library EModeEngine {
6570

6671
function _configAssetsEMode(
6772
IPoolConfigurator poolConfigurator,
73+
IPool pool,
6874
IEngine.AssetEModeUpdate[] memory updates
6975
) internal {
7076
for (uint256 i = 0; i < updates.length; i++) {
77+
DataTypes.CollateralConfig memory cfg = pool.getEModeCategoryCollateralConfig(
78+
updates[i].eModeCategory
79+
);
80+
require(cfg.liquidationThreshold != 0, 'INVALID_UPDATE');
7181
if (updates[i].collateral != EngineFlags.KEEP_CURRENT) {
7282
poolConfigurator.setAssetCollateralInEMode(
7383
updates[i].asset,

0 commit comments

Comments
 (0)