Skip to content

Commit

Permalink
uint to address conversion fixed for compiler version 0.8.0, IERC20 u…
Browse files Browse the repository at this point in the history
…sed for transfers. FxERC20 safe transfer to be implemented. Not done.
  • Loading branch information
reddyismav committed Jul 19, 2021
1 parent 82a17f7 commit e61b6ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions contracts/examples/erc20-transfer/FxERC20RootTunnel.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ pragma solidity ^0.8.0;
import { ERC20 } from "../../lib/ERC20.sol";
import { Create2 } from "../../lib/Create2.sol";
import { FxBaseRootTunnel } from "../../tunnel/FxBaseRootTunnel.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {SafeERC20,IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/**
* @title FxERC20RootTunnel
*/
contract FxERC20RootTunnel is FxBaseRootTunnel, Create2 {
using SafeERC20 for ERC20;
using SafeERC20 for IERC20;
// maybe DEPOSIT and MAP_TOKEN can be reduced to bytes4
bytes32 public constant DEPOSIT = keccak256("DEPOSIT");
bytes32 public constant MAP_TOKEN = keccak256("MAP_TOKEN");
Expand Down Expand Up @@ -59,7 +59,7 @@ contract FxERC20RootTunnel is FxBaseRootTunnel, Create2 {
}

// transfer from depositor to this contract
ERC20(rootToken).safeTransferFrom(
IERC20(rootToken).safeTransferFrom(
msg.sender, // depositor
address(this), // manager contract
amount
Expand All @@ -77,7 +77,7 @@ contract FxERC20RootTunnel is FxBaseRootTunnel, Create2 {
require(rootToChildTokens[rootToken] == childToken, "FxERC20RootTunnel: INVALID_MAPPING_ON_EXIT");

// transfer from tokens to
ERC20(rootToken).safeTransfer(
IERC20(rootToken).safeTransfer(
to,
amount
);
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/RLPReader.sol
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ library RLPReader {
// 1 byte for the length prefix
require(item.len == 21);

return address(toUint(item));
return address(uint160(toUint(item)));
}

function toUint(RLPItem memory item) internal pure returns (uint) {
Expand Down

0 comments on commit e61b6ae

Please sign in to comment.