Skip to content
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
4 changes: 1 addition & 3 deletions src/core/SSVBasedApps.sol
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,7 @@ contract SSVBasedApps is
_delegateTo(SSVCoreModules.SSV_PROTOCOL_MANAGER);
}

function updateDisabledFeatures(
uint32 disabledFeatures
) external onlyOwner {
function updateDisabledFeatures(uint32 value) external onlyOwner {
_delegateTo(SSVCoreModules.SSV_PROTOCOL_MANAGER);
}

Expand Down
4 changes: 4 additions & 0 deletions src/core/modules/StrategyManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ contract StrategyManager is ReentrancyGuardTransient, IStrategyManager {

ValidationLib.validateArrayLengths(tokens, obligationPercentages);

if (!s.registeredBApps[bApp]) {
revert IBasedAppManager.BAppNotRegistered();
}

// Check if a strategy exists for the given bApp.
// It is not possible opt-in to the same bApp twice with the same strategy owner.
if (s.accountBAppStrategy[msg.sender][bApp] != 0) {
Expand Down
30 changes: 29 additions & 1 deletion test/modules/StrategyManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity 0.8.29;
import { IERC20, BasedAppMock } from "@ssv/test/helpers/Setup.t.sol";
import { BasedAppsManagerTest } from "@ssv/test/modules/BasedAppsManager.t.sol";
import { IStrategyManager } from "@ssv/src/core/interfaces/IStrategyManager.sol";
import { IStrategyManager } from "@ssv/src/core/interfaces/IStrategyManager.sol";
import { IBasedAppManager } from "@ssv/src/core/interfaces/IBasedAppManager.sol";
import { UtilsTest } from "@ssv/test/helpers/Utils.t.sol";
import { ValidationLib } from "@ssv/src/core/libraries/ValidationLib.sol";

Expand Down Expand Up @@ -1041,6 +1041,34 @@ contract StrategyManagerTest is UtilsTest, BasedAppsManagerTest {
vm.stopPrank();
}

function testRevertStrategyOptingInToNonExistingBApp(
uint32 percentage
) public {
vm.assume(
percentage > 0 && percentage <= proxiedManager.maxPercentage()
);
testCreateStrategies();
vm.startPrank(USER1);
address[] memory tokensInput = new address[](0);
uint32[] memory obligationPercentagesInput = new uint32[](0);
for (uint256 i = 0; i < bApps.length; i++) {
vm.expectRevert(
abi.encodeWithSelector(
IBasedAppManager.BAppNotRegistered.selector,
address(erc20mock2)
)
);
proxiedManager.optInToBApp(
STRATEGY1,
address(bApps[i]),
tokensInput,
obligationPercentagesInput,
abi.encodePacked("0x00")
);
}
vm.stopPrank();
}

function testStrategyOwnerDepositERC20WithNoObligation(
uint256 amount
) public {
Expand Down