Skip to content

Commit

Permalink
fix: naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlagonia committed Jan 31, 2024
1 parent 0821426 commit 2f5acf7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
11 changes: 7 additions & 4 deletions src/BaseStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ abstract contract BaseStrategy {
* @dev Use to assure that the call is coming from the strategies management.
*/
modifier onlyManagement() {
TokenizedStrategy.isManagement(msg.sender);
require(TokenizedStrategy.isManagement(msg.sender), "!management");
_;
}

Expand All @@ -61,7 +61,7 @@ abstract contract BaseStrategy {
* management or the keeper.
*/
modifier onlyKeepers() {
TokenizedStrategy.isKeeperOrManagement(msg.sender);
require(TokenizedStrategy.isKeeperOrManagement(msg.sender), "!keeper");
_;
}

Expand All @@ -70,7 +70,10 @@ abstract contract BaseStrategy {
* management or the emergency admin.
*/
modifier onlyEmergencyAuthorized() {
TokenizedStrategy.isEmergencyAuthorized(msg.sender);
require(
TokenizedStrategy.isEmergencyAuthorized(msg.sender),
"!emergency authorized"
);
_;
}

Expand Down Expand Up @@ -145,7 +148,7 @@ abstract contract BaseStrategy {
// Initialize the strategy's storage variables.
_delegateCall(
abi.encodeCall(
ITokenizedStrategy.init,
ITokenizedStrategy.initialize,
(_asset, _name, msg.sender, msg.sender, msg.sender)
)
);
Expand Down
20 changes: 7 additions & 13 deletions src/TokenizedStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ contract TokenizedStrategy {
* @dev Require that the call is coming from the strategies management.
*/
modifier onlyManagement() {
isManagement(msg.sender);
require(isManagement(msg.sender), "!management");
_;
}

Expand All @@ -263,7 +263,7 @@ contract TokenizedStrategy {
* management or the keeper.
*/
modifier onlyKeepers() {
isKeeperOrManagement(msg.sender);
require(isKeeperOrManagement(msg.sender), "!keeper");
_;
}

Expand All @@ -272,7 +272,7 @@ contract TokenizedStrategy {
* management or the emergency admin.
*/
modifier onlyEmergencyAuthorized() {
isEmergencyAuthorized(msg.sender);
require(isEmergencyAuthorized(msg.sender), "!emergency authorized");
_;
}

Expand Down Expand Up @@ -306,8 +306,7 @@ contract TokenizedStrategy {
* @param _sender The original msg.sender.
*/
function isManagement(address _sender) public view returns (bool) {
require(_sender == _strategyStorage().management, "!management");
return true;
return _sender == _strategyStorage().management;
}

/**
Expand All @@ -324,8 +323,7 @@ contract TokenizedStrategy {
*/
function isKeeperOrManagement(address _sender) public view returns (bool) {
StrategyData storage S = _strategyStorage();
require(_sender == S.keeper || _sender == S.management, "!keeper");
return true;
return _sender == S.keeper || _sender == S.management;
}

/**
Expand All @@ -342,11 +340,7 @@ contract TokenizedStrategy {
*/
function isEmergencyAuthorized(address _sender) public view returns (bool) {
StrategyData storage S = _strategyStorage();
require(
_sender == S.emergencyAdmin || _sender == S.management,
"!emergency authorized"
);
return true;
return _sender == S.emergencyAdmin || _sender == S.management;
}

/*//////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -440,7 +434,7 @@ contract TokenizedStrategy {
* @param _performanceFeeRecipient Address to receive performance fees.
* @param _keeper Address to set as strategies `keeper`.
*/
function init(
function initialize(
address _asset,
string memory _name,
address _management,
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/ITokenizedStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ interface ITokenizedStrategy is IERC4626, IERC20Permit {
INITIALIZATION
//////////////////////////////////////////////////////////////*/

function init(
function initialize(
address _asset,
string memory _name,
address _management,
Expand Down
2 changes: 1 addition & 1 deletion src/test/AccessControl.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ contract AccessControlTest is Setup {
assertEq(tokenizedStrategy.keeper(), address(0));

vm.expectRevert("initialized");
tokenizedStrategy.init(
tokenizedStrategy.initialize(
address(asset),
name_,
_address,
Expand Down

0 comments on commit 2f5acf7

Please sign in to comment.