From a9a713a35fdfe5326cdc96f5efe5530cf87e6b6e Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Mon, 15 Apr 2024 16:38:52 +0530 Subject: [PATCH 1/9] feat: add code coverage --- Makefile | 7 + README.md | 2 + report/amber.png | Bin 0 -> 141 bytes report/cmd_line | 1 + .../src/contracts/RiskSteward.sol.func-c.html | 203 ++++ .../src/contracts/RiskSteward.sol.func.html | 203 ++++ .../src/contracts/RiskSteward.sol.gcov.html | 563 +++++++++ .../contracts/src/contracts/index-sort-b.html | 124 ++ .../contracts/src/contracts/index-sort-f.html | 124 ++ .../contracts/src/contracts/index-sort-l.html | 124 ++ report/contracts/src/contracts/index.html | 124 ++ report/coverage.svg | 1 + report/emerald.png | Bin 0 -> 141 bytes report/gcov.css | 1073 +++++++++++++++++ report/glass.png | Bin 0 -> 167 bytes report/index-sort-b.html | 124 ++ report/index-sort-f.html | 124 ++ report/index-sort-l.html | 124 ++ report/index.html | 124 ++ report/ruby.png | Bin 0 -> 141 bytes report/snow.png | Bin 0 -> 141 bytes report/updown.png | Bin 0 -> 117 bytes 22 files changed, 3045 insertions(+) create mode 100644 report/amber.png create mode 100644 report/cmd_line create mode 100644 report/contracts/src/contracts/RiskSteward.sol.func-c.html create mode 100644 report/contracts/src/contracts/RiskSteward.sol.func.html create mode 100644 report/contracts/src/contracts/RiskSteward.sol.gcov.html create mode 100644 report/contracts/src/contracts/index-sort-b.html create mode 100644 report/contracts/src/contracts/index-sort-f.html create mode 100644 report/contracts/src/contracts/index-sort-l.html create mode 100644 report/contracts/src/contracts/index.html create mode 100644 report/coverage.svg create mode 100644 report/emerald.png create mode 100644 report/gcov.css create mode 100644 report/glass.png create mode 100644 report/index-sort-b.html create mode 100644 report/index-sort-f.html create mode 100644 report/index-sort-l.html create mode 100644 report/index.html create mode 100644 report/ruby.png create mode 100644 report/snow.png create mode 100644 report/updown.png diff --git a/Makefile b/Makefile index a0966ff..81bde7b 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,13 @@ # deps update:; forge update +coverage :; forge coverage --report lcov && \ + lcov --remove ./lcov.info -o ./lcov.info.p \ + 'tests/*' \ + && genhtml ./lcov.info.p -o report --branch-coverage \ + && coverage=$$(awk -F '[<>]' '/headerCovTableEntryHi/{print $3}' ./report/index.html | sed 's/[^0-9.]//g' | head -n 1); \ + wget -O ./report/coverage.svg "https://img.shields.io/badge/coverage-$${coverage}%25-brightgreen" + # Build & test build :; forge build --sizes test :; forge test -vvv diff --git a/README.md b/README.md index 8e58153..1efd6df 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Expanding from the scope of from CapsPlusRiskSteward, we now introduce the new RiskSteward, allowing hardly constrained risk parameter updates by risk service providers and reducing governance overhead. +[![Coverage badge](./report/coverage.svg)](https://github.com/bgd-labs/aave-risk-stewards-2) + ## Specification The new RiskSteward we propose follows the same design as the CapsPlusRiskSteward: a smart contract to which the Aave Governance gives `POOL_ADMIN` the role over all v3 instances, controlled by a 2-of-2 multi-sig of the risk providers, and heavily constrained on what can do and how by its own logic. diff --git a/report/amber.png b/report/amber.png new file mode 100644 index 0000000000000000000000000000000000000000..2cab170d8359081983a4e343848dfe06bc490f12 GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga>?NMQuI!iC1^G2tW}LqE04T&+ z;1OBOz`!j8!i<;h*8KqrvZOouIx;Y9?C1WI$O`1M1^9%x{(levWG + + + + + + LCOV - lcov.info.p - contracts/src/contracts/RiskSteward.sol - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - contracts/src/contracts - RiskSteward.sol (source / functions)CoverageTotalHit
Test:lcov.info.pLines:100.0 %100100
Test Date:2024-04-15 16:35:51Functions:100.0 %1717
Branches:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by function hit count
RiskSteward.getRiskConfig1
RiskSteward.isAssetRestricted2
RiskSteward._updateCollateralSide3
RiskSteward._updateRates3
RiskSteward._updateCaps4
RiskSteward._getInterestRatesForAsset6
RiskSteward.getTimelock6
RiskSteward._validateRatesUpdate7
RiskSteward._validateCapsUpdate10
RiskSteward._validateCollateralsUpdate10
RiskSteward._updateWithinAllowedRange34
RiskSteward._validateParamUpdate45
RiskSteward.setRiskConfig260
RiskSteward.setAssetRestricted262
RiskSteward.updateRates264
RiskSteward.updateCaps267
RiskSteward.updateCollateralSide267
+
+
+ + + +
Generated by: LCOV version 2.0-1
+
+ + + diff --git a/report/contracts/src/contracts/RiskSteward.sol.func.html b/report/contracts/src/contracts/RiskSteward.sol.func.html new file mode 100644 index 0000000..636845b --- /dev/null +++ b/report/contracts/src/contracts/RiskSteward.sol.func.html @@ -0,0 +1,203 @@ + + + + + + + LCOV - lcov.info.p - contracts/src/contracts/RiskSteward.sol - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - contracts/src/contracts - RiskSteward.sol (source / functions)CoverageTotalHit
Test:lcov.info.pLines:100.0 %100100
Test Date:2024-04-15 16:35:51Functions:100.0 %1717
Branches:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by function hit count
RiskSteward._getInterestRatesForAsset6
RiskSteward._updateCaps4
RiskSteward._updateCollateralSide3
RiskSteward._updateRates3
RiskSteward._updateWithinAllowedRange34
RiskSteward._validateCapsUpdate10
RiskSteward._validateCollateralsUpdate10
RiskSteward._validateParamUpdate45
RiskSteward._validateRatesUpdate7
RiskSteward.getRiskConfig1
RiskSteward.getTimelock6
RiskSteward.isAssetRestricted2
RiskSteward.setAssetRestricted262
RiskSteward.setRiskConfig260
RiskSteward.updateCaps267
RiskSteward.updateCollateralSide267
RiskSteward.updateRates264
+
+
+ + + +
Generated by: LCOV version 2.0-1
+
+ + + diff --git a/report/contracts/src/contracts/RiskSteward.sol.gcov.html b/report/contracts/src/contracts/RiskSteward.sol.gcov.html new file mode 100644 index 0000000..d3d7d4e --- /dev/null +++ b/report/contracts/src/contracts/RiskSteward.sol.gcov.html @@ -0,0 +1,563 @@ + + + + + + + LCOV - lcov.info.p - contracts/src/contracts/RiskSteward.sol + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - contracts/src/contracts - RiskSteward.sol (source / functions)CoverageTotalHit
Test:lcov.info.pLines:100.0 %100100
Test Date:2024-04-15 16:35:51Functions:100.0 %1717
Branches:-00
+
+ + + + + + + + +

+
             Branch data     Line data    Source code
