Skip to content

Commit

Permalink
feat: Add isControlledFacilitator function
Browse files Browse the repository at this point in the history
  • Loading branch information
CheyenneAtapour committed Oct 14, 2024
1 parent a8f654a commit 5f92f09
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/contracts/misc/GhoBucketSteward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ contract GhoBucketSteward is Ownable, RiskCouncilControlled, IGhoBucketSteward {
return _controlledFacilitators.values();
}

/// @inheritdoc IGhoBucketSteward
function isControlledFacilitator(address facilitator) external view returns (bool) {
return _controlledFacilitatorsByAddress[facilitator];
}

/// @inheritdoc IGhoBucketSteward
function getFacilitatorBucketCapacityTimelock(
address facilitator
Expand Down
7 changes: 7 additions & 0 deletions src/contracts/misc/interfaces/IGhoBucketSteward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ interface IGhoBucketSteward {
*/
function getControlledFacilitators() external view returns (address[] memory);

/**
* @notice Checks if a facilitator is controlled by this steward
* @param facilitator The facilitator address to check
* @return True if the facilitator is controlled by this steward
*/
function isControlledFacilitator(address facilitator) external view returns (bool);

/**
* @notice Returns timestamp of the facilitators last bucket capacity update
* @param facilitator The facilitator address
Expand Down
11 changes: 11 additions & 0 deletions src/test/TestGhoBucketSteward.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,15 @@ contract TestGhoBucketSteward is TestGhoBase {
newGsmList[0] = address(GHO_GSM_4626);
GHO_BUCKET_STEWARD.setControlledFacilitator(newGsmList, true);
}

function testIsControlledFacilitator() public {
address facilitator = makeAddr('FACILITATOR');
address[] memory controlledFacilitators = new address[](1);
controlledFacilitators[0] = facilitator;
vm.prank(SHORT_EXECUTOR);
GHO_BUCKET_STEWARD.setControlledFacilitator(controlledFacilitators, true);
assertTrue(GHO_BUCKET_STEWARD.isControlledFacilitator(facilitator));
address nonFacilitator = makeAddr('NON_FACILITATOR');
assertFalse(GHO_BUCKET_STEWARD.isControlledFacilitator(nonFacilitator));
}
}

0 comments on commit 5f92f09

Please sign in to comment.