Skip to content

Commit

Permalink
FIX: fix all comments @jozer-rami
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredolopez80 committed Jun 28, 2024
1 parent 04fa7e7 commit 2cc5fb8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 67 deletions.
20 changes: 11 additions & 9 deletions src/PalmeraModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ contract PalmeraModule is Auth, Helpers {
!_authority.doesUserHaveRole(
superSafeOrgSafe.safe, uint8(DataTypes.Role.SUPER_SAFE)
)
) && (superSafeOrgSafe.child.length > 0)
) && (superSafeOrgSafe.child.length != 0)
) {
_authority.setUserRole(
superSafeOrgSafe.safe, uint8(DataTypes.Role.SUPER_SAFE), true
Expand Down Expand Up @@ -419,7 +419,7 @@ contract PalmeraModule is Auth, Helpers {
// Check if the safe is Root Safe and has child
if (
((_safe.tier == DataTypes.Tier.ROOT) || (_safe.superSafe == 0))
&& (_safe.child.length > 0)
&& (_safe.child.length != 0)
) {
revert Errors.CannotRemoveSafeBeforeRemoveChild(_safe.child.length);
}
Expand Down Expand Up @@ -963,9 +963,10 @@ contract PalmeraModule is Auth, Helpers {
revert Errors.OrgNotRegistered(org);
}
/// Check if the Safe address is into an Safe mapping
for (uint256 i; i < indexSafe[org].length;) {
if (safes[org][indexSafe[org][i]].safe == safe) {
return indexSafe[org][i];
uint256[] memory indexSafeOrg = indexSafe[org];
for (uint256 i; i < indexSafeOrg.length;) {
if (safes[org][indexSafeOrg[i]].safe == safe) {
return indexSafeOrg[i];
}
unchecked {
++i;
Expand Down Expand Up @@ -1114,10 +1115,11 @@ contract PalmeraModule is Auth, Helpers {
/// @param org ID's of the organisation
/// @param safeId uint256 of the safe
function removeIndexSafe(bytes32 org, uint256 safeId) private {
for (uint256 i; i < indexSafe[org].length;) {
if (indexSafe[org][i] == safeId) {
indexSafe[org][i] = indexSafe[org][indexSafe[org].length - 1];
indexSafe[org].pop();
uint256[] storage indexSafeOrg = indexSafe[org];
for (uint256 i; i < indexSafeOrg.length;) {
if (indexSafeOrg[i] == safeId) {
indexSafeOrg[i] = indexSafeOrg[indexSafeOrg.length - 1];
indexSafeOrg.pop();
break;
}
unchecked {
Expand Down
58 changes: 0 additions & 58 deletions src/SigningUtils.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.23;

import {ECDSA} from "@openzeppelin/utils/cryptography/ECDSA.sol";
import {Enum} from "@safe-contracts/base/Executor.sol";

/// @title SigningUtils
Expand All @@ -21,61 +20,4 @@ abstract contract SigningUtils {
bytes signatures;
}

// /**
// * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
// * function returns the hash of the fully encoded EIP712 message for this domain.
// *
// * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
// *
// * ```solidity
// * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
// * keccak256("Mail(address to,string contents)"),
// * mailTo,
// * keccak256(bytes(mailContents))
// * )));
// * address signer = ECDSA.recover(digest, signature);
// * ```
// */
// function _hashTypedDataV4(bytes32 domainSeparator, bytes32 structHash)
// internal
// view
// virtual
// returns (bytes32)
// {
// return ECDSA.toTypedDataHash(domainSeparator, structHash);
// }

// /**
// * @dev Given a transaction, it creates a hash of the transaction that can be signed
// * @param domainSeparatorSafe Hash of the Safe domain separator
// * @param safeTx Safe transaction
// * @return Hash of the transaction
// */
// function createDigestExecTx(
// bytes32 domainSeparatorSafe,
// Transaction memory safeTx
// ) public view returns (bytes32) {
// bytes32 digest = _hashTypedDataV4(
// domainSeparatorSafe,
// keccak256(
// abi.encode(
// keccak256(
// "execTransaction(address to,uint256 value,bytes data,Enum.Operation operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,bytes signatures)"
// ),
// safeTx.to,
// safeTx.value,
// safeTx.data,
// safeTx.operation,
// safeTx.safeTxGas,
// safeTx.baseGas,
// safeTx.gasPrice,
// safeTx.gasToken,
// safeTx.refundReceiver,
// safeTx.signatures
// )
// )
// );

// return digest;
// }
}

0 comments on commit 2cc5fb8

Please sign in to comment.