-
Notifications
You must be signed in to change notification settings - Fork 987
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:safe-global/safe-contracts into bou…
…nty_module_pagination
- Loading branch information
Showing
32 changed files
with
3,599 additions
and
3,078 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,12 @@ import "../common/Enum.sol"; | |
/// @title Executor - A contract that can execute transactions | ||
/// @author Richard Meissner - <[email protected]> | ||
contract Executor { | ||
/// @dev Executes either a delegatecall or a call with provided parameters | ||
/// @param to Destination address. | ||
/// @param value Ether value. | ||
/// @param data Data payload. | ||
/// @param operation Operation type. | ||
/// @return success boolean flag indicating if the call succeeded | ||
function execute( | ||
address to, | ||
uint256 value, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ abstract contract BaseGuard is Guard { | |
} | ||
} | ||
|
||
/// @title Fallback Manager - A contract that manages fallback calls made to this contract | ||
/// @title Guard Manager - A contract that manages transaction guards which perform pre and post-checks on execution by multisig owners | ||
/// @author Richard Meissner - <[email protected]> | ||
contract GuardManager is SelfAuthorized { | ||
event ChangedGuard(address guard); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// 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"; | ||
|
||
interface ISafe { | ||
function getOwners() external view returns (address[] memory); | ||
} | ||
|
||
contract OnlyOwnersGuard is BaseGuard { | ||
ISafe public safe; | ||
|
||
constructor() {} | ||
|
||
function checkTransaction( | ||
address, | ||
uint256, | ||
bytes memory, | ||
Enum.Operation, | ||
uint256, | ||
uint256, | ||
uint256, | ||
address, | ||
// solhint-disable-next-line no-unused-vars | ||
address payable, | ||
bytes memory, | ||
address msgSender | ||
) external override { | ||
// Only owners can exec | ||
address[] memory owners = ISafe(msg.sender).getOwners(); | ||
for (uint256 i = 0; i < owners.length; i++) { | ||
if (owners[i] == msgSender) { | ||
return; | ||
} | ||
} | ||
|
||
// msg sender is not an owner | ||
revert("msg sender is not allowed to exec"); | ||
} | ||
|
||
function checkAfterExecution(bytes32, bool) external view override {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.