Skip to content

Commit

Permalink
Allowance module: Refactor Safe interface from GnosisSafe to Safe (#489)
Browse files Browse the repository at this point in the history
This PR:
- Renames the `GnosisSafe` interface to just `Safe`
  • Loading branch information
mmv08 authored Aug 29, 2024
1 parent e09f7fc commit e418cd8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions modules/allowances/contracts/AllowanceModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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");
Expand Down

0 comments on commit e418cd8

Please sign in to comment.