Skip to content

Commit

Permalink
use SafeERC20 in ERC20Wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx committed May 27, 2021
1 parent 19076f6 commit bd86b24
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions contracts/token/ERC20/extensions/draft-ERC20Wrapper.sol
Expand Up @@ -3,6 +3,7 @@
pragma solidity ^0.8.0;

import "../ERC20.sol";
import "../utils/SafeERC20.sol";

abstract contract ERC20Wrapper is ERC20 {
IERC20 immutable public underlying;
Expand All @@ -12,14 +13,14 @@ abstract contract ERC20Wrapper is ERC20 {
}

function depositFor(address account, uint256 amount) public virtual returns (bool) {
require(underlying.transferFrom(_msgSender(), address(this), amount));
SafeERC20.safeTransferFrom(underlying, _msgSender(), address(this), amount);
_mint(account, amount);
return true;
}

function withdrawTo(address account, uint256 amount) public virtual returns (bool) {
_burn(_msgSender(), amount);
require(underlying.transfer(account, amount));
SafeERC20.safeTransfer(underlying, account, amount);
return true;
}
}

0 comments on commit bd86b24

Please sign in to comment.