Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowance module: Refactor Safe interface from GnosisSafe to Safe #489

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 Safe {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe 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,
Safe 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, Safe 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(Safe 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
Loading