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
2 changes: 1 addition & 1 deletion src/delegate/DelegateEnsoShortcuts.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ contract DelegateEnsoShortcuts is AbstractEnsoShortcuts {
error OnlyDelegateCall();

function _checkMsgSender() internal view override {
if (msg.sender == __self) revert OnlyDelegateCall();
if (address(this) == __self) revert OnlyDelegateCall();
}
}
17 changes: 17 additions & 0 deletions test/DelegateEnsoShortcuts.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,21 @@ contract DelegateEnsoShortcutsTest is Test, SafeTestTools {
assertEq(weth.balanceOf(address(safeInstance.safe)), 10 ether);
assertEq(safeBalanceBefore - 10 ether, address(safeInstance.safe).balance);
}

function testToDirectlyCallDelegateContract() public {
bytes32[] memory commands = new bytes32[](1);
commands[0] = WeirollPlanner.buildCommand(
weth.deposit.selector,
0x03, // call with value
0x00ffffffffff, // 1 input
0xff, // no output
address(weth)
);

bytes[] memory state = new bytes[](1);
state[0] = abi.encode(10 ether);

vm.expectRevert(DelegateEnsoShortcuts.OnlyDelegateCall.selector);
shortcuts.executeShortcut(bytes32(0), bytes32(0), commands, state);
}
}
Loading