diff --git a/src/contracts/misc/GhoAaveSteward.sol b/src/contracts/misc/GhoAaveSteward.sol index bece9bc9..bacabaac 100644 --- a/src/contracts/misc/GhoAaveSteward.sol +++ b/src/contracts/misc/GhoAaveSteward.sol @@ -21,12 +21,6 @@ import {RiskCouncilControlled} from './RiskCouncilControlled.sol'; contract GhoAaveSteward is Ownable, IGhoAaveSteward, RiskCouncilControlled { using ReserveConfiguration for DataTypes.ReserveConfigurationMap; - /// @inheritdoc IGhoAaveSteward - uint256 public constant GHO_BORROW_RATE_CHANGE_MAX = 0.0500e27; // 5.00% - - /// @inheritdoc IGhoAaveSteward - uint256 public constant GHO_BORROW_RATE_MAX = 0.2500e27; // 25.00% - /// @inheritdoc IGhoAaveSteward uint256 public constant MINIMUM_DELAY = 2 days; @@ -100,39 +94,6 @@ contract GhoAaveSteward is Ownable, IGhoAaveSteward, RiskCouncilControlled { .setBorrowCap(GHO_TOKEN, newBorrowCap); } - /// @inheritdoc IGhoAaveSteward - function updateGhoBorrowRate( - uint256 newBorrowRate - ) external onlyRiskCouncil notTimelocked(_ghoTimelocks.ghoBorrowRateLastUpdate) { - DataTypes.ReserveData memory ghoReserveData = IPool( - IPoolAddressesProvider(POOL_ADDRESSES_PROVIDER).getPool() - ).getReserveData(GHO_TOKEN); - require( - ghoReserveData.interestRateStrategyAddress != address(0), - 'GHO_INTEREST_RATE_STRATEGY_NOT_FOUND' - ); - - uint256 currentBorrowRate = GhoInterestRateStrategy(ghoReserveData.interestRateStrategyAddress) - .getBaseVariableBorrowRate(); - require(newBorrowRate <= GHO_BORROW_RATE_MAX, 'BORROW_RATE_HIGHER_THAN_MAX'); - require( - _isDifferenceLowerThanMax(currentBorrowRate, newBorrowRate, GHO_BORROW_RATE_CHANGE_MAX), - 'INVALID_BORROW_RATE_UPDATE' - ); - - IFixedRateStrategyFactory strategyFactory = IFixedRateStrategyFactory( - FIXED_RATE_STRATEGY_FACTORY - ); - uint256[] memory borrowRateList = new uint256[](1); - borrowRateList[0] = newBorrowRate; - address strategy = strategyFactory.createStrategies(borrowRateList)[0]; - - _ghoTimelocks.ghoBorrowRateLastUpdate = uint40(block.timestamp); - - IPoolConfigurator(IPoolAddressesProvider(POOL_ADDRESSES_PROVIDER).getPoolConfigurator()) - .setReserveInterestRateStrategyAddress(GHO_TOKEN, strategy); - } - /// @inheritdoc IGhoAaveSteward function getGhoTimelocks() external view returns (GhoDebounce memory) { return _ghoTimelocks; diff --git a/src/contracts/misc/interfaces/IGhoAaveSteward.sol b/src/contracts/misc/interfaces/IGhoAaveSteward.sol index 5e194f9f..f98e6079 100644 --- a/src/contracts/misc/interfaces/IGhoAaveSteward.sol +++ b/src/contracts/misc/interfaces/IGhoAaveSteward.sol @@ -9,7 +9,6 @@ pragma solidity ^0.8.10; interface IGhoAaveSteward { struct GhoDebounce { uint40 ghoBorrowCapLastUpdate; - uint40 ghoBorrowRateLastUpdate; } /** @@ -33,28 +32,6 @@ interface IGhoAaveSteward { */ function updateGhoBorrowCap(uint256 newBorrowCap) external; - /** - * @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 is lower than `GHO_BORROW_RATE_MAX` - * @dev Only callable by Risk Council - * @param newBorrowRate The new variable borrow rate (expressed in ray) (e.g. 0.0150e27 results in 1.50%) - */ - function updateGhoBorrowRate(uint256 newBorrowRate) external; - - /** - * @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%) - */ - function GHO_BORROW_RATE_MAX() external view returns (uint256); - /** * @notice Returns the minimum delay that must be respected between parameters update. * @return The minimum delay between parameter updates (in seconds) diff --git a/src/test/TestGhoAaveSteward.t.sol b/src/test/TestGhoAaveSteward.t.sol index e59e7fad..7726557c 100644 --- a/src/test/TestGhoAaveSteward.t.sol +++ b/src/test/TestGhoAaveSteward.t.sol @@ -17,8 +17,6 @@ contract TestGhoAaveSteward is TestGhoBase { } function testConstructor() public { - assertEq(GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX(), GHO_BORROW_RATE_CHANGE_MAX); - assertEq(GHO_AAVE_STEWARD.GHO_BORROW_RATE_MAX(), GHO_BORROW_RATE_MAX); assertEq(GHO_AAVE_STEWARD.MINIMUM_DELAY(), MINIMUM_DELAY_V2); assertEq(GHO_AAVE_STEWARD.owner(), SHORT_EXECUTOR); @@ -29,7 +27,6 @@ contract TestGhoAaveSteward is TestGhoBase { IGhoAaveSteward.GhoDebounce memory ghoTimelocks = GHO_AAVE_STEWARD.getGhoTimelocks(); assertEq(ghoTimelocks.ghoBorrowCapLastUpdate, 0); - assertEq(ghoTimelocks.ghoBorrowRateLastUpdate, 0); } function testRevertConstructorInvalidExecutor() public { @@ -130,182 +127,10 @@ contract TestGhoAaveSteward is TestGhoBase { GHO_AAVE_STEWARD.updateGhoBorrowCap(oldBorrowCap * 2 + 1); } - function testUpdateGhoBorrowRateUpwards() public { - uint256 oldBorrowRate = _getGhoBorrowRate(); - uint256 newBorrowRate = oldBorrowRate + 1; - vm.prank(RISK_COUNCIL); - GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - uint256 currentBorrowRate = _getGhoBorrowRate(); - assertEq(currentBorrowRate, newBorrowRate); - } - - function testUpdateGhoBorrowRateDownwards() public { - uint256 oldBorrowRate = _getGhoBorrowRate(); - uint256 newBorrowRate = oldBorrowRate - 1; - vm.prank(RISK_COUNCIL); - GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - uint256 currentBorrowRate = _getGhoBorrowRate(); - assertEq(currentBorrowRate, newBorrowRate); - } - - function testUpdateGhoBorrowRateMaxValue() public { - uint256 ghoBorrowRateMax = GHO_AAVE_STEWARD.GHO_BORROW_RATE_MAX(); - (, uint256 oldBorrowRate) = _setGhoBorrowRateViaConfigurator(ghoBorrowRateMax - 1); - vm.prank(RISK_COUNCIL); - GHO_AAVE_STEWARD.updateGhoBorrowRate(ghoBorrowRateMax); - uint256 currentBorrowRate = _getGhoBorrowRate(); - assertEq(currentBorrowRate, ghoBorrowRateMax); - } - - function testUpdateGhoBorrowRateMaxIncrement() public { - uint256 oldBorrowRate = _getGhoBorrowRate(); - uint256 newBorrowRate = oldBorrowRate + GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX(); - vm.prank(RISK_COUNCIL); - GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - uint256 currentBorrowRate = _getGhoBorrowRate(); - assertEq(currentBorrowRate, newBorrowRate); - } - - function testUpdateGhoBorrowRateDecrement() public { - uint256 oldBorrowRate = _getGhoBorrowRate(); - uint256 newBorrowRate = oldBorrowRate - 1; - vm.prank(RISK_COUNCIL); - GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - uint256 currentBorrowRate = _getGhoBorrowRate(); - assertEq(currentBorrowRate, newBorrowRate); - } - - function testUpdateGhoBorrowRateMaxDecrement() public { - vm.startPrank(RISK_COUNCIL); - - // set a high borrow rate - GHO_AAVE_STEWARD.updateGhoBorrowRate(GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX() + 1); - vm.warp(block.timestamp + GHO_AAVE_STEWARD.MINIMUM_DELAY() + 1); - - uint256 oldBorrowRate = _getGhoBorrowRate(); - uint256 newBorrowRate = oldBorrowRate - GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX(); - GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - uint256 currentBorrowRate = _getGhoBorrowRate(); - assertEq(currentBorrowRate, newBorrowRate); - - vm.stopPrank(); - } - - function testUpdateGhoBorrowRateTimelock() public { - uint256 oldBorrowRate = _getGhoBorrowRate(); - vm.prank(RISK_COUNCIL); - GHO_AAVE_STEWARD.updateGhoBorrowRate(oldBorrowRate + 1); - IGhoAaveSteward.GhoDebounce memory ghoTimelocks = GHO_AAVE_STEWARD.getGhoTimelocks(); - assertEq(ghoTimelocks.ghoBorrowRateLastUpdate, block.timestamp); - } - - function testUpdateGhoBorrowRateAfterTimelock() public { - uint256 oldBorrowRate = _getGhoBorrowRate(); - vm.prank(RISK_COUNCIL); - GHO_AAVE_STEWARD.updateGhoBorrowRate(oldBorrowRate + 1); - skip(GHO_AAVE_STEWARD.MINIMUM_DELAY() + 1); - uint256 newBorrowRate = oldBorrowRate + 2; - vm.prank(RISK_COUNCIL); - GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - uint256 currentBorrowRate = _getGhoBorrowRate(); - assertEq(currentBorrowRate, newBorrowRate); - } - - function testRevertUpdateGhoBorrowRateIfUnauthorized() public { - vm.expectRevert('INVALID_CALLER'); - vm.prank(ALICE); - GHO_AAVE_STEWARD.updateGhoBorrowRate(0.07e4); - } - - function testRevertUpdateGhoBorrowRateIfUpdatedTooSoon() public { - address oldInterestStrategy = POOL.getReserveInterestRateStrategyAddress(address(GHO_TOKEN)); - uint256 oldBorrowRate = GhoInterestRateStrategy(oldInterestStrategy) - .getBaseVariableBorrowRate(); - vm.prank(RISK_COUNCIL); - uint256 newBorrowRate = oldBorrowRate + 1; - GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - vm.prank(RISK_COUNCIL); - vm.expectRevert('DEBOUNCE_NOT_RESPECTED'); - GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - } - - function testRevertUpdateGhoBorrowRateIfInterestRateNotFound() public { - uint256 oldBorrowRate = _getGhoBorrowRate(); - DataTypes.ReserveData memory mockData = POOL.getReserveData(address(GHO_TOKEN)); - mockData.interestRateStrategyAddress = address(0); - vm.mockCall( - address(POOL), - abi.encodeWithSelector(IPool.getReserveData.selector, address(GHO_TOKEN)), - abi.encode(mockData) - ); - vm.expectRevert('GHO_INTEREST_RATE_STRATEGY_NOT_FOUND'); - vm.prank(RISK_COUNCIL); - GHO_AAVE_STEWARD.updateGhoBorrowRate(oldBorrowRate + 1); - } - - function testRevertUpdateGhoBorrowRateIfValueMoreThanMax() public { - uint256 maxGhoBorrowRate = GHO_AAVE_STEWARD.GHO_BORROW_RATE_MAX(); - _setGhoBorrowRateViaConfigurator(maxGhoBorrowRate); - vm.prank(RISK_COUNCIL); - vm.expectRevert('BORROW_RATE_HIGHER_THAN_MAX'); - GHO_AAVE_STEWARD.updateGhoBorrowRate(maxGhoBorrowRate + 1); - } - - function testRevertUpdateGhoBorrowRateIfMaxExceededUpwards() public { - uint256 oldBorrowRate = _getGhoBorrowRate(); - uint256 newBorrowRate = oldBorrowRate + GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX() + 1; - vm.prank(RISK_COUNCIL); - vm.expectRevert('INVALID_BORROW_RATE_UPDATE'); - GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - } - - function testRevertUpdateGhoBorrowRateIfMaxExceededDownwards() public { - vm.startPrank(RISK_COUNCIL); - - // set a high borrow rate - GHO_AAVE_STEWARD.updateGhoBorrowRate(GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX() + 1); - 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; - vm.expectRevert('INVALID_BORROW_RATE_UPDATE'); - GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - - vm.stopPrank(); - } - function _setGhoBorrowCapViaConfigurator(uint256 newBorrowCap) internal { CONFIGURATOR.setBorrowCap(address(GHO_TOKEN), newBorrowCap); } - function _setGhoBorrowRateViaConfigurator( - uint256 newBorrowRate - ) internal returns (GhoInterestRateStrategy, uint256) { - GhoInterestRateStrategy newRateStrategy = new GhoInterestRateStrategy( - address(PROVIDER), - newBorrowRate - ); - CONFIGURATOR.setReserveInterestRateStrategyAddress( - address(GHO_TOKEN), - address(newRateStrategy) - ); - address currentInterestRateStrategy = POOL.getReserveInterestRateStrategyAddress( - address(GHO_TOKEN) - ); - uint256 currentBorrowRate = GhoInterestRateStrategy(currentInterestRateStrategy) - .getBaseVariableBorrowRate(); - assertEq(currentInterestRateStrategy, address(newRateStrategy)); - assertEq(currentBorrowRate, newBorrowRate); - return (newRateStrategy, newBorrowRate); - } - - function _getGhoBorrowRate() internal view returns (uint256) { - address currentInterestRateStrategy = POOL.getReserveInterestRateStrategyAddress( - address(GHO_TOKEN) - ); - return GhoInterestRateStrategy(currentInterestRateStrategy).getBaseVariableBorrowRate(); - } - function _getGhoBorrowCap() internal view returns (uint256) { DataTypes.ReserveConfigurationMap memory configuration = POOL.getConfiguration( address(GHO_TOKEN) diff --git a/src/test/TestGhoAaveStewardArbitrum.t.sol b/src/test/TestGhoAaveStewardArbitrum.t.sol deleted file mode 100644 index 192e9fd1..00000000 --- a/src/test/TestGhoAaveStewardArbitrum.t.sol +++ /dev/null @@ -1,202 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import './TestGhoBase.t.sol'; - -contract TestGhoCcipStewardArbitrum is TestGhoBase { - function setUp() public { - /// @dev Since block.timestamp starts at 0 this is a necessary condition (block.timestamp > `MINIMUM_DELAY`) for the timelocked contract methods to work. - vm.warp(ARB_GHO_AAVE_STEWARD.MINIMUM_DELAY() + 1); - } - - function testConstructor() public { - assertEq(ARB_GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX(), GHO_BORROW_RATE_CHANGE_MAX); - assertEq(ARB_GHO_AAVE_STEWARD.GHO_BORROW_RATE_MAX(), GHO_BORROW_RATE_MAX); - assertEq(ARB_GHO_AAVE_STEWARD.MINIMUM_DELAY(), MINIMUM_DELAY_V2); - - assertEq(ARB_GHO_AAVE_STEWARD.owner(), SHORT_EXECUTOR); - assertEq(ARB_GHO_AAVE_STEWARD.POOL_ADDRESSES_PROVIDER(), address(PROVIDER)); - assertEq(ARB_GHO_AAVE_STEWARD.GHO_TOKEN(), address(GHO_TOKEN)); - assertEq( - ARB_GHO_AAVE_STEWARD.FIXED_RATE_STRATEGY_FACTORY(), - address(FIXED_RATE_STRATEGY_FACTORY) - ); - assertEq(ARB_GHO_AAVE_STEWARD.RISK_COUNCIL(), RISK_COUNCIL); - - IGhoAaveSteward.GhoDebounce memory ghoTimelocks = ARB_GHO_AAVE_STEWARD.getGhoTimelocks(); - assertEq(ghoTimelocks.ghoBorrowCapLastUpdate, 0); - assertEq(ghoTimelocks.ghoBorrowRateLastUpdate, 0); - } - - function testUpdateGhoBorrowRateUpwards() public { - uint256 oldBorrowRate = _getGhoBorrowRate(); - uint256 newBorrowRate = oldBorrowRate + 1; - vm.prank(RISK_COUNCIL); - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - uint256 currentBorrowRate = _getGhoBorrowRate(); - assertEq(currentBorrowRate, newBorrowRate); - } - - function testUpdateGhoBorrowRateDownwards() public { - uint256 oldBorrowRate = _getGhoBorrowRate(); - uint256 newBorrowRate = oldBorrowRate - 1; - vm.prank(RISK_COUNCIL); - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - uint256 currentBorrowRate = _getGhoBorrowRate(); - assertEq(currentBorrowRate, newBorrowRate); - } - - function testUpdateGhoBorrowRateMaxValue() public { - uint256 ghoBorrowRateMax = ARB_GHO_AAVE_STEWARD.GHO_BORROW_RATE_MAX(); - (, uint256 oldBorrowRate) = _setGhoBorrowRateViaConfigurator(ghoBorrowRateMax - 1); - vm.prank(RISK_COUNCIL); - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(ghoBorrowRateMax); - uint256 currentBorrowRate = _getGhoBorrowRate(); - assertEq(currentBorrowRate, ghoBorrowRateMax); - } - - function testUpdateGhoBorrowRateMaxIncrement() public { - uint256 oldBorrowRate = _getGhoBorrowRate(); - uint256 newBorrowRate = oldBorrowRate + ARB_GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX(); - vm.prank(RISK_COUNCIL); - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - uint256 currentBorrowRate = _getGhoBorrowRate(); - assertEq(currentBorrowRate, newBorrowRate); - } - - function testUpdateGhoBorrowRateDecrement() public { - uint256 oldBorrowRate = _getGhoBorrowRate(); - uint256 newBorrowRate = oldBorrowRate - 1; - vm.prank(RISK_COUNCIL); - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - uint256 currentBorrowRate = _getGhoBorrowRate(); - assertEq(currentBorrowRate, newBorrowRate); - } - - function testUpdateGhoBorrowRateMaxDecrement() public { - vm.startPrank(RISK_COUNCIL); - - // set a high borrow rate - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(ARB_GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX() + 1); - vm.warp(block.timestamp + ARB_GHO_AAVE_STEWARD.MINIMUM_DELAY() + 1); - - uint256 oldBorrowRate = _getGhoBorrowRate(); - uint256 newBorrowRate = oldBorrowRate - ARB_GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX(); - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - uint256 currentBorrowRate = _getGhoBorrowRate(); - assertEq(currentBorrowRate, newBorrowRate); - - vm.stopPrank(); - } - - function testUpdateGhoBorrowRateTimelock() public { - uint256 oldBorrowRate = _getGhoBorrowRate(); - vm.prank(RISK_COUNCIL); - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(oldBorrowRate + 1); - IGhoAaveSteward.GhoDebounce memory ghoTimelocks = ARB_GHO_AAVE_STEWARD.getGhoTimelocks(); - assertEq(ghoTimelocks.ghoBorrowRateLastUpdate, block.timestamp); - } - - function testUpdateGhoBorrowRateAfterTimelock() public { - uint256 oldBorrowRate = _getGhoBorrowRate(); - vm.prank(RISK_COUNCIL); - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(oldBorrowRate + 1); - skip(ARB_GHO_AAVE_STEWARD.MINIMUM_DELAY() + 1); - uint256 newBorrowRate = oldBorrowRate + 2; - vm.prank(RISK_COUNCIL); - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - uint256 currentBorrowRate = _getGhoBorrowRate(); - assertEq(currentBorrowRate, newBorrowRate); - } - - function testRevertUpdateGhoBorrowRateIfUnauthorized() public { - vm.expectRevert('INVALID_CALLER'); - vm.prank(ALICE); - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(0.07e4); - } - - function testRevertUpdateGhoBorrowRateIfUpdatedTooSoon() public { - address oldInterestStrategy = POOL.getReserveInterestRateStrategyAddress(address(GHO_TOKEN)); - uint256 oldBorrowRate = GhoInterestRateStrategy(oldInterestStrategy) - .getBaseVariableBorrowRate(); - vm.prank(RISK_COUNCIL); - uint256 newBorrowRate = oldBorrowRate + 1; - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - vm.prank(RISK_COUNCIL); - vm.expectRevert('DEBOUNCE_NOT_RESPECTED'); - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - } - - function testRevertUpdateGhoBorrowRateIfInterestRateNotFound() public { - uint256 oldBorrowRate = _getGhoBorrowRate(); - DataTypes.ReserveData memory mockData = POOL.getReserveData(address(GHO_TOKEN)); - mockData.interestRateStrategyAddress = address(0); - vm.mockCall( - address(POOL), - abi.encodeWithSelector(IPool.getReserveData.selector, address(GHO_TOKEN)), - abi.encode(mockData) - ); - vm.expectRevert('GHO_INTEREST_RATE_STRATEGY_NOT_FOUND'); - vm.prank(RISK_COUNCIL); - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(oldBorrowRate + 1); - } - - function testRevertUpdateGhoBorrowRateIfValueMoreThanMax() public { - uint256 maxGhoBorrowRate = ARB_GHO_AAVE_STEWARD.GHO_BORROW_RATE_MAX(); - _setGhoBorrowRateViaConfigurator(maxGhoBorrowRate); - vm.prank(RISK_COUNCIL); - vm.expectRevert('BORROW_RATE_HIGHER_THAN_MAX'); - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(maxGhoBorrowRate + 1); - } - - function testRevertUpdateGhoBorrowRateIfMaxExceededUpwards() public { - uint256 oldBorrowRate = _getGhoBorrowRate(); - uint256 newBorrowRate = oldBorrowRate + ARB_GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX() + 1; - vm.prank(RISK_COUNCIL); - vm.expectRevert('INVALID_BORROW_RATE_UPDATE'); - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - } - - function testRevertUpdateGhoBorrowRateIfMaxExceededDownwards() public { - vm.startPrank(RISK_COUNCIL); - - // set a high borrow rate - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(ARB_GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX() + 1); - vm.warp(block.timestamp + ARB_GHO_AAVE_STEWARD.MINIMUM_DELAY() + 1); - - uint256 oldBorrowRate = _getGhoBorrowRate(); - uint256 newBorrowRate = oldBorrowRate - ARB_GHO_AAVE_STEWARD.GHO_BORROW_RATE_CHANGE_MAX() - 1; - vm.expectRevert('INVALID_BORROW_RATE_UPDATE'); - ARB_GHO_AAVE_STEWARD.updateGhoBorrowRate(newBorrowRate); - - vm.stopPrank(); - } - - function _setGhoBorrowRateViaConfigurator( - uint256 newBorrowRate - ) internal returns (GhoInterestRateStrategy, uint256) { - GhoInterestRateStrategy newRateStrategy = new GhoInterestRateStrategy( - address(PROVIDER), - newBorrowRate - ); - CONFIGURATOR.setReserveInterestRateStrategyAddress( - address(GHO_TOKEN), - address(newRateStrategy) - ); - address currentInterestRateStrategy = POOL.getReserveInterestRateStrategyAddress( - address(GHO_TOKEN) - ); - uint256 currentBorrowRate = GhoInterestRateStrategy(currentInterestRateStrategy) - .getBaseVariableBorrowRate(); - assertEq(currentInterestRateStrategy, address(newRateStrategy)); - assertEq(currentBorrowRate, newBorrowRate); - return (newRateStrategy, newBorrowRate); - } - - function _getGhoBorrowRate() internal view returns (uint256) { - address currentInterestRateStrategy = POOL.getReserveInterestRateStrategyAddress( - address(GHO_TOKEN) - ); - return GhoInterestRateStrategy(currentInterestRateStrategy).getBaseVariableBorrowRate(); - } -} diff --git a/src/test/TestGhoBase.t.sol b/src/test/TestGhoBase.t.sol index be4137f2..7f9a95e4 100644 --- a/src/test/TestGhoBase.t.sol +++ b/src/test/TestGhoBase.t.sol @@ -140,7 +140,6 @@ contract TestGhoBase is Test, Constants, Events { GhoCcipSteward GHO_CCIP_STEWARD; GhoGsmSteward GHO_GSM_STEWARD; GhoCcipSteward ARB_GHO_CCIP_STEWARD; - GhoAaveSteward ARB_GHO_AAVE_STEWARD; BucketCapacityManager BUCKET_CAPACITY_MANAGER; BucketCapacityManager ARB_BUCKET_CAPACITY_MANAGER; @@ -427,15 +426,6 @@ contract TestGhoBase is Test, Constants, Events { RISK_COUNCIL ); - // Deploy Arb Gho Aave Steward - ARB_GHO_AAVE_STEWARD = new GhoAaveSteward( - SHORT_EXECUTOR, - address(PROVIDER), - address(GHO_TOKEN), - address(FIXED_RATE_STRATEGY_FACTORY), - RISK_COUNCIL - ); - // Deploy Arb Bucket Capacity Manager ARB_BUCKET_CAPACITY_MANAGER = new BucketCapacityManager( SHORT_EXECUTOR,