+
+       1                 :             : // SPDX-License-Identifier: MIT
+       2                 :             : pragma solidity ^0.8.0;
+       3                 :             : 
+       4                 :             : import {IPoolDataProvider} from 'aave-address-book/AaveV3.sol';
+       5                 :             : import {Address} from 'solidity-utils/contracts/oz-common/Address.sol';
+       6                 :             : import {EngineFlags} from 'aave-helpers/v3-config-engine/EngineFlags.sol';
+       7                 :             : import {ConfigConstants} from './libraries/ConfigConstants.sol';
+       8                 :             : import {Ownable} from 'solidity-utils/contracts/oz-common/Ownable.sol';
+       9                 :             : import {IAaveV3ConfigEngine as IEngine} from 'aave-v3-periphery/contracts/v3-config-engine/IAaveV3ConfigEngine.sol';
+      10                 :             : import {IRiskSteward} from '../interfaces/IRiskSteward.sol';
+      11                 :             : import {IDefaultInterestRateStrategyV2} from 'aave-v3-core/contracts/interfaces/IDefaultInterestRateStrategyV2.sol';
+      12                 :             : 
+      13                 :             : /**
+      14                 :             :  * @title RiskSteward
+      15                 :             :  * @author BGD labs
+      16                 :             :  * @notice Contract to manage the risk params within configured bound on aave v3 pool:
+      17                 :             :  *         This contract can update the following risk params: caps, ltv, liqThreshold, liqBonus, debtCeiling, interest rates params.
+      18                 :             :  */
+      19                 :             : contract RiskSteward is Ownable, IRiskSteward {
+      20                 :             :   using Address for address;
+      21                 :             : 
+      22                 :             :   /// @inheritdoc IRiskSteward
+      23                 :             :   IEngine public immutable CONFIG_ENGINE;
+      24                 :             : 
+      25                 :             :   /// @inheritdoc IRiskSteward
+      26                 :             :   IPoolDataProvider public immutable POOL_DATA_PROVIDER;
+      27                 :             : 
+      28                 :             :   /// @inheritdoc IRiskSteward
+      29                 :             :   address public immutable RISK_COUNCIL;
+      30                 :             : 
+      31                 :             :   uint256 internal constant BPS_MAX = 100_00;
+      32                 :             : 
+      33                 :             :   Config internal _riskConfig;
+      34                 :             : 
+      35                 :             :   mapping(address => Debounce) internal _timelocks;
+      36                 :             : 
+      37                 :             :   mapping(address => bool) internal _restrictedAssets;
+      38                 :             : 
+      39                 :             :   /**
+      40                 :             :    * @dev Modifier preventing anyone, but the council to update risk params.
+      41                 :             :    */
+      42                 :             :   modifier onlyRiskCouncil() {
+      43                 :             :     if (RISK_COUNCIL != msg.sender) revert InvalidCaller();
+      44                 :             :     _;
+      45                 :             :   }
+      46                 :             : 
+      47                 :             :   /**
+      48                 :             :    * @param poolDataProvider The pool data provider of the pool to be controlled by the steward
+      49                 :             :    * @param engine the config engine to be used by the steward
+      50                 :             :    * @param riskCouncil the safe address of the council being able to interact with the steward
+      51                 :             :    * @param riskConfig the risk configuration to setup for each individual risk param
+      52                 :             :    */
+      53                 :             :   constructor(
+      54                 :             :     IPoolDataProvider poolDataProvider,
+      55                 :             :     IEngine engine,
+      56                 :             :     address riskCouncil,
+      57                 :             :     Config memory riskConfig
+      58                 :             :   ) {
+      59                 :             :     POOL_DATA_PROVIDER = poolDataProvider;
+      60                 :             :     CONFIG_ENGINE = engine;
+      61                 :             :     RISK_COUNCIL = riskCouncil;
+      62                 :             :     _riskConfig = riskConfig;
+      63                 :             :   }
+      64                 :             : 
+      65                 :             :   /// @inheritdoc IRiskSteward
+      66                 :         267 :   function updateCaps(IEngine.CapsUpdate[] calldata capsUpdate) external onlyRiskCouncil {
+      67                 :          20 :     _validateCapsUpdate(capsUpdate);
+      68                 :           8 :     _updateCaps(capsUpdate);
+      69                 :             :   }
+      70                 :             : 
+      71                 :             :   /// @inheritdoc IRiskSteward
+      72                 :         264 :   function updateRates(IEngine.RateStrategyUpdate[] calldata ratesUpdate) external onlyRiskCouncil {
+      73                 :          14 :     _validateRatesUpdate(ratesUpdate);
+      74                 :           6 :     _updateRates(ratesUpdate);
+      75                 :             :   }
+      76                 :             : 
+      77                 :             :   /// @inheritdoc IRiskSteward
+      78                 :         267 :   function updateCollateralSide(
+      79                 :             :     IEngine.CollateralUpdate[] calldata collateralUpdates
+      80                 :             :   ) external onlyRiskCouncil {
+      81                 :          20 :     _validateCollateralsUpdate(collateralUpdates);
+      82                 :           6 :     _updateCollateralSide(collateralUpdates);
+      83                 :             :   }
+      84                 :             : 
+      85                 :             :   /// @inheritdoc IRiskSteward
+      86                 :           6 :   function getTimelock(address asset) external view returns (Debounce memory) {
+      87                 :          12 :     return _timelocks[asset];
+      88                 :             :   }
+      89                 :             : 
+      90                 :             :   /// @inheritdoc IRiskSteward
+      91                 :         260 :   function setRiskConfig(Config calldata riskConfig) external onlyOwner {
+      92                 :           6 :     _riskConfig = riskConfig;
+      93                 :           6 :     emit RiskConfigSet(riskConfig);
+      94                 :             :   }
+      95                 :             : 
+      96                 :             :   /// @inheritdoc IRiskSteward
+      97                 :           1 :   function getRiskConfig() external view returns (Config memory) {
+      98                 :           2 :     return _riskConfig;
+      99                 :             :   }
+     100                 :             : 
+     101                 :             :   /// @inheritdoc IRiskSteward
+     102                 :           2 :   function isAssetRestricted(address asset) external view returns (bool) {
+     103                 :           4 :     return _restrictedAssets[asset];
+     104                 :             :   }
+     105                 :             : 
+     106                 :             :   /// @inheritdoc IRiskSteward
+     107                 :         262 :   function setAssetRestricted(address asset, bool isRestricted) external onlyOwner {
+     108                 :          10 :     _restrictedAssets[asset] = isRestricted;
+     109                 :          10 :     emit AssetRestricted(asset, isRestricted);
+     110                 :             :   }
+     111                 :             : 
+     112                 :             :   /**
+     113                 :             :    * @notice method to validate the caps update
+     114                 :             :    * @param capsUpdate list containing the new supply, borrow caps of the assets
+     115                 :             :    */
+     116                 :          10 :   function _validateCapsUpdate(IEngine.CapsUpdate[] calldata capsUpdate) internal view {
+     117                 :          20 :     if (capsUpdate.length == 0) revert NoZeroUpdates();
+     118                 :             : 
+     119                 :          38 :     for (uint256 i = 0; i < capsUpdate.length; i++) {
+     120                 :          20 :       address asset = capsUpdate[i].asset;
+     121                 :             : 
+     122                 :          11 :       if (_restrictedAssets[asset]) revert AssetIsRestricted();
+     123                 :          36 :       if (capsUpdate[i].supplyCap == 0 || capsUpdate[i].borrowCap == 0) revert InvalidUpdateToZero();
+     124                 :             : 
+     125                 :          24 :       (uint256 currentBorrowCap, uint256 currentSupplyCap) = POOL_DATA_PROVIDER.getReserveCaps(
+     126                 :             :         capsUpdate[i].asset
+     127                 :             :       );
+     128                 :             : 
+     129                 :          16 :       _validateParamUpdate(
+     130                 :             :         currentSupplyCap,
+     131                 :             :         capsUpdate[i].supplyCap,
+     132                 :             :         _timelocks[asset].supplyCapLastUpdated,
+     133                 :             :         _riskConfig.supplyCap,
+     134                 :             :         ConfigConstants.IS_SUPPLY_CAP_CHANGE_RELATIVE
+     135                 :             :       );
+     136                 :           8 :       _validateParamUpdate(
+     137                 :             :         currentBorrowCap,
+     138                 :             :         capsUpdate[i].borrowCap,
+     139                 :             :         _timelocks[asset].borrowCapLastUpdated,
+     140                 :             :         _riskConfig.borrowCap,
+     141                 :             :         ConfigConstants.IS_BORROW_CAP_CHANGE_RELATIVE
+     142                 :             :       );
+     143                 :             :     }
+     144                 :             :   }
+     145                 :             : 
+     146                 :             :   /**
+     147                 :             :    * @notice method to validate the interest rates update
+     148                 :             :    * @param ratesUpdate list containing the new interest rates params of the assets
+     149                 :             :    */
+     150                 :           7 :   function _validateRatesUpdate(IEngine.RateStrategyUpdate[] calldata ratesUpdate) internal view {
+     151                 :          14 :     if (ratesUpdate.length == 0) revert NoZeroUpdates();
+     152                 :             : 
+     153                 :          27 :     for (uint256 i = 0; i < ratesUpdate.length; i++) {
+     154                 :          14 :       address asset = ratesUpdate[i].asset;
+     155                 :           8 :       if (_restrictedAssets[asset]) revert AssetIsRestricted();
+     156                 :             : 
+     157                 :          12 :       (
+     158                 :             :         uint256 currentOptimalUsageRatio,
+     159                 :             :         uint256 currentBaseVariableBorrowRate,
+     160                 :             :         uint256 currentVariableRateSlope1,
+     161                 :             :         uint256 currentVariableRateSlope2
+     162                 :          12 :       ) = _getInterestRatesForAsset(asset);
+     163                 :             : 
+     164                 :          10 :       _validateParamUpdate(
+     165                 :             :         currentOptimalUsageRatio,
+     166                 :             :         ratesUpdate[i].params.optimalUsageRatio,
+     167                 :             :         _timelocks[asset].optimalUsageRatioLastUpdated,
+     168                 :             :         _riskConfig.optimalUsageRatio,
+     169                 :             :         ConfigConstants.IS_OPTIMAL_USAGE_CHANGE_RELATIVE
+     170                 :             :       );
+     171                 :           6 :       _validateParamUpdate(
+     172                 :             :         currentBaseVariableBorrowRate,
+     173                 :             :         ratesUpdate[i].params.baseVariableBorrowRate,
+     174                 :             :         _timelocks[asset].baseVariableRateLastUpdated,
+     175                 :             :         _riskConfig.baseVariableBorrowRate,
+     176                 :             :         ConfigConstants.IS_BASE_VARIABLE_BORROW_RATE_CHANGE_RELATIVE
+     177                 :             :       );
+     178                 :           6 :       _validateParamUpdate(
+     179                 :             :         currentVariableRateSlope1,
+     180                 :             :         ratesUpdate[i].params.variableRateSlope1,
+     181                 :             :         _timelocks[asset].variableRateSlope1LastUpdated,
+     182                 :             :         _riskConfig.variableRateSlope1,
+     183                 :             :         ConfigConstants.IS_VARIABLE_RATE_SLOPE_1_CHANGE_RELATIVE
+     184                 :             :       );
+     185                 :           6 :       _validateParamUpdate(
+     186                 :             :         currentVariableRateSlope2,
+     187                 :             :         ratesUpdate[i].params.variableRateSlope2,
+     188                 :             :         _timelocks[asset].variableRateSlope2LastUpdated,
+     189                 :             :         _riskConfig.variableRateSlope2,
+     190                 :             :         ConfigConstants.IS_VARIABLE_RATE_SLOPE_2_CHANGE_RELATIVE
+     191                 :             :       );
+     192                 :             :     }
+     193                 :             :   }
+     194                 :             : 
+     195                 :             :   /**
+     196                 :             :    * @notice method to validate the collaterals update
+     197                 :             :    * @param collateralUpdates list containing the new collateral updates of the assets
+     198                 :             :    */
+     199                 :          10 :   function _validateCollateralsUpdate(
+     200                 :             :     IEngine.CollateralUpdate[] calldata collateralUpdates
+     201                 :             :   ) internal view {
+     202                 :          20 :     if (collateralUpdates.length == 0) revert NoZeroUpdates();
+     203                 :             : 
+     204                 :          36 :     for (uint256 i = 0; i < collateralUpdates.length; i++) {
+     205                 :          20 :       address asset = collateralUpdates[i].asset;
+     206                 :             : 
+     207                 :          11 :       if (_restrictedAssets[asset]) revert AssetIsRestricted();
+     208                 :          19 :       if (collateralUpdates[i].liqProtocolFee != EngineFlags.KEEP_CURRENT) revert ParamChangeNotAllowed();
+     209                 :             :       if (
+     210                 :          40 :         collateralUpdates[i].ltv == 0 ||
+     211                 :          14 :         collateralUpdates[i].liqThreshold == 0 ||
+     212                 :          14 :         collateralUpdates[i].liqBonus == 0 ||
+     213                 :          14 :         collateralUpdates[i].debtCeiling == 0
+     214                 :           2 :       ) revert InvalidUpdateToZero();
+     215                 :             : 
+     216                 :          14 :       (
+     217                 :             :         ,
+     218                 :             :         uint256 currentLtv,
+     219                 :             :         uint256 currentLiquidationThreshold,
+     220                 :             :         uint256 currentLiquidationBonus,
+     221                 :             :         ,
+     222                 :             :         ,
+     223                 :             :         ,
+     224                 :             :         ,
+     225                 :             :         ,
+     226                 :             : 
+     227                 :          14 :       ) = POOL_DATA_PROVIDER.getReserveConfigurationData(asset);
+     228                 :          21 :       uint256 currentDebtCeiling = POOL_DATA_PROVIDER.getDebtCeiling(asset);
+     229                 :             : 
+     230                 :          14 :       _validateParamUpdate(
+     231                 :             :         currentLtv,
+     232                 :             :         collateralUpdates[i].ltv,
+     233                 :             :         _timelocks[asset].ltvLastUpdated,
+     234                 :             :         _riskConfig.ltv,
+     235                 :             :         ConfigConstants.IS_LTV_CHANGE_RELATIVE
+     236                 :             :       );
+     237                 :           8 :       _validateParamUpdate(
+     238                 :             :         currentLiquidationThreshold,
+     239                 :             :         collateralUpdates[i].liqThreshold,
+     240                 :             :         _timelocks[asset].liquidationThresholdLastUpdated,
+     241                 :             :         _riskConfig.liquidationThreshold,
+     242                 :             :         ConfigConstants.IS_LIQUDATION_THRESHOLD_CHANGE_RELATIVE
+     243                 :             :       );
+     244                 :           8 :       _validateParamUpdate(
+     245                 :             :         currentLiquidationBonus - 100_00, // as the definition is 100% + x%, and config engine takes into account x% for simplicity.
+     246                 :             :         collateralUpdates[i].liqBonus,
+     247                 :             :         _timelocks[asset].liquidationBonusLastUpdated,
+     248                 :             :         _riskConfig.liquidationBonus,
+     249                 :             :         ConfigConstants.IS_LIQUIDATION_BONUS_CHANGE_RELATIVE
+     250                 :             :       );
+     251                 :           8 :       _validateParamUpdate(
+     252                 :             :         currentDebtCeiling / 100, // as the definition is with 2 decimals, and config engine does not take the decimals into account.
+     253                 :             :         collateralUpdates[i].debtCeiling,
+     254                 :             :         _timelocks[asset].debtCeilingLastUpdated,
+     255                 :             :         _riskConfig.debtCeiling,
+     256                 :             :         ConfigConstants.IS_DEBT_CEILING_CHANGE_RELATIVE
+     257                 :             :       );
+     258                 :             :     }
+     259                 :             :   }
+     260                 :             : 
+     261                 :             :   /**
+     262                 :             :    * @notice method to validate the risk param update is within the allowed bound and the debounce is respected
+     263                 :             :    * @param currentParamValue the current value of the risk param
+     264                 :             :    * @param newParamValue the new value of the risk param
+     265                 :             :    * @param lastUpdated timestamp when the risk param was last updated by the steward
+     266                 :             :    * @param riskConfig the risk configuration containing the minimum delay and the max percent change allowed for the risk param
+     267                 :             :    */
+     268                 :          45 :   function _validateParamUpdate(
+     269                 :             :     uint256 currentParamValue,
+     270                 :             :     uint256 newParamValue,
+     271                 :             :     uint40 lastUpdated,
+     272                 :             :     RiskParamConfig memory riskConfig,
+     273                 :             :     bool isChangeRelative
+     274                 :             :   ) internal view {
+     275                 :         135 :     if (newParamValue == EngineFlags.KEEP_CURRENT) return;
+     276                 :             : 
+     277                 :         114 :     if (block.timestamp - lastUpdated < riskConfig.minDelay) revert DebounceNotRespected();
+     278                 :             :     if (
+     279                 :          68 :       !_updateWithinAllowedRange(
+     280                 :             :         currentParamValue,
+     281                 :             :         newParamValue,
+     282                 :             :         riskConfig.maxPercentChange,
+     283                 :             :         isChangeRelative
+     284                 :             :       )
+     285                 :          14 :     ) revert UpdateNotInRange();
+     286                 :             :   }
+     287                 :             : 
+     288                 :             :   /**
+     289                 :             :    * @notice method to update the borrow / supply caps using the config engine and updates the debounce
+     290                 :             :    * @param capsUpdate list containing the new supply, borrow caps of the assets
+     291                 :             :    */
+     292                 :           4 :   function _updateCaps(IEngine.CapsUpdate[] calldata capsUpdate) internal {
+     293                 :          20 :     for (uint256 i = 0; i < capsUpdate.length; i++) {
+     294                 :           8 :       address asset = capsUpdate[i].asset;
+     295                 :             : 
+     296                 :           8 :       if (capsUpdate[i].supplyCap != EngineFlags.KEEP_CURRENT) {
+     297                 :           6 :         _timelocks[asset].supplyCapLastUpdated = uint40(block.timestamp);
+     298                 :           6 :         emit SupplyCapUpdated(
+     299                 :             :           asset,
+     300                 :             :           capsUpdate[i].supplyCap,
+     301                 :             :           uint40(block.timestamp) + _riskConfig.supplyCap.minDelay
+     302                 :             :         );
+     303                 :             :       }
+     304                 :             : 
+     305                 :           8 :       if (capsUpdate[i].borrowCap != EngineFlags.KEEP_CURRENT) {
+     306                 :           6 :         _timelocks[asset].borrowCapLastUpdated = uint40(block.timestamp);
+     307                 :           6 :         emit BorrowCapUpdated(
+     308                 :             :           asset,
+     309                 :             :           capsUpdate[i].borrowCap,
+     310                 :             :           uint40(block.timestamp) + _riskConfig.borrowCap.minDelay
+     311                 :             :         );
+     312                 :             :       }
+     313                 :             :     }
+     314                 :             : 
+     315                 :           8 :     address(CONFIG_ENGINE).functionDelegateCall(
+     316                 :             :       abi.encodeWithSelector(CONFIG_ENGINE.updateCaps.selector, capsUpdate)
+     317                 :             :     );
+     318                 :             :   }
+     319                 :             : 
+     320                 :             :   /**
+     321                 :             :    * @notice method to update the interest rates params using the config engine and updates the debounce
+     322                 :             :    * @param ratesUpdate list containing the new interest rates params of the assets
+     323                 :             :    */
+     324                 :           3 :   function _updateRates(IEngine.RateStrategyUpdate[] calldata ratesUpdate) internal {
+     325                 :          15 :     for (uint256 i = 0; i < ratesUpdate.length; i++) {
+     326                 :           6 :       address asset = ratesUpdate[i].asset;
+     327                 :             : 
+     328                 :           6 :       if (ratesUpdate[i].params.optimalUsageRatio != EngineFlags.KEEP_CURRENT) {
+     329                 :           6 :         _timelocks[asset].optimalUsageRatioLastUpdated = uint40(block.timestamp);
+     330                 :           6 :         emit OptimalUsageRatioUpdated(
+     331                 :             :           asset,
+     332                 :             :           ratesUpdate[i].params.optimalUsageRatio,
+     333                 :             :           uint40(block.timestamp) + _riskConfig.optimalUsageRatio.minDelay
+     334                 :             :         );
+     335                 :             :       }
+     336                 :             : 
+     337                 :           6 :       if (ratesUpdate[i].params.baseVariableBorrowRate != EngineFlags.KEEP_CURRENT) {
+     338                 :           6 :         _timelocks[asset].baseVariableRateLastUpdated = uint40(block.timestamp);
+     339                 :           6 :         emit BaseVariableBorrowRateUpdated(
+     340                 :             :           asset,
+     341                 :             :           ratesUpdate[i].params.baseVariableBorrowRate,
+     342                 :             :           uint40(block.timestamp) + _riskConfig.baseVariableBorrowRate.minDelay
+     343                 :             :         );
+     344                 :             :       }
+     345                 :             : 
+     346                 :           6 :       if (ratesUpdate[i].params.variableRateSlope1 != EngineFlags.KEEP_CURRENT) {
+     347                 :           6 :         _timelocks[asset].variableRateSlope1LastUpdated = uint40(block.timestamp);
+     348                 :           6 :         emit VariableRateSlope1Updated(
+     349                 :             :           asset,
+     350                 :             :           ratesUpdate[i].params.variableRateSlope1,
+     351                 :             :           uint40(block.timestamp) + _riskConfig.variableRateSlope1.minDelay
+     352                 :             :         );
+     353                 :             :       }
+     354                 :             : 
+     355                 :           6 :       if (ratesUpdate[i].params.variableRateSlope2 != EngineFlags.KEEP_CURRENT) {
+     356                 :           6 :         _timelocks[asset].variableRateSlope2LastUpdated = uint40(block.timestamp);
+     357                 :           6 :         emit VariableRateSlope2Updated(
+     358                 :             :           asset,
+     359                 :             :           ratesUpdate[i].params.variableRateSlope2,
+     360                 :             :           uint40(block.timestamp) + _riskConfig.variableRateSlope2.minDelay
+     361                 :             :         );
+     362                 :             :       }
+     363                 :             :     }
+     364                 :             : 
+     365                 :           6 :     address(CONFIG_ENGINE).functionDelegateCall(
+     366                 :             :       abi.encodeWithSelector(CONFIG_ENGINE.updateRateStrategies.selector, ratesUpdate)
+     367                 :             :     );
+     368                 :             :   }
+     369                 :             : 
+     370                 :             :   /**
+     371                 :             :    * @notice method to update the collateral side params using the config engine and updates the debounce
+     372                 :             :    * @param collateralUpdates list containing the new collateral updates of the assets
+     373                 :             :    */
+     374                 :           3 :   function _updateCollateralSide(IEngine.CollateralUpdate[] calldata collateralUpdates) internal {
+     375                 :          15 :     for (uint256 i = 0; i < collateralUpdates.length; i++) {
+     376                 :           6 :       address asset = collateralUpdates[i].asset;
+     377                 :             : 
+     378                 :           6 :       if (collateralUpdates[i].ltv != EngineFlags.KEEP_CURRENT) {
+     379                 :           4 :         _timelocks[asset].ltvLastUpdated = uint40(block.timestamp);
+     380                 :           4 :         emit LtvUpdated(
+     381                 :             :           asset,
+     382                 :             :           collateralUpdates[i].ltv,
+     383                 :             :           uint40(block.timestamp) + _riskConfig.ltv.minDelay
+     384                 :             :         );
+     385                 :             :       }
+     386                 :             : 
+     387                 :           6 :       if (collateralUpdates[i].liqThreshold != EngineFlags.KEEP_CURRENT) {
+     388                 :           4 :         _timelocks[asset].liquidationThresholdLastUpdated = uint40(block.timestamp);
+     389                 :           4 :         emit LiquidationThresholdUpdated(
+     390                 :             :           asset,
+     391                 :             :           collateralUpdates[i].liqThreshold,
+     392                 :             :           uint40(block.timestamp) + _riskConfig.liquidationThreshold.minDelay
+     393                 :             :         );
+     394                 :             :       }
+     395                 :             : 
+     396                 :           6 :       if (collateralUpdates[i].liqBonus != EngineFlags.KEEP_CURRENT) {
+     397                 :           4 :         _timelocks[asset].liquidationBonusLastUpdated = uint40(block.timestamp);
+     398                 :           4 :         emit LiquidationBonusUpdated(
+     399                 :             :           asset,
+     400                 :             :           collateralUpdates[i].liqBonus,
+     401                 :             :           uint40(block.timestamp) + _riskConfig.liquidationBonus.minDelay
+     402                 :             :         );
+     403                 :             :       }
+     404                 :             : 
+     405                 :           6 :       if (collateralUpdates[i].debtCeiling != EngineFlags.KEEP_CURRENT) {
+     406                 :           6 :         _timelocks[asset].debtCeilingLastUpdated = uint40(block.timestamp);
+     407                 :           6 :         emit DebtCeilingUpdated(
+     408                 :             :           asset,
+     409                 :             :           collateralUpdates[i].debtCeiling,
+     410                 :             :           uint40(block.timestamp) + _riskConfig.debtCeiling.minDelay
+     411                 :             :         );
+     412                 :             :       }
+     413                 :             :     }
+     414                 :             : 
+     415                 :           6 :     address(CONFIG_ENGINE).functionDelegateCall(
+     416                 :             :       abi.encodeWithSelector(CONFIG_ENGINE.updateCollateralSide.selector, collateralUpdates)
+     417                 :             :     );
+     418                 :             :   }
+     419                 :             : 
+     420                 :             :   /**
+     421                 :             :    * @notice method to fetch the current interest rate params of the asset
+     422                 :             :    * @param asset the address of the underlying asset
+     423                 :             :    * @return optimalUsageRatio the current optimal usage ratio of the asset
+     424                 :             :    * @return baseVariableBorrowRate the current base variable borrow rate of the asset
+     425                 :             :    * @return variableRateSlope1 the current variable rate slope 1 of the asset
+     426                 :             :    * @return variableRateSlope2 the current variable rate slope 2 of the asset
+     427                 :             :    */
+     428                 :           6 :   function _getInterestRatesForAsset(
+     429                 :             :     address asset
+     430                 :             :   )
+     431                 :             :     internal
+     432                 :             :     view
+     433                 :             :     returns (
+     434                 :             :       uint256 optimalUsageRatio,
+     435                 :             :       uint256 baseVariableBorrowRate,
+     436                 :             :       uint256 variableRateSlope1,
+     437                 :             :       uint256 variableRateSlope2
+     438                 :             :     )
+     439                 :             :   {
+     440                 :          18 :     address rateStrategyAddress = POOL_DATA_PROVIDER.getInterestRateStrategyAddress(asset);
+     441                 :          12 :     IDefaultInterestRateStrategyV2.InterestRateData
+     442                 :          12 :       memory interestRateData = IDefaultInterestRateStrategyV2(rateStrategyAddress)
+     443                 :             :         .getInterestRateDataBps(asset);
+     444                 :          10 :     return (
+     445                 :             :       interestRateData.optimalUsageRatio,
+     446                 :             :       interestRateData.baseVariableBorrowRate,
+     447                 :             :       interestRateData.variableRateSlope1,
+     448                 :             :       interestRateData.variableRateSlope2
+     449                 :             :     );
+     450                 :             :   }
+     451                 :             : 
+     452                 :             :   /**
+     453                 :             :    * @notice Ensures the risk param update is within the allowed range
+     454                 :             :    * @param from current risk param value
+     455                 :             :    * @param to new updated risk param value
+     456                 :             :    * @param maxPercentChange the max percent change allowed
+     457                 :             :    * @param isChangeRelative true, if maxPercentChange is relative in value, false if maxPercentChange
+     458                 :             :    *        is absolute in value.
+     459                 :             :    * @return bool true, if difference is within the maxPercentChange
+     460                 :             :    */
+     461                 :          34 :   function _updateWithinAllowedRange(
+     462                 :             :     uint256 from,
+     463                 :             :     uint256 to,
+     464                 :             :     uint256 maxPercentChange,
+     465                 :             :     bool isChangeRelative
+     466                 :             :   ) internal pure returns (bool) {
+     467                 :             :     // diff denotes the difference between the from and to values, ensuring it is a positive value always
+     468                 :         170 :     int256 diff = int256(from) - int256(to);
+     469                 :          90 :     if (diff < 0) diff = -diff;
+     470                 :             : 
+     471                 :             :     // maxDiff denotes the max permitted difference on both the upper and lower bounds, if the maxPercentChange is relative in value
+     472                 :             :     // we calculate the max permitted difference using the maxPercentChange and the from value, otherwise if the maxPercentChange is absolute in value
+     473                 :             :     // the max permitted difference is the maxPercentChange itself
+     474                 :         102 :     uint256 maxDiff = isChangeRelative ? (maxPercentChange * from) / BPS_MAX : maxPercentChange;
+     475                 :         109 :     if (uint256(diff) > maxDiff) return false;
+     476                 :          54 :     return true;
+     477                 :             :   }
+     478                 :             : }
+        
+
+
+ + + + +
Generated by: LCOV version 2.0-1
+
+ + + diff --git a/report/contracts/src/contracts/index-sort-b.html b/report/contracts/src/contracts/index-sort-b.html new file mode 100644 index 0000000..0289be9 --- /dev/null +++ b/report/contracts/src/contracts/index-sort-b.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - lcov.info.p - contracts/src/contracts + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - contracts/src/contractsCoverageTotalHit
Test:lcov.info.pLines:100.0 %100100
Test Date:2024-04-15 16:35:51Functions:100.0 %1717
Branches:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by file nameLine Coverage Sort by line coverageBranch Coverage Sort by branch coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit Rate Total Hit
RiskSteward.sol +
100.0%
+
100.0 %100100-100.0 %1717
+
+
+ + + + +
Generated by: LCOV version 2.0-1
+
+ + + diff --git a/report/contracts/src/contracts/index-sort-f.html b/report/contracts/src/contracts/index-sort-f.html new file mode 100644 index 0000000..c329ce2 --- /dev/null +++ b/report/contracts/src/contracts/index-sort-f.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - lcov.info.p - contracts/src/contracts + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - contracts/src/contractsCoverageTotalHit
Test:lcov.info.pLines:100.0 %100100
Test Date:2024-04-15 16:35:51Functions:100.0 %1717
Branches:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by file nameLine Coverage Sort by line coverageBranch Coverage Sort by branch coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit Rate Total Hit
RiskSteward.sol +
100.0%
+
100.0 %100100-100.0 %1717
+
+
+ + + + +
Generated by: LCOV version 2.0-1
+
+ + + diff --git a/report/contracts/src/contracts/index-sort-l.html b/report/contracts/src/contracts/index-sort-l.html new file mode 100644 index 0000000..ac07ad6 --- /dev/null +++ b/report/contracts/src/contracts/index-sort-l.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - lcov.info.p - contracts/src/contracts + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - contracts/src/contractsCoverageTotalHit
Test:lcov.info.pLines:100.0 %100100
Test Date:2024-04-15 16:35:51Functions:100.0 %1717
Branches:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by file nameLine Coverage Sort by line coverageBranch Coverage Sort by branch coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit Rate Total Hit
RiskSteward.sol +
100.0%
+
100.0 %100100-100.0 %1717
+
+
+ + + + +
Generated by: LCOV version 2.0-1
+
+ + + diff --git a/report/contracts/src/contracts/index.html b/report/contracts/src/contracts/index.html new file mode 100644 index 0000000..d1a42a9 --- /dev/null +++ b/report/contracts/src/contracts/index.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - lcov.info.p - contracts/src/contracts + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - contracts/src/contractsCoverageTotalHit
Test:lcov.info.pLines:100.0 %100100
Test Date:2024-04-15 16:35:51Functions:100.0 %1717
Branches:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by file nameLine Coverage Sort by line coverageBranch Coverage Sort by branch coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit Rate Total Hit
RiskSteward.sol +
100.0%
+
100.0 %100100-100.0 %1717
+
+
+ + + + +
Generated by: LCOV version 2.0-1
+
+ + + diff --git a/report/coverage.svg b/report/coverage.svg new file mode 100644 index 0000000..b846227 --- /dev/null +++ b/report/coverage.svg @@ -0,0 +1 @@ +coverage: 100.0%coverage100.0% \ No newline at end of file diff --git a/report/emerald.png b/report/emerald.png new file mode 100644 index 0000000000000000000000000000000000000000..38ad4f4068b935643d2486f323005fb294a9bd7e GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga>?NMQuI!iC1^Jb!lvI6;R0X`wF(yt=9xVZRt1vCRixIA4P dLn>}1Cji+@42)0J?}79&c)I$ztaD0e0sy@GAL0N2 literal 0 HcmV?d00001 diff --git a/report/gcov.css b/report/gcov.css new file mode 100644 index 0000000..f329042 --- /dev/null +++ b/report/gcov.css @@ -0,0 +1,1073 @@ +/* All views: initial background and text color */ +body +{ + color: #000000; + background-color: #ffffff; +} + +/* All views: standard link format*/ +a:link +{ + color: #284fa8; + text-decoration: underline; +} + +/* All views: standard link - visited format */ +a:visited +{ + color: #00cb40; + text-decoration: underline; +} + +/* All views: standard link - activated format */ +a:active +{ + color: #ff0040; + text-decoration: underline; +} + +/* All views: main title format */ +td.title +{ + text-align: center; + padding-bottom: 10px; + font-family: sans-serif; + font-size: 20pt; + font-style: italic; + font-weight: bold; +} +/* "Line coverage date bins" leader */ +td.subTableHeader +{ + text-align: center; + padding-bottom: 6px; + font-family: sans-serif; + font-weight: bold; + vertical-align: center; +} + +/* All views: header item format */ +td.headerItem +{ + text-align: right; + padding-right: 6px; + font-family: sans-serif; + font-weight: bold; + vertical-align: top; + white-space: nowrap; +} + +/* All views: header item value format */ +td.headerValue +{ + text-align: left; + color: #284fa8; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; +} + +/* All views: header item coverage table heading */ +td.headerCovTableHead +{ + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; +} + +/* All views: header item coverage table entry */ +td.headerCovTableEntry +{ + text-align: right; + color: #284fa8; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; + padding-left: 12px; + padding-right: 4px; + background-color: #dae7fe; +} + +/* All views: header item coverage table entry for high coverage rate */ +td.headerCovTableEntryHi +{ + text-align: right; + color: #000000; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; + padding-left: 12px; + padding-right: 4px; + background-color: #a7fc9d; +} + +/* All views: header item coverage table entry for medium coverage rate */ +td.headerCovTableEntryMed +{ + text-align: right; + color: #000000; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; + padding-left: 12px; + padding-right: 4px; + background-color: #ffea20; +} + +/* All views: header item coverage table entry for ow coverage rate */ +td.headerCovTableEntryLo +{ + text-align: right; + color: #000000; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; + padding-left: 12px; + padding-right: 4px; + background-color: #ff0000; +} + +/* All views: header legend value for legend entry */ +td.headerValueLeg +{ + text-align: left; + color: #000000; + font-family: sans-serif; + font-size: 80%; + white-space: nowrap; + padding-top: 4px; +} + +/* All views: color of horizontal ruler */ +td.ruler +{ + background-color: #6688d4; +} + +/* All views: version string format */ +td.versionInfo +{ + text-align: center; + padding-top: 2px; + font-family: sans-serif; + font-style: italic; +} + +/* Directory view/File view (all)/Test case descriptions: + table headline format */ +td.tableHead +{ + text-align: center; + color: #ffffff; + background-color: #6688d4; + font-family: sans-serif; + font-size: 120%; + font-weight: bold; + white-space: nowrap; + padding-left: 4px; + padding-right: 4px; +} + +span.tableHeadSort +{ + padding-right: 4px; +} + +/* Directory view/File view (all): filename entry format */ +td.coverFile +{ + text-align: left; + padding-left: 10px; + padding-right: 20px; + color: #284fa8; + background-color: #dae7fe; + font-family: monospace; +} + +/* Directory view/File view (all): filename entry format */ +td.overallOwner +{ + text-align: center; + font-weight: bold; + font-family: sans-serif; + background-color: #dae7fe; + padding-right: 10px; + padding-left: 10px; +} + +/* Directory view/File view (all): filename entry format */ +td.ownerName +{ + text-align: right; + font-style: italic; + font-family: sans-serif; + background-color: #E5DBDB; + padding-right: 10px; + padding-left: 20px; +} + +/* Directory view/File view (all): bar-graph entry format*/ +td.coverBar +{ + padding-left: 10px; + padding-right: 10px; + background-color: #dae7fe; +} + +/* Directory view/File view (all): bar-graph entry format*/ +td.owner_coverBar +{ + padding-left: 10px; + padding-right: 10px; + background-color: #E5DBDB; +} + +/* Directory view/File view (all): bar-graph outline color */ +td.coverBarOutline +{ + background-color: #000000; +} + +/* Directory view/File view (all): percentage entry for files with + high coverage rate */ +td.coverPerHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #a7fc9d; + font-weight: bold; + font-family: sans-serif; +} + +/* 'owner' entry: slightly lighter color than 'coverPerHi' */ +td.owner_coverPerHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #82E0AA; + font-weight: bold; + font-family: sans-serif; +} + +/* Directory view/File view (all): line count entry */ +td.coverNumDflt +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #dae7fe; + white-space: nowrap; + font-family: sans-serif; +} + +/* td background color and font for the 'owner' section of the table */ +td.ownerTla +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #E5DBDB; + white-space: nowrap; + font-family: sans-serif; + font-style: italic; +} + +/* Directory view/File view (all): line count entry for files with + high coverage rate */ +td.coverNumHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #a7fc9d; + white-space: nowrap; + font-family: sans-serif; +} + +td.owner_coverNumHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #82E0AA; + white-space: nowrap; + font-family: sans-serif; +} + +/* Directory view/File view (all): percentage entry for files with + medium coverage rate */ +td.coverPerMed +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #ffea20; + font-weight: bold; + font-family: sans-serif; +} + +td.owner_coverPerMed +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #F9E79F; + font-weight: bold; + font-family: sans-serif; +} + +/* Directory view/File view (all): line count entry for files with + medium coverage rate */ +td.coverNumMed +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #ffea20; + white-space: nowrap; + font-family: sans-serif; +} + +td.owner_coverNumMed +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #F9E79F; + white-space: nowrap; + font-family: sans-serif; +} + +/* Directory view/File view (all): percentage entry for files with + low coverage rate */ +td.coverPerLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #ff0000; + font-weight: bold; + font-family: sans-serif; +} + +td.owner_coverPerLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #EC7063; + font-weight: bold; + font-family: sans-serif; +} + +/* Directory view/File view (all): line count entry for files with + low coverage rate */ +td.coverNumLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #ff0000; + white-space: nowrap; + font-family: sans-serif; +} + +td.owner_coverNumLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #EC7063; + white-space: nowrap; + font-family: sans-serif; +} + +/* File view (all): "show/hide details" link format */ +a.detail:link +{ + color: #b8d0ff; + font-size:80%; +} + +/* File view (all): "show/hide details" link - visited format */ +a.detail:visited +{ + color: #b8d0ff; + font-size:80%; +} + +/* File view (all): "show/hide details" link - activated format */ +a.detail:active +{ + color: #ffffff; + font-size:80%; +} + +/* File view (detail): test name entry */ +td.testName +{ + text-align: right; + padding-right: 10px; + background-color: #dae7fe; + font-family: sans-serif; +} + +/* File view (detail): test percentage entry */ +td.testPer +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #dae7fe; + font-family: sans-serif; +} + +/* File view (detail): test lines count entry */ +td.testNum +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #dae7fe; + font-family: sans-serif; +} + +/* Test case descriptions: test name format*/ +dt +{ + font-family: sans-serif; + font-weight: bold; +} + +/* Test case descriptions: description table body */ +td.testDescription +{ + padding-top: 10px; + padding-left: 30px; + padding-bottom: 10px; + padding-right: 30px; + background-color: #dae7fe; +} + +/* Source code view: function entry */ +td.coverFn +{ + text-align: left; + padding-left: 10px; + padding-right: 20px; + color: #284fa8; + background-color: #dae7fe; + font-family: monospace; +} + +/* Source code view: function entry zero count*/ +td.coverFnLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #ff0000; + font-weight: bold; + font-family: sans-serif; +} + +/* Source code view: function entry nonzero count*/ +td.coverFnHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #dae7fe; + font-weight: bold; + font-family: sans-serif; +} + +td.coverFnAlias +{ + text-align: right; + padding-left: 10px; + padding-right: 20px; + color: #284fa8; + /* make this a slightly different color than the leader - otherwise, + otherwise the alias is hard to distinguish in the table */ + background-color: #E5DBDB; /* very light pale grey/blue */ + font-family: monospace; +} + +/* Source code view: function entry zero count*/ +td.coverFnAliasLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #EC7063; /* lighter red */ + font-family: sans-serif; +} + +/* Source code view: function entry nonzero count*/ +td.coverFnAliasHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #dae7fe; + font-weight: bold; + font-family: sans-serif; +} + +/* Source code view: source code format */ +pre.source +{ + font-family: monospace; + white-space: pre; + margin-top: 2px; +} + +/* Source code view: line number format */ +span.lineNum +{ + background-color: #efe383; +} + +/* Source code view: format for Cov legend */ +span.coverLegendCov +{ + padding-left: 10px; + padding-right: 10px; + padding-bottom: 2px; + background-color: #cad7fe; +} + +/* Source code view: format for NoCov legend */ +span.coverLegendNoCov +{ + padding-left: 10px; + padding-right: 10px; + padding-bottom: 2px; + background-color: #ff6230; +} + +/* Source code view: format for the source code heading line */ +pre.sourceHeading +{ + white-space: pre; + font-family: monospace; + font-weight: bold; + margin: 0px; +} + +/* All views: header legend value for low rate */ +td.headerValueLegL +{ + font-family: sans-serif; + text-align: center; + white-space: nowrap; + padding-left: 4px; + padding-right: 2px; + background-color: #ff0000; + font-size: 80%; +} + +/* All views: header legend value for med rate */ +td.headerValueLegM +{ + font-family: sans-serif; + text-align: center; + white-space: nowrap; + padding-left: 2px; + padding-right: 2px; + background-color: #ffea20; + font-size: 80%; +} + +/* All views: header legend value for hi rate */ +td.headerValueLegH +{ + font-family: sans-serif; + text-align: center; + white-space: nowrap; + padding-left: 2px; + padding-right: 4px; + background-color: #a7fc9d; + font-size: 80%; +} + +/* All views except source code view: legend format for low coverage */ +span.coverLegendCovLo +{ + padding-left: 10px; + padding-right: 10px; + padding-top: 2px; + background-color: #ff0000; +} + +/* All views except source code view: legend format for med coverage */ +span.coverLegendCovMed +{ + padding-left: 10px; + padding-right: 10px; + padding-top: 2px; + background-color: #ffea20; +} + +/* All views except source code view: legend format for hi coverage */ +span.coverLegendCovHi +{ + padding-left: 10px; + padding-right: 10px; + padding-top: 2px; + background-color: #a7fc9d; +} + +a.branchTla:link +{ + color: #000000; +} + +a.branchTla:visited +{ + color: #000000; +} + +/* Source code view/table entry backround: format for lines classified as "Uncovered New Code (+ => 0): +Newly added code is not tested" */ +td.tlaUNC +{ + text-align: right; + background-color: #FF6230; +} +td.tlaBgUNC { + background-color: #FF6230; +} + +/* Source code view/table entry backround: format for lines classified as "Uncovered New Code (+ => 0): +Newly added code is not tested" */ +span.tlaUNC +{ + text-align: left; + background-color: #FF6230; +} +span.tlaBgUNC { + background-color: #FF6230; +} +a.tlaBgUNC { + background-color: #FF6230; + color: #000000; +} + +td.headerCovTableHeadUNC { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #FF6230; +} + +/* Source code view/table entry backround: format for lines classified as "Lost Baseline Coverage (1 => 0): +Unchanged code is no longer tested" */ +td.tlaLBC +{ + text-align: right; + background-color: #FF6230; +} +td.tlaBgLBC { + background-color: #FF6230; +} + +/* Source code view/table entry backround: format for lines classified as "Lost Baseline Coverage (1 => 0): +Unchanged code is no longer tested" */ +span.tlaLBC +{ + text-align: left; + background-color: #FF6230; +} +span.tlaBgLBC { + background-color: #FF6230; +} +a.tlaBgLBC { + background-color: #FF6230; + color: #000000; +} + +td.headerCovTableHeadLBC { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #FF6230; +} + +/* Source code view/table entry backround: format for lines classified as "Uncovered Included Code (# => 0): +Previously unused code is untested" */ +td.tlaUIC +{ + text-align: right; + background-color: #FF6230; +} +td.tlaBgUIC { + background-color: #FF6230; +} + +/* Source code view/table entry backround: format for lines classified as "Uncovered Included Code (# => 0): +Previously unused code is untested" */ +span.tlaUIC +{ + text-align: left; + background-color: #FF6230; +} +span.tlaBgUIC { + background-color: #FF6230; +} +a.tlaBgUIC { + background-color: #FF6230; + color: #000000; +} + +td.headerCovTableHeadUIC { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #FF6230; +} + +/* Source code view/table entry backround: format for lines classified as "Uncovered Baseline Code (0 => 0): +Unchanged code was untested before, is untested now" */ +td.tlaUBC +{ + text-align: right; + background-color: #FF6230; +} +td.tlaBgUBC { + background-color: #FF6230; +} + +/* Source code view/table entry backround: format for lines classified as "Uncovered Baseline Code (0 => 0): +Unchanged code was untested before, is untested now" */ +span.tlaUBC +{ + text-align: left; + background-color: #FF6230; +} +span.tlaBgUBC { + background-color: #FF6230; +} +a.tlaBgUBC { + background-color: #FF6230; + color: #000000; +} + +td.headerCovTableHeadUBC { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #FF6230; +} + +/* Source code view/table entry backround: format for lines classified as "Gained Baseline Coverage (0 => 1): +Unchanged code is tested now" */ +td.tlaGBC +{ + text-align: right; + background-color: #CAD7FE; +} +td.tlaBgGBC { + background-color: #CAD7FE; +} + +/* Source code view/table entry backround: format for lines classified as "Gained Baseline Coverage (0 => 1): +Unchanged code is tested now" */ +span.tlaGBC +{ + text-align: left; + background-color: #CAD7FE; +} +span.tlaBgGBC { + background-color: #CAD7FE; +} +a.tlaBgGBC { + background-color: #CAD7FE; + color: #000000; +} + +td.headerCovTableHeadGBC { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #CAD7FE; +} + +/* Source code view/table entry backround: format for lines classified as "Gained Included Coverage (# => 1): +Previously unused code is tested now" */ +td.tlaGIC +{ + text-align: right; + background-color: #CAD7FE; +} +td.tlaBgGIC { + background-color: #CAD7FE; +} + +/* Source code view/table entry backround: format for lines classified as "Gained Included Coverage (# => 1): +Previously unused code is tested now" */ +span.tlaGIC +{ + text-align: left; + background-color: #CAD7FE; +} +span.tlaBgGIC { + background-color: #CAD7FE; +} +a.tlaBgGIC { + background-color: #CAD7FE; + color: #000000; +} + +td.headerCovTableHeadGIC { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #CAD7FE; +} + +/* Source code view/table entry backround: format for lines classified as "Gained New Coverage (+ => 1): +Newly added code is tested" */ +td.tlaGNC +{ + text-align: right; + background-color: #CAD7FE; +} +td.tlaBgGNC { + background-color: #CAD7FE; +} + +/* Source code view/table entry backround: format for lines classified as "Gained New Coverage (+ => 1): +Newly added code is tested" */ +span.tlaGNC +{ + text-align: left; + background-color: #CAD7FE; +} +span.tlaBgGNC { + background-color: #CAD7FE; +} +a.tlaBgGNC { + background-color: #CAD7FE; + color: #000000; +} + +td.headerCovTableHeadGNC { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #CAD7FE; +} + +/* Source code view/table entry backround: format for lines classified as "Covered Baseline Code (1 => 1): +Unchanged code was tested before and is still tested" */ +td.tlaCBC +{ + text-align: right; + background-color: #CAD7FE; +} +td.tlaBgCBC { + background-color: #CAD7FE; +} + +/* Source code view/table entry backround: format for lines classified as "Covered Baseline Code (1 => 1): +Unchanged code was tested before and is still tested" */ +span.tlaCBC +{ + text-align: left; + background-color: #CAD7FE; +} +span.tlaBgCBC { + background-color: #CAD7FE; +} +a.tlaBgCBC { + background-color: #CAD7FE; + color: #000000; +} + +td.headerCovTableHeadCBC { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #CAD7FE; +} + +/* Source code view/table entry backround: format for lines classified as "Excluded Uncovered Baseline (0 => #): +Previously untested code is unused now" */ +td.tlaEUB +{ + text-align: right; + background-color: #FFFFFF; +} +td.tlaBgEUB { + background-color: #FFFFFF; +} + +/* Source code view/table entry backround: format for lines classified as "Excluded Uncovered Baseline (0 => #): +Previously untested code is unused now" */ +span.tlaEUB +{ + text-align: left; + background-color: #FFFFFF; +} +span.tlaBgEUB { + background-color: #FFFFFF; +} +a.tlaBgEUB { + background-color: #FFFFFF; + color: #000000; +} + +td.headerCovTableHeadEUB { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #FFFFFF; +} + +/* Source code view/table entry backround: format for lines classified as "Excluded Covered Baseline (1 => #): +Previously tested code is unused now" */ +td.tlaECB +{ + text-align: right; + background-color: #FFFFFF; +} +td.tlaBgECB { + background-color: #FFFFFF; +} + +/* Source code view/table entry backround: format for lines classified as "Excluded Covered Baseline (1 => #): +Previously tested code is unused now" */ +span.tlaECB +{ + text-align: left; + background-color: #FFFFFF; +} +span.tlaBgECB { + background-color: #FFFFFF; +} +a.tlaBgECB { + background-color: #FFFFFF; + color: #000000; +} + +td.headerCovTableHeadECB { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #FFFFFF; +} + +/* Source code view/table entry backround: format for lines classified as "Deleted Uncovered Baseline (0 => -): +Previously untested code has been deleted" */ +td.tlaDUB +{ + text-align: right; + background-color: #FFFFFF; +} +td.tlaBgDUB { + background-color: #FFFFFF; +} + +/* Source code view/table entry backround: format for lines classified as "Deleted Uncovered Baseline (0 => -): +Previously untested code has been deleted" */ +span.tlaDUB +{ + text-align: left; + background-color: #FFFFFF; +} +span.tlaBgDUB { + background-color: #FFFFFF; +} +a.tlaBgDUB { + background-color: #FFFFFF; + color: #000000; +} + +td.headerCovTableHeadDUB { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #FFFFFF; +} + +/* Source code view/table entry backround: format for lines classified as "Deleted Covered Baseline (1 => -): +Previously tested code has been deleted" */ +td.tlaDCB +{ + text-align: right; + background-color: #FFFFFF; +} +td.tlaBgDCB { + background-color: #FFFFFF; +} + +/* Source code view/table entry backround: format for lines classified as "Deleted Covered Baseline (1 => -): +Previously tested code has been deleted" */ +span.tlaDCB +{ + text-align: left; + background-color: #FFFFFF; +} +span.tlaBgDCB { + background-color: #FFFFFF; +} +a.tlaBgDCB { + background-color: #FFFFFF; + color: #000000; +} + +td.headerCovTableHeadDCB { + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + white-space: nowrap; + background-color: #FFFFFF; +} + +/* Source code view: format for date/owner bin that is not hit */ +span.missBins +{ + background-color: #ff0000 /* red */ +} diff --git a/report/glass.png b/report/glass.png new file mode 100644 index 0000000000000000000000000000000000000000..e1abc00680a3093c49fdb775ae6bdb6764c95af2 GIT binary patch literal 167 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)gaEa{HEjtmSN`?>!lvI6;R0X`wF z|Ns97GD8ntt^-nxB|(0{3=Yq3q=7g|-tI089jvk*Kn`btM`SSr1Gf+eGhVt|_XjA* zUgGKN%6^Gmn4d%Ph(nkFP>9RZ#WAE}PI3Z}&BVayv3^M*kj3EX>gTe~DWM4f=_Dpv literal 0 HcmV?d00001 diff --git a/report/index-sort-b.html b/report/index-sort-b.html new file mode 100644 index 0000000..d4baaf2 --- /dev/null +++ b/report/index-sort-b.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - lcov.info.p + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top levelCoverageTotalHit
Test:lcov.info.pLines:100.0 %100100
Test Date:2024-04-15 16:35:51Functions:100.0 %1717
Branches:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Directory Sort by file nameLine Coverage Sort by line coverageBranch Coverage Sort by branch coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit Rate Total Hit
contracts/src/contracts +
100.0%
+
100.0 %100100-100.0 %1717
+
+
+ + + + +
Generated by: LCOV version 2.0-1
+
+ + + diff --git a/report/index-sort-f.html b/report/index-sort-f.html new file mode 100644 index 0000000..745a82b --- /dev/null +++ b/report/index-sort-f.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - lcov.info.p + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top levelCoverageTotalHit
Test:lcov.info.pLines:100.0 %100100
Test Date:2024-04-15 16:35:51Functions:100.0 %1717
Branches:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Directory Sort by file nameLine Coverage Sort by line coverageBranch Coverage Sort by branch coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit Rate Total Hit
contracts/src/contracts +
100.0%
+
100.0 %100100-100.0 %1717
+
+
+ + + + +
Generated by: LCOV version 2.0-1
+
+ + + diff --git a/report/index-sort-l.html b/report/index-sort-l.html new file mode 100644 index 0000000..5c2e8d7 --- /dev/null +++ b/report/index-sort-l.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - lcov.info.p + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top levelCoverageTotalHit
Test:lcov.info.pLines:100.0 %100100
Test Date:2024-04-15 16:35:51Functions:100.0 %1717
Branches:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Directory Sort by file nameLine Coverage Sort by line coverageBranch Coverage Sort by branch coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit Rate Total Hit
contracts/src/contracts +
100.0%
+
100.0 %100100-100.0 %1717
+
+
+ + + + +
Generated by: LCOV version 2.0-1
+
+ + + diff --git a/report/index.html b/report/index.html new file mode 100644 index 0000000..8309ab7 --- /dev/null +++ b/report/index.html @@ -0,0 +1,124 @@ + + + + + + + LCOV - lcov.info.p + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top levelCoverageTotalHit
Test:lcov.info.pLines:100.0 %100100
Test Date:2024-04-15 16:35:51Functions:100.0 %1717
Branches:-00
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Directory Sort by file nameLine Coverage Sort by line coverageBranch Coverage Sort by branch coverageFunction Coverage Sort by function coverage
Rate Total Hit Rate Total Hit Rate Total Hit
contracts/src/contracts +
100.0%
+
100.0 %100100-100.0 %1717
+
+
+ + + + +
Generated by: LCOV version 2.0-1
+
+ + + diff --git a/report/ruby.png b/report/ruby.png new file mode 100644 index 0000000000000000000000000000000000000000..991b6d4ec9e78be165e3ef757eed1aada287364d GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga>?NMQuI!iC1^FceV#7`HfI^%F z9+AZi4BSE>%y{W;-5;PJOS+@4BLl<6e(pbstUx|nfKQ0)e^Y%R^MdiLxj>4`)5S5Q b;#P73kj=!v_*DHKNFRfztDnm{r-UW|iOwIS literal 0 HcmV?d00001 diff --git a/report/snow.png b/report/snow.png new file mode 100644 index 0000000000000000000000000000000000000000..2cdae107fceec6e7f02ac7acb4a34a82a540caa5 GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga>?NMQuI!iC1^MM!lvI6;R0X`wF|Ns97GD8ntt^-nBo-U3d c6}OTTfNUlP#;5A{K>8RwUHx3vIVCg!071?oo&W#< literal 0 HcmV?d00001 diff --git a/report/updown.png b/report/updown.png new file mode 100644 index 0000000000000000000000000000000000000000..aa56a238b3e6c435265250f9266cd1b8caba0f20 GIT binary patch literal 117 zcmeAS@N?(olHy`uVBq!ia0vp^AT}Qd8;}%R+`Ae`*?77*hG?8mPH5^{)z4*}Q$iB}huR`+ literal 0 HcmV?d00001 From 8fa1f0f702cb1106345f9866bcdaa655f40e5fbe Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Mon, 15 Apr 2024 16:41:00 +0530 Subject: [PATCH 2/9] chore: ci workflow --- .github/workflows/report-pages.yml | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/report-pages.yml diff --git a/.github/workflows/report-pages.yml b/.github/workflows/report-pages.yml new file mode 100644 index 0000000..d504def --- /dev/null +++ b/.github/workflows/report-pages.yml @@ -0,0 +1,43 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy static content to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + # Upload only report folder + path: "./report" + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From d287910f691543c75d58aea52cc2fc49eb03e27b Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Mon, 15 Apr 2024 16:47:05 +0530 Subject: [PATCH 3/9] chore: test ci --- .github/workflows/report-pages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/report-pages.yml b/.github/workflows/report-pages.yml index d504def..22692bd 100644 --- a/.github/workflows/report-pages.yml +++ b/.github/workflows/report-pages.yml @@ -2,6 +2,7 @@ name: Deploy static content to Pages on: + pull_request: # Runs on pushes targeting the default branch push: branches: ["main"] From 9d955a97b483982c759dbea51c0cf0d2a1052d71 Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Mon, 15 Apr 2024 16:55:50 +0530 Subject: [PATCH 4/9] fix: ci --- .github/workflows/report-pages.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/report-pages.yml b/.github/workflows/report-pages.yml index 22692bd..d504def 100644 --- a/.github/workflows/report-pages.yml +++ b/.github/workflows/report-pages.yml @@ -2,7 +2,6 @@ name: Deploy static content to Pages on: - pull_request: # Runs on pushes targeting the default branch push: branches: ["main"] From edb49417ea5d214bd6315eedf0d1c64834dd0840 Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 7 May 2024 16:01:54 +0200 Subject: [PATCH 5/9] Update url on report --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1efd6df..2a888e8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Expanding from the scope of from CapsPlusRiskSteward, we now introduce the new RiskSteward, allowing hardly constrained risk parameter updates by risk service providers and reducing governance overhead. -[![Coverage badge](./report/coverage.svg)](https://github.com/bgd-labs/aave-risk-stewards-2) +[![Coverage badge](./report/coverage.svg)]([https://github.com/bgd-labs/aave-risk-stewards-2](https://bgd-labs.github.io/aave-risk-stewards-2/) ## Specification From 195015a492278987f108dd06737d355509d3a3db Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 7 May 2024 16:02:29 +0200 Subject: [PATCH 6/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a888e8..5bd9fae 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Expanding from the scope of from CapsPlusRiskSteward, we now introduce the new RiskSteward, allowing hardly constrained risk parameter updates by risk service providers and reducing governance overhead. -[![Coverage badge](./report/coverage.svg)]([https://github.com/bgd-labs/aave-risk-stewards-2](https://bgd-labs.github.io/aave-risk-stewards-2/) +[![Coverage badge](./report/coverage.svg)](https://bgd-labs.github.io/aave-risk-stewards-2/) ## Specification From 05d86968933e462cf3bf78f38e6cebeaf3e1c952 Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Tue, 7 May 2024 19:46:10 +0530 Subject: [PATCH 7/9] feat: update coverage --- lcov.info | 336 +++++++ lcov.info.p | 152 +++ .../src/contracts/RiskSteward.sol.func-c.html | 72 +- .../src/contracts/RiskSteward.sol.func.html | 72 +- .../src/contracts/RiskSteward.sol.gcov.html | 911 +++++++++--------- .../contracts/src/contracts/index-sort-b.html | 28 +- .../contracts/src/contracts/index-sort-f.html | 28 +- .../contracts/src/contracts/index-sort-l.html | 28 +- report/contracts/src/contracts/index.html | 28 +- report/coverage.svg | 2 +- report/index-sort-b.html | 28 +- report/index-sort-f.html | 28 +- report/index-sort-l.html | 28 +- report/index.html | 28 +- 14 files changed, 1123 insertions(+), 646 deletions(-) create mode 100644 lcov.info create mode 100644 lcov.info.p diff --git a/lcov.info b/lcov.info new file mode 100644 index 0000000..dd69fb5 --- /dev/null +++ b/lcov.info @@ -0,0 +1,336 @@ +TN: +SF:src/contracts/RiskSteward.sol +FN:41,RiskSteward.onlyRiskCouncil +FNDA:266,RiskSteward.onlyRiskCouncil +DA:42,266 +DA:42,266 +BRDA:42,0,0,256 +BRDA:42,0,1,7 +DA:42,256 +FN:52,RiskSteward. +FNDA:0,RiskSteward. +DA:58,0 +DA:58,0 +DA:59,0 +DA:59,0 +DA:60,0 +DA:60,0 +DA:61,0 +DA:61,0 +FN:65,RiskSteward.updateCaps +FNDA:266,RiskSteward.updateCaps +DA:66,10 +DA:66,10 +DA:67,4 +DA:67,4 +FN:71,RiskSteward.updateRates +FNDA:263,RiskSteward.updateRates +DA:72,7 +DA:72,7 +DA:73,3 +DA:73,3 +FN:77,RiskSteward.updateCollateralSide +FNDA:266,RiskSteward.updateCollateralSide +DA:80,10 +DA:80,10 +DA:81,3 +DA:81,3 +FN:85,RiskSteward.getTimelock +FNDA:6,RiskSteward.getTimelock +DA:86,6 +DA:86,6 +FN:90,RiskSteward.setRiskConfig +FNDA:259,RiskSteward.setRiskConfig +DA:91,3 +DA:91,3 +DA:92,3 +DA:92,3 +FN:96,RiskSteward.getRiskConfig +FNDA:1,RiskSteward.getRiskConfig +DA:97,1 +DA:97,1 +FN:101,RiskSteward.isAssetRestricted +FNDA:2,RiskSteward.isAssetRestricted +DA:102,2 +DA:102,2 +FN:106,RiskSteward.setAssetRestricted +FNDA:261,RiskSteward.setAssetRestricted +DA:107,5 +DA:107,5 +DA:108,5 +DA:108,5 +FN:115,RiskSteward._validateCapsUpdate +FNDA:10,RiskSteward._validateCapsUpdate +DA:116,10 +DA:116,10 +BRDA:116,1,0,- +BRDA:116,1,1,10 +DA:116,0 +DA:118,10 +DA:118,10 +DA:118,14 +DA:118,4 +DA:119,10 +DA:119,10 +DA:121,10 +BRDA:121,2,0,1 +BRDA:121,2,1,9 +DA:121,1 +DA:122,9 +DA:122,9 +DA:122,9 +DA:122,8 +BRDA:122,3,0,1 +BRDA:122,3,1,8 +DA:122,1 +DA:124,8 +DA:124,8 +DA:124,8 +DA:128,8 +DA:128,8 +DA:137,4 +DA:137,4 +FN:153,RiskSteward._validateRatesUpdate +FNDA:7,RiskSteward._validateRatesUpdate +DA:154,7 +DA:154,7 +BRDA:154,4,0,- +BRDA:154,4,1,7 +DA:154,0 +DA:156,7 +DA:156,7 +DA:156,10 +DA:156,3 +DA:157,7 +DA:157,7 +DA:158,7 +BRDA:158,5,0,1 +BRDA:158,5,1,6 +DA:158,1 +DA:160,6 +DA:160,6 +DA:165,6 +DA:165,6 +DA:167,5 +DA:167,5 +DA:176,3 +DA:176,3 +DA:185,3 +DA:185,3 +DA:194,3 +DA:194,3 +FN:210,RiskSteward._validateCollateralsUpdate +FNDA:10,RiskSteward._validateCollateralsUpdate +DA:213,10 +DA:213,10 +BRDA:213,6,0,- +BRDA:213,6,1,10 +DA:213,0 +DA:215,10 +DA:215,10 +DA:215,13 +DA:215,3 +DA:216,10 +DA:216,10 +DA:218,10 +BRDA:218,7,0,1 +BRDA:218,7,1,9 +DA:218,1 +DA:219,9 +DA:219,9 +BRDA:219,8,0,1 +BRDA:219,8,1,8 +DA:219,1 +DA:221,8 +DA:221,8 +DA:221,8 +DA:221,8 +DA:221,8 +DA:222,7 +DA:222,7 +DA:223,7 +DA:223,7 +DA:224,7 +DA:224,7 +BRDA:220,9,0,1 +BRDA:220,9,1,7 +DA:225,1 +DA:225,1 +DA:227,7 +DA:227,7 +DA:238,7 +DA:238,7 +DA:239,7 +DA:239,7 +DA:239,7 +DA:241,7 +DA:241,7 +DA:250,4 +DA:250,4 +DA:259,4 +DA:259,4 +DA:268,4 +DA:268,4 +FN:284,RiskSteward._validateParamUpdate +FNDA:45,RiskSteward._validateParamUpdate +DA:287,45 +DA:287,45 +BRDA:287,10,0,37 +BRDA:287,10,1,35 +DA:287,45 +DA:289,37 +DA:289,37 +DA:289,37 +BRDA:289,11,0,3 +BRDA:289,11,1,34 +DA:289,3 +DA:291,34 +DA:291,34 +BRDA:290,12,0,7 +BRDA:290,12,1,27 +DA:297,7 +DA:297,7 +FN:304,RiskSteward._updateCaps +FNDA:4,RiskSteward._updateCaps +DA:305,4 +DA:305,4 +DA:305,8 +DA:305,4 +DA:306,4 +DA:306,4 +DA:308,4 +DA:308,4 +BRDA:308,13,0,3 +BRDA:308,13,1,4 +DA:309,3 +DA:309,3 +DA:312,4 +DA:312,4 +BRDA:312,14,0,3 +BRDA:312,14,1,4 +DA:313,3 +DA:313,3 +DA:317,4 +DA:317,4 +FN:326,RiskSteward._updateRates +FNDA:3,RiskSteward._updateRates +DA:327,3 +DA:327,3 +DA:327,6 +DA:327,3 +DA:328,3 +DA:328,3 +DA:330,3 +DA:330,3 +BRDA:330,15,0,3 +BRDA:330,15,1,3 +DA:331,3 +DA:331,3 +DA:334,3 +DA:334,3 +BRDA:334,16,0,3 +BRDA:334,16,1,3 +DA:335,3 +DA:335,3 +DA:338,3 +DA:338,3 +BRDA:338,17,0,3 +BRDA:338,17,1,3 +DA:339,3 +DA:339,3 +DA:342,3 +DA:342,3 +BRDA:342,18,0,3 +BRDA:342,18,1,3 +DA:343,3 +DA:343,3 +DA:347,3 +DA:347,3 +FN:356,RiskSteward._updateCollateralSide +FNDA:3,RiskSteward._updateCollateralSide +DA:357,3 +DA:357,3 +DA:357,6 +DA:357,3 +DA:358,3 +DA:358,3 +DA:360,3 +DA:360,3 +BRDA:360,19,0,2 +BRDA:360,19,1,3 +DA:361,2 +DA:361,2 +DA:364,3 +DA:364,3 +BRDA:364,20,0,2 +BRDA:364,20,1,3 +DA:365,2 +DA:365,2 +DA:368,3 +DA:368,3 +BRDA:368,21,0,2 +BRDA:368,21,1,3 +DA:369,2 +DA:369,2 +DA:372,3 +DA:372,3 +BRDA:372,22,0,3 +BRDA:372,22,1,3 +DA:373,3 +DA:373,3 +DA:377,3 +DA:377,3 +FN:390,RiskSteward._getInterestRatesForAsset +FNDA:6,RiskSteward._getInterestRatesForAsset +DA:402,6 +DA:402,6 +DA:402,6 +DA:403,6 +DA:403,6 +DA:404,6 +DA:404,6 +DA:406,5 +DA:406,5 +FN:423,RiskSteward._updateWithinAllowedRange +FNDA:34,RiskSteward._updateWithinAllowedRange +DA:430,34 +DA:430,34 +DA:430,34 +DA:435,34 +DA:435,34 +DA:435,34 +DA:436,34 +DA:436,34 +BRDA:436,23,0,7 +BRDA:436,23,1,27 +DA:436,7 +DA:437,27 +DA:437,27 +FNF:19 +FNH:18 +LF:94 +LH:90 +BRF:48 +BRH:45 +end_of_record +TN: +SF:tests/utils/ConfigEngineDeployer.sol +FN:21,ConfigEngineDeployer.deployEngine +FNDA:22,ConfigEngineDeployer.deployEngine +DA:22,22 +DA:22,22 +DA:22,22 +DA:33,22 +DA:33,22 +DA:33,22 +DA:43,22 +DA:43,22 +DA:44,22 +DA:44,22 +FNF:1 +FNH:1 +LF:4 +LH:4 +BRF:0 +BRH:0 +end_of_record diff --git a/lcov.info.p b/lcov.info.p new file mode 100644 index 0000000..a3fa4c0 --- /dev/null +++ b/lcov.info.p @@ -0,0 +1,152 @@ +TN: +SF:src/contracts/RiskSteward.sol +FN:101,RiskSteward.isAssetRestricted +FN:106,RiskSteward.setAssetRestricted +FN:115,RiskSteward._validateCapsUpdate +FN:153,RiskSteward._validateRatesUpdate +FN:210,RiskSteward._validateCollateralsUpdate +FN:284,RiskSteward._validateParamUpdate +FN:304,RiskSteward._updateCaps +FN:326,RiskSteward._updateRates +FN:356,RiskSteward._updateCollateralSide +FN:390,RiskSteward._getInterestRatesForAsset +FN:41,RiskSteward.onlyRiskCouncil +FN:423,RiskSteward._updateWithinAllowedRange +FN:52,RiskSteward. +FN:65,RiskSteward.updateCaps +FN:71,RiskSteward.updateRates +FN:77,RiskSteward.updateCollateralSide +FN:85,RiskSteward.getTimelock +FN:90,RiskSteward.setRiskConfig +FN:96,RiskSteward.getRiskConfig +FNDA:2,RiskSteward.isAssetRestricted +FNDA:261,RiskSteward.setAssetRestricted +FNDA:10,RiskSteward._validateCapsUpdate +FNDA:7,RiskSteward._validateRatesUpdate +FNDA:10,RiskSteward._validateCollateralsUpdate +FNDA:45,RiskSteward._validateParamUpdate +FNDA:4,RiskSteward._updateCaps +FNDA:3,RiskSteward._updateRates +FNDA:3,RiskSteward._updateCollateralSide +FNDA:6,RiskSteward._getInterestRatesForAsset +FNDA:266,RiskSteward.onlyRiskCouncil +FNDA:34,RiskSteward._updateWithinAllowedRange +FNDA:0,RiskSteward. +FNDA:266,RiskSteward.updateCaps +FNDA:263,RiskSteward.updateRates +FNDA:266,RiskSteward.updateCollateralSide +FNDA:6,RiskSteward.getTimelock +FNDA:259,RiskSteward.setRiskConfig +FNDA:1,RiskSteward.getRiskConfig +FNF:19 +FNH:18 +DA:42,788 +DA:58,0 +DA:59,0 +DA:60,0 +DA:61,0 +DA:66,20 +DA:67,8 +DA:72,14 +DA:73,6 +DA:80,20 +DA:81,6 +DA:86,12 +DA:91,6 +DA:92,6 +DA:97,2 +DA:102,4 +DA:107,10 +DA:108,10 +DA:116,20 +DA:118,38 +DA:119,20 +DA:121,11 +DA:122,36 +DA:124,24 +DA:128,16 +DA:137,8 +DA:154,14 +DA:156,27 +DA:157,14 +DA:158,8 +DA:160,12 +DA:165,12 +DA:167,10 +DA:176,6 +DA:185,6 +DA:194,6 +DA:213,20 +DA:215,36 +DA:216,20 +DA:218,11 +DA:219,19 +DA:221,40 +DA:222,14 +DA:223,14 +DA:224,14 +DA:225,2 +DA:227,14 +DA:238,14 +DA:239,21 +DA:241,14 +DA:250,8 +DA:259,8 +DA:268,8 +DA:287,135 +DA:289,114 +DA:291,68 +DA:297,14 +DA:305,20 +DA:306,8 +DA:308,8 +DA:309,6 +DA:312,8 +DA:313,6 +DA:317,8 +DA:327,15 +DA:328,6 +DA:330,6 +DA:331,6 +DA:334,6 +DA:335,6 +DA:338,6 +DA:339,6 +DA:342,6 +DA:343,6 +DA:347,6 +DA:357,15 +DA:358,6 +DA:360,6 +DA:361,4 +DA:364,6 +DA:365,4 +DA:368,6 +DA:369,4 +DA:372,6 +DA:373,6 +DA:377,6 +DA:402,18 +DA:403,12 +DA:404,12 +DA:406,10 +DA:430,102 +DA:435,102 +DA:436,75 +DA:437,54 +LF:94 +LH:90 +end_of_record +TN: +SF:tests/utils/ConfigEngineDeployer.sol +FN:21,ConfigEngineDeployer.deployEngine +FNDA:22,ConfigEngineDeployer.deployEngine +FNF:1 +FNH:1 +DA:22,66 +DA:33,66 +DA:43,44 +DA:44,44 +LF:4 +LH:4 +end_of_record diff --git a/report/contracts/src/contracts/RiskSteward.sol.func-c.html b/report/contracts/src/contracts/RiskSteward.sol.func-c.html index e314f5f..f596fa5 100644 --- a/report/contracts/src/contracts/RiskSteward.sol.func-c.html +++ b/report/contracts/src/contracts/RiskSteward.sol.func-c.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 100.0 % - 100 - 100 + 95.7 % + 94 + 90 Test Date: - 2024-04-15 16:35:51 + 2024-05-07 19:38:40 Functions: - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 @@ -72,121 +72,135 @@ - RiskSteward.getRiskConfig + RiskSteward. + + 0 + + + + + RiskSteward.getRiskConfig 1 - RiskSteward.isAssetRestricted + RiskSteward.isAssetRestricted 2 - RiskSteward._updateCollateralSide + RiskSteward._updateCollateralSide 3 - RiskSteward._updateRates + RiskSteward._updateRates 3 - RiskSteward._updateCaps + RiskSteward._updateCaps 4 - RiskSteward._getInterestRatesForAsset + RiskSteward._getInterestRatesForAsset 6 - RiskSteward.getTimelock + RiskSteward.getTimelock 6 - RiskSteward._validateRatesUpdate + RiskSteward._validateRatesUpdate 7 - RiskSteward._validateCapsUpdate + RiskSteward._validateCapsUpdate 10 - RiskSteward._validateCollateralsUpdate + RiskSteward._validateCollateralsUpdate 10 - RiskSteward._updateWithinAllowedRange + RiskSteward._updateWithinAllowedRange 34 - RiskSteward._validateParamUpdate + RiskSteward._validateParamUpdate 45 - RiskSteward.setRiskConfig + RiskSteward.setRiskConfig + + 259 + + + + + RiskSteward.setAssetRestricted - 260 + 261 - RiskSteward.setAssetRestricted + RiskSteward.updateRates - 262 + 263 - RiskSteward.updateRates + RiskSteward.onlyRiskCouncil - 264 + 266 - RiskSteward.updateCaps + RiskSteward.updateCaps - 267 + 266 - RiskSteward.updateCollateralSide + RiskSteward.updateCollateralSide - 267 + 266 diff --git a/report/contracts/src/contracts/RiskSteward.sol.func.html b/report/contracts/src/contracts/RiskSteward.sol.func.html index 636845b..8cda48d 100644 --- a/report/contracts/src/contracts/RiskSteward.sol.func.html +++ b/report/contracts/src/contracts/RiskSteward.sol.func.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 100.0 % - 100 - 100 + 95.7 % + 94 + 90 Test Date: - 2024-04-15 16:35:51 + 2024-05-07 19:38:40 Functions: - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 @@ -72,121 +72,135 @@ - RiskSteward._getInterestRatesForAsset + RiskSteward. + + 0 + + + + + RiskSteward._getInterestRatesForAsset 6 - RiskSteward._updateCaps + RiskSteward._updateCaps 4 - RiskSteward._updateCollateralSide + RiskSteward._updateCollateralSide 3 - RiskSteward._updateRates + RiskSteward._updateRates 3 - RiskSteward._updateWithinAllowedRange + RiskSteward._updateWithinAllowedRange 34 - RiskSteward._validateCapsUpdate + RiskSteward._validateCapsUpdate 10 - RiskSteward._validateCollateralsUpdate + RiskSteward._validateCollateralsUpdate 10 - RiskSteward._validateParamUpdate + RiskSteward._validateParamUpdate 45 - RiskSteward._validateRatesUpdate + RiskSteward._validateRatesUpdate 7 - RiskSteward.getRiskConfig + RiskSteward.getRiskConfig 1 - RiskSteward.getTimelock + RiskSteward.getTimelock 6 - RiskSteward.isAssetRestricted + RiskSteward.isAssetRestricted 2 - RiskSteward.setAssetRestricted + RiskSteward.onlyRiskCouncil + + 266 + + + + + RiskSteward.setAssetRestricted - 262 + 261 - RiskSteward.setRiskConfig + RiskSteward.setRiskConfig - 260 + 259 - RiskSteward.updateCaps + RiskSteward.updateCaps - 267 + 266 - RiskSteward.updateCollateralSide + RiskSteward.updateCollateralSide - 267 + 266 - RiskSteward.updateRates + RiskSteward.updateRates - 264 + 263 diff --git a/report/contracts/src/contracts/RiskSteward.sol.gcov.html b/report/contracts/src/contracts/RiskSteward.sol.gcov.html index d3d7d4e..2eef2a6 100644 --- a/report/contracts/src/contracts/RiskSteward.sol.gcov.html +++ b/report/contracts/src/contracts/RiskSteward.sol.gcov.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 100.0 % - 100 - 100 + 95.7 % + 94 + 90 Test Date: - 2024-04-15 16:35:51 + 2024-05-07 19:38:40 Functions: - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 @@ -69,484 +69,445 @@
             Branch data     Line data    Source code
