Skip to content

Commit

Permalink
FIX: eliminate all reference to gnosis
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredolopez80 committed May 16, 2024
1 parent 49ed6d4 commit b169a4a
Show file tree
Hide file tree
Showing 35 changed files with 775 additions and 868 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PROXY_FACTORY_ADDRESS=0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2
# RECEIVER_ADDRESS=0x54c29072A5EBFc4BCA9325864860be9Fa0d170a6


# Official Gnosis Safe
# Official Safe
# PROXY_FACTORY_ADDRESS=0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2
# MASTER_COPY_ADDRESS=0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552

Expand Down
206 changes: 103 additions & 103 deletions .gas-snapshot

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lcov.info
Original file line number Diff line number Diff line change
Expand Up @@ -974,8 +974,8 @@ FN:25,KeyperModuleHelper.initHelper
FNDA:0,KeyperModuleHelper.initHelper
DA:26,0
DA:27,0
FN:30,KeyperModuleHelper.setGnosisSafe
FNDA:21,KeyperModuleHelper.setGnosisSafe
FN:30,KeyperModuleHelper.setSafe
FNDA:21,KeyperModuleHelper.setSafe
DA:31,21
FN:35,KeyperModuleHelper.encodeSignaturesKeyperTx
FNDA:17,KeyperModuleHelper.encodeSignaturesKeyperTx
Expand Down
2 changes: 1 addition & 1 deletion libraries/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.15;
/// @title Library Constants
/// @custom:security-contact [email protected]
library Constants {
// Sentinel Owners for Gnosis Safe
// Sentinel Owners for Safe
address internal constant SENTINEL_ADDRESS = address(0x1);
// keccak256(
// "EIP712Domain(uint256 chainId,address verifyingContract)"
Expand Down
8 changes: 4 additions & 4 deletions libraries/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ library Errors {
error PreviewModuleNotFound(address squad);
/// @dev Error messages when Try to Execute a Transaction On Behalf and Fail
error TxOnBehalfExecutedFailed();
/// @dev Error messages when the caller is an Invalid Gnosis Safe
error InvalidGnosisSafe(address safe);
/// @dev Error messages when the caller is an Invalid Gnosis Root Safe
error InvalidGnosisRootSafe(address safe);
/// @dev Error messages when the caller is an Invalid Safe
error InvalidSafe(address safe);
/// @dev Error messages when the caller is an Invalid Root Safe
error InvalidRootSafe(address safe);
/// @dev Error messages when the Squad is an Invalid ID's
error InvalidSquadId();
/// @dev Error messages when the Try to Modify a Role Not Permitted
Expand Down
10 changes: 5 additions & 5 deletions libraries/Events.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ pragma solidity ^0.8.15;
/// @title Library Events
/// @custom:security-contact [email protected]
library Events {
/// @dev Event Fire when create a new Organization
/// @param creator Address of the creator
/// @param org Hash(DAO's name)
/// @param name String name of the organization
/// @dev Event Fire when create a new Organization
/// @param creator Address of the creator
/// @param org Hash(DAO's name)
/// @param name String name of the organization
event OrganizationCreated(
address indexed creator,
bytes32 indexed org,
Expand Down Expand Up @@ -75,7 +75,7 @@ library Events {
bool result
);

/// @dev Event Fire when any Gnosis Safe enable the Keyper Module
/// @dev Event Fire when any Safe enable the Keyper Module
event ModuleEnabled(address indexed safe, address indexed module);

/// @dev Event Fire when any Root Safe create a new Root Safe
Expand Down
2 changes: 1 addition & 1 deletion script/DeployKeyperEnv.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {GnosisSafeProxyFactory} from
"@safe-contracts/proxies/GnosisSafeProxyFactory.sol";
import {GnosisSafe} from "@safe-contracts/GnosisSafe.sol";

/// Deployement of Gnosis Safe contracts, KeyperRoles and KeyperModule
/// Deployement of Safe contracts, KeyperRoles and KeyperModule
/// @custom:security-contact [email protected]
contract DeployKeyperEnv is Script {
function run() public {
Expand Down
1 change: 0 additions & 1 deletion script/DeployKeyperSafe.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ contract DeployKeyperSafe is Script {

vm.startBroadcast();
KeyperModule keyper = KeyperModule(keyperModuleAddress);
// keyper.createSafeProxy(owners, threshold);
vm.stopBroadcast();
}
}
2 changes: 1 addition & 1 deletion script/DeployModuleWithMockedSafe.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "test/mocks/MockedContract.t.sol";
import {CREATE3Factory} from "@create3/CREATE3Factory.sol";
import "@solenv/Solenv.sol";

/// Deployement of Gnosis Safe contracts, KeyperRoles and KeyperModule
/// Deployement of Safe contracts, KeyperRoles and KeyperModule
/// @custom:security-contact [email protected]
contract DeployModuleWithMockedSafe is Script {
function run() public {
Expand Down
6 changes: 3 additions & 3 deletions script/DeploySafeFactory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ import {IProxyCreationCallback} from
/// @custom:security-contact [email protected]
contract DeploySafeFactory is Script {
GnosisSafeProxyFactory public proxyFactory;
GnosisSafe public gnosisSafeContract;
GnosisSafe public safeContract;
GnosisSafeProxy safeProxy;

// Deploys a GnosisSafeProxyFactory & GnosisSafe contract
function run() public {
vm.startBroadcast();
proxyFactory = new GnosisSafeProxyFactory();
gnosisSafeContract = new GnosisSafe();
safeContract = new GnosisSafe();
vm.stopBroadcast();
}

function newSafeProxy(bytes memory initializer) public returns (address) {
uint256 nonce = uint256(keccak256(initializer));
safeProxy = proxyFactory.createProxyWithNonce(
address(gnosisSafeContract), initializer, nonce
address(safeContract), initializer, nonce
);
return address(safeProxy);
}
Expand Down
76 changes: 38 additions & 38 deletions script/SkipExecutionOnBehalf.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
(sent, data) = receiverAddr.call{value: 1e5 gwei}("");
require(sent, "Failed to send Ether");

// Set keyperhelper gnosis safe to org
setGnosisSafe(rootAddr);
// Set keyperhelper safe to org
setSafe(rootAddr);
bytes memory emptyData;
bytes memory signatures = encodeSignaturesKeyperTx(
orgHash,
Expand Down Expand Up @@ -94,7 +94,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
address payable safeSquadA1Addr =
payable(keyperModule.getSquadSafeAddress(safeSquadA1));
address childSquadA1Addr = newKeyperSafe(4, 2);
setGnosisSafe(safeSquadA1Addr);
setSafe(safeSquadA1Addr);
bool result = createAddSquadTx(safeSquadA1, "ChildSquadA1");
assertEq(result, true);
// Create a child safe for squad A2
Expand All @@ -114,8 +114,8 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {

address fakeCaller = newKeyperSafe(4, 2);

// Set keyperhelper gnosis safe to Super Safe Squad A1
setGnosisSafe(safeSquadA1Addr);
// Set keyperhelper safe to Super Safe Squad A1
setSafe(safeSquadA1Addr);
bytes memory emptyData;
bytes memory signatures = encodeSignaturesKeyperTx(
orgHash,
Expand All @@ -126,8 +126,8 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
emptyData,
Enum.Operation(0)
);
// Set keyperhelper gnosis safe to Faker Caller
setGnosisSafe(fakeCaller);
// Set keyperhelper safe to Faker Caller
setSafe(fakeCaller);
bytes memory signatures2 = encodeSignaturesKeyperTx(
orgHash,
fakeCaller,
Expand All @@ -137,7 +137,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
emptyData,
Enum.Operation(0)
);
/// Wrapper of Execution On Behalf, for try to avoid the verification in the Gnosis Safe / Keyper Module
/// Wrapper of Execution On Behalf, for try to avoid the verification in the Safe / Keyper Module
bytes memory internalData = abi.encodeWithSignature(
"execTransactionOnBehalf(bytes32,address,address,address,uint256,bytes,uint8,bytes)",
orgHash,
Expand All @@ -151,7 +151,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
);

// Execute on behalf function from a authorized caller (Super Safe of These Tree) over child Squads but internal a Wrapper executeOnBehalf over Root Safe
setGnosisSafe(safeSquadA1Addr);
setSafe(safeSquadA1Addr);
result = execTransactionOnBehalfTx(
orgHash,
childSquadA1Addr,
Expand Down Expand Up @@ -193,7 +193,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
require(sent, "Failed to send Ether");

// Set Safe Role in FakeCaller (msg.sender) over Child Squad A1
setGnosisSafe(rootAddr);
setSafe(rootAddr);
result = createSetRoleTx(
uint8(DataTypes.Role.SAFE_LEAD_EXEC_ON_BEHALF_ONLY),
fakeCaller,
Expand All @@ -207,8 +207,8 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
bytes memory emptyData;
bytes memory signatures;

// Set keyperhelper gnosis safe to rootAddr
setGnosisSafe(childSquadA1Addr);
// Set keyperhelper safe to rootAddr
setSafe(childSquadA1Addr);
// Try to execute on behalf function from a not authorized caller child Squad A1 over Root Safe
bytes memory signatures2 = encodeSignaturesKeyperTx(
orgHash,
Expand Down Expand Up @@ -267,8 +267,8 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
(bool sent, bytes memory data) = safeSquadA1Addr.call{value: 2 gwei}("");
require(sent, "Failed to send Ether");

// Set keyperhelper gnosis safe to org
setGnosisSafe(rootAddr);
// Set keyperhelper safe to org
setSafe(rootAddr);
bytes memory emptyData;
bytes memory signatures = encodeSignaturesKeyperTx(
orgHash,
Expand Down Expand Up @@ -326,7 +326,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
address callerEOA = address(msg.sender);

// Owner of Root Safe sign args
setGnosisSafe(rootAddr);
setSafe(rootAddr);
bytes memory emptyData;
bytes memory signatures = encodeSignaturesKeyperTx(
orgHash,
Expand Down Expand Up @@ -384,8 +384,8 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
(sent, data) = safeSubSquadA1Addr.call{value: 100 gwei}("");
require(sent, "Failed to send Ether");

// Set keyperhelper gnosis safe to safeSquadA1
setGnosisSafe(safeSquadA1Addr);
// Set keyperhelper safe to safeSquadA1
setSafe(safeSquadA1Addr);
bytes memory emptyData;
bytes memory signatures = encodeSignaturesKeyperTx(
orgHash,
Expand All @@ -406,7 +406,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
);

// Execute on safe tx
setGnosisSafe(safeSquadA1Addr);
setSafe(safeSquadA1Addr);
bool result = execTransactionOnBehalfTx(
orgHash,
safeSquadA1Addr,
Expand Down Expand Up @@ -455,7 +455,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
address callerEOA = address(msg.sender);

// Owner of Target Safe signed args
setGnosisSafe(safeSubSquadA1Addr);
setSafe(safeSubSquadA1Addr);
bytes memory emptyData;
bytes memory signatures = encodeSignaturesKeyperTx(
orgHash,
Expand Down Expand Up @@ -511,7 +511,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
address callerEOA = address(msg.sender);

// Owner of Root Safe sign args
setGnosisSafe(rootAddr);
setSafe(rootAddr);
bytes memory emptyData;
bytes memory signatures = encodeInvalidSignaturesKeyperTx(
orgHash,
Expand Down Expand Up @@ -567,8 +567,8 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
(sent, data) = safeSquadA1Addr.call{value: 100 gwei}("");
require(sent, "Failed to send Ether");

// Set keyperhelper gnosis safe to safeSubSquadA1
setGnosisSafe(safeSubSquadA1Addr);
// Set keyperhelper safe to safeSubSquadA1
setSafe(safeSubSquadA1Addr);
bytes memory emptyData;
bytes memory signatures = encodeSignaturesKeyperTx(
orgHash,
Expand All @@ -580,7 +580,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
Enum.Operation(0)
);

setGnosisSafe(safeSubSquadA1Addr);
setSafe(safeSubSquadA1Addr);
// vm.expectRevert(Errors.NotAuthorizedExecOnBehalf.selector); // NotAuthorizedExecOnBehalf: Caller is not authorized to execute on behalf
bool result = execTransactionOnBehalfTx(
orgHash,
Expand Down Expand Up @@ -613,7 +613,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
console.log("Safe Squad A1 Test Execution On Behalf: ", safeSquadA1Addr);

// Try onbehalf with incorrect signers
setGnosisSafe(rootAddr);
setSafe(rootAddr);
bytes memory emptyData;
bytes memory signatures = encodeInvalidSignaturesKeyperTx(
orgHash,
Expand Down Expand Up @@ -661,8 +661,8 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
console.log("Safe Squad A1 Test Execution On Behalf: ", safeSquadA1Addr);
address fakeReceiver = address(0);

// Set keyperhelper gnosis safe to org
setGnosisSafe(rootAddr);
// Set keyperhelper safe to org
setSafe(rootAddr);
bytes memory emptyData;
bytes memory signatures = encodeSignaturesKeyperTx(
orgHash,
Expand Down Expand Up @@ -710,8 +710,8 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
console.log("Root address Test Execution On Behalf: ", rootAddr);
console.log("Safe Squad A1 Test Execution On Behalf: ", safeSquadA1Addr);

// Set keyperhelper gnosis safe to org
setGnosisSafe(rootAddr);
// Set keyperhelper safe to org
setSafe(rootAddr);
bytes memory emptyData;
bytes memory signatures = encodeSignaturesKeyperTx(
orgHash,
Expand All @@ -726,9 +726,9 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
// Execute on behalf function from a not authorized caller
// vm.expectRevert(
// abi.encodeWithSelector(
// Errors.InvalidGnosisSafe.selector, address(0)
// Errors.InvalidSafe.selector, address(0)
// )
// ); // InvalidGnosisSafe: Invalid Gnosis Safe
// ); // InvalidSafe: Invalid Safe
keyperModule.execTransactionOnBehalf(
orgHash,
rootAddr,
Expand Down Expand Up @@ -764,8 +764,8 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
console.log("Root address Test Execution On Behalf: ", rootAddr);
console.log("Safe Squad A1 Test Execution On Behalf: ", safeSquadA1Addr);

// Set keyperhelper gnosis safe to org
setGnosisSafe(rootAddr);
// Set keyperhelper safe to org
setSafe(rootAddr);
bytes memory emptyData;
bytes memory signatures = encodeSignaturesKeyperTx(
orgHash,
Expand Down Expand Up @@ -793,13 +793,13 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
vm.stopBroadcast();
}

// // Revert InvalidGnosisSafe() execTransactionOnBehalf : when param "targetSafe" is not a safe
// // Revert InvalidSafe() execTransactionOnBehalf : when param "targetSafe" is not a safe
// // Caller: rootAddr (org)
// // Caller Type: rootSafe
// // Caller Role: ROOT_SAFE, SAFE_LEAD
// // TargerSafe: fakeTargetSafe
// // TargetSafe Type: EOA
function testRevertInvalidGnosisSafeExecTransactionOnBehalf() public {
function testRevertInvalidSafeExecTransactionOnBehalf() public {
vm.startBroadcast();
(uint256 rootId, uint256 safeSquadA1) =
setupRootOrgAndOneSquad(orgName, squadA1Name);
Expand All @@ -810,8 +810,8 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
console.log("Safe Squad A1 Test Execution On Behalf: ", safeSquadA1Addr);
address fakeTargetSafe = address(0xFFE);

// Set keyperhelper gnosis safe to org
setGnosisSafe(rootAddr);
// Set keyperhelper safe to org
setSafe(rootAddr);
bytes memory emptyData;
bytes memory signatures = encodeSignaturesKeyperTx(
orgHash,
Expand All @@ -825,9 +825,9 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv {
// Execute on behalf function from a not authorized caller
// vm.expectRevert(
// abi.encodeWithSelector(
// Errors.InvalidGnosisSafe.selector, fakeTargetSafe
// Errors.InvalidSafe.selector, fakeTargetSafe
// )
// ); // InvalidGnosisSafe: Invalid Gnosis Safe
// ); // InvalidSafe: Invalid Safe
keyperModule.execTransactionOnBehalf(
orgHash,
rootAddr,
Expand Down
Loading

0 comments on commit b169a4a

Please sign in to comment.