Skip to content

Commit

Permalink
fix: name fixedFeeStrategyFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
CheyenneAtapour committed Aug 7, 2024
1 parent 335fbd1 commit f8ecd17
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/contracts/misc/GhoGsmSteward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ contract GhoGsmSteward is RiskCouncilControlled, IGhoGsmSteward {
uint256 public constant MINIMUM_DELAY = 2 days;

/// @inheritdoc IGhoGsmSteward
address public immutable GSM_FEE_STRATEGY_FACTORY;
address public immutable FIXED_FEE_STRATEGY_FACTORY;

mapping(address => GsmDebounce) internal _gsmTimelocksByAddress;

Expand All @@ -44,9 +44,9 @@ contract GhoGsmSteward is RiskCouncilControlled, IGhoGsmSteward {
address fixedFeeStrategyFactory,
address riskCouncil
) RiskCouncilControlled(riskCouncil) {
require(fixedFeeStrategyFactory != address(0), 'INVALID_GSM_FEE_STRATEGY_FACTORY');
require(fixedFeeStrategyFactory != address(0), 'INVALID_FIXED_FEE_STRATEGY_FACTORY');

GSM_FEE_STRATEGY_FACTORY = fixedFeeStrategyFactory;
FIXED_FEE_STRATEGY_FACTORY = fixedFeeStrategyFactory;
}

/**
Expand Down Expand Up @@ -76,7 +76,7 @@ contract GhoGsmSteward is RiskCouncilControlled, IGhoGsmSteward {
uint256 sellFee
) external onlyRiskCouncil notTimelocked(_gsmTimelocksByAddress[gsm].gsmFeeStrategyLastUpdated) {
address currentFeeStrategy = IGsm(gsm).getFeeStrategy();
require(currentFeeStrategy != address(0), 'GSM_FEE_STRATEGY_NOT_FOUND');
require(currentFeeStrategy != address(0), 'FIXED_FEE_STRATEGY_NOT_FOUND');

uint256 currentBuyFee = IGsmFeeStrategy(currentFeeStrategy).getBuyFee(1e4);
uint256 currentSellFee = IGsmFeeStrategy(currentFeeStrategy).getSellFee(1e4);
Expand All @@ -89,7 +89,7 @@ contract GhoGsmSteward is RiskCouncilControlled, IGhoGsmSteward {
'INVALID_SELL_FEE_UPDATE'
);

IFixedFeeStrategyFactory strategyFactory = IFixedFeeStrategyFactory(GSM_FEE_STRATEGY_FACTORY);
IFixedFeeStrategyFactory strategyFactory = IFixedFeeStrategyFactory(FIXED_FEE_STRATEGY_FACTORY);
uint256[] memory buyFeeList = new uint256[](1);
uint256[] memory sellFeeList = new uint256[](1);
buyFeeList[0] = buyFee;
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/misc/interfaces/IGhoGsmSteward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ interface IGhoGsmSteward {
* @notice Returns the address of the GSM Fee Strategy Factory
* @return The address of the GSM Fee Strategy Factory
*/
function GSM_FEE_STRATEGY_FACTORY() external view returns (address);
function FIXED_FEE_STRATEGY_FACTORY() external view returns (address);

/**
* @notice Returns the address of the risk council
Expand Down
2 changes: 1 addition & 1 deletion src/test/TestGhoBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ contract TestGhoBase is Test, Constants, Events {
MockPoolDataProvider MOCK_POOL_DATA_PROVIDER;

FixedRateStrategyFactory FIXED_RATE_STRATEGY_FACTORY;
FixedFeeStrategyFactory GSM_FEE_STRATEGY_FACTORY;
FixedFeeStrategyFactory FIXED_FEE_STRATEGY_FACTORY;
UpgradeableLockReleaseTokenPool GHO_TOKEN_POOL;

constructor() {
Expand Down
16 changes: 8 additions & 8 deletions src/test/TestGhoGsmSteward.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {IGhoGsmSteward} from '../contracts/misc/interfaces/IGhoGsmSteward.sol';
contract TestGhoGsmSteward is TestGhoBase {
function setUp() public {
// Deploy Gho GSM Steward
GSM_FEE_STRATEGY_FACTORY = new FixedFeeStrategyFactory();
GHO_GSM_STEWARD = new GhoGsmSteward(address(GSM_FEE_STRATEGY_FACTORY), RISK_COUNCIL);
FIXED_FEE_STRATEGY_FACTORY = new FixedFeeStrategyFactory();
GHO_GSM_STEWARD = new GhoGsmSteward(address(FIXED_FEE_STRATEGY_FACTORY), RISK_COUNCIL);

/// @dev Since block.timestamp starts at 0 this is a necessary condition (block.timestamp > `MINIMUM_DELAY`) for the timelocked contract methods to work.
vm.warp(GHO_GSM_STEWARD.MINIMUM_DELAY() + 1);
Expand All @@ -21,15 +21,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.GSM_FEE_STRATEGY_FACTORY(), address(GSM_FEE_STRATEGY_FACTORY));
assertEq(GHO_GSM_STEWARD.FIXED_FEE_STRATEGY_FACTORY(), address(FIXED_FEE_STRATEGY_FACTORY));
assertEq(GHO_GSM_STEWARD.RISK_COUNCIL(), RISK_COUNCIL);

address[] memory gsmFeeStrategies = GSM_FEE_STRATEGY_FACTORY.getFixedFeeStrategies();
address[] memory gsmFeeStrategies = FIXED_FEE_STRATEGY_FACTORY.getFixedFeeStrategies();
assertEq(gsmFeeStrategies.length, 0);
}

function testRevertConstructorInvalidGsmFeeStrategyFactory() public {
vm.expectRevert('INVALID_GSM_FEE_STRATEGY_FACTORY');
vm.expectRevert('INVALID_FIXED_FEE_STRATEGY_FACTORY');
new GhoGsmSteward(address(0), address(0x002));
}

Expand Down Expand Up @@ -312,7 +312,7 @@ contract TestGhoGsmSteward is TestGhoBase {
uint256 sellFee = IGsmFeeStrategy(feeStrategy).getSellFee(1e4);
vm.prank(RISK_COUNCIL);
GHO_GSM_STEWARD.updateGsmBuySellFees(address(GHO_GSM), buyFee + 1, sellFee + 1);
address[] memory cachedStrategies = GSM_FEE_STRATEGY_FACTORY.getFixedFeeStrategies();
address[] memory cachedStrategies = FIXED_FEE_STRATEGY_FACTORY.getFixedFeeStrategies();
assertEq(cachedStrategies.length, 1);
address newStrategy = GHO_GSM.getFeeStrategy();
assertEq(newStrategy, cachedStrategies[0]);
Expand All @@ -328,7 +328,7 @@ contract TestGhoGsmSteward is TestGhoBase {
skip(GHO_GSM_STEWARD.MINIMUM_DELAY() + 1);
vm.prank(RISK_COUNCIL);
GHO_GSM_STEWARD.updateGsmBuySellFees(address(GHO_GSM), buyFee + 1, sellFee + 1);
address[] memory cachedStrategies = GSM_FEE_STRATEGY_FACTORY.getFixedFeeStrategies();
address[] memory cachedStrategies = FIXED_FEE_STRATEGY_FACTORY.getFixedFeeStrategies();
assertEq(cachedStrategies.length, 1);
address newStrategy = GHO_GSM.getFeeStrategy();
assertEq(oldStrategy, newStrategy);
Expand Down Expand Up @@ -360,7 +360,7 @@ contract TestGhoGsmSteward is TestGhoBase {
abi.encodeWithSelector(GHO_GSM.getFeeStrategy.selector),
abi.encode(address(0))
);
vm.expectRevert('GSM_FEE_STRATEGY_NOT_FOUND');
vm.expectRevert('FIXED_FEE_STRATEGY_NOT_FOUND');
vm.prank(RISK_COUNCIL);
GHO_GSM_STEWARD.updateGsmBuySellFees(address(GHO_GSM), buyFee + 1, sellFee + 1);
}
Expand Down

0 comments on commit f8ecd17

Please sign in to comment.