-       1                 :             : // SPDX-License-Identifier: MIT
+       1                 :             : // SPDX-License-Identifier: BUSL-1.1
        2                 :             : pragma solidity ^0.8.0;
        3                 :             : 
        4                 :             : import {IPoolDataProvider} from 'aave-address-book/AaveV3.sol';
        5                 :             : import {Address} from 'solidity-utils/contracts/oz-common/Address.sol';
        6                 :             : import {EngineFlags} from 'aave-helpers/v3-config-engine/EngineFlags.sol';
-       7                 :             : import {ConfigConstants} from './libraries/ConfigConstants.sol';
-       8                 :             : import {Ownable} from 'solidity-utils/contracts/oz-common/Ownable.sol';
-       9                 :             : import {IAaveV3ConfigEngine as IEngine} from 'aave-v3-periphery/contracts/v3-config-engine/IAaveV3ConfigEngine.sol';
-      10                 :             : import {IRiskSteward} from '../interfaces/IRiskSteward.sol';
-      11                 :             : import {IDefaultInterestRateStrategyV2} from 'aave-v3-core/contracts/interfaces/IDefaultInterestRateStrategyV2.sol';
-      12                 :             : 
-      13                 :             : /**
-      14                 :             :  * @title RiskSteward
-      15                 :             :  * @author BGD labs
-      16                 :             :  * @notice Contract to manage the risk params within configured bound on aave v3 pool:
-      17                 :             :  *         This contract can update the following risk params: caps, ltv, liqThreshold, liqBonus, debtCeiling, interest rates params.
-      18                 :             :  */
-      19                 :             : contract RiskSteward is Ownable, IRiskSteward {
-      20                 :             :   using Address for address;
-      21                 :             : 
-      22                 :             :   /// @inheritdoc IRiskSteward
-      23                 :             :   IEngine public immutable CONFIG_ENGINE;
-      24                 :             : 
-      25                 :             :   /// @inheritdoc IRiskSteward
-      26                 :             :   IPoolDataProvider public immutable POOL_DATA_PROVIDER;
-      27                 :             : 
-      28                 :             :   /// @inheritdoc IRiskSteward
-      29                 :             :   address public immutable RISK_COUNCIL;
-      30                 :             : 
-      31                 :             :   uint256 internal constant BPS_MAX = 100_00;
-      32                 :             : 
-      33                 :             :   Config internal _riskConfig;
-      34                 :             : 
-      35                 :             :   mapping(address => Debounce) internal _timelocks;
-      36                 :             : 
-      37                 :             :   mapping(address => bool) internal _restrictedAssets;
-      38                 :             : 
-      39                 :             :   /**
-      40                 :             :    * @dev Modifier preventing anyone, but the council to update risk params.
-      41                 :             :    */
-      42                 :             :   modifier onlyRiskCouncil() {
-      43                 :             :     if (RISK_COUNCIL != msg.sender) revert InvalidCaller();
-      44                 :             :     _;
-      45                 :             :   }
-      46                 :             : 
-      47                 :             :   /**
-      48                 :             :    * @param poolDataProvider The pool data provider of the pool to be controlled by the steward
-      49                 :             :    * @param engine the config engine to be used by the steward
-      50                 :             :    * @param riskCouncil the safe address of the council being able to interact with the steward
-      51                 :             :    * @param riskConfig the risk configuration to setup for each individual risk param
-      52                 :             :    */
-      53                 :             :   constructor(
-      54                 :             :     IPoolDataProvider poolDataProvider,
-      55                 :             :     IEngine engine,
-      56                 :             :     address riskCouncil,
-      57                 :             :     Config memory riskConfig
-      58                 :             :   ) {
-      59                 :             :     POOL_DATA_PROVIDER = poolDataProvider;
-      60                 :             :     CONFIG_ENGINE = engine;
-      61                 :             :     RISK_COUNCIL = riskCouncil;
-      62                 :             :     _riskConfig = riskConfig;
-      63                 :             :   }
-      64                 :             : 
-      65                 :             :   /// @inheritdoc IRiskSteward
-      66                 :         267 :   function updateCaps(IEngine.CapsUpdate[] calldata capsUpdate) external onlyRiskCouncil {
-      67                 :          20 :     _validateCapsUpdate(capsUpdate);
-      68                 :           8 :     _updateCaps(capsUpdate);
-      69                 :             :   }
-      70                 :             : 
-      71                 :             :   /// @inheritdoc IRiskSteward
-      72                 :         264 :   function updateRates(IEngine.RateStrategyUpdate[] calldata ratesUpdate) external onlyRiskCouncil {
-      73                 :          14 :     _validateRatesUpdate(ratesUpdate);
-      74                 :           6 :     _updateRates(ratesUpdate);
-      75                 :             :   }
-      76                 :             : 
-      77                 :             :   /// @inheritdoc IRiskSteward
-      78                 :         267 :   function updateCollateralSide(
-      79                 :             :     IEngine.CollateralUpdate[] calldata collateralUpdates
-      80                 :             :   ) external onlyRiskCouncil {
-      81                 :          20 :     _validateCollateralsUpdate(collateralUpdates);
-      82                 :           6 :     _updateCollateralSide(collateralUpdates);
-      83                 :             :   }
-      84                 :             : 
-      85                 :             :   /// @inheritdoc IRiskSteward
-      86                 :           6 :   function getTimelock(address asset) external view returns (Debounce memory) {
-      87                 :          12 :     return _timelocks[asset];
-      88                 :             :   }
-      89                 :             : 
-      90                 :             :   /// @inheritdoc IRiskSteward
-      91                 :         260 :   function setRiskConfig(Config calldata riskConfig) external onlyOwner {
-      92                 :           6 :     _riskConfig = riskConfig;
-      93                 :           6 :     emit RiskConfigSet(riskConfig);
-      94                 :             :   }
-      95                 :             : 
-      96                 :             :   /// @inheritdoc IRiskSteward
-      97                 :           1 :   function getRiskConfig() external view returns (Config memory) {
-      98                 :           2 :     return _riskConfig;
-      99                 :             :   }
-     100                 :             : 
-     101                 :             :   /// @inheritdoc IRiskSteward
-     102                 :           2 :   function isAssetRestricted(address asset) external view returns (bool) {
-     103                 :           4 :     return _restrictedAssets[asset];
-     104                 :             :   }
-     105                 :             : 
-     106                 :             :   /// @inheritdoc IRiskSteward
-     107                 :         262 :   function setAssetRestricted(address asset, bool isRestricted) external onlyOwner {
-     108                 :          10 :     _restrictedAssets[asset] = isRestricted;
-     109                 :          10 :     emit AssetRestricted(asset, isRestricted);
-     110                 :             :   }
-     111                 :             : 
-     112                 :             :   /**
-     113                 :             :    * @notice method to validate the caps update
-     114                 :             :    * @param capsUpdate list containing the new supply, borrow caps of the assets
-     115                 :             :    */
-     116                 :          10 :   function _validateCapsUpdate(IEngine.CapsUpdate[] calldata capsUpdate) internal view {
-     117                 :          20 :     if (capsUpdate.length == 0) revert NoZeroUpdates();
-     118                 :             : 
-     119                 :          38 :     for (uint256 i = 0; i < capsUpdate.length; i++) {
-     120                 :          20 :       address asset = capsUpdate[i].asset;
-     121                 :             : 
-     122                 :          11 :       if (_restrictedAssets[asset]) revert AssetIsRestricted();
-     123                 :          36 :       if (capsUpdate[i].supplyCap == 0 || capsUpdate[i].borrowCap == 0) revert InvalidUpdateToZero();
-     124                 :             : 
-     125                 :          24 :       (uint256 currentBorrowCap, uint256 currentSupplyCap) = POOL_DATA_PROVIDER.getReserveCaps(
-     126                 :             :         capsUpdate[i].asset
-     127                 :             :       );
-     128                 :             : 
-     129                 :          16 :       _validateParamUpdate(
-     130                 :             :         currentSupplyCap,
-     131                 :             :         capsUpdate[i].supplyCap,
-     132                 :             :         _timelocks[asset].supplyCapLastUpdated,
-     133                 :             :         _riskConfig.supplyCap,
-     134                 :             :         ConfigConstants.IS_SUPPLY_CAP_CHANGE_RELATIVE
-     135                 :             :       );
-     136                 :           8 :       _validateParamUpdate(
-     137                 :             :         currentBorrowCap,
-     138                 :             :         capsUpdate[i].borrowCap,
-     139                 :             :         _timelocks[asset].borrowCapLastUpdated,
-     140                 :             :         _riskConfig.borrowCap,
-     141                 :             :         ConfigConstants.IS_BORROW_CAP_CHANGE_RELATIVE
-     142                 :             :       );
-     143                 :             :     }
-     144                 :             :   }
-     145                 :             : 
-     146                 :             :   /**
-     147                 :             :    * @notice method to validate the interest rates update
-     148                 :             :    * @param ratesUpdate list containing the new interest rates params of the assets
-     149                 :             :    */
-     150                 :           7 :   function _validateRatesUpdate(IEngine.RateStrategyUpdate[] calldata ratesUpdate) internal view {
-     151                 :          14 :     if (ratesUpdate.length == 0) revert NoZeroUpdates();
-     152                 :             : 
-     153                 :          27 :     for (uint256 i = 0; i < ratesUpdate.length; i++) {
-     154                 :          14 :       address asset = ratesUpdate[i].asset;
-     155                 :           8 :       if (_restrictedAssets[asset]) revert AssetIsRestricted();
-     156                 :             : 
-     157                 :          12 :       (
-     158                 :             :         uint256 currentOptimalUsageRatio,
-     159                 :             :         uint256 currentBaseVariableBorrowRate,
-     160                 :             :         uint256 currentVariableRateSlope1,
-     161                 :             :         uint256 currentVariableRateSlope2
-     162                 :          12 :       ) = _getInterestRatesForAsset(asset);
-     163                 :             : 
-     164                 :          10 :       _validateParamUpdate(
-     165                 :             :         currentOptimalUsageRatio,
-     166                 :             :         ratesUpdate[i].params.optimalUsageRatio,
-     167                 :             :         _timelocks[asset].optimalUsageRatioLastUpdated,
-     168                 :             :         _riskConfig.optimalUsageRatio,
-     169                 :             :         ConfigConstants.IS_OPTIMAL_USAGE_CHANGE_RELATIVE
-     170                 :             :       );
-     171                 :           6 :       _validateParamUpdate(
-     172                 :             :         currentBaseVariableBorrowRate,
-     173                 :             :         ratesUpdate[i].params.baseVariableBorrowRate,
-     174                 :             :         _timelocks[asset].baseVariableRateLastUpdated,
-     175                 :             :         _riskConfig.baseVariableBorrowRate,
-     176                 :             :         ConfigConstants.IS_BASE_VARIABLE_BORROW_RATE_CHANGE_RELATIVE
-     177                 :             :       );
-     178                 :           6 :       _validateParamUpdate(
-     179                 :             :         currentVariableRateSlope1,
-     180                 :             :         ratesUpdate[i].params.variableRateSlope1,
-     181                 :             :         _timelocks[asset].variableRateSlope1LastUpdated,
-     182                 :             :         _riskConfig.variableRateSlope1,
-     183                 :             :         ConfigConstants.IS_VARIABLE_RATE_SLOPE_1_CHANGE_RELATIVE
+       7                 :             : import {Ownable} from 'solidity-utils/contracts/oz-common/Ownable.sol';
+       8                 :             : import {IAaveV3ConfigEngine as IEngine} from 'aave-v3-origin/periphery/contracts/v3-config-engine/AaveV3ConfigEngine.sol';
+       9                 :             : import {IRiskSteward} from '../interfaces/IRiskSteward.sol';
+      10                 :             : import {IDefaultInterestRateStrategyV2} from 'aave-v3-origin/core/contracts/interfaces/IDefaultInterestRateStrategyV2.sol';
+      11                 :             : 
+      12                 :             : /**
+      13                 :             :  * @title RiskSteward
+      14                 :             :  * @author BGD labs
+      15                 :             :  * @notice Contract to manage the risk params within configured bound on aave v3 pool:
+      16                 :             :  *         This contract can update the following risk params: caps, ltv, liqThreshold, liqBonus, debtCeiling, interest rates params.
+      17                 :             :  */
+      18                 :             : contract RiskSteward is Ownable, IRiskSteward {
+      19                 :             :   using Address for address;
+      20                 :             : 
+      21                 :             :   /// @inheritdoc IRiskSteward
+      22                 :             :   IEngine public immutable CONFIG_ENGINE;
+      23                 :             : 
+      24                 :             :   /// @inheritdoc IRiskSteward
+      25                 :             :   IPoolDataProvider public immutable POOL_DATA_PROVIDER;
+      26                 :             : 
+      27                 :             :   /// @inheritdoc IRiskSteward
+      28                 :             :   address public immutable RISK_COUNCIL;
+      29                 :             : 
+      30                 :             :   uint256 internal constant BPS_MAX = 100_00;
+      31                 :             : 
+      32                 :             :   Config internal _riskConfig;
+      33                 :             : 
+      34                 :             :   mapping(address => Debounce) internal _timelocks;
+      35                 :             : 
+      36                 :             :   mapping(address => bool) internal _restrictedAssets;
+      37                 :             : 
+      38                 :             :   /**
+      39                 :             :    * @dev Modifier preventing anyone, but the council to update risk params.
+      40                 :             :    */
+      41                 :         266 :   modifier onlyRiskCouncil() {
+      42                 :         788 :     if (RISK_COUNCIL != msg.sender) revert InvalidCaller();
+      43                 :             :     _;
+      44                 :             :   }
+      45                 :             : 
+      46                 :             :   /**
+      47                 :             :    * @param poolDataProvider The pool data provider of the pool to be controlled by the steward
+      48                 :             :    * @param engine the config engine to be used by the steward
+      49                 :             :    * @param riskCouncil the safe address of the council being able to interact with the steward
+      50                 :             :    * @param riskConfig the risk configuration to setup for each individual risk param
+      51                 :             :    */
+      52                 :           0 :   constructor(
+      53                 :             :     IPoolDataProvider poolDataProvider,
+      54                 :             :     IEngine engine,
+      55                 :             :     address riskCouncil,
+      56                 :             :     Config memory riskConfig
+      57                 :             :   ) {
+      58                 :           0 :     POOL_DATA_PROVIDER = poolDataProvider;
+      59                 :           0 :     CONFIG_ENGINE = engine;
+      60                 :           0 :     RISK_COUNCIL = riskCouncil;
+      61                 :           0 :     _riskConfig = riskConfig;
+      62                 :             :   }
+      63                 :             : 
+      64                 :             :   /// @inheritdoc IRiskSteward
+      65                 :         266 :   function updateCaps(IEngine.CapsUpdate[] calldata capsUpdate) external onlyRiskCouncil {
+      66                 :          20 :     _validateCapsUpdate(capsUpdate);
+      67                 :           8 :     _updateCaps(capsUpdate);
+      68                 :             :   }
+      69                 :             : 
+      70                 :             :   /// @inheritdoc IRiskSteward
+      71                 :         263 :   function updateRates(IEngine.RateStrategyUpdate[] calldata ratesUpdate) external onlyRiskCouncil {
+      72                 :          14 :     _validateRatesUpdate(ratesUpdate);
+      73                 :           6 :     _updateRates(ratesUpdate);
+      74                 :             :   }
+      75                 :             : 
+      76                 :             :   /// @inheritdoc IRiskSteward
+      77                 :         266 :   function updateCollateralSide(
+      78                 :             :     IEngine.CollateralUpdate[] calldata collateralUpdates
+      79                 :             :   ) external onlyRiskCouncil {
+      80                 :          20 :     _validateCollateralsUpdate(collateralUpdates);
+      81                 :           6 :     _updateCollateralSide(collateralUpdates);
+      82                 :             :   }
+      83                 :             : 
+      84                 :             :   /// @inheritdoc IRiskSteward
+      85                 :           6 :   function getTimelock(address asset) external view returns (Debounce memory) {
+      86                 :          12 :     return _timelocks[asset];
+      87                 :             :   }
+      88                 :             : 
+      89                 :             :   /// @inheritdoc IRiskSteward
+      90                 :         259 :   function setRiskConfig(Config calldata riskConfig) external onlyOwner {
+      91                 :           6 :     _riskConfig = riskConfig;
+      92                 :           6 :     emit RiskConfigSet(riskConfig);
+      93                 :             :   }
+      94                 :             : 
+      95                 :             :   /// @inheritdoc IRiskSteward
+      96                 :           1 :   function getRiskConfig() external view returns (Config memory) {
+      97                 :           2 :     return _riskConfig;
+      98                 :             :   }
+      99                 :             : 
+     100                 :             :   /// @inheritdoc IRiskSteward
+     101                 :           2 :   function isAssetRestricted(address asset) external view returns (bool) {
+     102                 :           4 :     return _restrictedAssets[asset];
+     103                 :             :   }
+     104                 :             : 
+     105                 :             :   /// @inheritdoc IRiskSteward
+     106                 :         261 :   function setAssetRestricted(address asset, bool isRestricted) external onlyOwner {
+     107                 :          10 :     _restrictedAssets[asset] = isRestricted;
+     108                 :          10 :     emit AssetRestricted(asset, isRestricted);
+     109                 :             :   }
+     110                 :             : 
+     111                 :             :   /**
+     112                 :             :    * @notice method to validate the caps update
+     113                 :             :    * @param capsUpdate list containing the new supply, borrow caps of the assets
+     114                 :             :    */
+     115                 :          10 :   function _validateCapsUpdate(IEngine.CapsUpdate[] calldata capsUpdate) internal view {
+     116                 :          20 :     if (capsUpdate.length == 0) revert NoZeroUpdates();
+     117                 :             : 
+     118                 :          38 :     for (uint256 i = 0; i < capsUpdate.length; i++) {
+     119                 :          20 :       address asset = capsUpdate[i].asset;
+     120                 :             : 
+     121                 :          11 :       if (_restrictedAssets[asset]) revert AssetIsRestricted();
+     122                 :          36 :       if (capsUpdate[i].supplyCap == 0 || capsUpdate[i].borrowCap == 0) revert InvalidUpdateToZero();
+     123                 :             : 
+     124                 :          24 :       (uint256 currentBorrowCap, uint256 currentSupplyCap) = POOL_DATA_PROVIDER.getReserveCaps(
+     125                 :             :         capsUpdate[i].asset
+     126                 :             :       );
+     127                 :             : 
+     128                 :          16 :       _validateParamUpdate(
+     129                 :             :         ParamUpdateValidationInput({
+     130                 :             :           currentValue: currentSupplyCap,
+     131                 :             :           newValue: capsUpdate[i].supplyCap,
+     132                 :             :           lastUpdated: _timelocks[asset].supplyCapLastUpdated,
+     133                 :             :           riskConfig: _riskConfig.supplyCap,
+     134                 :             :           isChangeRelative: true
+     135                 :             :         })
+     136                 :             :       );
+     137                 :           8 :       _validateParamUpdate(
+     138                 :             :         ParamUpdateValidationInput({
+     139                 :             :           currentValue: currentBorrowCap,
+     140                 :             :           newValue: capsUpdate[i].borrowCap,
+     141                 :             :           lastUpdated: _timelocks[asset].borrowCapLastUpdated,
+     142                 :             :           riskConfig: _riskConfig.borrowCap,
+     143                 :             :           isChangeRelative: true
+     144                 :             :         })
+     145                 :             :       );
+     146                 :             :     }
+     147                 :             :   }
+     148                 :             : 
+     149                 :             :   /**
+     150                 :             :    * @notice method to validate the interest rates update
+     151                 :             :    * @param ratesUpdate list containing the new interest rates params of the assets
+     152                 :             :    */
+     153                 :           7 :   function _validateRatesUpdate(IEngine.RateStrategyUpdate[] calldata ratesUpdate) internal view {
+     154                 :          14 :     if (ratesUpdate.length == 0) revert NoZeroUpdates();
+     155                 :             : 
+     156                 :          27 :     for (uint256 i = 0; i < ratesUpdate.length; i++) {
+     157                 :          14 :       address asset = ratesUpdate[i].asset;
+     158                 :           8 :       if (_restrictedAssets[asset]) revert AssetIsRestricted();
+     159                 :             : 
+     160                 :          12 :       (
+     161                 :             :         uint256 currentOptimalUsageRatio,
+     162                 :             :         uint256 currentBaseVariableBorrowRate,
+     163                 :             :         uint256 currentVariableRateSlope1,
+     164                 :             :         uint256 currentVariableRateSlope2
+     165                 :          12 :       ) = _getInterestRatesForAsset(asset);
+     166                 :             : 
+     167                 :          10 :       _validateParamUpdate(
+     168                 :             :         ParamUpdateValidationInput({
+     169                 :             :           currentValue: currentOptimalUsageRatio,
+     170                 :             :           newValue: ratesUpdate[i].params.optimalUsageRatio,
+     171                 :             :           lastUpdated: _timelocks[asset].optimalUsageRatioLastUpdated,
+     172                 :             :           riskConfig: _riskConfig.optimalUsageRatio,
+     173                 :             :           isChangeRelative: false
+     174                 :             :         })
+     175                 :             :       );
+     176                 :           6 :       _validateParamUpdate(
+     177                 :             :         ParamUpdateValidationInput({
+     178                 :             :           currentValue: currentBaseVariableBorrowRate,
+     179                 :             :           newValue: ratesUpdate[i].params.baseVariableBorrowRate,
+     180                 :             :           lastUpdated: _timelocks[asset].baseVariableRateLastUpdated,
+     181                 :             :           riskConfig: _riskConfig.baseVariableBorrowRate,
+     182                 :             :           isChangeRelative: false
+     183                 :             :         })
      184                 :             :       );
      185                 :           6 :       _validateParamUpdate(
-     186                 :             :         currentVariableRateSlope2,
-     187                 :             :         ratesUpdate[i].params.variableRateSlope2,
-     188                 :             :         _timelocks[asset].variableRateSlope2LastUpdated,
-     189                 :             :         _riskConfig.variableRateSlope2,
-     190                 :             :         ConfigConstants.IS_VARIABLE_RATE_SLOPE_2_CHANGE_RELATIVE
-     191                 :             :       );
-     192                 :             :     }
-     193                 :             :   }
-     194                 :             : 
-     195                 :             :   /**
-     196                 :             :    * @notice method to validate the collaterals update
-     197                 :             :    * @param collateralUpdates list containing the new collateral updates of the assets
-     198                 :             :    */
-     199                 :          10 :   function _validateCollateralsUpdate(
-     200                 :             :     IEngine.CollateralUpdate[] calldata collateralUpdates
-     201                 :             :   ) internal view {
-     202                 :          20 :     if (collateralUpdates.length == 0) revert NoZeroUpdates();
-     203                 :             : 
-     204                 :          36 :     for (uint256 i = 0; i < collateralUpdates.length; i++) {
-     205                 :          20 :       address asset = collateralUpdates[i].asset;
-     206                 :             : 
-     207                 :          11 :       if (_restrictedAssets[asset]) revert AssetIsRestricted();
-     208                 :          19 :       if (collateralUpdates[i].liqProtocolFee != EngineFlags.KEEP_CURRENT) revert ParamChangeNotAllowed();
-     209                 :             :       if (
-     210                 :          40 :         collateralUpdates[i].ltv == 0 ||
-     211                 :          14 :         collateralUpdates[i].liqThreshold == 0 ||
-     212                 :          14 :         collateralUpdates[i].liqBonus == 0 ||
-     213                 :          14 :         collateralUpdates[i].debtCeiling == 0
-     214                 :           2 :       ) revert InvalidUpdateToZero();
-     215                 :             : 
-     216                 :          14 :       (
-     217                 :             :         ,
-     218                 :             :         uint256 currentLtv,
-     219                 :             :         uint256 currentLiquidationThreshold,
-     220                 :             :         uint256 currentLiquidationBonus,
-     221                 :             :         ,
-     222                 :             :         ,
-     223                 :             :         ,
-     224                 :             :         ,
-     225                 :             :         ,
+     186                 :             :         ParamUpdateValidationInput({
+     187                 :             :           currentValue: currentVariableRateSlope1,
+     188                 :             :           newValue: ratesUpdate[i].params.variableRateSlope1,
+     189                 :             :           lastUpdated: _timelocks[asset].variableRateSlope1LastUpdated,
+     190                 :             :           riskConfig: _riskConfig.variableRateSlope1,
+     191                 :             :           isChangeRelative: false
+     192                 :             :         })
+     193                 :             :       );
+     194                 :           6 :       _validateParamUpdate(
+     195                 :             :         ParamUpdateValidationInput({
+     196                 :             :           currentValue: currentVariableRateSlope2,
+     197                 :             :           newValue: ratesUpdate[i].params.variableRateSlope2,
+     198                 :             :           lastUpdated: _timelocks[asset].variableRateSlope2LastUpdated,
+     199                 :             :           riskConfig: _riskConfig.variableRateSlope2,
+     200                 :             :           isChangeRelative: false
+     201                 :             :         })
+     202                 :             :       );
+     203                 :             :     }
+     204                 :             :   }
+     205                 :             : 
+     206                 :             :   /**
+     207                 :             :    * @notice method to validate the collaterals update
+     208                 :             :    * @param collateralUpdates list containing the new collateral updates of the assets
+     209                 :             :    */
+     210                 :          10 :   function _validateCollateralsUpdate(
+     211                 :             :     IEngine.CollateralUpdate[] calldata collateralUpdates
+     212                 :             :   ) internal view {
+     213                 :          20 :     if (collateralUpdates.length == 0) revert NoZeroUpdates();
+     214                 :             : 
+     215                 :          36 :     for (uint256 i = 0; i < collateralUpdates.length; i++) {
+     216                 :          20 :       address asset = collateralUpdates[i].asset;
+     217                 :             : 
+     218                 :          11 :       if (_restrictedAssets[asset]) revert AssetIsRestricted();
+     219                 :          19 :       if (collateralUpdates[i].liqProtocolFee != EngineFlags.KEEP_CURRENT) revert ParamChangeNotAllowed();
+     220                 :             :       if (
+     221                 :          40 :         collateralUpdates[i].ltv == 0 ||
+     222                 :          14 :         collateralUpdates[i].liqThreshold == 0 ||
+     223                 :          14 :         collateralUpdates[i].liqBonus == 0 ||
+     224                 :          14 :         collateralUpdates[i].debtCeiling == 0
+     225                 :           2 :       ) revert InvalidUpdateToZero();
      226                 :             : 
-     227                 :          14 :       ) = POOL_DATA_PROVIDER.getReserveConfigurationData(asset);
-     228                 :          21 :       uint256 currentDebtCeiling = POOL_DATA_PROVIDER.getDebtCeiling(asset);
-     229                 :             : 
-     230                 :          14 :       _validateParamUpdate(
-     231                 :             :         currentLtv,
-     232                 :             :         collateralUpdates[i].ltv,
-     233                 :             :         _timelocks[asset].ltvLastUpdated,
-     234                 :             :         _riskConfig.ltv,
-     235                 :             :         ConfigConstants.IS_LTV_CHANGE_RELATIVE
-     236                 :             :       );
-     237                 :           8 :       _validateParamUpdate(
-     238                 :             :         currentLiquidationThreshold,
-     239                 :             :         collateralUpdates[i].liqThreshold,
-     240                 :             :         _timelocks[asset].liquidationThresholdLastUpdated,
-     241                 :             :         _riskConfig.liquidationThreshold,
-     242                 :             :         ConfigConstants.IS_LIQUDATION_THRESHOLD_CHANGE_RELATIVE
-     243                 :             :       );
-     244                 :           8 :       _validateParamUpdate(
-     245                 :             :         currentLiquidationBonus - 100_00, // as the definition is 100% + x%, and config engine takes into account x% for simplicity.
-     246                 :             :         collateralUpdates[i].liqBonus,
-     247                 :             :         _timelocks[asset].liquidationBonusLastUpdated,
-     248                 :             :         _riskConfig.liquidationBonus,
-     249                 :             :         ConfigConstants.IS_LIQUIDATION_BONUS_CHANGE_RELATIVE
-     250                 :             :       );
-     251                 :           8 :       _validateParamUpdate(
-     252                 :             :         currentDebtCeiling / 100, // as the definition is with 2 decimals, and config engine does not take the decimals into account.
-     253                 :             :         collateralUpdates[i].debtCeiling,
-     254                 :             :         _timelocks[asset].debtCeilingLastUpdated,
-     255                 :             :         _riskConfig.debtCeiling,
-     256                 :             :         ConfigConstants.IS_DEBT_CEILING_CHANGE_RELATIVE
-     257                 :             :       );
-     258                 :             :     }
-     259                 :             :   }
-     260                 :             : 
-     261                 :             :   /**
-     262                 :             :    * @notice method to validate the risk param update is within the allowed bound and the debounce is respected
-     263                 :             :    * @param currentParamValue the current value of the risk param
-     264                 :             :    * @param newParamValue the new value of the risk param
-     265                 :             :    * @param lastUpdated timestamp when the risk param was last updated by the steward
-     266                 :             :    * @param riskConfig the risk configuration containing the minimum delay and the max percent change allowed for the risk param
-     267                 :             :    */
-     268                 :          45 :   function _validateParamUpdate(
-     269                 :             :     uint256 currentParamValue,
-     270                 :             :     uint256 newParamValue,
-     271                 :             :     uint40 lastUpdated,
-     272                 :             :     RiskParamConfig memory riskConfig,
-     273                 :             :     bool isChangeRelative
-     274                 :             :   ) internal view {
-     275                 :         135 :     if (newParamValue == EngineFlags.KEEP_CURRENT) return;
-     276                 :             : 
-     277                 :         114 :     if (block.timestamp - lastUpdated < riskConfig.minDelay) revert DebounceNotRespected();
-     278                 :             :     if (
-     279                 :          68 :       !_updateWithinAllowedRange(
-     280                 :             :         currentParamValue,
-     281                 :             :         newParamValue,
-     282                 :             :         riskConfig.maxPercentChange,
-     283                 :             :         isChangeRelative
-     284                 :             :       )
-     285                 :          14 :     ) revert UpdateNotInRange();
-     286                 :             :   }
-     287                 :             : 
-     288                 :             :   /**
-     289                 :             :    * @notice method to update the borrow / supply caps using the config engine and updates the debounce
-     290                 :             :    * @param capsUpdate list containing the new supply, borrow caps of the assets
-     291                 :             :    */
-     292                 :           4 :   function _updateCaps(IEngine.CapsUpdate[] calldata capsUpdate) internal {
-     293                 :          20 :     for (uint256 i = 0; i < capsUpdate.length; i++) {
-     294                 :           8 :       address asset = capsUpdate[i].asset;
-     295                 :             : 
-     296                 :           8 :       if (capsUpdate[i].supplyCap != EngineFlags.KEEP_CURRENT) {
-     297                 :           6 :         _timelocks[asset].supplyCapLastUpdated = uint40(block.timestamp);
-     298                 :           6 :         emit SupplyCapUpdated(
-     299                 :             :           asset,
-     300                 :             :           capsUpdate[i].supplyCap,
-     301                 :             :           uint40(block.timestamp) + _riskConfig.supplyCap.minDelay
-     302                 :             :         );
-     303                 :             :       }
-     304                 :             : 
-     305                 :           8 :       if (capsUpdate[i].borrowCap != EngineFlags.KEEP_CURRENT) {
-     306                 :           6 :         _timelocks[asset].borrowCapLastUpdated = uint40(block.timestamp);
-     307                 :           6 :         emit BorrowCapUpdated(
-     308                 :             :           asset,
-     309                 :             :           capsUpdate[i].borrowCap,
-     310                 :             :           uint40(block.timestamp) + _riskConfig.borrowCap.minDelay
-     311                 :             :         );
-     312                 :             :       }
-     313                 :             :     }
-     314                 :             : 
-     315                 :           8 :     address(CONFIG_ENGINE).functionDelegateCall(
-     316                 :             :       abi.encodeWithSelector(CONFIG_ENGINE.updateCaps.selector, capsUpdate)
-     317                 :             :     );
-     318                 :             :   }
-     319                 :             : 
-     320                 :             :   /**
-     321                 :             :    * @notice method to update the interest rates params using the config engine and updates the debounce
-     322                 :             :    * @param ratesUpdate list containing the new interest rates params of the assets
-     323                 :             :    */
-     324                 :           3 :   function _updateRates(IEngine.RateStrategyUpdate[] calldata ratesUpdate) internal {
-     325                 :          15 :     for (uint256 i = 0; i < ratesUpdate.length; i++) {
-     326                 :           6 :       address asset = ratesUpdate[i].asset;
-     327                 :             : 
-     328                 :           6 :       if (ratesUpdate[i].params.optimalUsageRatio != EngineFlags.KEEP_CURRENT) {
-     329                 :           6 :         _timelocks[asset].optimalUsageRatioLastUpdated = uint40(block.timestamp);
-     330                 :           6 :         emit OptimalUsageRatioUpdated(
-     331                 :             :           asset,
-     332                 :             :           ratesUpdate[i].params.optimalUsageRatio,
-     333                 :             :           uint40(block.timestamp) + _riskConfig.optimalUsageRatio.minDelay
-     334                 :             :         );
-     335                 :             :       }
-     336                 :             : 
-     337                 :           6 :       if (ratesUpdate[i].params.baseVariableBorrowRate != EngineFlags.KEEP_CURRENT) {
-     338                 :           6 :         _timelocks[asset].baseVariableRateLastUpdated = uint40(block.timestamp);
-     339                 :           6 :         emit BaseVariableBorrowRateUpdated(
-     340                 :             :           asset,
-     341                 :             :           ratesUpdate[i].params.baseVariableBorrowRate,
-     342                 :             :           uint40(block.timestamp) + _riskConfig.baseVariableBorrowRate.minDelay
-     343                 :             :         );
+     227                 :          14 :       (
+     228                 :             :         ,
+     229                 :             :         uint256 currentLtv,
+     230                 :             :         uint256 currentLiquidationThreshold,
+     231                 :             :         uint256 currentLiquidationBonus,
+     232                 :             :         ,
+     233                 :             :         ,
+     234                 :             :         ,
+     235                 :             :         ,
+     236                 :             :         ,
+     237                 :             : 
+     238                 :          14 :       ) = POOL_DATA_PROVIDER.getReserveConfigurationData(asset);
+     239                 :          21 :       uint256 currentDebtCeiling = POOL_DATA_PROVIDER.getDebtCeiling(asset);
+     240                 :             : 
+     241                 :          14 :       _validateParamUpdate(
+     242                 :             :         ParamUpdateValidationInput({
+     243                 :             :           currentValue: currentLtv,
+     244                 :             :           newValue: collateralUpdates[i].ltv,
+     245                 :             :           lastUpdated: _timelocks[asset].ltvLastUpdated,
+     246                 :             :           riskConfig: _riskConfig.ltv,
+     247                 :             :           isChangeRelative: false
+     248                 :             :         })
+     249                 :             :       );
+     250                 :           8 :       _validateParamUpdate(
+     251                 :             :         ParamUpdateValidationInput({
+     252                 :             :           currentValue: currentLiquidationThreshold,
+     253                 :             :           newValue: collateralUpdates[i].liqThreshold,
+     254                 :             :           lastUpdated: _timelocks[asset].liquidationThresholdLastUpdated,
+     255                 :             :           riskConfig: _riskConfig.liquidationThreshold,
+     256                 :             :           isChangeRelative: false
+     257                 :             :         })
+     258                 :             :       );
+     259                 :           8 :       _validateParamUpdate(
+     260                 :             :         ParamUpdateValidationInput({
+     261                 :             :           currentValue: currentLiquidationBonus - 100_00, // as the definition is 100% + x%, and config engine takes into account x% for simplicity.
+     262                 :             :           newValue: collateralUpdates[i].liqBonus,
+     263                 :             :           lastUpdated: _timelocks[asset].liquidationBonusLastUpdated,
+     264                 :             :           riskConfig: _riskConfig.liquidationBonus,
+     265                 :             :           isChangeRelative: false
+     266                 :             :         })
+     267                 :             :       );
+     268                 :           8 :       _validateParamUpdate(
+     269                 :             :         ParamUpdateValidationInput({
+     270                 :             :           currentValue: currentDebtCeiling / 100, // as the definition is with 2 decimals, and config engine does not take the decimals into account.
+     271                 :             :           newValue: collateralUpdates[i].debtCeiling,
+     272                 :             :           lastUpdated: _timelocks[asset].debtCeilingLastUpdated,
+     273                 :             :           riskConfig: _riskConfig.debtCeiling,
+     274                 :             :           isChangeRelative: true
+     275                 :             :         })
+     276                 :             :       );
+     277                 :             :     }
+     278                 :             :   }
+     279                 :             : 
+     280                 :             :   /**
+     281                 :             :    * @notice method to validate the risk param update is within the allowed bound and the debounce is respected
+     282                 :             :    * @param validationParam struct containing values used for validation of the risk param update
+     283                 :             :    */
+     284                 :          45 :   function _validateParamUpdate(
+     285                 :             :     ParamUpdateValidationInput memory validationParam
+     286                 :             :   ) internal view {
+     287                 :         135 :     if (validationParam.newValue == EngineFlags.KEEP_CURRENT) return;
+     288                 :             : 
+     289                 :         114 :     if (block.timestamp - validationParam.lastUpdated < validationParam.riskConfig.minDelay) revert DebounceNotRespected();
+     290                 :             :     if (
+     291                 :          68 :       !_updateWithinAllowedRange(
+     292                 :             :         validationParam.currentValue,
+     293                 :             :         validationParam.newValue,
+     294                 :             :         validationParam.riskConfig.maxPercentChange,
+     295                 :             :         validationParam.isChangeRelative
+     296                 :             :       )
+     297                 :          14 :     ) revert UpdateNotInRange();
+     298                 :             :   }
+     299                 :             : 
+     300                 :             :   /**
+     301                 :             :    * @notice method to update the borrow / supply caps using the config engine and updates the debounce
+     302                 :             :    * @param capsUpdate list containing the new supply, borrow caps of the assets
+     303                 :             :    */
+     304                 :           4 :   function _updateCaps(IEngine.CapsUpdate[] calldata capsUpdate) internal {
+     305                 :          20 :     for (uint256 i = 0; i < capsUpdate.length; i++) {
+     306                 :           8 :       address asset = capsUpdate[i].asset;
+     307                 :             : 
+     308                 :           8 :       if (capsUpdate[i].supplyCap != EngineFlags.KEEP_CURRENT) {
+     309                 :           6 :         _timelocks[asset].supplyCapLastUpdated = uint40(block.timestamp);
+     310                 :             :       }
+     311                 :             : 
+     312                 :           8 :       if (capsUpdate[i].borrowCap != EngineFlags.KEEP_CURRENT) {
+     313                 :           6 :         _timelocks[asset].borrowCapLastUpdated = uint40(block.timestamp);
+     314                 :             :       }
+     315                 :             :     }
+     316                 :             : 
+     317                 :           8 :     address(CONFIG_ENGINE).functionDelegateCall(
+     318                 :             :       abi.encodeWithSelector(CONFIG_ENGINE.updateCaps.selector, capsUpdate)
+     319                 :             :     );
+     320                 :             :   }
+     321                 :             : 
+     322                 :             :   /**
+     323                 :             :    * @notice method to update the interest rates params using the config engine and updates the debounce
+     324                 :             :    * @param ratesUpdate list containing the new interest rates params of the assets
+     325                 :             :    */
+     326                 :           3 :   function _updateRates(IEngine.RateStrategyUpdate[] calldata ratesUpdate) internal {
+     327                 :          15 :     for (uint256 i = 0; i < ratesUpdate.length; i++) {
+     328                 :           6 :       address asset = ratesUpdate[i].asset;
+     329                 :             : 
+     330                 :           6 :       if (ratesUpdate[i].params.optimalUsageRatio != EngineFlags.KEEP_CURRENT) {
+     331                 :           6 :         _timelocks[asset].optimalUsageRatioLastUpdated = uint40(block.timestamp);
+     332                 :             :       }
+     333                 :             : 
+     334                 :           6 :       if (ratesUpdate[i].params.baseVariableBorrowRate != EngineFlags.KEEP_CURRENT) {
+     335                 :           6 :         _timelocks[asset].baseVariableRateLastUpdated = uint40(block.timestamp);
+     336                 :             :       }
+     337                 :             : 
+     338                 :           6 :       if (ratesUpdate[i].params.variableRateSlope1 != EngineFlags.KEEP_CURRENT) {
+     339                 :           6 :         _timelocks[asset].variableRateSlope1LastUpdated = uint40(block.timestamp);
+     340                 :             :       }
+     341                 :             : 
+     342                 :           6 :       if (ratesUpdate[i].params.variableRateSlope2 != EngineFlags.KEEP_CURRENT) {
+     343                 :           6 :         _timelocks[asset].variableRateSlope2LastUpdated = uint40(block.timestamp);
      344                 :             :       }
-     345                 :             : 
-     346                 :           6 :       if (ratesUpdate[i].params.variableRateSlope1 != EngineFlags.KEEP_CURRENT) {
-     347                 :           6 :         _timelocks[asset].variableRateSlope1LastUpdated = uint40(block.timestamp);
-     348                 :           6 :         emit VariableRateSlope1Updated(
-     349                 :             :           asset,
-     350                 :             :           ratesUpdate[i].params.variableRateSlope1,
-     351                 :             :           uint40(block.timestamp) + _riskConfig.variableRateSlope1.minDelay
-     352                 :             :         );
-     353                 :             :       }
-     354                 :             : 
-     355                 :           6 :       if (ratesUpdate[i].params.variableRateSlope2 != EngineFlags.KEEP_CURRENT) {
-     356                 :           6 :         _timelocks[asset].variableRateSlope2LastUpdated = uint40(block.timestamp);
-     357                 :           6 :         emit VariableRateSlope2Updated(
-     358                 :             :           asset,
-     359                 :             :           ratesUpdate[i].params.variableRateSlope2,
-     360                 :             :           uint40(block.timestamp) + _riskConfig.variableRateSlope2.minDelay
-     361                 :             :         );
+     345                 :             :     }
+     346                 :             : 
+     347                 :           6 :     address(CONFIG_ENGINE).functionDelegateCall(
+     348                 :             :       abi.encodeWithSelector(CONFIG_ENGINE.updateRateStrategies.selector, ratesUpdate)
+     349                 :             :     );
+     350                 :             :   }
+     351                 :             : 
+     352                 :             :   /**
+     353                 :             :    * @notice method to update the collateral side params using the config engine and updates the debounce
+     354                 :             :    * @param collateralUpdates list containing the new collateral updates of the assets
+     355                 :             :    */
+     356                 :           3 :   function _updateCollateralSide(IEngine.CollateralUpdate[] calldata collateralUpdates) internal {
+     357                 :          15 :     for (uint256 i = 0; i < collateralUpdates.length; i++) {
+     358                 :           6 :       address asset = collateralUpdates[i].asset;
+     359                 :             : 
+     360                 :           6 :       if (collateralUpdates[i].ltv != EngineFlags.KEEP_CURRENT) {
+     361                 :           4 :         _timelocks[asset].ltvLastUpdated = uint40(block.timestamp);
      362                 :             :       }
-     363                 :             :     }
-     364                 :             : 
-     365                 :           6 :     address(CONFIG_ENGINE).functionDelegateCall(
-     366                 :             :       abi.encodeWithSelector(CONFIG_ENGINE.updateRateStrategies.selector, ratesUpdate)
-     367                 :             :     );
-     368                 :             :   }
-     369                 :             : 
-     370                 :             :   /**
-     371                 :             :    * @notice method to update the collateral side params using the config engine and updates the debounce
-     372                 :             :    * @param collateralUpdates list containing the new collateral updates of the assets
-     373                 :             :    */
-     374                 :           3 :   function _updateCollateralSide(IEngine.CollateralUpdate[] calldata collateralUpdates) internal {
-     375                 :          15 :     for (uint256 i = 0; i < collateralUpdates.length; i++) {
-     376                 :           6 :       address asset = collateralUpdates[i].asset;
-     377                 :             : 
-     378                 :           6 :       if (collateralUpdates[i].ltv != EngineFlags.KEEP_CURRENT) {
-     379                 :           4 :         _timelocks[asset].ltvLastUpdated = uint40(block.timestamp);
-     380                 :           4 :         emit LtvUpdated(
-     381                 :             :           asset,
-     382                 :             :           collateralUpdates[i].ltv,
-     383                 :             :           uint40(block.timestamp) + _riskConfig.ltv.minDelay
-     384                 :             :         );
-     385                 :             :       }
-     386                 :             : 
-     387                 :           6 :       if (collateralUpdates[i].liqThreshold != EngineFlags.KEEP_CURRENT) {
-     388                 :           4 :         _timelocks[asset].liquidationThresholdLastUpdated = uint40(block.timestamp);
-     389                 :           4 :         emit LiquidationThresholdUpdated(
-     390                 :             :           asset,
-     391                 :             :           collateralUpdates[i].liqThreshold,
-     392                 :             :           uint40(block.timestamp) + _riskConfig.liquidationThreshold.minDelay
-     393                 :             :         );
-     394                 :             :       }
-     395                 :             : 
-     396                 :           6 :       if (collateralUpdates[i].liqBonus != EngineFlags.KEEP_CURRENT) {
-     397                 :           4 :         _timelocks[asset].liquidationBonusLastUpdated = uint40(block.timestamp);
-     398                 :           4 :         emit LiquidationBonusUpdated(
-     399                 :             :           asset,
-     400                 :             :           collateralUpdates[i].liqBonus,
-     401                 :             :           uint40(block.timestamp) + _riskConfig.liquidationBonus.minDelay
-     402                 :             :         );
-     403                 :             :       }
-     404                 :             : 
-     405                 :           6 :       if (collateralUpdates[i].debtCeiling != EngineFlags.KEEP_CURRENT) {
-     406                 :           6 :         _timelocks[asset].debtCeilingLastUpdated = uint40(block.timestamp);
-     407                 :           6 :         emit DebtCeilingUpdated(
-     408                 :             :           asset,
-     409                 :             :           collateralUpdates[i].debtCeiling,
-     410                 :             :           uint40(block.timestamp) + _riskConfig.debtCeiling.minDelay
-     411                 :             :         );
-     412                 :             :       }
-     413                 :             :     }
-     414                 :             : 
-     415                 :           6 :     address(CONFIG_ENGINE).functionDelegateCall(
-     416                 :             :       abi.encodeWithSelector(CONFIG_ENGINE.updateCollateralSide.selector, collateralUpdates)
-     417                 :             :     );
-     418                 :             :   }
-     419                 :             : 
-     420                 :             :   /**
-     421                 :             :    * @notice method to fetch the current interest rate params of the asset
-     422                 :             :    * @param asset the address of the underlying asset
-     423                 :             :    * @return optimalUsageRatio the current optimal usage ratio of the asset
-     424                 :             :    * @return baseVariableBorrowRate the current base variable borrow rate of the asset
-     425                 :             :    * @return variableRateSlope1 the current variable rate slope 1 of the asset
-     426                 :             :    * @return variableRateSlope2 the current variable rate slope 2 of the asset
-     427                 :             :    */
-     428                 :           6 :   function _getInterestRatesForAsset(
-     429                 :             :     address asset
-     430                 :             :   )
-     431                 :             :     internal
-     432                 :             :     view
-     433                 :             :     returns (
-     434                 :             :       uint256 optimalUsageRatio,
-     435                 :             :       uint256 baseVariableBorrowRate,
-     436                 :             :       uint256 variableRateSlope1,
-     437                 :             :       uint256 variableRateSlope2
-     438                 :             :     )
-     439                 :             :   {
-     440                 :          18 :     address rateStrategyAddress = POOL_DATA_PROVIDER.getInterestRateStrategyAddress(asset);
-     441                 :          12 :     IDefaultInterestRateStrategyV2.InterestRateData
-     442                 :          12 :       memory interestRateData = IDefaultInterestRateStrategyV2(rateStrategyAddress)
-     443                 :             :         .getInterestRateDataBps(asset);
-     444                 :          10 :     return (
-     445                 :             :       interestRateData.optimalUsageRatio,
-     446                 :             :       interestRateData.baseVariableBorrowRate,
-     447                 :             :       interestRateData.variableRateSlope1,
-     448                 :             :       interestRateData.variableRateSlope2
-     449                 :             :     );
-     450                 :             :   }
-     451                 :             : 
-     452                 :             :   /**
-     453                 :             :    * @notice Ensures the risk param update is within the allowed range
-     454                 :             :    * @param from current risk param value
-     455                 :             :    * @param to new updated risk param value
-     456                 :             :    * @param maxPercentChange the max percent change allowed
-     457                 :             :    * @param isChangeRelative true, if maxPercentChange is relative in value, false if maxPercentChange
-     458                 :             :    *        is absolute in value.
-     459                 :             :    * @return bool true, if difference is within the maxPercentChange
-     460                 :             :    */
-     461                 :          34 :   function _updateWithinAllowedRange(
-     462                 :             :     uint256 from,
-     463                 :             :     uint256 to,
-     464                 :             :     uint256 maxPercentChange,
-     465                 :             :     bool isChangeRelative
-     466                 :             :   ) internal pure returns (bool) {
-     467                 :             :     // diff denotes the difference between the from and to values, ensuring it is a positive value always
-     468                 :         170 :     int256 diff = int256(from) - int256(to);
-     469                 :          90 :     if (diff < 0) diff = -diff;
-     470                 :             : 
-     471                 :             :     // maxDiff denotes the max permitted difference on both the upper and lower bounds, if the maxPercentChange is relative in value
-     472                 :             :     // we calculate the max permitted difference using the maxPercentChange and the from value, otherwise if the maxPercentChange is absolute in value
-     473                 :             :     // the max permitted difference is the maxPercentChange itself
-     474                 :         102 :     uint256 maxDiff = isChangeRelative ? (maxPercentChange * from) / BPS_MAX : maxPercentChange;
-     475                 :         109 :     if (uint256(diff) > maxDiff) return false;
-     476                 :          54 :     return true;
-     477                 :             :   }
-     478                 :             : }
+     363                 :             : 
+     364                 :           6 :       if (collateralUpdates[i].liqThreshold != EngineFlags.KEEP_CURRENT) {
+     365                 :           4 :         _timelocks[asset].liquidationThresholdLastUpdated = uint40(block.timestamp);
+     366                 :             :       }
+     367                 :             : 
+     368                 :           6 :       if (collateralUpdates[i].liqBonus != EngineFlags.KEEP_CURRENT) {
+     369                 :           4 :         _timelocks[asset].liquidationBonusLastUpdated = uint40(block.timestamp);
+     370                 :             :       }
+     371                 :             : 
+     372                 :           6 :       if (collateralUpdates[i].debtCeiling != EngineFlags.KEEP_CURRENT) {
+     373                 :           6 :         _timelocks[asset].debtCeilingLastUpdated = uint40(block.timestamp);
+     374                 :             :       }
+     375                 :             :     }
+     376                 :             : 
+     377                 :           6 :     address(CONFIG_ENGINE).functionDelegateCall(
+     378                 :             :       abi.encodeWithSelector(CONFIG_ENGINE.updateCollateralSide.selector, collateralUpdates)
+     379                 :             :     );
+     380                 :             :   }
+     381                 :             : 
+     382                 :             :   /**
+     383                 :             :    * @notice method to fetch the current interest rate params of the asset
+     384                 :             :    * @param asset the address of the underlying asset
+     385                 :             :    * @return optimalUsageRatio the current optimal usage ratio of the asset
+     386                 :             :    * @return baseVariableBorrowRate the current base variable borrow rate of the asset
+     387                 :             :    * @return variableRateSlope1 the current variable rate slope 1 of the asset
+     388                 :             :    * @return variableRateSlope2 the current variable rate slope 2 of the asset
+     389                 :             :    */
+     390                 :           6 :   function _getInterestRatesForAsset(
+     391                 :             :     address asset
+     392                 :             :   )
+     393                 :             :     internal
+     394                 :             :     view
+     395                 :             :     returns (
+     396                 :             :       uint256 optimalUsageRatio,
+     397                 :             :       uint256 baseVariableBorrowRate,
+     398                 :             :       uint256 variableRateSlope1,
+     399                 :             :       uint256 variableRateSlope2
+     400                 :             :     )
+     401                 :             :   {
+     402                 :          18 :     address rateStrategyAddress = POOL_DATA_PROVIDER.getInterestRateStrategyAddress(asset);
+     403                 :          12 :     IDefaultInterestRateStrategyV2.InterestRateData
+     404                 :          12 :       memory interestRateData = IDefaultInterestRateStrategyV2(rateStrategyAddress)
+     405                 :             :         .getInterestRateDataBps(asset);
+     406                 :          10 :     return (
+     407                 :             :       interestRateData.optimalUsageRatio,
+     408                 :             :       interestRateData.baseVariableBorrowRate,
+     409                 :             :       interestRateData.variableRateSlope1,
+     410                 :             :       interestRateData.variableRateSlope2
+     411                 :             :     );
+     412                 :             :   }
+     413                 :             : 
+     414                 :             :   /**
+     415                 :             :    * @notice Ensures the risk param update is within the allowed range
+     416                 :             :    * @param from current risk param value
+     417                 :             :    * @param to new updated risk param value
+     418                 :             :    * @param maxPercentChange the max percent change allowed
+     419                 :             :    * @param isChangeRelative true, if maxPercentChange is relative in value, false if maxPercentChange
+     420                 :             :    *        is absolute in value.
+     421                 :             :    * @return bool true, if difference is within the maxPercentChange
+     422                 :             :    */
+     423                 :          34 :   function _updateWithinAllowedRange(
+     424                 :             :     uint256 from,
+     425                 :             :     uint256 to,
+     426                 :             :     uint256 maxPercentChange,
+     427                 :             :     bool isChangeRelative
+     428                 :             :   ) internal pure returns (bool) {
+     429                 :             :     // diff denotes the difference between the from and to values, ensuring it is a positive value always
+     430                 :         102 :     uint256 diff = from > to ? from - to : to - from;
+     431                 :             : 
+     432                 :             :     // maxDiff denotes the max permitted difference on both the upper and lower bounds, if the maxPercentChange is relative in value
+     433                 :             :     // we calculate the max permitted difference using the maxPercentChange and the from value, otherwise if the maxPercentChange is absolute in value
+     434                 :             :     // the max permitted difference is the maxPercentChange itself
+     435                 :         102 :     uint256 maxDiff = isChangeRelative ? (maxPercentChange * from) / BPS_MAX : maxPercentChange;
+     436                 :          75 :     if (diff > maxDiff) return false;
+     437                 :          54 :     return true;
+     438                 :             :   }
+     439                 :             : }
         
diff --git a/report/contracts/src/contracts/index-sort-b.html b/report/contracts/src/contracts/index-sort-b.html index 0289be9..471fe4c 100644 --- a/report/contracts/src/contracts/index-sort-b.html +++ b/report/contracts/src/contracts/index-sort-b.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 100.0 % - 100 - 100 + 95.7 % + 94 + 90 Test Date: - 2024-04-15 16:35:51 + 2024-05-07 19:38:40 Functions: - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 @@ -98,17 +98,17 @@ RiskSteward.sol -
100.0%
+
95.7%95.7%
- 100.0 % - 100 - 100 + 95.7 % + 94 + 90 - - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 diff --git a/report/contracts/src/contracts/index-sort-f.html b/report/contracts/src/contracts/index-sort-f.html index c329ce2..b61d77c 100644 --- a/report/contracts/src/contracts/index-sort-f.html +++ b/report/contracts/src/contracts/index-sort-f.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 100.0 % - 100 - 100 + 95.7 % + 94 + 90 Test Date: - 2024-04-15 16:35:51 + 2024-05-07 19:38:40 Functions: - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 @@ -98,17 +98,17 @@ RiskSteward.sol -
100.0%
+
95.7%95.7%
- 100.0 % - 100 - 100 + 95.7 % + 94 + 90 - - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 diff --git a/report/contracts/src/contracts/index-sort-l.html b/report/contracts/src/contracts/index-sort-l.html index ac07ad6..4ee5b7e 100644 --- a/report/contracts/src/contracts/index-sort-l.html +++ b/report/contracts/src/contracts/index-sort-l.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 100.0 % - 100 - 100 + 95.7 % + 94 + 90 Test Date: - 2024-04-15 16:35:51 + 2024-05-07 19:38:40 Functions: - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 @@ -98,17 +98,17 @@ RiskSteward.sol -
100.0%
+
95.7%95.7%
- 100.0 % - 100 - 100 + 95.7 % + 94 + 90 - - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 diff --git a/report/contracts/src/contracts/index.html b/report/contracts/src/contracts/index.html index d1a42a9..3fc1efa 100644 --- a/report/contracts/src/contracts/index.html +++ b/report/contracts/src/contracts/index.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 100.0 % - 100 - 100 + 95.7 % + 94 + 90 Test Date: - 2024-04-15 16:35:51 + 2024-05-07 19:38:40 Functions: - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 @@ -98,17 +98,17 @@ RiskSteward.sol -
100.0%
+
95.7%95.7%
- 100.0 % - 100 - 100 + 95.7 % + 94 + 90 - - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 diff --git a/report/coverage.svg b/report/coverage.svg index b846227..87f84be 100644 --- a/report/coverage.svg +++ b/report/coverage.svg @@ -1 +1 @@ -coverage: 100.0%coverage100.0% \ No newline at end of file +coverage: 95.7%coverage95.7% \ No newline at end of file diff --git a/report/index-sort-b.html b/report/index-sort-b.html index d4baaf2..fe8cab8 100644 --- a/report/index-sort-b.html +++ b/report/index-sort-b.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 100.0 % - 100 - 100 + 95.7 % + 94 + 90 Test Date: - 2024-04-15 16:35:51 + 2024-05-07 19:38:40 Functions: - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 @@ -98,17 +98,17 @@ contracts/src/contracts -
100.0%
+
95.7%95.7%
- 100.0 % - 100 - 100 + 95.7 % + 94 + 90 - - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 diff --git a/report/index-sort-f.html b/report/index-sort-f.html index 745a82b..33a211c 100644 --- a/report/index-sort-f.html +++ b/report/index-sort-f.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 100.0 % - 100 - 100 + 95.7 % + 94 + 90 Test Date: - 2024-04-15 16:35:51 + 2024-05-07 19:38:40 Functions: - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 @@ -98,17 +98,17 @@ contracts/src/contracts -
100.0%
+
95.7%95.7%
- 100.0 % - 100 - 100 + 95.7 % + 94 + 90 - - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 diff --git a/report/index-sort-l.html b/report/index-sort-l.html index 5c2e8d7..89f8cea 100644 --- a/report/index-sort-l.html +++ b/report/index-sort-l.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 100.0 % - 100 - 100 + 95.7 % + 94 + 90 Test Date: - 2024-04-15 16:35:51 + 2024-05-07 19:38:40 Functions: - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 @@ -98,17 +98,17 @@ contracts/src/contracts -
100.0%
+
95.7%95.7%
- 100.0 % - 100 - 100 + 95.7 % + 94 + 90 - - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 diff --git a/report/index.html b/report/index.html index 8309ab7..eb95eb2 100644 --- a/report/index.html +++ b/report/index.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 100.0 % - 100 - 100 + 95.7 % + 94 + 90 Test Date: - 2024-04-15 16:35:51 + 2024-05-07 19:38:40 Functions: - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 @@ -98,17 +98,17 @@ contracts/src/contracts -
100.0%
+
95.7%95.7%
- 100.0 % - 100 - 100 + 95.7 % + 94 + 90 - - 100.0 % - 17 - 17 + 94.7 % + 19 + 18 From 6cd0460c620e7a6c6c8ffc50bb87de557116a56b Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Tue, 7 May 2024 19:47:52 +0530 Subject: [PATCH 8/9] fix: ci --- .github/workflows/main.yml | 1 + lcov.info | 336 ------------------------------------- lcov.info.p | 152 ----------------- 3 files changed, 1 insertion(+), 488 deletions(-) delete mode 100644 lcov.info delete mode 100644 lcov.info.p diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2c4e7d8..b75a24e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,3 +10,4 @@ on: jobs: test: uses: bgd-labs/github-workflows/.github/workflows/foundry-test.yml@main + secrets: inherit diff --git a/lcov.info b/lcov.info deleted file mode 100644 index dd69fb5..0000000 --- a/lcov.info +++ /dev/null @@ -1,336 +0,0 @@ -TN: -SF:src/contracts/RiskSteward.sol -FN:41,RiskSteward.onlyRiskCouncil -FNDA:266,RiskSteward.onlyRiskCouncil -DA:42,266 -DA:42,266 -BRDA:42,0,0,256 -BRDA:42,0,1,7 -DA:42,256 -FN:52,RiskSteward. -FNDA:0,RiskSteward. -DA:58,0 -DA:58,0 -DA:59,0 -DA:59,0 -DA:60,0 -DA:60,0 -DA:61,0 -DA:61,0 -FN:65,RiskSteward.updateCaps -FNDA:266,RiskSteward.updateCaps -DA:66,10 -DA:66,10 -DA:67,4 -DA:67,4 -FN:71,RiskSteward.updateRates -FNDA:263,RiskSteward.updateRates -DA:72,7 -DA:72,7 -DA:73,3 -DA:73,3 -FN:77,RiskSteward.updateCollateralSide -FNDA:266,RiskSteward.updateCollateralSide -DA:80,10 -DA:80,10 -DA:81,3 -DA:81,3 -FN:85,RiskSteward.getTimelock -FNDA:6,RiskSteward.getTimelock -DA:86,6 -DA:86,6 -FN:90,RiskSteward.setRiskConfig -FNDA:259,RiskSteward.setRiskConfig -DA:91,3 -DA:91,3 -DA:92,3 -DA:92,3 -FN:96,RiskSteward.getRiskConfig -FNDA:1,RiskSteward.getRiskConfig -DA:97,1 -DA:97,1 -FN:101,RiskSteward.isAssetRestricted -FNDA:2,RiskSteward.isAssetRestricted -DA:102,2 -DA:102,2 -FN:106,RiskSteward.setAssetRestricted -FNDA:261,RiskSteward.setAssetRestricted -DA:107,5 -DA:107,5 -DA:108,5 -DA:108,5 -FN:115,RiskSteward._validateCapsUpdate -FNDA:10,RiskSteward._validateCapsUpdate -DA:116,10 -DA:116,10 -BRDA:116,1,0,- -BRDA:116,1,1,10 -DA:116,0 -DA:118,10 -DA:118,10 -DA:118,14 -DA:118,4 -DA:119,10 -DA:119,10 -DA:121,10 -BRDA:121,2,0,1 -BRDA:121,2,1,9 -DA:121,1 -DA:122,9 -DA:122,9 -DA:122,9 -DA:122,8 -BRDA:122,3,0,1 -BRDA:122,3,1,8 -DA:122,1 -DA:124,8 -DA:124,8 -DA:124,8 -DA:128,8 -DA:128,8 -DA:137,4 -DA:137,4 -FN:153,RiskSteward._validateRatesUpdate -FNDA:7,RiskSteward._validateRatesUpdate -DA:154,7 -DA:154,7 -BRDA:154,4,0,- -BRDA:154,4,1,7 -DA:154,0 -DA:156,7 -DA:156,7 -DA:156,10 -DA:156,3 -DA:157,7 -DA:157,7 -DA:158,7 -BRDA:158,5,0,1 -BRDA:158,5,1,6 -DA:158,1 -DA:160,6 -DA:160,6 -DA:165,6 -DA:165,6 -DA:167,5 -DA:167,5 -DA:176,3 -DA:176,3 -DA:185,3 -DA:185,3 -DA:194,3 -DA:194,3 -FN:210,RiskSteward._validateCollateralsUpdate -FNDA:10,RiskSteward._validateCollateralsUpdate -DA:213,10 -DA:213,10 -BRDA:213,6,0,- -BRDA:213,6,1,10 -DA:213,0 -DA:215,10 -DA:215,10 -DA:215,13 -DA:215,3 -DA:216,10 -DA:216,10 -DA:218,10 -BRDA:218,7,0,1 -BRDA:218,7,1,9 -DA:218,1 -DA:219,9 -DA:219,9 -BRDA:219,8,0,1 -BRDA:219,8,1,8 -DA:219,1 -DA:221,8 -DA:221,8 -DA:221,8 -DA:221,8 -DA:221,8 -DA:222,7 -DA:222,7 -DA:223,7 -DA:223,7 -DA:224,7 -DA:224,7 -BRDA:220,9,0,1 -BRDA:220,9,1,7 -DA:225,1 -DA:225,1 -DA:227,7 -DA:227,7 -DA:238,7 -DA:238,7 -DA:239,7 -DA:239,7 -DA:239,7 -DA:241,7 -DA:241,7 -DA:250,4 -DA:250,4 -DA:259,4 -DA:259,4 -DA:268,4 -DA:268,4 -FN:284,RiskSteward._validateParamUpdate -FNDA:45,RiskSteward._validateParamUpdate -DA:287,45 -DA:287,45 -BRDA:287,10,0,37 -BRDA:287,10,1,35 -DA:287,45 -DA:289,37 -DA:289,37 -DA:289,37 -BRDA:289,11,0,3 -BRDA:289,11,1,34 -DA:289,3 -DA:291,34 -DA:291,34 -BRDA:290,12,0,7 -BRDA:290,12,1,27 -DA:297,7 -DA:297,7 -FN:304,RiskSteward._updateCaps -FNDA:4,RiskSteward._updateCaps -DA:305,4 -DA:305,4 -DA:305,8 -DA:305,4 -DA:306,4 -DA:306,4 -DA:308,4 -DA:308,4 -BRDA:308,13,0,3 -BRDA:308,13,1,4 -DA:309,3 -DA:309,3 -DA:312,4 -DA:312,4 -BRDA:312,14,0,3 -BRDA:312,14,1,4 -DA:313,3 -DA:313,3 -DA:317,4 -DA:317,4 -FN:326,RiskSteward._updateRates -FNDA:3,RiskSteward._updateRates -DA:327,3 -DA:327,3 -DA:327,6 -DA:327,3 -DA:328,3 -DA:328,3 -DA:330,3 -DA:330,3 -BRDA:330,15,0,3 -BRDA:330,15,1,3 -DA:331,3 -DA:331,3 -DA:334,3 -DA:334,3 -BRDA:334,16,0,3 -BRDA:334,16,1,3 -DA:335,3 -DA:335,3 -DA:338,3 -DA:338,3 -BRDA:338,17,0,3 -BRDA:338,17,1,3 -DA:339,3 -DA:339,3 -DA:342,3 -DA:342,3 -BRDA:342,18,0,3 -BRDA:342,18,1,3 -DA:343,3 -DA:343,3 -DA:347,3 -DA:347,3 -FN:356,RiskSteward._updateCollateralSide -FNDA:3,RiskSteward._updateCollateralSide -DA:357,3 -DA:357,3 -DA:357,6 -DA:357,3 -DA:358,3 -DA:358,3 -DA:360,3 -DA:360,3 -BRDA:360,19,0,2 -BRDA:360,19,1,3 -DA:361,2 -DA:361,2 -DA:364,3 -DA:364,3 -BRDA:364,20,0,2 -BRDA:364,20,1,3 -DA:365,2 -DA:365,2 -DA:368,3 -DA:368,3 -BRDA:368,21,0,2 -BRDA:368,21,1,3 -DA:369,2 -DA:369,2 -DA:372,3 -DA:372,3 -BRDA:372,22,0,3 -BRDA:372,22,1,3 -DA:373,3 -DA:373,3 -DA:377,3 -DA:377,3 -FN:390,RiskSteward._getInterestRatesForAsset -FNDA:6,RiskSteward._getInterestRatesForAsset -DA:402,6 -DA:402,6 -DA:402,6 -DA:403,6 -DA:403,6 -DA:404,6 -DA:404,6 -DA:406,5 -DA:406,5 -FN:423,RiskSteward._updateWithinAllowedRange -FNDA:34,RiskSteward._updateWithinAllowedRange -DA:430,34 -DA:430,34 -DA:430,34 -DA:435,34 -DA:435,34 -DA:435,34 -DA:436,34 -DA:436,34 -BRDA:436,23,0,7 -BRDA:436,23,1,27 -DA:436,7 -DA:437,27 -DA:437,27 -FNF:19 -FNH:18 -LF:94 -LH:90 -BRF:48 -BRH:45 -end_of_record -TN: -SF:tests/utils/ConfigEngineDeployer.sol -FN:21,ConfigEngineDeployer.deployEngine -FNDA:22,ConfigEngineDeployer.deployEngine -DA:22,22 -DA:22,22 -DA:22,22 -DA:33,22 -DA:33,22 -DA:33,22 -DA:43,22 -DA:43,22 -DA:44,22 -DA:44,22 -FNF:1 -FNH:1 -LF:4 -LH:4 -BRF:0 -BRH:0 -end_of_record diff --git a/lcov.info.p b/lcov.info.p deleted file mode 100644 index a3fa4c0..0000000 --- a/lcov.info.p +++ /dev/null @@ -1,152 +0,0 @@ -TN: -SF:src/contracts/RiskSteward.sol -FN:101,RiskSteward.isAssetRestricted -FN:106,RiskSteward.setAssetRestricted -FN:115,RiskSteward._validateCapsUpdate -FN:153,RiskSteward._validateRatesUpdate -FN:210,RiskSteward._validateCollateralsUpdate -FN:284,RiskSteward._validateParamUpdate -FN:304,RiskSteward._updateCaps -FN:326,RiskSteward._updateRates -FN:356,RiskSteward._updateCollateralSide -FN:390,RiskSteward._getInterestRatesForAsset -FN:41,RiskSteward.onlyRiskCouncil -FN:423,RiskSteward._updateWithinAllowedRange -FN:52,RiskSteward. -FN:65,RiskSteward.updateCaps -FN:71,RiskSteward.updateRates -FN:77,RiskSteward.updateCollateralSide -FN:85,RiskSteward.getTimelock -FN:90,RiskSteward.setRiskConfig -FN:96,RiskSteward.getRiskConfig -FNDA:2,RiskSteward.isAssetRestricted -FNDA:261,RiskSteward.setAssetRestricted -FNDA:10,RiskSteward._validateCapsUpdate -FNDA:7,RiskSteward._validateRatesUpdate -FNDA:10,RiskSteward._validateCollateralsUpdate -FNDA:45,RiskSteward._validateParamUpdate -FNDA:4,RiskSteward._updateCaps -FNDA:3,RiskSteward._updateRates -FNDA:3,RiskSteward._updateCollateralSide -FNDA:6,RiskSteward._getInterestRatesForAsset -FNDA:266,RiskSteward.onlyRiskCouncil -FNDA:34,RiskSteward._updateWithinAllowedRange -FNDA:0,RiskSteward. -FNDA:266,RiskSteward.updateCaps -FNDA:263,RiskSteward.updateRates -FNDA:266,RiskSteward.updateCollateralSide -FNDA:6,RiskSteward.getTimelock -FNDA:259,RiskSteward.setRiskConfig -FNDA:1,RiskSteward.getRiskConfig -FNF:19 -FNH:18 -DA:42,788 -DA:58,0 -DA:59,0 -DA:60,0 -DA:61,0 -DA:66,20 -DA:67,8 -DA:72,14 -DA:73,6 -DA:80,20 -DA:81,6 -DA:86,12 -DA:91,6 -DA:92,6 -DA:97,2 -DA:102,4 -DA:107,10 -DA:108,10 -DA:116,20 -DA:118,38 -DA:119,20 -DA:121,11 -DA:122,36 -DA:124,24 -DA:128,16 -DA:137,8 -DA:154,14 -DA:156,27 -DA:157,14 -DA:158,8 -DA:160,12 -DA:165,12 -DA:167,10 -DA:176,6 -DA:185,6 -DA:194,6 -DA:213,20 -DA:215,36 -DA:216,20 -DA:218,11 -DA:219,19 -DA:221,40 -DA:222,14 -DA:223,14 -DA:224,14 -DA:225,2 -DA:227,14 -DA:238,14 -DA:239,21 -DA:241,14 -DA:250,8 -DA:259,8 -DA:268,8 -DA:287,135 -DA:289,114 -DA:291,68 -DA:297,14 -DA:305,20 -DA:306,8 -DA:308,8 -DA:309,6 -DA:312,8 -DA:313,6 -DA:317,8 -DA:327,15 -DA:328,6 -DA:330,6 -DA:331,6 -DA:334,6 -DA:335,6 -DA:338,6 -DA:339,6 -DA:342,6 -DA:343,6 -DA:347,6 -DA:357,15 -DA:358,6 -DA:360,6 -DA:361,4 -DA:364,6 -DA:365,4 -DA:368,6 -DA:369,4 -DA:372,6 -DA:373,6 -DA:377,6 -DA:402,18 -DA:403,12 -DA:404,12 -DA:406,10 -DA:430,102 -DA:435,102 -DA:436,75 -DA:437,54 -LF:94 -LH:90 -end_of_record -TN: -SF:tests/utils/ConfigEngineDeployer.sol -FN:21,ConfigEngineDeployer.deployEngine -FNDA:22,ConfigEngineDeployer.deployEngine -FNF:1 -FNH:1 -DA:22,66 -DA:33,66 -DA:43,44 -DA:44,44 -LF:4 -LH:4 -end_of_record From 9aefb95b359e7af7c44e131abd021238f9042ea6 Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Tue, 7 May 2024 20:12:37 +0530 Subject: [PATCH 9/9] feat: update coverage --- .../src/contracts/RiskSteward.sol.func-c.html | 26 +++--- .../src/contracts/RiskSteward.sol.func.html | 14 +-- .../src/contracts/RiskSteward.sol.gcov.html | 26 +++--- .../contracts/src/contracts/index-sort-b.html | 20 ++-- .../contracts/src/contracts/index-sort-f.html | 20 ++-- .../contracts/src/contracts/index-sort-l.html | 20 ++-- report/contracts/src/contracts/index.html | 20 ++-- report/coverage.svg | 2 +- report/index-sort-b.html | 20 ++-- report/index-sort-f.html | 20 ++-- report/index-sort-l.html | 20 ++-- report/index.html | 20 ++-- tests/RiskSteward.t.sol | 92 ++++++++++++------- 13 files changed, 175 insertions(+), 145 deletions(-) diff --git a/report/contracts/src/contracts/RiskSteward.sol.func-c.html b/report/contracts/src/contracts/RiskSteward.sol.func-c.html index f596fa5..baca6c3 100644 --- a/report/contracts/src/contracts/RiskSteward.sol.func-c.html +++ b/report/contracts/src/contracts/RiskSteward.sol.func-c.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 95.7 % + 100.0 % + 94 94 - 90 Test Date: - 2024-05-07 19:38:40 + 2024-05-07 20:11:46 Functions: - 94.7 % + 100.0 % + 19 19 - 18 @@ -70,18 +70,11 @@ Hit count Sort by function hit count - - - RiskSteward. - - 0 - - RiskSteward.getRiskConfig - 1 + 2 @@ -133,6 +126,13 @@ 7 + + + RiskSteward. + + 8 + + RiskSteward._validateCapsUpdate diff --git a/report/contracts/src/contracts/RiskSteward.sol.func.html b/report/contracts/src/contracts/RiskSteward.sol.func.html index 8cda48d..cf1183d 100644 --- a/report/contracts/src/contracts/RiskSteward.sol.func.html +++ b/report/contracts/src/contracts/RiskSteward.sol.func.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 95.7 % + 100.0 % + 94 94 - 90 Test Date: - 2024-05-07 19:38:40 + 2024-05-07 20:11:46 Functions: - 94.7 % + 100.0 % + 19 19 - 18 @@ -74,7 +74,7 @@ RiskSteward. - 0 + 8 @@ -144,7 +144,7 @@ RiskSteward.getRiskConfig - 1 + 2 diff --git a/report/contracts/src/contracts/RiskSteward.sol.gcov.html b/report/contracts/src/contracts/RiskSteward.sol.gcov.html index 2eef2a6..ecdce90 100644 --- a/report/contracts/src/contracts/RiskSteward.sol.gcov.html +++ b/report/contracts/src/contracts/RiskSteward.sol.gcov.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 95.7 % + 100.0 % + 94 94 - 90 Test Date: - 2024-05-07 19:38:40 + 2024-05-07 20:11:46 Functions: - 94.7 % + 100.0 % + 19 19 - 18 @@ -120,20 +120,20 @@ 49 : : * @param riskCouncil the safe address of the council being able to interact with the steward 50 : : * @param riskConfig the risk configuration to setup for each individual risk param 51 : : */ - 52 : 0 : constructor( + 52 : 8 : constructor( 53 : : IPoolDataProvider poolDataProvider, 54 : : IEngine engine, 55 : : address riskCouncil, 56 : : Config memory riskConfig 57 : : ) { - 58 : 0 : POOL_DATA_PROVIDER = poolDataProvider; - 59 : 0 : CONFIG_ENGINE = engine; - 60 : 0 : RISK_COUNCIL = riskCouncil; - 61 : 0 : _riskConfig = riskConfig; + 58 : 6 : POOL_DATA_PROVIDER = poolDataProvider; + 59 : 4 : CONFIG_ENGINE = engine; + 60 : 8 : RISK_COUNCIL = riskCouncil; + 61 : 10 : _riskConfig = riskConfig; 62 : : } 63 : : 64 : : /// @inheritdoc IRiskSteward - 65 : 266 : function updateCaps(IEngine.CapsUpdate[] calldata capsUpdate) external onlyRiskCouncil { + 65 : 266 : function updateCaps(IEngine.CapsUpdate[] calldata capsUpdate) external onlyRiskCouncil { 66 : 20 : _validateCapsUpdate(capsUpdate); 67 : 8 : _updateCaps(capsUpdate); 68 : : } @@ -164,8 +164,8 @@ 93 : : } 94 : : 95 : : /// @inheritdoc IRiskSteward - 96 : 1 : function getRiskConfig() external view returns (Config memory) { - 97 : 2 : return _riskConfig; + 96 : 2 : function getRiskConfig() external view returns (Config memory) { + 97 : 4 : return _riskConfig; 98 : : } 99 : : 100 : : /// @inheritdoc IRiskSteward diff --git a/report/contracts/src/contracts/index-sort-b.html b/report/contracts/src/contracts/index-sort-b.html index 471fe4c..73a2491 100644 --- a/report/contracts/src/contracts/index-sort-b.html +++ b/report/contracts/src/contracts/index-sort-b.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 95.7 % + 100.0 % + 94 94 - 90 Test Date: - 2024-05-07 19:38:40 + 2024-05-07 20:11:46 Functions: - 94.7 % + 100.0 % + 19 19 - 18 @@ -98,17 +98,17 @@ RiskSteward.sol -
95.7%95.7%
+
100.0%
- 95.7 % + 100.0 % + 94 94 - 90 - - 94.7 % + 100.0 % + 19 19 - 18 diff --git a/report/contracts/src/contracts/index-sort-f.html b/report/contracts/src/contracts/index-sort-f.html index b61d77c..5eafbea 100644 --- a/report/contracts/src/contracts/index-sort-f.html +++ b/report/contracts/src/contracts/index-sort-f.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 95.7 % + 100.0 % + 94 94 - 90 Test Date: - 2024-05-07 19:38:40 + 2024-05-07 20:11:46 Functions: - 94.7 % + 100.0 % + 19 19 - 18 @@ -98,17 +98,17 @@ RiskSteward.sol -
95.7%95.7%
+
100.0%
- 95.7 % + 100.0 % + 94 94 - 90 - - 94.7 % + 100.0 % + 19 19 - 18 diff --git a/report/contracts/src/contracts/index-sort-l.html b/report/contracts/src/contracts/index-sort-l.html index 4ee5b7e..0c1174b 100644 --- a/report/contracts/src/contracts/index-sort-l.html +++ b/report/contracts/src/contracts/index-sort-l.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 95.7 % + 100.0 % + 94 94 - 90 Test Date: - 2024-05-07 19:38:40 + 2024-05-07 20:11:46 Functions: - 94.7 % + 100.0 % + 19 19 - 18 @@ -98,17 +98,17 @@ RiskSteward.sol -
95.7%95.7%
+
100.0%
- 95.7 % + 100.0 % + 94 94 - 90 - - 94.7 % + 100.0 % + 19 19 - 18 diff --git a/report/contracts/src/contracts/index.html b/report/contracts/src/contracts/index.html index 3fc1efa..0e3fb63 100644 --- a/report/contracts/src/contracts/index.html +++ b/report/contracts/src/contracts/index.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 95.7 % + 100.0 % + 94 94 - 90 Test Date: - 2024-05-07 19:38:40 + 2024-05-07 20:11:46 Functions: - 94.7 % + 100.0 % + 19 19 - 18 @@ -98,17 +98,17 @@ RiskSteward.sol -
95.7%95.7%
+
100.0%
- 95.7 % + 100.0 % + 94 94 - 90 - - 94.7 % + 100.0 % + 19 19 - 18 diff --git a/report/coverage.svg b/report/coverage.svg index 87f84be..b846227 100644 --- a/report/coverage.svg +++ b/report/coverage.svg @@ -1 +1 @@ -coverage: 95.7%coverage95.7% \ No newline at end of file +coverage: 100.0%coverage100.0% \ No newline at end of file diff --git a/report/index-sort-b.html b/report/index-sort-b.html index fe8cab8..a5d0cf8 100644 --- a/report/index-sort-b.html +++ b/report/index-sort-b.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 95.7 % + 100.0 % + 94 94 - 90 Test Date: - 2024-05-07 19:38:40 + 2024-05-07 20:11:46 Functions: - 94.7 % + 100.0 % + 19 19 - 18 @@ -98,17 +98,17 @@ contracts/src/contracts -
95.7%95.7%
+
100.0%
- 95.7 % + 100.0 % + 94 94 - 90 - - 94.7 % + 100.0 % + 19 19 - 18 diff --git a/report/index-sort-f.html b/report/index-sort-f.html index 33a211c..6b8e8f4 100644 --- a/report/index-sort-f.html +++ b/report/index-sort-f.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 95.7 % + 100.0 % + 94 94 - 90 Test Date: - 2024-05-07 19:38:40 + 2024-05-07 20:11:46 Functions: - 94.7 % + 100.0 % + 19 19 - 18 @@ -98,17 +98,17 @@ contracts/src/contracts -
95.7%95.7%
+
100.0%
- 95.7 % + 100.0 % + 94 94 - 90 - - 94.7 % + 100.0 % + 19 19 - 18 diff --git a/report/index-sort-l.html b/report/index-sort-l.html index 89f8cea..1626fe6 100644 --- a/report/index-sort-l.html +++ b/report/index-sort-l.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 95.7 % + 100.0 % + 94 94 - 90 Test Date: - 2024-05-07 19:38:40 + 2024-05-07 20:11:46 Functions: - 94.7 % + 100.0 % + 19 19 - 18 @@ -98,17 +98,17 @@ contracts/src/contracts -
95.7%95.7%
+
100.0%
- 95.7 % + 100.0 % + 94 94 - 90 - - 94.7 % + 100.0 % + 19 19 - 18 diff --git a/report/index.html b/report/index.html index eb95eb2..65e3e64 100644 --- a/report/index.html +++ b/report/index.html @@ -31,18 +31,18 @@ lcov.info.p Lines: - 95.7 % + 100.0 % + 94 94 - 90 Test Date: - 2024-05-07 19:38:40 + 2024-05-07 20:11:46 Functions: - 94.7 % + 100.0 % + 19 19 - 18 @@ -98,17 +98,17 @@ contracts/src/contracts -
95.7%95.7%
+
100.0%
- 95.7 % + 100.0 % + 94 94 - 90 - - 94.7 % + 100.0 % + 19 19 - 18 diff --git a/tests/RiskSteward.t.sol b/tests/RiskSteward.t.sol index 40e0cb7..545fe09 100644 --- a/tests/RiskSteward.t.sol +++ b/tests/RiskSteward.t.sol @@ -15,6 +15,8 @@ import {ConfigEngineDeployer} from './utils/ConfigEngineDeployer.sol'; contract RiskSteward_Test is Test { address public constant riskCouncil = address(42); RiskSteward public steward; + address public configEngine; + IRiskSteward.RiskParamConfig public defaultRiskParamConfig; IRiskSteward.Config public riskConfig; event AssetRestricted(address indexed asset, bool indexed isRestricted); @@ -29,11 +31,11 @@ contract RiskSteward_Test is Test { GovV3Helpers.executePayload(vm, v3_1_updatePayload); // deploy new config engine - address configEngine = ConfigEngineDeployer.deployEngine( + configEngine = ConfigEngineDeployer.deployEngine( address(UpgradePayload(v3_1_updatePayload).DEFAULT_IR()) ); - IRiskSteward.RiskParamConfig memory defaultRiskParamConfig = IRiskSteward.RiskParamConfig({ + defaultRiskParamConfig = IRiskSteward.RiskParamConfig({ minDelay: 5 days, maxPercentChange: 10_00 // 10% }); @@ -686,7 +688,7 @@ contract RiskSteward_Test is Test { rateStrategyUpdate[0] = IEngine.RateStrategyUpdate({ asset: AaveV3EthereumAssets.DAI_UNDERLYING, params: IEngine.InterestRateInputData({ - optimalUsageRatio: _bpsToRay(90_00), + optimalUsageRatio: 90_00, baseVariableBorrowRate: EngineFlags.KEEP_CURRENT, variableRateSlope1: EngineFlags.KEEP_CURRENT, variableRateSlope2: EngineFlags.KEEP_CURRENT @@ -737,7 +739,7 @@ contract RiskSteward_Test is Test { maxPercentChange: 20_00 // 20% }); - IRiskSteward.Config memory newRiskConfig = IRiskSteward.Config({ + IRiskSteward.Config memory initialRiskConfig = IRiskSteward.Config({ ltv: newRiskParamConfig, liquidationThreshold: newRiskParamConfig, liquidationBonus: newRiskParamConfig, @@ -751,37 +753,65 @@ contract RiskSteward_Test is Test { }); vm.expectEmit(); - emit RiskConfigSet(newRiskConfig); + emit RiskConfigSet(initialRiskConfig); vm.prank(GovernanceV3Ethereum.EXECUTOR_LVL_1); - steward.setRiskConfig(newRiskConfig); - - IRiskSteward.Config memory updatedRiskConfig = steward.getRiskConfig(); - - assertEq(newRiskConfig.ltv.minDelay, updatedRiskConfig.ltv.minDelay); - assertEq(newRiskConfig.ltv.maxPercentChange, updatedRiskConfig.ltv.maxPercentChange); - assertEq(newRiskConfig.liquidationThreshold.minDelay, updatedRiskConfig.liquidationThreshold.minDelay); - assertEq(newRiskConfig.liquidationThreshold.maxPercentChange, updatedRiskConfig.liquidationThreshold.maxPercentChange); - assertEq(newRiskConfig.liquidationBonus.minDelay, updatedRiskConfig.liquidationBonus.minDelay); - assertEq(newRiskConfig.liquidationBonus.maxPercentChange, updatedRiskConfig.liquidationBonus.maxPercentChange); - assertEq(newRiskConfig.supplyCap.minDelay, updatedRiskConfig.supplyCap.minDelay); - assertEq(newRiskConfig.supplyCap.maxPercentChange, updatedRiskConfig.supplyCap.maxPercentChange); - assertEq(newRiskConfig.borrowCap.minDelay, updatedRiskConfig.borrowCap.minDelay); - assertEq(newRiskConfig.borrowCap.maxPercentChange, updatedRiskConfig.borrowCap.maxPercentChange); - assertEq(newRiskConfig.debtCeiling.minDelay, updatedRiskConfig.debtCeiling.minDelay); - assertEq(newRiskConfig.debtCeiling.maxPercentChange, updatedRiskConfig.debtCeiling.maxPercentChange); - assertEq(newRiskConfig.baseVariableBorrowRate.minDelay, updatedRiskConfig.baseVariableBorrowRate.minDelay); - assertEq(newRiskConfig.baseVariableBorrowRate.maxPercentChange, updatedRiskConfig.baseVariableBorrowRate.maxPercentChange); - assertEq(newRiskConfig.variableRateSlope1.minDelay, updatedRiskConfig.variableRateSlope1.minDelay); - assertEq(newRiskConfig.variableRateSlope1.maxPercentChange, updatedRiskConfig.variableRateSlope1.maxPercentChange); - assertEq(newRiskConfig.variableRateSlope2.minDelay, updatedRiskConfig.variableRateSlope2.minDelay); - assertEq(newRiskConfig.variableRateSlope2.maxPercentChange, updatedRiskConfig.variableRateSlope2.maxPercentChange); - assertEq(newRiskConfig.optimalUsageRatio.minDelay, updatedRiskConfig.optimalUsageRatio.minDelay); - assertEq(newRiskConfig.optimalUsageRatio.maxPercentChange, updatedRiskConfig.optimalUsageRatio.maxPercentChange); + steward.setRiskConfig(initialRiskConfig); + + _validateRiskConfig(initialRiskConfig, steward.getRiskConfig()); + } + + function test_constructor() public { + riskConfig = IRiskSteward.Config({ + ltv: defaultRiskParamConfig, + liquidationThreshold: defaultRiskParamConfig, + liquidationBonus: defaultRiskParamConfig, + supplyCap: defaultRiskParamConfig, + borrowCap: defaultRiskParamConfig, + debtCeiling: defaultRiskParamConfig, + baseVariableBorrowRate: defaultRiskParamConfig, + variableRateSlope1: defaultRiskParamConfig, + variableRateSlope2: defaultRiskParamConfig, + optimalUsageRatio: defaultRiskParamConfig + }); + + steward = new RiskSteward( + AaveV3Ethereum.AAVE_PROTOCOL_DATA_PROVIDER, + IEngine(configEngine), + riskCouncil, + riskConfig + ); + + assertEq(address(steward.POOL_DATA_PROVIDER()), address(AaveV3Ethereum.AAVE_PROTOCOL_DATA_PROVIDER)); + assertEq(address(steward.CONFIG_ENGINE()), address(IEngine(configEngine))); + assertEq(steward.RISK_COUNCIL(), riskCouncil); + _validateRiskConfig(riskConfig, steward.getRiskConfig()); } - function _bpsToRay(uint256 amount) internal pure returns (uint256) { - return (amount * 1e27) / 10_000; + function _validateRiskConfig( + IRiskSteward.Config memory initialRiskConfig, + IRiskSteward.Config memory updatedRiskConfig + ) internal { + assertEq(initialRiskConfig.ltv.minDelay, updatedRiskConfig.ltv.minDelay); + assertEq(initialRiskConfig.ltv.maxPercentChange, updatedRiskConfig.ltv.maxPercentChange); + assertEq(initialRiskConfig.liquidationThreshold.minDelay, updatedRiskConfig.liquidationThreshold.minDelay); + assertEq(initialRiskConfig.liquidationThreshold.maxPercentChange, updatedRiskConfig.liquidationThreshold.maxPercentChange); + assertEq(initialRiskConfig.liquidationBonus.minDelay, updatedRiskConfig.liquidationBonus.minDelay); + assertEq(initialRiskConfig.liquidationBonus.maxPercentChange, updatedRiskConfig.liquidationBonus.maxPercentChange); + assertEq(initialRiskConfig.supplyCap.minDelay, updatedRiskConfig.supplyCap.minDelay); + assertEq(initialRiskConfig.supplyCap.maxPercentChange, updatedRiskConfig.supplyCap.maxPercentChange); + assertEq(initialRiskConfig.borrowCap.minDelay, updatedRiskConfig.borrowCap.minDelay); + assertEq(initialRiskConfig.borrowCap.maxPercentChange, updatedRiskConfig.borrowCap.maxPercentChange); + assertEq(initialRiskConfig.debtCeiling.minDelay, updatedRiskConfig.debtCeiling.minDelay); + assertEq(initialRiskConfig.debtCeiling.maxPercentChange, updatedRiskConfig.debtCeiling.maxPercentChange); + assertEq(initialRiskConfig.baseVariableBorrowRate.minDelay, updatedRiskConfig.baseVariableBorrowRate.minDelay); + assertEq(initialRiskConfig.baseVariableBorrowRate.maxPercentChange, updatedRiskConfig.baseVariableBorrowRate.maxPercentChange); + assertEq(initialRiskConfig.variableRateSlope1.minDelay, updatedRiskConfig.variableRateSlope1.minDelay); + assertEq(initialRiskConfig.variableRateSlope1.maxPercentChange, updatedRiskConfig.variableRateSlope1.maxPercentChange); + assertEq(initialRiskConfig.variableRateSlope2.minDelay, updatedRiskConfig.variableRateSlope2.minDelay); + assertEq(initialRiskConfig.variableRateSlope2.maxPercentChange, updatedRiskConfig.variableRateSlope2.maxPercentChange); + assertEq(initialRiskConfig.optimalUsageRatio.minDelay, updatedRiskConfig.optimalUsageRatio.minDelay); + assertEq(initialRiskConfig.optimalUsageRatio.maxPercentChange, updatedRiskConfig.optimalUsageRatio.maxPercentChange); } function _getInterestRatesForAsset(