Skip to content

Commit

Permalink
test: rate limit test
Browse files Browse the repository at this point in the history
  • Loading branch information
CheyenneAtapour committed Jul 11, 2024
1 parent 703c063 commit 2b87923
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
7 changes: 6 additions & 1 deletion src/contracts/misc/ArbGhoSteward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity ^0.8.10;

import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
import {IOwnable} from 'ccip/v0.8/shared/interfaces/IOwnable.sol';
import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';
import {IPoolAddressesProvider} from '@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol';
import {IPoolConfigurator} from '@aave/core-v3/contracts/interfaces/IPoolConfigurator.sol';
Expand Down Expand Up @@ -114,7 +115,7 @@ contract ArbGhoSteward is Ownable, IArbGhoSteward {
}

/// @inheritdoc IArbGhoSteward
function setRateLimit(
function updateRateLimit(
uint64 remoteChainSelector,
RateLimiter.Config calldata outboundConfig,
RateLimiter.Config calldata inboundConfig
Expand Down Expand Up @@ -176,6 +177,10 @@ contract ArbGhoSteward is Ownable, IArbGhoSteward {
.setReserveInterestRateStrategyAddress(GHO_TOKEN, strategy);
}

function acceptOwnership(address target) external onlyRiskCouncil {
IOwnable(target).acceptOwnership();
}

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

/// @inheritdoc IArbGhoSteward
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/misc/interfaces/IArbGhoSteward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface IArbGhoSteward {
* @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
2 changes: 0 additions & 2 deletions src/test/TestArbGhoSteward.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ contract TestArbGhoSteward is TestGhoBase {
);
}

/* TODO: Rate limit is currently restricted to only the owner
function testUpdateRateLimit() public {
vm.expectEmit(false, false, false, true);
emit ChainConfigured(
Expand All @@ -144,7 +143,6 @@ contract TestArbGhoSteward is TestGhoBase {
RateLimiter.Config({isEnabled: true, capacity: type(uint128).max, rate: 1e15})
);
}
*/

function testUpdateFacilitatorBucketCapacity() public {
(uint256 currentBucketCapacity, ) = GHO_TOKEN.getFacilitatorBucket(address(GHO_ATOKEN));
Expand Down
14 changes: 6 additions & 8 deletions src/test/TestGhoBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -412,17 +412,15 @@ contract TestGhoBase is Test, Constants, Events {
vm.prank(SHORT_EXECUTOR);
ARB_GHO_STEWARD.setControlledFacilitator(controlledFacilitators, true);

// Grant roles to steward
//vm.startPrank(OWNER);
// TODO: rate limit admin is basically only owner allowed
//ARB_GHO_TOKEN_POOL.setRateLimitAdmin(address(ARB_GHO_STEWARD));
// TODO: gho bucket capacity manager
// TODO: AAve risk admin
//vm.stopPrank();

// Setup Arb GHO Token Pool
vm.prank(OWNER);
ARB_GHO_TOKEN_POOL.applyChainUpdates(chainUpdate);

// Transfer ownership from the arb token pool to steward via transfer/acceptOwnership
vm.prank(OWNER);
ARB_GHO_TOKEN_POOL.transferOwnership(address(ARB_GHO_STEWARD));
vm.prank(RISK_COUNCIL);
ARB_GHO_STEWARD.acceptOwnership(address(ARB_GHO_TOKEN_POOL));
}

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

0 comments on commit 2b87923

Please sign in to comment.