Skip to content

Commit

Permalink
fix: rename bucket capacity manager
Browse files Browse the repository at this point in the history
  • Loading branch information
CheyenneAtapour committed Jul 30, 2024
1 parent 489b7b7 commit b0d60a9
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 357 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';
import {IGhoToken} from '../gho/interfaces/IGhoToken.sol';
import {RiskCouncilControlled} from './RiskCouncilControlled.sol';
import {IBucketCapacityManager} from './interfaces/IBucketCapacityManager.sol';
import {IGhoBucketCapacitySteward} from './interfaces/IGhoBucketCapacitySteward.sol';

/**
* @title BucketCapacityManager
* @title GhoBucketCapacitySteward
* @author Aave Labs
* @notice Helper contract for managing bucket capacities of controlled facilitators
* @dev Only the Risk Council is able to action contract's functions, based on specific conditions that have been agreed upon with the community.
* @dev Requires GHO_TOKEN_BUCKET_MANAGER_ROLE on GhoToken
*/
contract BucketCapacityManager is Ownable, RiskCouncilControlled, IBucketCapacityManager {
contract GhoBucketCapacitySteward is Ownable, RiskCouncilControlled, IGhoBucketCapacitySteward {
using EnumerableSet for EnumerableSet.AddressSet;

/// @inheritdoc IBucketCapacityManager
/// @inheritdoc IGhoBucketCapacitySteward
uint256 public constant MINIMUM_DELAY = 2 days;

/// @inheritdoc IBucketCapacityManager
/// @inheritdoc IGhoBucketCapacitySteward
address public immutable GHO_TOKEN;

/// @inheritdoc IBucketCapacityManager
/// @inheritdoc IGhoBucketCapacitySteward
function RISK_COUNCIL() public view override returns (address) {
return COUNCIL;
}
Expand Down Expand Up @@ -60,7 +60,7 @@ contract BucketCapacityManager is Ownable, RiskCouncilControlled, IBucketCapacit
_transferOwnership(owner);
}

/// @inheritdoc IBucketCapacityManager
/// @inheritdoc IGhoBucketCapacitySteward
function updateFacilitatorBucketCapacity(
address facilitator,
uint128 newBucketCapacity
Expand All @@ -77,7 +77,7 @@ contract BucketCapacityManager is Ownable, RiskCouncilControlled, IBucketCapacit
IGhoToken(GHO_TOKEN).setFacilitatorBucketCapacity(facilitator, newBucketCapacity);
}

/// @inheritdoc IBucketCapacityManager
/// @inheritdoc IGhoBucketCapacitySteward
function setControlledFacilitator(
address[] memory facilitatorList,
bool approve
Expand All @@ -92,12 +92,12 @@ contract BucketCapacityManager is Ownable, RiskCouncilControlled, IBucketCapacit
}
}

/// @inheritdoc IBucketCapacityManager
/// @inheritdoc IGhoBucketCapacitySteward
function getControlledFacilitators() external view returns (address[] memory) {
return _controlledFacilitators.values();
}

