Skip to content

Commit cb3689f

Browse files
committed
fix: revert prior unneeded changes
1 parent 55d8bad commit cb3689f

File tree

2 files changed

+33
-104
lines changed

2 files changed

+33
-104
lines changed

src/contracts/RiskSteward.sol

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,7 @@ contract RiskSteward is Ownable, IRiskSteward {
360360
eModeCategoryUpdates[i].liqBonus == 0
361361
) revert InvalidUpdateToZero();
362362

363-
DataTypes.CollateralConfig memory currentEmodeConfig = POOL.getEModeCategoryCollateralConfig(
364-
eModeId
365-
);
363+
DataTypes.CollateralConfig memory currentEmodeConfig = POOL.getEModeCategoryCollateralConfig(eModeId);
366364

367365
_validateParamUpdate(
368366
ParamUpdateValidationInput({
@@ -597,9 +595,7 @@ contract RiskSteward is Ownable, IRiskSteward {
597595
* @notice method to update the eMode category params using the config engine and updates the debounce
598596
* @param eModeCategoryUpdates list containing the new eMode category params of the eMode category id
599597
*/
600-
function _updateEModeCategories(
601-
IEngine.EModeCategoryUpdate[] calldata eModeCategoryUpdates
602-
) internal {
598+
function _updateEModeCategories(IEngine.EModeCategoryUpdate[] calldata eModeCategoryUpdates) internal {
603599
for (uint256 i = 0; i < eModeCategoryUpdates.length; i++) {
604600
uint8 eModeId = eModeCategoryUpdates[i].eModeCategory;
605601

@@ -655,17 +651,13 @@ contract RiskSteward is Ownable, IRiskSteward {
655651
* @notice method to update the pendle oracle discount rate
656652
* @param discountRateUpdate list containing the new discount rate values for the pendle oracles
657653
*/
658-
function _updatePendleDiscountRates(
659-
DiscountRatePendleUpdate[] calldata discountRateUpdate
660-
) internal {
654+
function _updatePendleDiscountRates(DiscountRatePendleUpdate[] calldata discountRateUpdate) internal {
661655
for (uint256 i = 0; i < discountRateUpdate.length; i++) {
662656
address oracle = discountRateUpdate[i].oracle;
663657

664658
_timelocks[oracle].priceCapLastUpdated = uint40(block.timestamp);
665659

666-
IPendlePriceCapAdapter(oracle).setDiscountRatePerYear(
667-
discountRateUpdate[i].discountRate.toUint64()
668-
);
660+
IPendlePriceCapAdapter(oracle).setDiscountRatePerYear(discountRateUpdate[i].discountRate.toUint64());
669661
}
670662
}
671663

@@ -715,7 +707,7 @@ contract RiskSteward is Ownable, IRiskSteward {
715707
uint256 to,
716708
uint256 maxPercentChange,
717709
bool isChangeRelative
718-
) internal pure virtual returns (bool) {
710+
) internal pure returns (bool) {
719711
// diff denotes the difference between the from and to values, ensuring it is a positive value always
720712
uint256 diff = from > to ? from - to : to - from;
721713

tests/RiskSteward.t.sol

Lines changed: 28 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -852,14 +852,10 @@ contract RiskSteward_Test is Test {
852852

853853
function test_updateEModeCategories() public virtual {
854854
uint8 eModeId = 1;
855-
DataTypes.CollateralConfig memory currentEmodeConfig = AaveV3Ethereum
856-
.POOL
857-
.getEModeCategoryCollateralConfig(eModeId);
855+
DataTypes.CollateralConfig memory currentEmodeConfig = AaveV3Ethereum.POOL.getEModeCategoryCollateralConfig(eModeId);
858856
string memory label = AaveV3Ethereum.POOL.getEModeCategoryLabel(eModeId);
859857

860-
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](
861-
1
862-
);
858+
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](1);
863859
eModeCategoryUpdates[0] = IEngine.EModeCategoryUpdate({
864860
eModeCategory: eModeId,
865861
ltv: currentEmodeConfig.ltv + 50, // 0.5% absolute increase
@@ -873,9 +869,7 @@ contract RiskSteward_Test is Test {
873869

874870
RiskSteward.EModeDebounce memory lastUpdated = steward.getEModeTimelock(eModeId);
875871

876-
DataTypes.CollateralConfig memory afterEmodeConfig = AaveV3Ethereum
877-
.POOL
878-
.getEModeCategoryCollateralConfig(eModeId);
872+
DataTypes.CollateralConfig memory afterEmodeConfig = AaveV3Ethereum.POOL.getEModeCategoryCollateralConfig(eModeId);
879873
string memory afterLabel = AaveV3Ethereum.POOL.getEModeCategoryLabel(eModeId);
880874

881875
assertEq(afterEmodeConfig.ltv, eModeCategoryUpdates[0].ltv);
@@ -918,13 +912,9 @@ contract RiskSteward_Test is Test {
918912

919913
function test_updateEModeCategories_outOfRange() public virtual {
920914
uint8 eModeId = 1;
921-
DataTypes.CollateralConfig memory currentEmodeConfig = AaveV3Ethereum
922-
.POOL
923-
.getEModeCategoryCollateralConfig(eModeId);
915+
DataTypes.CollateralConfig memory currentEmodeConfig = AaveV3Ethereum.POOL.getEModeCategoryCollateralConfig(eModeId);
924916

925-
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](
926-
1
927-
);
917+
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](1);
928918
eModeCategoryUpdates[0] = IEngine.EModeCategoryUpdate({
929919
eModeCategory: eModeId,
930920
ltv: currentEmodeConfig.ltv + 51, // 0.5% absolute increase
@@ -953,13 +943,9 @@ contract RiskSteward_Test is Test {
953943

954944
function test_updateEModeCategories_debounceNotRespected() public virtual {
955945
uint8 eModeId = 1;
956-
DataTypes.CollateralConfig memory currentEmodeConfig = AaveV3Ethereum
957-
.POOL
958-
.getEModeCategoryCollateralConfig(eModeId);
946+
DataTypes.CollateralConfig memory currentEmodeConfig = AaveV3Ethereum.POOL.getEModeCategoryCollateralConfig(eModeId);
959947

960-
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](
961-
1
962-
);
948+
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](1);
963949
eModeCategoryUpdates[0] = IEngine.EModeCategoryUpdate({
964950
eModeCategory: eModeId,
965951
ltv: currentEmodeConfig.ltv + 50, // 0.5% absolute increase
@@ -980,9 +966,7 @@ contract RiskSteward_Test is Test {
980966

981967
function test_updateEModeCategories_eModeDoesNotExist() public virtual {
982968
uint8 eModeId = 100;
983-
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](
984-
1
985-
);
969+
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](1);
986970
eModeCategoryUpdates[0] = IEngine.EModeCategoryUpdate({
987971
eModeCategory: eModeId,
988972
ltv: 50,
@@ -1001,9 +985,7 @@ contract RiskSteward_Test is Test {
1001985
vm.prank(GovernanceV3Ethereum.EXECUTOR_LVL_1);
1002986
steward.setEModeCategoryRestricted(eModeCategoryId, true);
1003987

1004-
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](
1005-
1
1006-
);
988+
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](1);
1007989
eModeCategoryUpdates[0] = IEngine.EModeCategoryUpdate({
1008990
eModeCategory: eModeCategoryId,
1009991
ltv: 50,
@@ -1031,9 +1013,7 @@ contract RiskSteward_Test is Test {
10311013
vm.prank(GovernanceV3Ethereum.EXECUTOR_LVL_1);
10321014
steward.setRiskConfig(config);
10331015

1034-
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](
1035-
1
1036-
);
1016+
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](1);
10371017
eModeCategoryUpdates[0] = IEngine.EModeCategoryUpdate({
10381018
eModeCategory: 1,
10391019
ltv: 0,
@@ -1049,15 +1029,11 @@ contract RiskSteward_Test is Test {
10491029

10501030
function test_updateEModeCategories_allKeepCurrent() public virtual {
10511031
uint8 eModeId = 1;
1052-
DataTypes.CollateralConfig memory prevEmodeConfig = AaveV3Ethereum
1053-
.POOL
1054-
.getEModeCategoryCollateralConfig(eModeId);
1032+
DataTypes.CollateralConfig memory prevEmodeConfig = AaveV3Ethereum.POOL.getEModeCategoryCollateralConfig(eModeId);
10551033
string memory prevLabel = AaveV3Ethereum.POOL.getEModeCategoryLabel(eModeId);
10561034
RiskSteward.EModeDebounce memory prevLastUpdated = steward.getEModeTimelock(eModeId);
10571035

1058-
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](
1059-
1
1060-
);
1036+
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](1);
10611037
eModeCategoryUpdates[0] = IEngine.EModeCategoryUpdate({
10621038
eModeCategory: eModeId,
10631039
ltv: EngineFlags.KEEP_CURRENT,
@@ -1069,9 +1045,7 @@ contract RiskSteward_Test is Test {
10691045
vm.startPrank(riskCouncil);
10701046
steward.updateEModeCategories(eModeCategoryUpdates);
10711047

1072-
DataTypes.CollateralConfig memory afterEmodeConfig = AaveV3Ethereum
1073-
.POOL
1074-
.getEModeCategoryCollateralConfig(eModeId);
1048+
DataTypes.CollateralConfig memory afterEmodeConfig = AaveV3Ethereum.POOL.getEModeCategoryCollateralConfig(eModeId);
10751049
RiskSteward.EModeDebounce memory afterLastUpdated = steward.getEModeTimelock(eModeId);
10761050
string memory afterLabel = AaveV3Ethereum.POOL.getEModeCategoryLabel(eModeId);
10771051

@@ -1081,26 +1055,16 @@ contract RiskSteward_Test is Test {
10811055
assertEq(afterLabel, prevLabel);
10821056

10831057
assertEq(prevLastUpdated.eModeLtvLastUpdated, afterLastUpdated.eModeLtvLastUpdated);
1084-
assertEq(
1085-
prevLastUpdated.eModeLiquidationThresholdLastUpdated,
1086-
afterLastUpdated.eModeLiquidationThresholdLastUpdated
1087-
);
1088-
assertEq(
1089-
prevLastUpdated.eModeLiquidationBonusLastUpdated,
1090-
afterLastUpdated.eModeLiquidationBonusLastUpdated
1091-
);
1058+
assertEq(prevLastUpdated.eModeLiquidationThresholdLastUpdated, afterLastUpdated.eModeLiquidationThresholdLastUpdated);
1059+
assertEq(prevLastUpdated.eModeLiquidationBonusLastUpdated, afterLastUpdated.eModeLiquidationBonusLastUpdated);
10921060
}
10931061

10941062
function test_updateEModeCategories_sameUpdate() public virtual {
10951063
uint8 eModeId = 1;
1096-
DataTypes.CollateralConfig memory prevEmodeConfig = AaveV3Ethereum
1097-
.POOL
1098-
.getEModeCategoryCollateralConfig(eModeId);
1064+
DataTypes.CollateralConfig memory prevEmodeConfig = AaveV3Ethereum.POOL.getEModeCategoryCollateralConfig(eModeId);
10991065
string memory prevLabel = AaveV3Ethereum.POOL.getEModeCategoryLabel(eModeId);
11001066

1101-
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](
1102-
1
1103-
);
1067+
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](1);
11041068
eModeCategoryUpdates[0] = IEngine.EModeCategoryUpdate({
11051069
eModeCategory: eModeId,
11061070
ltv: prevEmodeConfig.ltv,
@@ -1112,9 +1076,7 @@ contract RiskSteward_Test is Test {
11121076
vm.startPrank(riskCouncil);
11131077
steward.updateEModeCategories(eModeCategoryUpdates);
11141078

1115-
DataTypes.CollateralConfig memory afterEmodeConfig = AaveV3Ethereum
1116-
.POOL
1117-
.getEModeCategoryCollateralConfig(eModeId);
1079+
DataTypes.CollateralConfig memory afterEmodeConfig = AaveV3Ethereum.POOL.getEModeCategoryCollateralConfig(eModeId);
11181080
RiskSteward.EModeDebounce memory afterLastUpdated = steward.getEModeTimelock(eModeId);
11191081
string memory afterLabel = AaveV3Ethereum.POOL.getEModeCategoryLabel(eModeId);
11201082

@@ -1132,9 +1094,7 @@ contract RiskSteward_Test is Test {
11321094
uint8 eModeId = 1;
11331095
string memory newLabel = 'NEW_EMODE_LABEL';
11341096

1135-
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](
1136-
1
1137-
);
1097+
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](1);
11381098
eModeCategoryUpdates[0] = IEngine.EModeCategoryUpdate({
11391099
eModeCategory: eModeId,
11401100
ltv: EngineFlags.KEEP_CURRENT,
@@ -1181,9 +1141,7 @@ contract RiskSteward_Test is Test {
11811141
})
11821142
});
11831143

1184-
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](
1185-
1
1186-
);
1144+
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](1);
11871145
eModeCategoryUpdates[0] = IEngine.EModeCategoryUpdate({
11881146
eModeCategory: 1,
11891147
ltv: EngineFlags.KEEP_CURRENT,
@@ -1218,7 +1176,7 @@ contract RiskSteward_Test is Test {
12181176
vm.stopPrank();
12191177
}
12201178

1221-
function test_assetRestricted() public virtual {
1179+
function test_assetRestricted() public {
12221180
vm.expectEmit();
12231181
emit IRiskSteward.AddressRestricted(AaveV3EthereumAssets.GHO_UNDERLYING, true);
12241182

@@ -1303,14 +1261,8 @@ contract RiskSteward_Test is Test {
13031261
IRiskSteward.Config memory initialRiskConfig,
13041262
IRiskSteward.Config memory updatedRiskConfig
13051263
) internal pure {
1306-
assertEq(
1307-
initialRiskConfig.collateralConfig.ltv.minDelay,
1308-
updatedRiskConfig.collateralConfig.ltv.minDelay
1309-
);
1310-
assertEq(
1311-
initialRiskConfig.collateralConfig.ltv.maxPercentChange,
1312-
updatedRiskConfig.collateralConfig.ltv.maxPercentChange
1313-
);
1264+
assertEq(initialRiskConfig.collateralConfig.ltv.minDelay, updatedRiskConfig.collateralConfig.ltv.minDelay);
1265+
assertEq(initialRiskConfig.collateralConfig.ltv.maxPercentChange, updatedRiskConfig.collateralConfig.ltv.maxPercentChange);
13141266
assertEq(
13151267
initialRiskConfig.collateralConfig.liquidationThreshold.minDelay,
13161268
updatedRiskConfig.collateralConfig.liquidationThreshold.minDelay
@@ -1327,26 +1279,17 @@ contract RiskSteward_Test is Test {
13271279
initialRiskConfig.collateralConfig.liquidationBonus.maxPercentChange,
13281280
updatedRiskConfig.collateralConfig.liquidationBonus.maxPercentChange
13291281
);
1330-
assertEq(
1331-
initialRiskConfig.capConfig.supplyCap.minDelay,
1332-
updatedRiskConfig.capConfig.supplyCap.minDelay
1333-
);
1282+
assertEq(initialRiskConfig.capConfig.supplyCap.minDelay, updatedRiskConfig.capConfig.supplyCap.minDelay);
13341283
assertEq(
13351284
initialRiskConfig.capConfig.supplyCap.maxPercentChange,
13361285
updatedRiskConfig.capConfig.supplyCap.maxPercentChange
13371286
);
1338-
assertEq(
1339-
initialRiskConfig.capConfig.borrowCap.minDelay,
1340-
updatedRiskConfig.capConfig.borrowCap.minDelay
1341-
);
1287+
assertEq(initialRiskConfig.capConfig.borrowCap.minDelay, updatedRiskConfig.capConfig.borrowCap.minDelay);
13421288
assertEq(
13431289
initialRiskConfig.capConfig.borrowCap.maxPercentChange,
13441290
updatedRiskConfig.capConfig.borrowCap.maxPercentChange
13451291
);
1346-
assertEq(
1347-
initialRiskConfig.collateralConfig.debtCeiling.minDelay,
1348-
updatedRiskConfig.collateralConfig.debtCeiling.minDelay
1349-
);
1292+
assertEq(initialRiskConfig.collateralConfig.debtCeiling.minDelay, updatedRiskConfig.collateralConfig.debtCeiling.minDelay);
13501293
assertEq(
13511294
initialRiskConfig.collateralConfig.debtCeiling.maxPercentChange,
13521295
updatedRiskConfig.collateralConfig.debtCeiling.maxPercentChange
@@ -1387,18 +1330,12 @@ contract RiskSteward_Test is Test {
13871330
initialRiskConfig.priceCapConfig.priceCapLst.maxPercentChange,
13881331
updatedRiskConfig.priceCapConfig.priceCapLst.maxPercentChange
13891332
);
1390-
assertEq(
1391-
initialRiskConfig.priceCapConfig.priceCapLst.minDelay,
1392-
updatedRiskConfig.priceCapConfig.priceCapLst.minDelay
1393-
);
1333+
assertEq(initialRiskConfig.priceCapConfig.priceCapLst.minDelay, updatedRiskConfig.priceCapConfig.priceCapLst.minDelay);
13941334
assertEq(
13951335
initialRiskConfig.priceCapConfig.priceCapStable.maxPercentChange,
13961336
updatedRiskConfig.priceCapConfig.priceCapStable.maxPercentChange
13971337
);
1398-
assertEq(
1399-
initialRiskConfig.priceCapConfig.priceCapStable.minDelay,
1400-
updatedRiskConfig.priceCapConfig.priceCapStable.minDelay
1401-
);
1338+
assertEq(initialRiskConfig.priceCapConfig.priceCapStable.minDelay, updatedRiskConfig.priceCapConfig.priceCapStable.minDelay);
14021339
}
14031340

14041341
function _getInterestRatesForAsset(

0 commit comments

Comments
 (0)