Skip to content

Commit

Permalink
fix: remove unused constant
Browse files Browse the repository at this point in the history
  • Loading branch information
CheyenneAtapour committed Aug 18, 2024
1 parent 957c84f commit 1096260
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
3 changes: 0 additions & 3 deletions src/contracts/misc/GhoAaveSteward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ contract GhoAaveSteward is RiskCouncilControlled, IGhoAaveSteward {
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
using Address for address;

/// @inheritdoc IGhoAaveSteward
uint256 public constant GHO_BORROW_RATE_CHANGE_MAX = 0.05e4; // 5.00%

/// @inheritdoc IGhoAaveSteward
uint256 public constant GHO_BORROW_RATE_MAX = 0.25e4; // 25.00%

Expand Down
8 changes: 1 addition & 7 deletions src/contracts/misc/interfaces/IGhoAaveSteward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ interface IGhoAaveSteward {
/**
* @notice Updates the borrow rate of GHO, only if:
* - respects `MINIMUM_DELAY`, the minimum time delay between updates
* - the update changes up to `GHO_BORROW_RATE_CHANGE_MAX` upwards or downwards
* - the update changes up to 5% upwards or downwards
* - the update is lower than `GHO_BORROW_RATE_MAX`
* @dev Only callable by Risk Council
* @param optimalUsageRatio The new optimal usage ratio
Expand Down Expand Up @@ -95,12 +95,6 @@ interface IGhoAaveSteward {
*/
function getGhoTimelocks() external view returns (GhoDebounce memory);

/**
* @notice Returns the maximum increase/decrease for GHO borrow rate updates.
* @return The maximum increase change for borrow rate updates in ray (e.g. 0.010e27 results in 1.00%)
*/
function GHO_BORROW_RATE_CHANGE_MAX() external view returns (uint256);

/**
* @notice Returns maximum value that can be assigned to GHO borrow rate.
* @return The maximum value that can be assigned to GHO borrow rate in ray (e.g. 0.01e27 results in 1.0%)
Expand Down
13 changes: 7 additions & 6 deletions src/test/TestGhoAaveSteward.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity ^0.8.0;

import './TestGhoBase.t.sol';
import {Constants} from './helpers/Constants.sol';
import {IGhoAaveSteward} from '../contracts/misc/interfaces/IGhoAaveSteward.sol';
import {IDefaultInterestRateStrategyV2} from '../contracts/misc/deps/Dependencies.sol';
import {DefaultReserveInterestRateStrategyV2} from '../contracts/misc/deps/Dependencies.sol';
Expand Down Expand Up @@ -292,7 +293,7 @@ contract TestGhoAaveSteward is TestGhoBase {

function testUpdateGhoBorrowRateMaxIncrement() public {
uint256 oldBorrowRate = _getGhoBorrowRate();
uint256 newBorrowRate = oldBorrowRate + GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX();
uint256 newBorrowRate = oldBorrowRate + GHO_BORROW_RATE_CHANGE_MAX;
vm.prank(RISK_COUNCIL);
GHO_AAVE_STEWARD.updateGhoBorrowRate(
defaultRateParams.optimalUsageRatio,
Expand Down Expand Up @@ -324,14 +325,14 @@ contract TestGhoAaveSteward is TestGhoBase {
// set a high borrow rate
GHO_AAVE_STEWARD.updateGhoBorrowRate(
defaultRateParams.optimalUsageRatio,
_getGhoBorrowRate() + GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX(),
_getGhoBorrowRate() + GHO_BORROW_RATE_CHANGE_MAX,
defaultRateParams.variableRateSlope1,
defaultRateParams.variableRateSlope2
);
vm.warp(block.timestamp + GHO_AAVE_STEWARD.MINIMUM_DELAY() + 1);

uint256 oldBorrowRate = _getGhoBorrowRate();
uint256 newBorrowRate = oldBorrowRate - GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX();
uint256 newBorrowRate = oldBorrowRate - GHO_BORROW_RATE_CHANGE_MAX;
GHO_AAVE_STEWARD.updateGhoBorrowRate(
defaultRateParams.optimalUsageRatio,
newBorrowRate,
Expand Down Expand Up @@ -448,7 +449,7 @@ contract TestGhoAaveSteward is TestGhoBase {

function testRevertUpdateGhoBorrowRateIfMaxExceededUpwards() public {
uint256 oldBorrowRate = _getGhoBorrowRate();
uint256 newBorrowRate = oldBorrowRate + GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX() + 1;
uint256 newBorrowRate = oldBorrowRate + GHO_BORROW_RATE_CHANGE_MAX + 1;
vm.prank(RISK_COUNCIL);
vm.expectRevert('INVALID_BORROW_RATE_UPDATE');
GHO_AAVE_STEWARD.updateGhoBorrowRate(
Expand All @@ -465,14 +466,14 @@ contract TestGhoAaveSteward is TestGhoBase {
// set a high borrow rate
GHO_AAVE_STEWARD.updateGhoBorrowRate(
defaultRateParams.optimalUsageRatio,
_getGhoBorrowRate() + GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX(),
_getGhoBorrowRate() + GHO_BORROW_RATE_CHANGE_MAX,
defaultRateParams.variableRateSlope1,
defaultRateParams.variableRateSlope2
);
vm.warp(block.timestamp + GHO_AAVE_STEWARD.MINIMUM_DELAY() + 1);

uint256 oldBorrowRate = _getGhoBorrowRate();
uint256 newBorrowRate = oldBorrowRate - GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX() - 1;
uint256 newBorrowRate = oldBorrowRate - GHO_BORROW_RATE_CHANGE_MAX - 1;
vm.expectRevert('INVALID_BORROW_RATE_UPDATE');
GHO_AAVE_STEWARD.updateGhoBorrowRate(
defaultRateParams.optimalUsageRatio,
Expand Down
2 changes: 1 addition & 1 deletion src/test/helpers/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ contract Constants {
uint40 constant STEWARD_LIFESPAN = 90 days;

// Gho Stewards
uint256 constant GHO_BORROW_RATE_CHANGE_MAX = 0.0500e27;
uint256 constant GHO_BORROW_RATE_CHANGE_MAX = 0.05e4;
uint256 constant GSM_FEE_RATE_CHANGE_MAX = 0.0050e4;
uint256 constant GHO_BORROW_RATE_MAX = 0.2500e27;
uint256 constant MINIMUM_DELAY_V2 = 2 days;
Expand Down

0 comments on commit 1096260

Please sign in to comment.