Skip to content

Commit

Permalink
fix: remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
CheyenneAtapour committed Jul 22, 2024
1 parent b2d1c93 commit 242aa04
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 140 deletions.
87 changes: 0 additions & 87 deletions src/contracts/misc/ArbGhoSteward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ contract ArbGhoSteward is Ownable, IArbGhoSteward {
/// @inheritdoc IArbGhoSteward
uint256 public constant GHO_BORROW_RATE_CHANGE_MAX = 0.0500e27; // 5.00%

/// @inheritdoc IArbGhoSteward
uint256 public constant GSM_FEE_RATE_CHANGE_MAX = 0.0050e4; // 0.50%

/// @inheritdoc IArbGhoSteward
uint256 public constant MINIMUM_DELAY = 2 days;

Expand All @@ -56,14 +53,10 @@ contract ArbGhoSteward is Ownable, IArbGhoSteward {

GhoDebounce internal _ghoTimelocks;
mapping(address => uint40) _facilitatorsBucketCapacityTimelocks;
mapping(address => GsmDebounce) internal _gsmTimelocksByAddress;

mapping(address => bool) internal _controlledFacilitatorsByAddress;
EnumerableSet.AddressSet internal _controlledFacilitators;

mapping(uint256 => mapping(uint256 => address)) internal _gsmFeeStrategiesByRates;
EnumerableSet.AddressSet internal _gsmFeeStrategies;

/**
* @dev Only Risk Council can call functions marked by this modifier.
*/
Expand Down Expand Up @@ -179,76 +172,6 @@ contract ArbGhoSteward is Ownable, IArbGhoSteward {
IOwnable(target).acceptOwnership();
}

// TODO: Decide what functionality we can keep on Arbitrum of the below

/// @inheritdoc IArbGhoSteward
function updateGhoBorrowCap(
uint256 newBorrowCap
) external onlyRiskCouncil notTimelocked(_ghoTimelocks.ghoBorrowCapLastUpdate) {
DataTypes.ReserveConfigurationMap memory configuration = IPool(
IPoolAddressesProvider(POOL_ADDRESSES_PROVIDER).getPool()
).getConfiguration(GHO_TOKEN);
uint256 currentBorrowCap = configuration.getBorrowCap();
require(
_isDifferenceLowerThanMax(currentBorrowCap, newBorrowCap, currentBorrowCap),
'INVALID_BORROW_CAP_UPDATE'
);

_ghoTimelocks.ghoBorrowCapLastUpdate = uint40(block.timestamp);

IPoolConfigurator(IPoolAddressesProvider(POOL_ADDRESSES_PROVIDER).getPoolConfigurator())
.setBorrowCap(GHO_TOKEN, newBorrowCap);
}

/// @inheritdoc IArbGhoSteward
function updateGsmExposureCap(
address gsm,
uint128 newExposureCap
) external onlyRiskCouncil notTimelocked(_gsmTimelocksByAddress[gsm].gsmExposureCapLastUpdated) {
uint128 currentExposureCap = IGsm(gsm).getExposureCap();
require(
_isDifferenceLowerThanMax(currentExposureCap, newExposureCap, currentExposureCap),
'INVALID_EXPOSURE_CAP_UPDATE'
);

_gsmTimelocksByAddress[gsm].gsmExposureCapLastUpdated = uint40(block.timestamp);

IGsm(gsm).updateExposureCap(newExposureCap);
}

/// @inheritdoc IArbGhoSteward
function updateGsmBuySellFees(
address gsm,
uint256 buyFee,
uint256 sellFee
) external onlyRiskCouncil notTimelocked(_gsmTimelocksByAddress[gsm].gsmFeeStrategyLastUpdated) {
address currentFeeStrategy = IGsm(gsm).getFeeStrategy();
require(currentFeeStrategy != address(0), 'GSM_FEE_STRATEGY_NOT_FOUND');

uint256 currentBuyFee = IGsmFeeStrategy(currentFeeStrategy).getBuyFee(1e4);
uint256 currentSellFee = IGsmFeeStrategy(currentFeeStrategy).getSellFee(1e4);
require(
_isDifferenceLowerThanMax(currentBuyFee, buyFee, GSM_FEE_RATE_CHANGE_MAX),
'INVALID_BUY_FEE_UPDATE'
);
require(
_isDifferenceLowerThanMax(currentSellFee, sellFee, GSM_FEE_RATE_CHANGE_MAX),
'INVALID_SELL_FEE_UPDATE'
);

address cachedStrategyAddress = _gsmFeeStrategiesByRates[buyFee][sellFee];
if (cachedStrategyAddress == address(0)) {
FixedFeeStrategy newRateStrategy = new FixedFeeStrategy(buyFee, sellFee);
cachedStrategyAddress = address(newRateStrategy);
_gsmFeeStrategiesByRates[buyFee][sellFee] = cachedStrategyAddress;
_gsmFeeStrategies.add(cachedStrategyAddress);
}

_gsmTimelocksByAddress[gsm].gsmFeeStrategyLastUpdated = uint40(block.timestamp);

IGsm(gsm).updateFeeStrategy(cachedStrategyAddress);
}

/// @inheritdoc IArbGhoSteward
function setControlledFacilitator(
address[] memory facilitatorList,
Expand All @@ -274,23 +197,13 @@ contract ArbGhoSteward is Ownable, IArbGhoSteward {
return _ghoTimelocks;
}

/// @inheritdoc IArbGhoSteward
function getGsmTimelocks(address gsm) external view returns (GsmDebounce memory) {
return _gsmTimelocksByAddress[gsm];
}

/// @inheritdoc IArbGhoSteward
function getFacilitatorBucketCapacityTimelock(
address facilitator
) external view returns (uint40) {
return _facilitatorsBucketCapacityTimelocks[facilitator];
}

/// @inheritdoc IArbGhoSteward
function getGsmFeeStrategies() external view returns (address[] memory) {
return _gsmFeeStrategies.values();
}

/**
* @dev Ensures that the change is positive and the difference is lower than max.
* @param from current value
Expand Down
49 changes: 0 additions & 49 deletions src/contracts/misc/interfaces/IArbGhoSteward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,36 +53,6 @@ interface IArbGhoSteward {
*/
function updateGhoBorrowRate(uint256 newBorrowRate) external;

/**
* @notice Updates the GHO borrow cap, only if:
* - respects `MINIMUM_DELAY`, the minimum time delay between updates
* - the update changes up to 100% upwards or downwards
* @dev Only callable by Risk Council
* @param newBorrowCap The new borrow cap (in whole tokens)
*/
function updateGhoBorrowCap(uint256 newBorrowCap) external;

/**
* @notice Updates the exposure cap of the GSM, only if:
* - respects `MINIMUM_DELAY`, the minimum time delay between updates
* - the update changes up to 100% upwards or downwards
* @dev Only callable by Risk Council
* @param gsm The gsm address to update
* @param newExposureCap The new exposure cap (in underlying asset terms)
*/
function updateGsmExposureCap(address gsm, uint128 newExposureCap) external;

/**
* @notice Updates the fixed percent fees of the GSM, only if:
* - respects `MINIMUM_DELAY`, the minimum time delay between updates
* - the update changes up to `GSM_FEE_RATE_CHANGE_MAX` upwards or downwards (for both buy and sell individually)
* @dev Only callable by Risk Council
* @param gsm The gsm address to update
* @param buyFee The new buy fee (expressed in bps) (e.g. 0.0150e4 results in 1.50%)
* @param sellFee The new sell fee (expressed in bps) (e.g. 0.0150e4 results in 1.50%)
*/
function updateGsmBuySellFees(address gsm, uint256 buyFee, uint256 sellFee) external;

/**
* @notice Adds/Removes controlled facilitators
* @dev Only callable by owner
Expand All @@ -97,12 +67,6 @@ interface IArbGhoSteward {
*/
function GHO_BORROW_RATE_CHANGE_MAX() external view returns (uint256);

/**
* @notice Returns the maximum increase for GSM fee rates (buy or sell).
* @return The maximum increase change for GSM fee rates updates in bps (e.g. 0.010e4 results in 1.00%)
*/
function GSM_FEE_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 Expand Up @@ -157,23 +121,10 @@ interface IArbGhoSteward {
*/
function getGhoTimelocks() external view returns (GhoDebounce memory);

/**
* @notice Returns timestamp of the last update of Gsm parameters
* @param gsm The GSM address
* @return The GsmDebounce struct describing the last update of GSM parameters
*/
function getGsmTimelocks(address gsm) external view returns (GsmDebounce memory);

/**
* @notice Returns timestamp of the facilitators last bucket capacity update
* @param facilitator The facilitator address
* @return The unix time of the last bucket capacity (in seconds).
*/
function getFacilitatorBucketCapacityTimelock(address facilitator) external view returns (uint40);

/**
* @notice Returns the list of Fixed Fee Strategies for GSM
* @return An array of FixedFeeStrategy addresses
*/
function getGsmFeeStrategies() external view returns (address[] memory);
}
4 changes: 0 additions & 4 deletions src/test/TestArbGhoSteward.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ contract TestArbGhoSteward is TestGhoBase {

function testConstructor() public {
assertEq(ARB_GHO_STEWARD.GHO_BORROW_RATE_CHANGE_MAX(), GHO_BORROW_RATE_CHANGE_MAX);
assertEq(ARB_GHO_STEWARD.GSM_FEE_RATE_CHANGE_MAX(), GSM_FEE_RATE_CHANGE_MAX);
assertEq(ARB_GHO_STEWARD.GHO_BORROW_RATE_MAX(), GHO_BORROW_RATE_MAX);
assertEq(ARB_GHO_STEWARD.MINIMUM_DELAY(), MINIMUM_DELAY_V2);

Expand All @@ -42,9 +41,6 @@ contract TestArbGhoSteward is TestGhoBase {
controlledFacilitators[0]
);
assertEq(facilitatorTimelock, 0);

address[] memory gsmFeeStrategies = ARB_GHO_STEWARD.getGsmFeeStrategies();
assertEq(gsmFeeStrategies.length, 0);
}

function testRevertConstructorInvalidExecutor() public {
Expand Down

0 comments on commit 242aa04

Please sign in to comment.