Skip to content

Commit

Permalink
added IModuleGuard
Browse files Browse the repository at this point in the history
  • Loading branch information
RedVeil committed Oct 28, 2024
1 parent 743db52 commit a5cb048
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
[submodule "lib/ERC-7540-Reference"]
path = lib/ERC-7540-Reference
url = https://github.com/ERC4626-Alliance/ERC-7540-Reference
branch = main
[submodule "lib/solidity-bytes-utils"]
path = lib/solidity-bytes-utils
url = https://github.com/GNSPS/solidity-bytes-utils
Expand Down
41 changes: 41 additions & 0 deletions src/interfaces/external/safe/IModuleGuard.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: LGPL-3.0-only
/* solhint-disable one-contract-per-file */
pragma solidity >=0.7.0 <0.9.0;

import {IERC165} from "safe-smart-account/contracts/interfaces/IERC165.sol";

enum Operation {
Call,
DelegateCall
}

/**
* @title IModuleGuard Interface
*/
interface IModuleGuard is IERC165 {
/**
* @notice Checks the module transaction details.
* @dev The function needs to implement module transaction validation logic.
* @param to The address to which the transaction is intended.
* @param value The value of the transaction in Wei.
* @param data The transaction data.
* @param operation The type of operation of the module transaction.
* @param module The module involved in the transaction.
* @return moduleTxHash The hash of the module transaction.
*/
function checkModuleTransaction(
address to,
uint256 value,
bytes memory data,
Operation operation,
address module
) external returns (bytes32 moduleTxHash);

/**
* @notice Checks after execution of module transaction.
* @dev The function needs to implement a check after the execution of the module transaction.
* @param txHash The hash of the module transaction.
* @param success The status of the module transaction execution.
*/
function checkAfterModuleExecution(bytes32 txHash, bool success) external;
}
1 change: 1 addition & 0 deletions src/peripheral/gnosis/controllerModule/DrawdownModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {Owned} from "src/utils/Owned.sol";
import {OwnerManager} from "safe-smart-account/base/OwnerManager.sol";
import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol";


contract DrawdownModule is Owned {
using FixedPointMathLib for uint256;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity >=0.8.12 <0.9.0;

import {BaseGuard, Guard, Enum} from "safe-smart-account/base/GuardManager.sol";
import {IModuleGuard} from "safe-smart-account/base/ModuleManager.sol";
import {IModuleGuard} from "src/interfaces/external/safe/IModuleGuard.sol";
import {Owned} from "src/utils/Owned.sol";

contract MainTransactionGuard is BaseGuard, Owned {
Expand Down

0 comments on commit a5cb048

Please sign in to comment.