Skip to content

Commit

Permalink
feat: add withdraw to function
Browse files Browse the repository at this point in the history
  • Loading branch information
MerlinEgalite committed Oct 16, 2024
1 parent e036e84 commit fe09255
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/Wrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,22 @@ contract Wrapper {
/* PUBLIC */

/// @dev Compliant to `ERC20Wrapper` contract from OZ for convenience.
function depositFor(address account, uint256 amount) public returns (bool) {
function depositFor(address account, uint256 value) public returns (bool) {
require(account != address(0), ZeroAddress());
require(account != address(this), SelfAddress());

IERC20(LEGACY_MORPHO).transferFrom(msg.sender, address(this), amount);
IERC20(NEW_MORPHO).transfer(account, amount);
IERC20(LEGACY_MORPHO).transferFrom(msg.sender, address(this), value);
IERC20(NEW_MORPHO).transfer(account, value);
return true;
}

/// @dev Compliant to `ERC20Wrapper` contract from OZ for convenience.
function withdrawTo(address account, uint256 value) public returns (bool) {
require(account != address(0), ZeroAddress());
require(account != address(this), SelfAddress());

IERC20(NEW_MORPHO).transferFrom(msg.sender, address(this), value);
IERC20(LEGACY_MORPHO).transfer(account, value);
return true;
}

Expand Down

0 comments on commit fe09255

Please sign in to comment.