-
Notifications
You must be signed in to change notification settings - Fork 969
/
Copy pathDelegateCallTransactionGuard.sol
39 lines (33 loc) · 1.1 KB
/
DelegateCallTransactionGuard.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity >=0.7.0 <0.9.0;
import "../../common/Enum.sol";
import "../../base/GuardManager.sol";
import "../../GnosisSafe.sol";
contract DelegateCallTransactionGuard is Guard {
address public immutable allowedTarget;
constructor(address target) {
allowedTarget = target;
}
// solhint-disable-next-line payable-fallback
fallback() external {
// We don't revert on fallback to avoid issues in case of a Safe upgrade
// E.g. The expected check method might change and then the Safe would be locked.
}
function checkTransaction(
address to,
uint256,
bytes memory,
Enum.Operation operation,
uint256,
uint256,
uint256,
address,
// solhint-disable-next-line no-unused-vars
address payable,
bytes memory,
address
) external view override {
require(operation != Enum.Operation.DelegateCall || to == allowedTarget, "This call is restricted");
}
function checkAfterExecution(bytes32, bool) external view override {}
}