Skip to content

Commit

Permalink
test: update bridge limit
Browse files Browse the repository at this point in the history
  • Loading branch information
CheyenneAtapour committed Jul 10, 2024
1 parent 612ebe4 commit eb204c4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/contracts/misc/GhoStewardV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@ contract GhoStewardV2 is Ownable, IGhoStewardV2 {
}

/// @inheritdoc IGhoStewardV2
function setBridgeLimit(uint256 newBridgeLimit) external onlyRiskCouncil {
function updateBridgeLimit(uint256 newBridgeLimit) external onlyRiskCouncil {
UpgradeableLockReleaseTokenPool(GHO_TOKEN_POOL).setBridgeLimit(newBridgeLimit);
}

/// @inheritdoc IGhoStewardV2
function setRateLimit(
function updateRateLimit(
uint64 remoteChainSelector,
RateLimiter.Config calldata outboundConfig,
RateLimiter.Config calldata inboundConfig
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/misc/interfaces/IGhoStewardV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ interface IGhoStewardV2 {
* @dev Only callable by Risk Council
* @param newBridgeLimit The new desired bridge limit
*/
function setBridgeLimit(uint256 newBridgeLimit) external;
function updateBridgeLimit(uint256 newBridgeLimit) external;

/**
* @notice Updates the CCIP rate limit config
Expand All @@ -84,7 +84,7 @@ interface IGhoStewardV2 {
* @param outboundConfig The new outbound rate limiter config.
* @param inboundConfig The new inbound rate limiter config.
*/
function setRateLimit(
function updateRateLimit(
uint64 remoteChainSelector,
RateLimiter.Config calldata outboundConfig,
RateLimiter.Config calldata inboundConfig
Expand Down
5 changes: 5 additions & 0 deletions src/test/TestGhoBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ contract TestGhoBase is Test, Constants, Events {
controlledFacilitators[1] = address(GHO_GSM);
vm.prank(SHORT_EXECUTOR);
GHO_STEWARD_V2.setControlledFacilitator(controlledFacilitators, true);
// Grant roles to steward
vm.startPrank(OWNER);
GHO_TOKEN_POOL.setBridgeLimitAdmin(address(GHO_STEWARD_V2));
GHO_TOKEN_POOL.setRateLimitAdmin(address(GHO_STEWARD_V2));
vm.stopPrank();
}

function ghoFaucet(address to, uint256 amount) public {
Expand Down
17 changes: 17 additions & 0 deletions src/test/TestGhoStewardV2.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,23 @@ contract TestGhoStewardV2 is TestGhoBase {
GHO_STEWARD_V2.updateGsmBuySellFees(address(GHO_GSM), buyFee + 1, sellFee + 1);
}

function testUpdateBridgeLimit() public {
uint256 oldBridgeLimit = GHO_TOKEN_POOL.getBridgeLimit();
uint256 newBridgeLimit = oldBridgeLimit + 1;
vm.prank(RISK_COUNCIL);
GHO_STEWARD_V2.updateBridgeLimit(newBridgeLimit);
uint256 currentBridgeLimit = GHO_TOKEN_POOL.getBridgeLimit();
assertEq(currentBridgeLimit, newBridgeLimit);
}

function testRevertUpdateBridgeLimitIfUnauthorized() public {
uint256 oldBridgeLimit = GHO_TOKEN_POOL.getBridgeLimit();
uint256 newBridgeLimit = oldBridgeLimit + 1;
vm.prank(ALICE);
vm.expectRevert('INVALID_CALLER');
GHO_STEWARD_V2.updateBridgeLimit(newBridgeLimit);
}

function testSetControlledFacilitatorAdd() public {
address[] memory oldControlledFacilitators = GHO_STEWARD_V2.getControlledFacilitators();
address[] memory newGsmList = new address[](1);
Expand Down

0 comments on commit eb204c4

Please sign in to comment.