Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update name #101

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/TokenizedStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1594,6 +1594,14 @@ contract TokenizedStrategy {
emit UpdateProfitMaxUnlockTime(_profitMaxUnlockTime);
}

/**
* @notice Updates the name for the strategy.
* @param _name The new name for the strategy.
*/
function setName(string calldata _name) external onlyManagement {
_strategyStorage().name = _name;
}

/*//////////////////////////////////////////////////////////////
ERC20 METHODS
//////////////////////////////////////////////////////////////*/
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/ITokenizedStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ interface ITokenizedStrategy is IERC4626, IERC20Permit {

function setProfitMaxUnlockTime(uint256 _profitMaxUnlockTime) external;

function setName(string calldata _newName) external;

function shutdownStrategy() external;

function emergencyWithdraw(uint256 _amount) external;
Expand Down
15 changes: 15 additions & 0 deletions src/test/AccessControl.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -369,4 +369,19 @@ contract AccessControlTest is Setup {
vm.prank(keeper);
strategy.tend();
}

function test_setName(address _address) public {
vm.assume(_address != address(strategy) && _address != management);

string memory newName = "New Strategy Name";

vm.prank(_address);
vm.expectRevert("!management");
strategy.setName(newName);

vm.prank(management);
strategy.setName(newName);

assertEq(strategy.name(), newName);
}
}
Loading