From e418cd84bc12144635477c9662c04e7692c3c7d7 Mon Sep 17 00:00:00 2001 From: Mikhail <16622558+mmv08@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:03:15 +0200 Subject: [PATCH] Allowance module: Refactor Safe interface from GnosisSafe to Safe (#489) This PR: - Renames the `GnosisSafe` interface to just `Safe` --- modules/allowances/contracts/AllowanceModule.sol | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/allowances/contracts/AllowanceModule.sol b/modules/allowances/contracts/AllowanceModule.sol index 5a83a4bd0..8a3525a5b 100644 --- a/modules/allowances/contracts/AllowanceModule.sol +++ b/modules/allowances/contracts/AllowanceModule.sol @@ -4,7 +4,7 @@ pragma solidity >=0.7.0 <0.8.0; import "./Enum.sol"; import "./SignatureDecoder.sol"; -interface GnosisSafe { +interface ISafe { /// @dev Allows a Module to execute a Safe transaction without any further confirmations. /// @param to Destination address of module transaction. /// @param value Ether value of module transaction. @@ -150,7 +150,7 @@ contract AllowanceModule is SignatureDecoder { /// @param delegate Delegate whose allowance should be updated. /// @param signature Signature generated by the delegate to authorize the transfer. function executeAllowanceTransfer( - GnosisSafe safe, + ISafe safe, address token, address payable to, uint96 amount, @@ -239,7 +239,7 @@ contract AllowanceModule is SignatureDecoder { return keccak256(generateTransferHashData(safe, token, to, amount, paymentToken, payment, nonce)); } - function checkSignature(address expectedDelegate, bytes memory signature, bytes memory transferHashData, GnosisSafe safe) private view { + function checkSignature(address expectedDelegate, bytes memory signature, bytes memory transferHashData, ISafe safe) private view { address signer = recoverSignature(signature, transferHashData); require( expectedDelegate == signer && delegates[address(safe)][uint48(signer)].delegate == signer, @@ -261,7 +261,7 @@ contract AllowanceModule is SignatureDecoder { if (v == 0) { revert("Contract signatures are not supported by this module"); } else if (v == 1) { - // If v is 1 we also use msg.sender, this is so that we are compatible to the GnosisSafe signature scheme + // If v is 1 we also use msg.sender, this is so that we are compatible to the Safe signature scheme owner = msg.sender; } else if (v > 30) { // To support eth_sign and similar we adjust v and hash the transferHashData with the Ethereum message prefix before applying ecrecover @@ -274,7 +274,7 @@ contract AllowanceModule is SignatureDecoder { require(owner != address(0), "owner != address(0)"); } - function transfer(GnosisSafe safe, address token, address payable to, uint96 amount) private { + function transfer(ISafe safe, address token, address payable to, uint96 amount) private { if (token == address(0)) { // solium-disable-next-line security/no-send require(safe.execTransactionFromModule(to, amount, "", Enum.Operation.Call), "Could not execute ether transfer");