diff --git a/contracts/core/Allo.sol b/contracts/core/Allo.sol index b42722fa7..cc1e1c593 100644 --- a/contracts/core/Allo.sol +++ b/contracts/core/Allo.sol @@ -61,7 +61,7 @@ contract Allo is IAllo, Native, Transfer, Initializable, Ownable, AccessControl mapping(uint256 => Pool) private pools; /// @notice Strategy -> bool - mapping(address => bool) private approvedStrategies; + mapping(address => bool) private cloneableStrategies; /// ==================================== /// =========== Intializer ============= @@ -127,14 +127,14 @@ contract Allo is IAllo, Native, Transfer, Initializable, Ownable, AccessControl if (_strategy == address(0)) { revert ZERO_ADDRESS(); } - if (_isApprovedStrategy(_strategy)) { + if (_isCloneableStrategy(_strategy)) { revert IS_APPROVED_STRATEGY(); } return _createPool(_identityId, IStrategy(_strategy), _initStrategyData, _token, _amount, _metadata, _managers); } - /// @notice Creates a new pool (by cloning an approved strategies) + /// @notice Creates a new pool (by cloning an cloneable strategies) /// @param _identityId The identityId of the pool /// @param _initStrategyData The data to initialize the strategy /// @param _token The address of the token @@ -150,7 +150,7 @@ contract Allo is IAllo, Native, Transfer, Initializable, Ownable, AccessControl Metadata memory _metadata, address[] memory _managers ) external payable returns (uint256 poolId) { - if (!_isApprovedStrategy(_strategy)) { + if (!_isCloneableStrategy(_strategy)) { revert NOT_APPROVED_STRATEGY(); } @@ -207,19 +207,19 @@ contract Allo is IAllo, Native, Transfer, Initializable, Ownable, AccessControl /// @notice Add a strategy to the allowlist /// @param _strategy The address of the strategy /// @dev Only callable by the owner - function addToApprovedStrategies(address _strategy) external onlyOwner { + function addToCloneableStrategies(address _strategy) external onlyOwner { if (_strategy == address(0)) { revert ZERO_ADDRESS(); } - approvedStrategies[_strategy] = true; + cloneableStrategies[_strategy] = true; emit StrategyApproved(_strategy); } /// @notice Remove a strategy from the allowlist /// @param _strategy The address of the strategy /// @dev Only callable by the owner - function removeFromApprovedStrategies(address _strategy) external onlyOwner { - approvedStrategies[_strategy] = false; + function removeFromCloneableStrategies(address _strategy) external onlyOwner { + cloneableStrategies[_strategy] = false; emit StrategyRemoved(_strategy); } @@ -445,10 +445,10 @@ contract Allo is IAllo, Native, Transfer, Initializable, Ownable, AccessControl emit PoolFunded(_poolId, amountAfterFee, feeAmount); } - /// @notice Checks if the strategy is approved + /// @notice Checks if the strategy is cloneable /// @param _strategy The address of the strategy - function _isApprovedStrategy(address _strategy) internal view returns (bool) { - return approvedStrategies[_strategy]; + function _isCloneableStrategy(address _strategy) internal view returns (bool) { + return cloneableStrategies[_strategy]; } /// @notice Checks if the address is a pool admin @@ -552,9 +552,9 @@ contract Allo is IAllo, Native, Transfer, Initializable, Ownable, AccessControl return registry; } - /// @notice return boolean if strategy is approved - function isApprovedStrategy(address _strategy) external view returns (bool) { - return _isApprovedStrategy(_strategy); + /// @notice return boolean if strategy is cloneable + function isCloneableStrategy(address _strategy) external view returns (bool) { + return _isCloneableStrategy(_strategy); } /// @notice return the pool diff --git a/contracts/core/IAllo.sol b/contracts/core/IAllo.sol index fd5df7deb..a2f190ff3 100644 --- a/contracts/core/IAllo.sol +++ b/contracts/core/IAllo.sol @@ -68,8 +68,8 @@ interface IAllo { function updateTreasury(address payable _treasury) external; function updateFeePercentage(uint256 _feePercentage) external; function updateBaseFee(uint256 _baseFee) external; - function addToApprovedStrategies(address _strategy) external; - function removeFromApprovedStrategies(address _strategy) external; + function addToCloneableStrategies(address _strategy) external; + function removeFromCloneableStrategies(address _strategy) external; function addPoolManager(uint256 _poolId, address _manager) external; function removePoolManager(uint256 _poolId, address _manager) external; function recoverFunds(address _token, address _recipient) external; @@ -88,7 +88,7 @@ interface IAllo { function isPoolAdmin(uint256 _poolId, address _address) external view returns (bool); function isPoolManager(uint256 _poolId, address _address) external view returns (bool); - function isApprovedStrategy(address) external view returns (bool); + function isCloneableStrategy(address) external view returns (bool); function getStrategy(uint256 _poolId) external view returns (address); function getFeePercentage() external view returns (uint256); diff --git a/test/foundry/core/Allo.t.sol b/test/foundry/core/Allo.t.sol index 9bd081d22..e6d1b640f 100644 --- a/test/foundry/core/Allo.t.sol +++ b/test/foundry/core/Allo.t.sol @@ -106,7 +106,7 @@ contract AlloTest is Test, AlloSetup, RegistrySetupFull, Native { } function test_createPool() public { - allo().addToApprovedStrategies(strategy); + allo().addToCloneableStrategies(strategy); vm.expectEmit(true, true, false, false); emit PoolCreated(1, poolIdentity_id(), IStrategy(strategy), NATIVE, 0, metadata); @@ -133,7 +133,7 @@ contract AlloTest is Test, AlloSetup, RegistrySetupFull, Native { } function testRevert_createPoolWithCustomStrategy_IS_APPROVED_STRATEGY() public { - allo().addToApprovedStrategies(strategy); + allo().addToCloneableStrategies(strategy); vm.expectRevert(IAllo.IS_APPROVED_STRATEGY.selector); vm.prank(pool_admin()); allo().createPoolWithCustomStrategy(poolIdentity_id(), strategy, "0x", NATIVE, 0, metadata, pool_managers()); @@ -328,38 +328,38 @@ contract AlloTest is Test, AlloSetup, RegistrySetupFull, Native { allo().updateBaseFee(1e16); } - function test_addToApprovedStrategies() public { + function test_addToCloneableStrategies() public { address _strategy = makeAddr("strategy"); - assertFalse(allo().isApprovedStrategy(_strategy)); - allo().addToApprovedStrategies(_strategy); - assertTrue(allo().isApprovedStrategy(_strategy)); + assertFalse(allo().isCloneableStrategy(_strategy)); + allo().addToCloneableStrategies(_strategy); + assertTrue(allo().isCloneableStrategy(_strategy)); } - function testRevert_addToApprovedStrategies_ZERO_ADDRESS() public { + function testRevert_addToCloneableStrategies_ZERO_ADDRESS() public { vm.expectRevert(IAllo.ZERO_ADDRESS.selector); - allo().addToApprovedStrategies(address(0)); + allo().addToCloneableStrategies(address(0)); } - function testRevert_addToApprovedStrategies_UNAUTHORIZED() public { + function testRevert_addToCloneableStrategies_UNAUTHORIZED() public { vm.expectRevert(); vm.prank(makeAddr("anon")); address _strategy = makeAddr("strategy"); - allo().addToApprovedStrategies(_strategy); + allo().addToCloneableStrategies(_strategy); } - function test_removeFromApprovedStrategies() public { + function test_removeFromCloneableStrategies() public { address _strategy = makeAddr("strategy"); - allo().addToApprovedStrategies(_strategy); - assertTrue(allo().isApprovedStrategy(_strategy)); - allo().removeFromApprovedStrategies(_strategy); - assertFalse(allo().isApprovedStrategy(_strategy)); + allo().addToCloneableStrategies(_strategy); + assertTrue(allo().isCloneableStrategy(_strategy)); + allo().removeFromCloneableStrategies(_strategy); + assertFalse(allo().isCloneableStrategy(_strategy)); } - function testRevert_removeFromApprovedStrategies_UNAUTHORIZED() public { + function testRevert_removeFromCloneableStrategies_UNAUTHORIZED() public { address _strategy = makeAddr("strategy"); vm.expectRevert(); vm.prank(makeAddr("anon")); - allo().removeFromApprovedStrategies(_strategy); + allo().removeFromCloneableStrategies(_strategy); } function test_addPoolManager() public {