Skip to content

Commit

Permalink
fix transfer function?
Browse files Browse the repository at this point in the history
  • Loading branch information
lorbke committed Nov 16, 2024
1 parent 38bd43c commit b87658e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions packages/foundry/contracts/Permit2Vault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ contract Permit2Vault {
function depositERC20Regular(IERC20 token, uint256 amount) external {
tokenBalancesByUser[msg.sender][token] += amount;
totalBalance += amount;
token.transfer(address(this), amount);
token.transfer(msg.sender, address(this), amount);
emit Deposited(address(msg.sender), amount);
}

Expand All @@ -81,7 +81,7 @@ contract Permit2Vault {
totalBalance -= amount;
// TODO: In production, use an ERC20 compatibility library to
// execute thie transfer to support non-compliant tokens.
token.transfer(msg.sender, amount);
token.transfer(address(this), msg.sender, amount);
emit Withdrawn(msg.sender, amount);
}

Expand All @@ -94,7 +94,7 @@ contract Permit2Vault {
}
}

function rescueTokens(IERC20 token, address recipient) external {
token.transfer(recipient, totalBalance);
}
// function rescueTokens(IERC20 token, address recipient) external {
// token.transfer(recipient, totalBalance);
// }
}
2 changes: 1 addition & 1 deletion packages/foundry/interfaces/IERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ pragma solidity ^0.8.28;

// Minimal ERC20 interface.
interface IERC20 {
function transfer(address to, uint256 amount) external returns (bool);
function transfer(address from, address to, uint256 amount) external returns (bool);
}

0 comments on commit b87658e

Please sign in to comment.