Skip to content

Commit

Permalink
solidity version 0.6.2 to 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
reddyismav committed Aug 12, 2021
1 parent 1abe18c commit 585d7a6
Show file tree
Hide file tree
Showing 45 changed files with 161 additions and 87 deletions.
2 changes: 1 addition & 1 deletion contracts/FxChild.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity >=0.6.2<0.7.0;

// IStateReceiver represents interface to receive state
interface IStateReceiver {
Expand Down
6 changes: 3 additions & 3 deletions contracts/FxRoot.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity >=0.6.2<0.7.0;


interface IStateSender {
Expand All @@ -17,7 +17,7 @@ contract FxRoot is IFxStateSender {
IStateSender public stateSender;
address public fxChild;

constructor(address _stateSender) {
constructor(address _stateSender) public {
stateSender = IStateSender(_stateSender);
}

Expand All @@ -26,7 +26,7 @@ contract FxRoot is IFxStateSender {
fxChild = _fxChild;
}

function sendMessageToChild(address _receiver, bytes calldata _data) public override {
function sendMessageToChild(address _receiver, bytes memory _data) public override {
bytes memory data = abi.encode(msg.sender, _receiver, _data);
stateSender.syncState(fxChild, data);
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/examples/erc1155-transfer/FxERC1155ChildTunnel.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity >=0.6.2<0.7.0;

import {IFxERC1155} from "../../tokens/IFxERC1155.sol";
import {ERC1155Holder} from "../../lib/ERC1155Holder.sol" ;
Expand All @@ -19,7 +19,7 @@ contract FxERC1155ChildTunnel is FxBaseChildTunnel, Create2, ERC1155Holder {
mapping(address => address) public rootToChildToken;
address public tokenTemplate;

constructor(address _fxChild, address _tokenTemplate) FxBaseChildTunnel(_fxChild) {
constructor(address _fxChild, address _tokenTemplate) FxBaseChildTunnel(_fxChild) public {
tokenTemplate = _tokenTemplate;
require(_isContract(_tokenTemplate), "Token template is not contract");
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/examples/erc1155-transfer/FxERC1155RootTunnel.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity >=0.6.2<0.7.0;

import {ERC1155} from "../../lib/ERC1155.sol";
import {ERC1155Holder} from "../../lib/ERC1155Holder.sol" ;
Expand All @@ -18,7 +18,7 @@ contract FxERC1155RootTunnel is FxBaseRootTunnel, Create2, ERC1155Holder {
mapping(address => address) public rootToChildTokens;
bytes32 public childTokenTemplateCodeHash;

constructor(address _checkpointManager, address _fxRoot, address _fxERC1155Token) FxBaseRootTunnel(_checkpointManager, _fxRoot) {
constructor(address _checkpointManager, address _fxRoot, address _fxERC1155Token) FxBaseRootTunnel(_checkpointManager, _fxRoot) public {
childTokenTemplateCodeHash = keccak256(minimalProxyCreationCode(_fxERC1155Token));
}

Expand Down
4 changes: 2 additions & 2 deletions 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.8.0;
pragma solidity >=0.6.2<0.7.0;

import { FxBaseChildTunnel } from '../../tunnel/FxBaseChildTunnel.sol';
import { Create2 } from '../../lib/Create2.sol';
Expand All @@ -21,7 +21,7 @@ contract FxERC20ChildTunnel is FxBaseChildTunnel, Create2 {
// token template
address public tokenTemplate;

constructor(address _fxChild, address _tokenTemplate) FxBaseChildTunnel(_fxChild) {
constructor(address _fxChild, address _tokenTemplate) FxBaseChildTunnel(_fxChild) public {
tokenTemplate = _tokenTemplate;
require(_isContract(_tokenTemplate), "Token template is not contract");
}
Expand Down
6 changes: 3 additions & 3 deletions contracts/examples/erc20-transfer/FxERC20RootTunnel.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity >=0.6.2<0.7.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";
import {SafeERC20,IERC20} from "../../lib/SafeERC20.sol";

/**
* @title FxERC20RootTunnel
Expand All @@ -20,7 +20,7 @@ contract FxERC20RootTunnel is FxBaseRootTunnel, Create2 {
mapping(address => address) public rootToChildTokens;
bytes32 public childTokenTemplateCodeHash;

constructor(address _checkpointManager, address _fxRoot, address _fxERC20Token) FxBaseRootTunnel(_checkpointManager, _fxRoot) {
constructor(address _checkpointManager, address _fxRoot, address _fxERC20Token) FxBaseRootTunnel(_checkpointManager, _fxRoot) public {
// compute child token template code hash
childTokenTemplateCodeHash = keccak256(minimalProxyCreationCode(_fxERC20Token));
}
Expand Down
8 changes: 4 additions & 4 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.8.0;
pragma solidity >=0.6.2<0.7.0;

import { FxBaseChildTunnel } from '../../tunnel/FxBaseChildTunnel.sol';
import { Create2 } from '../../lib/Create2.sol';
Expand All @@ -22,18 +22,18 @@ contract FxERC721ChildTunnel is FxBaseChildTunnel, Create2, IERC721Receiver {
// token template
address public tokenTemplate;

constructor(address _fxChild, address _tokenTemplate) FxBaseChildTunnel(_fxChild) {
constructor(address _fxChild, address _tokenTemplate) FxBaseChildTunnel(_fxChild) public {
tokenTemplate = _tokenTemplate;
require(_isContract(_tokenTemplate), "Token template is not contract");
}

function onERC721Received(
address /* operator */, address /* from */, uint256 /* tokenId */, bytes calldata /* data */
) external pure override returns (bytes4) {
) external override returns (bytes4) {
return this.onERC721Received.selector;
}

function withdraw(address childToken, uint256 tokenId, bytes memory data) external {
function withdraw(address childToken, uint256 tokenId, bytes calldata data) external {
IFxERC721 childTokenContract = IFxERC721(childToken);
// child token contract will have root token
address rootToken = childTokenContract.connectedToken();
Expand Down
6 changes: 3 additions & 3 deletions 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.8.0;
pragma solidity >=0.6.2<0.7.0;

import { ERC721 } from "../../lib/ERC721.sol";
import { Create2 } from "../../lib/Create2.sol";
Expand All @@ -20,14 +20,14 @@ contract FxERC721RootTunnel is FxBaseRootTunnel, Create2, IERC721Receiver {
bytes32 public childTokenTemplateCodeHash;

constructor(address _checkpointManager, address _fxRoot, address _fxERC721Token)
FxBaseRootTunnel(_checkpointManager, _fxRoot) {
FxBaseRootTunnel(_checkpointManager, _fxRoot) public {
// compute child token template code hash
childTokenTemplateCodeHash = keccak256(minimalProxyCreationCode(_fxERC721Token));
}

function onERC721Received(
address /* operator */, address /* from */, uint256 /* tokenId */, bytes calldata /* data */
) external pure override returns (bytes4) {
) external override returns (bytes4) {
return this.onERC721Received.selector;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity >=0.6.2<0.7.0;

import { FxBaseChildTunnel } from '../../tunnel/FxBaseChildTunnel.sol';
import { Create2 } from '../../lib/Create2.sol';
Expand All @@ -24,7 +24,7 @@ contract FxMintableERC20ChildTunnel is Ownable, FxBaseChildTunnel, Create2 {
// root token tempalte code hash
bytes32 public rootTokenTemplateCodeHash;

constructor(address _fxChild, address _childTokenTemplate, address _rootTokenTemplate) FxBaseChildTunnel(_fxChild) {
constructor(address _fxChild, address _childTokenTemplate, address _rootTokenTemplate) FxBaseChildTunnel(_fxChild) public {
childTokenTemplate = _childTokenTemplate;
require(_isContract(_childTokenTemplate), "Token template is not contract");
// compute root token template code hash
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity >=0.6.2<0.7.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";
import {SafeERC20,IERC20} from "../../lib/SafeERC20.sol";


/**
Expand All @@ -23,7 +23,7 @@ contract FxMintableERC20RootTunnel is FxBaseRootTunnel, Create2 {
address public rootTokenTemplate;
bytes32 public childTokenTemplateCodeHash;

constructor(address _checkpointManager, address _fxRoot, address _rootTokenTemplate) FxBaseRootTunnel(_checkpointManager, _fxRoot) {
constructor(address _checkpointManager, address _fxRoot, address _rootTokenTemplate) FxBaseRootTunnel(_checkpointManager, _fxRoot) public {
rootTokenTemplate = _rootTokenTemplate;
}

Expand Down
4 changes: 2 additions & 2 deletions 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.8.0;
pragma solidity >=0.6.2<0.7.0;

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

Expand All @@ -11,7 +11,7 @@ contract FxStateChildTunnel is FxBaseChildTunnel {
address public latestRootMessageSender;
bytes public latestData;

constructor(address _fxChild) FxBaseChildTunnel(_fxChild) {
constructor(address _fxChild) FxBaseChildTunnel(_fxChild) public {

}

Expand Down
4 changes: 2 additions & 2 deletions 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.8.0;
pragma solidity >=0.6.2<0.7.0;

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

Expand All @@ -9,7 +9,7 @@ import { FxBaseRootTunnel } from '../../tunnel/FxBaseRootTunnel.sol';
contract FxStateRootTunnel is FxBaseRootTunnel {
bytes public latestData;

constructor(address _checkpointManager, address _fxRoot) FxBaseRootTunnel(_checkpointManager, _fxRoot) {}
constructor(address _checkpointManager, address _fxRoot) FxBaseRootTunnel(_checkpointManager, _fxRoot) public {}

function _processMessageFromChild(bytes memory data) internal override {
latestData = data;
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.8.0;
pragma solidity >=0.6.2<0.7.0;

/**
* @dev Collection of functions related to the address type
Expand Down
4 changes: 2 additions & 2 deletions 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.8.0;
pragma solidity >=0.6.2<0.7.0;

/*
* @dev Provides information about the current execution context, including the
Expand All @@ -17,7 +17,7 @@ abstract contract Context {
return msg.sender;
}

function _msgData() internal view virtual returns (bytes calldata) {
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
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.8.0;
pragma solidity >=0.6.2<0.7.0;


// Create2 adds common methods for minimal proxy with create2
Expand Down
7 changes: 3 additions & 4 deletions 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.8.0;
pragma solidity >=0.6.2<0.7.0;

import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
Expand Down Expand Up @@ -33,10 +33,9 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
/**
* @dev See {IERC165-supportsInterface}.
*/
bytes4 INTERFACE_ID = 0x01ffc9a7;
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155).interfaceId
|| interfaceId == type(IERC1155MetadataURI).interfaceId
|| super.supportsInterface(interfaceId);
return interfaceId == INTERFACE_ID;
}

/**
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.8.0;
pragma solidity >=0.6.2<0.7.0;

import "./ERC1155Receiver.sol";

Expand Down
6 changes: 3 additions & 3 deletions 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.8.0;
pragma solidity >=0.6.2<0.7.0;

import "./IERC1155Receiver.sol";
import "./ERC165.sol";
Expand All @@ -12,8 +12,8 @@ abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
/**
* @dev See {IERC165-supportsInterface}.
*/
bytes4 INTERFACE_ID = 0x01ffc9a7;
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155Receiver).interfaceId
|| super.supportsInterface(interfaceId);
return interfaceId == INTERFACE_ID;
}
}
5 changes: 3 additions & 2 deletions 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.8.0;
pragma solidity >=0.6.2<0.7.0;

import "./IERC165.sol";

Expand All @@ -22,7 +22,8 @@ abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
bytes4 INTERFACE = 0x01ffc9a7;
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
return interfaceId == INTERFACE;
}
}
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.8.0;
pragma solidity >=0.6.2<0.7.0;

import { IERC20 } from './IERC20.sol';
import { SafeMath } from './SafeMath.sol';
Expand Down
7 changes: 3 additions & 4 deletions 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.8.0;
pragma solidity >=0.6.2<0.7.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
Expand Down Expand Up @@ -40,10 +40,9 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
/**
* @dev See {IERC165-supportsInterface}.
*/
bytes4 INTERFACE_ID = 0x01ffc9a7;
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC721).interfaceId
|| interfaceId == type(IERC721Metadata).interfaceId
|| super.supportsInterface(interfaceId);
return interfaceId == INTERFACE_ID;
}

/**
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.8.0;
pragma solidity >=0.6.2<0.7.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.8.0;
pragma solidity >=0.6.2<0.7.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.8.0;
pragma solidity >=0.6.2<0.7.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.8.0;
pragma solidity >=0.6.2<0.7.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.8.0;
pragma solidity >=0.6.2<0.7.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.8.0;
pragma solidity >=0.6.2<0.7.0;

import "./IERC165.sol";

Expand Down
Loading

0 comments on commit 585d7a6

Please sign in to comment.