-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
65 changed files
with
6,238 additions
and
2,600 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v16.0.0 | ||
v18.0.0 |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
{ | ||
"extends": "solhint:recommended", | ||
"rules": { | ||
"compiler-version": "off", | ||
"func-visibility": [ | ||
"warn", | ||
{ | ||
"ignoreConstructors": true | ||
} | ||
], | ||
"not-rely-on-time": "off", | ||
"reason-string": "off", | ||
"no-empty-blocks": "off", | ||
"avoid-low-level-calls": "off" | ||
} | ||
"extends": "solhint:recommended", | ||
"rules": { | ||
"compiler-version": "off", | ||
"func-visibility": [ | ||
"warn", | ||
{ | ||
"ignoreConstructors": true | ||
} | ||
], | ||
"not-rely-on-time": "off", | ||
"reason-string": "off", | ||
"no-empty-blocks": "off", | ||
"avoid-low-level-calls": "off", | ||
"no-inline-assembly": "off" | ||
} | ||
} |
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 @@ | ||
./contracts/test |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,96 @@ | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
pragma solidity >=0.7.0 <0.9.0; | ||
|
||
import {Enum} from "@gnosis.pm/safe-contracts/contracts/common/Enum.sol"; | ||
|
||
import {Guardable} from "../guard/Guardable.sol"; | ||
import {IAvatar} from "../interfaces/IAvatar.sol"; | ||
import {IGuard} from "../interfaces/IGuard.sol"; | ||
import {Modifier} from "./Modifier.sol"; | ||
import {Module} from "./Module.sol"; | ||
|
||
abstract contract GuardableModifier is Module, Guardable, Modifier { | ||
/// @dev Passes a transaction to be executed by the avatar. | ||
/// @notice Can only be called by this contract. | ||
/// @param to Destination address of module transaction. | ||
/// @param value Ether value of module transaction. | ||
/// @param data Data payload of module transaction. | ||
/// @param operation Operation type of module transaction: 0 == call, 1 == delegate call. | ||
function exec( | ||
address to, | ||
uint256 value, | ||
bytes memory data, | ||
Enum.Operation operation | ||
) internal virtual override returns (bool success) { | ||
address currentGuard = guard; | ||
if (currentGuard != address(0)) { | ||
IGuard(currentGuard).checkTransaction( | ||
/// Transaction info used by module transactions. | ||
to, | ||
value, | ||
data, | ||
operation, | ||
/// Zero out the redundant transaction information only used for Safe multisig transctions. | ||
0, | ||
0, | ||
0, | ||
address(0), | ||
payable(0), | ||
"", | ||
sentOrSignedByModule() | ||
); | ||
} | ||
success = IAvatar(target).execTransactionFromModule( | ||
to, | ||
value, | ||
data, | ||
operation | ||
); | ||
if (currentGuard != address(0)) { | ||
IGuard(currentGuard).checkAfterExecution(bytes32(0), success); | ||
} | ||
} | ||
|
||
/// @dev Passes a transaction to be executed by the target and returns data. | ||
/// @notice Can only be called by this contract. | ||
/// @param to Destination address of module transaction. | ||
/// @param value Ether value of module transaction. | ||
/// @param data Data payload of module transaction. | ||
/// @param operation Operation type of module transaction: 0 == call, 1 == delegate call. | ||
function execAndReturnData( | ||
address to, | ||
uint256 value, | ||
bytes memory data, | ||
Enum.Operation operation | ||
) internal virtual override returns (bool success, bytes memory returnData) { | ||
address currentGuard = guard; | ||
if (currentGuard != address(0)) { | ||
IGuard(currentGuard).checkTransaction( | ||
/// Transaction info used by module transactions. | ||
to, | ||
value, | ||
data, | ||
operation, | ||
/// Zero out the redundant transaction information only used for Safe multisig transctions. | ||
0, | ||
0, | ||
0, | ||
address(0), | ||
payable(0), | ||
"", | ||
sentOrSignedByModule() | ||
); | ||
} | ||
|
||
(success, returnData) = IAvatar(target).execTransactionFromModuleReturnData( | ||
to, | ||
value, | ||
data, | ||
operation | ||
); | ||
|
||
if (currentGuard != address(0)) { | ||
IGuard(currentGuard).checkAfterExecution(bytes32(0), success); | ||
} | ||
} | ||
} |
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,95 @@ | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
pragma solidity >=0.7.0 <0.9.0; | ||
|
||
import {Enum} from "@gnosis.pm/safe-contracts/contracts/common/Enum.sol"; | ||
import {IGuard} from "../interfaces/IGuard.sol"; | ||
import {Guardable} from "../guard/Guardable.sol"; | ||
import {Module} from "./Module.sol"; | ||
import {IAvatar} from "../interfaces/IAvatar.sol"; | ||
|
||
/// @title GuardableModule - A contract that can pass messages to a Module Manager contract if enabled by that contract. | ||
abstract contract GuardableModule is Module, Guardable { | ||
/// @dev Passes a transaction to be executed by the avatar. | ||
/// @notice Can only be called by this contract. | ||
/// @param to Destination address of module transaction. | ||
/// @param value Ether value of module transaction. | ||
/// @param data Data payload of module transaction. | ||
/// @param operation Operation type of module transaction: 0 == call, 1 == delegate call. | ||
function exec( | ||
address to, | ||
uint256 value, | ||
bytes memory data, | ||
Enum.Operation operation | ||
) internal override returns (bool success) { | ||
address currentGuard = guard; | ||
if (currentGuard != address(0)) { | ||
IGuard(currentGuard).checkTransaction( | ||
/// Transaction info used by module transactions. | ||
to, | ||
value, | ||
data, | ||
operation, | ||
/// Zero out the redundant transaction information only used for Safe multisig transctions. | ||
0, | ||
0, | ||
0, | ||
address(0), | ||
payable(0), | ||
"", | ||
msg.sender | ||
); | ||
} | ||
success = IAvatar(target).execTransactionFromModule( | ||
to, | ||
value, | ||
data, | ||
operation | ||
); | ||
if (currentGuard != address(0)) { | ||
IGuard(currentGuard).checkAfterExecution(bytes32(0), success); | ||
} | ||
} | ||
|
||
/// @dev Passes a transaction to be executed by the target and returns data. | ||
/// @notice Can only be called by this contract. | ||
/// @param to Destination address of module transaction. | ||
/// @param value Ether value of module transaction. | ||
/// @param data Data payload of module transaction. | ||
/// @param operation Operation type of module transaction: 0 == call, 1 == delegate call. | ||
function execAndReturnData( | ||
address to, | ||
uint256 value, | ||
bytes memory data, | ||
Enum.Operation operation | ||
) internal virtual override returns (bool success, bytes memory returnData) { | ||
address currentGuard = guard; | ||
if (currentGuard != address(0)) { | ||
IGuard(currentGuard).checkTransaction( | ||
/// Transaction info used by module transactions. | ||
to, | ||
value, | ||
data, | ||
operation, | ||
/// Zero out the redundant transaction information only used for Safe multisig transctions. | ||
0, | ||
0, | ||
0, | ||
address(0), | ||
payable(0), | ||
"", | ||
msg.sender | ||
); | ||
} | ||
|
||
(success, returnData) = IAvatar(target).execTransactionFromModuleReturnData( | ||
to, | ||
value, | ||
data, | ||
operation | ||
); | ||
|
||
if (currentGuard != address(0)) { | ||
IGuard(currentGuard).checkAfterExecution(bytes32(0), success); | ||
} | ||
} | ||
} |
Oops, something went wrong.