/// @inheritdoc IBucketCapacityManager
/// @inheritdoc IGhoBucketCapacitySteward
function getFacilitatorBucketCapacityTimelock(
address facilitator
) external view returns (uint40) {
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/misc/GhoGsmSteward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {RiskCouncilControlled} from './RiskCouncilControlled.sol';
* @author Aave Labs
* @notice Helper contract for managing parameters of the GSM
* @dev Only the Risk Council is able to action contract's functions, based on specific conditions that have been agreed upon with the community.
* @dev Requires role GSM_CONFIGURATOR_ROLE on the GhoGsm contract and CONFIGURATOR on every GSM asset to be managed
* @dev Requires role GSM_CONFIGURATOR_ROLE on every GSM contract to be managed
*/
contract GhoGsmSteward is Ownable, RiskCouncilControlled, IGhoGsmSteward {
using EnumerableSet for EnumerableSet.AddressSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
pragma solidity ^0.8.10;

/**
* @title IBucketCapacityManager
* @title IGhoBucketCapacitySteward
* @author Aave Labs
* @notice Defines the basic interface of the BucketCapacityManager
* @notice Defines the basic interface of the GhoBucketCapacitySteward
*/
interface IBucketCapacityManager {
interface IGhoBucketCapacitySteward {
/**
* @notice Adds/Removes controlled facilitators
* @dev Only callable by owner
Expand Down
181 changes: 0 additions & 181 deletions src/test/TestBucketCapacityManager.t.sol

This file was deleted.

30 changes: 6 additions & 24 deletions src/test/TestGhoBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ import {UpgradeableBurnMintTokenPool} from '../contracts/misc/deps/Dependencies.
import {RateLimiter} from '../contracts/misc/deps/Dependencies.sol';
import {IGhoCcipSteward} from '../contracts/misc/interfaces/IGhoCcipSteward.sol';
import {GhoCcipSteward} from '../contracts/misc/GhoCcipSteward.sol';
import {BucketCapacityManager} from '../contracts/misc/BucketCapacityManager.sol';
import {GhoBucketCapacitySteward} from '../contracts/misc/GhoBucketCapacitySteward.sol';

contract TestGhoBase is Test, Constants, Events {
using WadRayMath for uint256;
Expand Down Expand Up @@ -140,8 +140,8 @@ contract TestGhoBase is Test, Constants, Events {
GhoCcipSteward GHO_CCIP_STEWARD;
GhoGsmSteward GHO_GSM_STEWARD;
GhoCcipSteward ARB_GHO_CCIP_STEWARD;
BucketCapacityManager BUCKET_CAPACITY_MANAGER;
BucketCapacityManager ARB_BUCKET_CAPACITY_MANAGER;
GhoBucketCapacitySteward GHO_BUCKET_CAPACITY_STEWARD;
GhoBucketCapacitySteward ARB_GHO_BUCKET_CAPACITY_STEWARD;

FixedRateStrategyFactory FIXED_RATE_STRATEGY_FACTORY;
UpgradeableLockReleaseTokenPool GHO_TOKEN_POOL;
Expand Down Expand Up @@ -365,8 +365,8 @@ contract TestGhoBase is Test, Constants, Events {
// Deploy Gho GSM Steward
GHO_GSM_STEWARD = new GhoGsmSteward(SHORT_EXECUTOR, RISK_COUNCIL);

// Deploy Bucket Capacity Manager
BUCKET_CAPACITY_MANAGER = new BucketCapacityManager(
// Deploy Gho Bucket Capacity Steward
GHO_BUCKET_CAPACITY_STEWARD = new GhoBucketCapacitySteward(
SHORT_EXECUTOR,
address(GHO_TOKEN),
RISK_COUNCIL
Expand All @@ -375,7 +375,7 @@ contract TestGhoBase is Test, Constants, Events {
controlledFacilitators[0] = address(GHO_ATOKEN);
controlledFacilitators[1] = address(GHO_GSM);
vm.prank(SHORT_EXECUTOR);
BUCKET_CAPACITY_MANAGER.setControlledFacilitator(controlledFacilitators, true);
GHO_BUCKET_CAPACITY_STEWARD.setControlledFacilitator(controlledFacilitators, true);

// Setup GHO Token Pool
uint64 SOURCE_CHAIN_SELECTOR = 1;
Expand Down Expand Up @@ -418,24 +418,6 @@ contract TestGhoBase is Test, Constants, Events {
// Setup Arb GHO Token Pool
vm.prank(OWNER);
ARB_GHO_TOKEN_POOL.applyChainUpdates(chainUpdate);

// Deploy Arb Gho CCIP Steward
ARB_GHO_CCIP_STEWARD = new GhoCcipSteward(
SHORT_EXECUTOR,
address(GHO_TOKEN),
address(ARB_GHO_TOKEN_POOL),
RISK_COUNCIL,
true
);

// Deploy Arb Bucket Capacity Manager
ARB_BUCKET_CAPACITY_MANAGER = new BucketCapacityManager(
SHORT_EXECUTOR,
address(GHO_TOKEN),
RISK_COUNCIL
);
vm.prank(SHORT_EXECUTOR);
ARB_BUCKET_CAPACITY_MANAGER.setControlledFacilitator(controlledFacilitators, true);
}

function getOutboundRateLimiterConfig() public pure returns (RateLimiter.Config memory) {
Expand Down
Loading

0 comments on commit b0d60a9

Please sign in to comment.