11// SPDX-License-Identifier: MIT
2- pragma solidity 0.7.3 ;
2+ pragma solidity ^ 0.8.0 ;
33
44import { Create2 } from "../../lib/Create2.sol " ;
55import { SafeMath } from "../../lib/SafeMath.sol " ;
66import { FxERC20 } from "../../tokens/FxERC20.sol " ;
77import { FxBaseRootTunnel } from "../../tunnel/FxBaseRootTunnel.sol " ;
8+ import {SafeERC20,IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol " ;
9+
810
911/**
1012 * @title FxMintableERC20RootTunnel
1113 */
1214contract FxMintableERC20RootTunnel is FxBaseRootTunnel , Create2 {
1315 using SafeMath for uint256 ;
16+ using SafeERC20 for IERC20 ;
1417
1518 // maybe DEPOSIT and MAP_TOKEN can be reduced to bytes4
1619 bytes32 public constant DEPOSIT = keccak256 ("DEPOSIT " );
@@ -30,7 +33,7 @@ contract FxMintableERC20RootTunnel is FxBaseRootTunnel, Create2 {
3033 require (rootToChildTokens[rootToken] != address (0x0 ), "FxMintableERC20RootTunnel: NO_MAPPING_FOUND " );
3134
3235 // transfer from depositor to this contract
33- FxERC20 (rootToken).transferFrom (
36+ IERC20 (rootToken).safeTransferFrom (
3437 msg .sender , // depositor
3538 address (this ), // manager contract
3639 amount
@@ -68,7 +71,7 @@ contract FxMintableERC20RootTunnel is FxBaseRootTunnel, Create2 {
6871 tokenObj.approve (address (this ), amount);
6972
7073 // transfer from tokens
71- tokenObj. transferFrom (
74+ IERC20 (rootToken). safeTransferFrom (
7275 address (this ),
7376 to,
7477 amount
@@ -96,4 +99,3 @@ contract FxMintableERC20RootTunnel is FxBaseRootTunnel, Create2 {
9699 return (size > 0 );
97100 }
98101}
99-
0 commit comments