Skip to content

Commit

Permalink
fix: remove ownable where not required
Browse files Browse the repository at this point in the history
  • Loading branch information
CheyenneAtapour committed Jul 30, 2024
1 parent e1285bf commit eefe810
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 52 deletions.
8 changes: 1 addition & 7 deletions src/contracts/misc/GhoAaveSteward.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
import {IPoolAddressesProvider} from '@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol';
import {IPoolConfigurator} from '@aave/core-v3/contracts/interfaces/IPoolConfigurator.sol';
import {IPool} from '@aave/core-v3/contracts/interfaces/IPool.sol';
Expand All @@ -19,7 +18,7 @@ import {RiskCouncilControlled} from './RiskCouncilControlled.sol';
* @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 RiskAdmin on the Aave V3 Ethereum Pool
*/
contract GhoAaveSteward is Ownable, RiskCouncilControlled, IGhoAaveSteward {
contract GhoAaveSteward is RiskCouncilControlled, IGhoAaveSteward {
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;

/// @inheritdoc IGhoAaveSteward
Expand All @@ -46,29 +45,24 @@ contract GhoAaveSteward is Ownable, RiskCouncilControlled, IGhoAaveSteward {

/**
* @dev Constructor
* @param owner The address of the owner of the contract
* @param addressesProvider The address of the PoolAddressesProvider of Aave V3 Ethereum Pool
* @param ghoToken The address of the GhoToken
* @param fixedRateStrategyFactory The address of the FixedRateStrategyFactory
* @param riskCouncil The address of the risk council
*/
constructor(
address owner,
address addressesProvider,
address ghoToken,
address fixedRateStrategyFactory,
address riskCouncil
) RiskCouncilControlled(riskCouncil) {
require(owner != address(0), 'INVALID_OWNER');
require(addressesProvider != address(0), 'INVALID_ADDRESSES_PROVIDER');
require(ghoToken != address(0), 'INVALID_GHO_TOKEN');
require(fixedRateStrategyFactory != address(0), 'INVALID_FIXED_RATE_STRATEGY_FACTORY');

POOL_ADDRESSES_PROVIDER = addressesProvider;
GHO_TOKEN = ghoToken;
FIXED_RATE_STRATEGY_FACTORY = fixedRateStrategyFactory;

_transferOwnership(owner);
}

/// @inheritdoc IGhoAaveSteward
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/misc/GhoBucketCapacitySteward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ contract GhoBucketCapacitySteward is Ownable, RiskCouncilControlled, IGhoBucketC

/**
* @dev Constructor
* @param owner The address of the owner of the contract
* @param owner The address of the contract's owner
* @param ghoToken The address of the GhoToken
* @param riskCouncil The address of the risk council
*/
Expand Down
8 changes: 1 addition & 7 deletions src/contracts/misc/GhoCcipSteward.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

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 {IGhoCcipSteward} from './interfaces/IGhoCcipSteward.sol';
Expand All @@ -15,7 +14,7 @@ import {UpgradeableLockReleaseTokenPool, RateLimiter} from './deps/Dependencies.
* @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 roles RateLimitAdmin and BridgeLimitAdmin (if on Ethereum) on GhoTokenPool
*/
contract GhoCcipSteward is Ownable, RiskCouncilControlled, IGhoCcipSteward {
contract GhoCcipSteward is RiskCouncilControlled, IGhoCcipSteward {
using EnumerableSet for EnumerableSet.AddressSet;

/// @inheritdoc IGhoCcipSteward
Expand All @@ -40,27 +39,22 @@ contract GhoCcipSteward is Ownable, RiskCouncilControlled, IGhoCcipSteward {

/**
* @dev Constructor
* @param owner The address of the owner of the contract
* @param ghoToken The address of the GhoToken
* @param ghoTokenPool The address of the Gho CCIP Token Pool
* @param riskCouncil The address of the risk council
*/
constructor(
address owner,
address ghoToken,
address ghoTokenPool,
address riskCouncil,
bool bridgeLimitEnabled
) RiskCouncilControlled(riskCouncil) {
require(owner != address(0), 'INVALID_OWNER');
require(ghoToken != address(0), 'INVALID_GHO_TOKEN');
require(ghoTokenPool != address(0), 'INVALID_GHO_TOKEN_POOL');

GHO_TOKEN = ghoToken;
GHO_TOKEN_POOL = ghoTokenPool;
BRIDGE_LIMIT_ENABLED = bridgeLimitEnabled;

_transferOwnership(owner);
}

/// @inheritdoc IGhoCcipSteward
Expand Down
10 changes: 2 additions & 8 deletions src/contracts/misc/GhoGsmSteward.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';
import {FixedFeeStrategy} from '../facilitators/gsm/feeStrategy/FixedFeeStrategy.sol';
import {IGsm} from '../facilitators/gsm/interfaces/IGsm.sol';
Expand All @@ -16,7 +15,7 @@ import {RiskCouncilControlled} from './RiskCouncilControlled.sol';
* @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 every GSM contract to be managed
*/
contract GhoGsmSteward is Ownable, RiskCouncilControlled, IGhoGsmSteward {
contract GhoGsmSteward is RiskCouncilControlled, IGhoGsmSteward {
using EnumerableSet for EnumerableSet.AddressSet;

/// @inheritdoc IGhoGsmSteward
Expand All @@ -40,14 +39,9 @@ contract GhoGsmSteward is Ownable, RiskCouncilControlled, IGhoGsmSteward {

/**
* @dev Constructor
* @param owner The address of the owner of the contract
* @param riskCouncil The address of the risk council
*/
constructor(address owner, address riskCouncil) RiskCouncilControlled(riskCouncil) {
require(owner != address(0), 'INVALID_OWNER');

_transferOwnership(owner);
}
constructor(address riskCouncil) RiskCouncilControlled(riskCouncil) {}

/**
* @inheritdoc IGhoGsmSteward
Expand Down
14 changes: 4 additions & 10 deletions src/test/TestGhoAaveSteward.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ contract TestGhoAaveSteward is TestGhoBase {
function testConstructor() public {
assertEq(GHO_AAVE_STEWARD.MINIMUM_DELAY(), MINIMUM_DELAY_V2);

assertEq(GHO_AAVE_STEWARD.owner(), SHORT_EXECUTOR);
assertEq(GHO_AAVE_STEWARD.POOL_ADDRESSES_PROVIDER(), address(PROVIDER));
assertEq(GHO_AAVE_STEWARD.GHO_TOKEN(), address(GHO_TOKEN));
assertEq(GHO_AAVE_STEWARD.FIXED_RATE_STRATEGY_FACTORY(), address(FIXED_RATE_STRATEGY_FACTORY));
Expand All @@ -25,29 +24,24 @@ contract TestGhoAaveSteward is TestGhoBase {
assertEq(ghoTimelocks.ghoBorrowCapLastUpdate, 0);
}

function testRevertConstructorInvalidExecutor() public {
vm.expectRevert('INVALID_OWNER');
new GhoAaveSteward(address(0), address(0x002), address(0x003), address(0x004), address(0x005));
}

function testRevertConstructorInvalidAddressesProvider() public {
vm.expectRevert('INVALID_ADDRESSES_PROVIDER');
new GhoAaveSteward(address(0x001), address(0), address(0x003), address(0x004), address(0x005));
new GhoAaveSteward(address(0), address(0x002), address(0x003), address(0x004));
}

function testRevertConstructorInvalidGhoToken() public {
vm.expectRevert('INVALID_GHO_TOKEN');
new GhoAaveSteward(address(0x001), address(0x002), address(0), address(0x004), address(0x005));
new GhoAaveSteward(address(0x001), address(0), address(0x003), address(0x004));
}

function testRevertConstructorInvalidFixedRateStrategyFactory() public {
vm.expectRevert('INVALID_FIXED_RATE_STRATEGY_FACTORY');
new GhoAaveSteward(address(0x001), address(0x002), address(0x003), address(0), address(0x005));
new GhoAaveSteward(address(0x001), address(0x002), address(0), address(0x004));
}

function testRevertConstructorInvalidRiskCouncil() public {
vm.expectRevert('INVALID_RISK_COUNCIL');
new GhoAaveSteward(address(0x001), address(0x002), address(0x003), address(0x004), address(0));
new GhoAaveSteward(address(0x001), address(0x002), address(0x003), address(0));
}

function testUpdateGhoBorrowCap() public {
Expand Down
4 changes: 1 addition & 3 deletions src/test/TestGhoBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ contract TestGhoBase is Test, Constants, Events {

// Deploy Gho Aave Steward
GHO_AAVE_STEWARD = new GhoAaveSteward(
SHORT_EXECUTOR,
address(PROVIDER),
address(GHO_TOKEN),
address(FIXED_RATE_STRATEGY_FACTORY),
Expand All @@ -352,15 +351,14 @@ contract TestGhoBase is Test, Constants, Events {

// Deploy Gho CCIP Steward
GHO_CCIP_STEWARD = new GhoCcipSteward(
SHORT_EXECUTOR,
address(GHO_TOKEN),
address(GHO_TOKEN_POOL),
RISK_COUNCIL,
true
);

// Deploy Gho GSM Steward
GHO_GSM_STEWARD = new GhoGsmSteward(SHORT_EXECUTOR, RISK_COUNCIL);
GHO_GSM_STEWARD = new GhoGsmSteward(RISK_COUNCIL);

// Deploy Gho Bucket Capacity Steward
GHO_BUCKET_CAPACITY_STEWARD = new GhoBucketCapacitySteward(
Expand Down
12 changes: 3 additions & 9 deletions src/test/TestGhoCcipSteward.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,24 @@ contract TestGhoCcipSteward is TestGhoBase {
function testConstructor() public {
assertEq(GHO_CCIP_STEWARD.MINIMUM_DELAY(), MINIMUM_DELAY_V2);

assertEq(GHO_CCIP_STEWARD.owner(), SHORT_EXECUTOR);
assertEq(GHO_CCIP_STEWARD.GHO_TOKEN(), address(GHO_TOKEN));
assertEq(GHO_CCIP_STEWARD.GHO_TOKEN_POOL(), address(GHO_TOKEN_POOL));
assertEq(GHO_CCIP_STEWARD.RISK_COUNCIL(), RISK_COUNCIL);
}

function testRevertConstructorInvalidExecutor() public {
vm.expectRevert('INVALID_OWNER');
new GhoCcipSteward(address(0), address(0x002), address(0x003), address(0x004), true);
}

function testRevertConstructorInvalidGhoToken() public {
vm.expectRevert('INVALID_GHO_TOKEN');
new GhoCcipSteward(address(0x001), address(0), address(0x003), address(0x004), true);
new GhoCcipSteward(address(0), address(0x002), address(0x003), true);
}

function testRevertConstructorInvalidGhoTokenPool() public {
vm.expectRevert('INVALID_GHO_TOKEN_POOL');
new GhoCcipSteward(address(0x001), address(0x002), address(0), address(0x004), true);
new GhoCcipSteward(address(0x001), address(0), address(0x003), true);
}

function testRevertConstructorInvalidRiskCouncil() public {
vm.expectRevert('INVALID_RISK_COUNCIL');
new GhoCcipSteward(address(0x001), address(0x002), address(0x003), address(0), true);
new GhoCcipSteward(address(0x001), address(0x002), address(0), true);
}

function testUpdateBridgeLimit() public {
Expand Down
8 changes: 1 addition & 7 deletions src/test/TestGhoGsmSteward.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,15 @@ contract TestGhoGsmSteward is TestGhoBase {
assertEq(GHO_GSM_STEWARD.GSM_FEE_RATE_CHANGE_MAX(), GSM_FEE_RATE_CHANGE_MAX);
assertEq(GHO_GSM_STEWARD.MINIMUM_DELAY(), MINIMUM_DELAY_V2);

assertEq(GHO_GSM_STEWARD.owner(), SHORT_EXECUTOR);
assertEq(GHO_GSM_STEWARD.RISK_COUNCIL(), RISK_COUNCIL);

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

function testRevertConstructorInvalidExecutor() public {
vm.expectRevert('INVALID_OWNER');
new GhoGsmSteward(address(0), address(0x002));
}

function testRevertConstructorInvalidRiskCouncil() public {
vm.expectRevert('INVALID_RISK_COUNCIL');
new GhoGsmSteward(address(0x001), address(0));
new GhoGsmSteward(address(0));
}

function testUpdateGsmExposureCapUpwards() public {
Expand Down

0 comments on commit eefe810

Please sign in to comment.