From 7ad27d8a5f47bd63fd8466b993826f66a184c0f9 Mon Sep 17 00:00:00 2001 From: Schlagonia Date: Fri, 6 Sep 2024 09:32:54 -0600 Subject: [PATCH] feat: update name --- src/TokenizedStrategy.sol | 8 ++++++++ src/interfaces/ITokenizedStrategy.sol | 2 ++ src/test/AccessControl.t.sol | 15 +++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/src/TokenizedStrategy.sol b/src/TokenizedStrategy.sol index c79822c..f9b2172 100644 --- a/src/TokenizedStrategy.sol +++ b/src/TokenizedStrategy.sol @@ -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 //////////////////////////////////////////////////////////////*/ diff --git a/src/interfaces/ITokenizedStrategy.sol b/src/interfaces/ITokenizedStrategy.sol index 8e10d22..d5920eb 100644 --- a/src/interfaces/ITokenizedStrategy.sol +++ b/src/interfaces/ITokenizedStrategy.sol @@ -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; diff --git a/src/test/AccessControl.t.sol b/src/test/AccessControl.t.sol index 1c2c110..cf88248 100644 --- a/src/test/AccessControl.t.sol +++ b/src/test/AccessControl.t.sol @@ -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); + } }