Skip to content

Commit

Permalink
Merge pull request #10 from reddyismav/halborn-audit
Browse files Browse the repository at this point in the history
halborn audit fixes
  • Loading branch information
jdkanani authored Aug 5, 2021
2 parents d7c12b2 + 20c2b1f commit 1abe18c
Show file tree
Hide file tree
Showing 47 changed files with 8,424 additions and 17,348 deletions.
4 changes: 2 additions & 2 deletions contracts/FxChild.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;

// IStateReceiver represents interface to receive state
interface IStateReceiver {
Expand All @@ -19,7 +19,7 @@ contract FxChild is IStateReceiver {

event NewFxMessage(address rootMessageSender, address receiver, bytes data);

function setFxRoot(address _fxRoot) public {
function setFxRoot(address _fxRoot) external {
require(fxRoot == address(0x0));
fxRoot = _fxRoot;
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/FxRoot.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;


interface IStateSender {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import {IFxERC1155} from "../../tokens/IFxERC1155.sol";
import {ERC1155Holder} from "../../lib/ERC1155Holder.sol" ;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import {ERC1155} from "../../lib/ERC1155.sol";
import {ERC1155Holder} from "../../lib/ERC1155Holder.sol" ;
Expand Down
2 changes: 1 addition & 1 deletion contracts/examples/erc20-transfer/FxERC20ChildTunnel.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import { FxBaseChildTunnel } from '../../tunnel/FxBaseChildTunnel.sol';
import { Create2 } from '../../lib/Create2.sol';
Expand Down
8 changes: 5 additions & 3 deletions contracts/examples/erc20-transfer/FxERC20RootTunnel.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import { ERC20 } from "../../lib/ERC20.sol";
import { Create2 } from "../../lib/Create2.sol";
import { FxBaseRootTunnel } from "../../tunnel/FxBaseRootTunnel.sol";
import {SafeERC20,IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/**
* @title FxERC20RootTunnel
*/
contract FxERC20RootTunnel is FxBaseRootTunnel, Create2 {
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 @@ -57,7 +59,7 @@ contract FxERC20RootTunnel is FxBaseRootTunnel, Create2 {
}

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

// transfer from tokens to
ERC20(rootToken).transfer(
IERC20(rootToken).safeTransfer(
to,
amount
);
Expand Down
4 changes: 2 additions & 2 deletions contracts/examples/erc721-transfer/FxERC721ChildTunnel.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import { FxBaseChildTunnel } from '../../tunnel/FxBaseChildTunnel.sol';
import { Create2 } from '../../lib/Create2.sol';
Expand Down Expand Up @@ -33,7 +33,7 @@ contract FxERC721ChildTunnel is FxBaseChildTunnel, Create2, IERC721Receiver {
return this.onERC721Received.selector;
}

function withdraw(address childToken, uint256 tokenId, bytes memory data) public {
function withdraw(address childToken, uint256 tokenId, bytes memory data) external {
IFxERC721 childTokenContract = IFxERC721(childToken);
// child token contract will have root token
address rootToken = childTokenContract.connectedToken();
Expand Down
2 changes: 1 addition & 1 deletion contracts/examples/erc721-transfer/FxERC721RootTunnel.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import { ERC721 } from "../../lib/ERC721.sol";
import { Create2 } from "../../lib/Create2.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import { FxBaseChildTunnel } from '../../tunnel/FxBaseChildTunnel.sol';
import { Create2 } from '../../lib/Create2.sol';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import { Create2 } from "../../lib/Create2.sol";
import { SafeMath } from "../../lib/SafeMath.sol";
import { FxERC20 } from "../../tokens/FxERC20.sol";
import { FxBaseRootTunnel } from "../../tunnel/FxBaseRootTunnel.sol";
import {SafeERC20,IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";


/**
* @title FxMintableERC20RootTunnel
*/
contract FxMintableERC20RootTunnel is FxBaseRootTunnel, Create2 {
using SafeMath for uint256;
using SafeERC20 for IERC20;

// maybe DEPOSIT and MAP_TOKEN can be reduced to bytes4
bytes32 public constant DEPOSIT = keccak256("DEPOSIT");
Expand All @@ -30,7 +33,7 @@ contract FxMintableERC20RootTunnel is FxBaseRootTunnel, Create2 {
require(rootToChildTokens[rootToken] != address(0x0), "FxMintableERC20RootTunnel: NO_MAPPING_FOUND");

// transfer from depositor to this contract
FxERC20(rootToken).transferFrom(
IERC20(rootToken).safeTransferFrom(
msg.sender, // depositor
address(this), // manager contract
amount
Expand Down Expand Up @@ -68,7 +71,7 @@ contract FxMintableERC20RootTunnel is FxBaseRootTunnel, Create2 {
tokenObj.approve(address(this), amount);

// transfer from tokens
tokenObj.transferFrom(
IERC20(rootToken).safeTransferFrom(
address(this),
to,
amount
Expand Down Expand Up @@ -96,4 +99,3 @@ contract FxMintableERC20RootTunnel is FxBaseRootTunnel, Create2 {
return (size > 0);
}
}

2 changes: 1 addition & 1 deletion contracts/examples/state-transfer/FxStateChildTunnel.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import { FxBaseChildTunnel } from '../../tunnel/FxBaseChildTunnel.sol';

Expand Down
2 changes: 1 addition & 1 deletion contracts/examples/state-transfer/FxStateRootTunnel.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import { FxBaseRootTunnel } from '../../tunnel/FxBaseRootTunnel.sol';

Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/Address.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.7.3;
pragma solidity ^0.8.0;

/**
* @dev Collection of functions related to the address type
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/Context.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.7.3;
pragma solidity ^0.8.0;

/*
* @dev Provides information about the current execution context, including the
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/Create2.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;


// Create2 adds common methods for minimal proxy with create2
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/ERC1155.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/ERC1155Holder.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import "./ERC1155Receiver.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/ERC1155Receiver.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import "./IERC1155Receiver.sol";
import "./ERC165.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/ERC165.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import "./IERC165.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/ERC20.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import { IERC20 } from './IERC20.sol';
import { SafeMath } from './SafeMath.sol';
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/ERC721.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/IERC1155.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import "./IERC165.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/IERC1155MetadataURI.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import "./IERC1155.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/IERC1155Receiver.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import "./IERC165.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/IERC165.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.7.3;
pragma solidity ^0.8.0;

/**
* @dev Interface of the ERC165 standard, as defined in the
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/IERC20.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;

/**
* @dev Interface of the ERC20 standard as defined in the EIP.
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/IERC721.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import "./IERC165.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/IERC721Metadata.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import "./IERC721.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/IERC721Receiver.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.7.3;
pragma solidity ^0.8.0;

/**
* @title ERC721 token receiver interface
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/Merkle.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;

library Merkle {
function checkMembership(
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/MerklePatriciaProof.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;

import {RLPReader} from "./RLPReader.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/Ownable.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
pragma solidity ^0.8.0;

/**
* @dev Contract module which provides a basic access control mechanism, where
Expand Down
Loading

0 comments on commit 1abe18c

Please sign in to comment.