Skip to content

Commit

Permalink
Solidity version 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 268325b
Show file tree
Hide file tree
Showing 47 changed files with 124 additions and 54 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.7.0<0.8.0;

// IStateReceiver represents interface to receive state
interface IStateReceiver {
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.8.0;
pragma solidity >=0.7.0<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.8.0;
pragma solidity >=0.7.0<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.8.0;
pragma solidity >=0.7.0<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.8.0;
pragma solidity >=0.7.0<0.8.0;

import { FxBaseChildTunnel } from '../../tunnel/FxBaseChildTunnel.sol';
import { Create2 } from '../../lib/Create2.sol';
Expand Down
4 changes: 2 additions & 2 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.7.0<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";
import {SafeERC20,IERC20} from "../../lib/SafeERC20.sol";

/**
* @title FxERC20RootTunnel
Expand Down
2 changes: 1 addition & 1 deletion 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.7.0<0.8.0;

import { FxBaseChildTunnel } from '../../tunnel/FxBaseChildTunnel.sol';
import { Create2 } from '../../lib/Create2.sol';
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.8.0;
pragma solidity >=0.7.0<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.8.0;
pragma solidity >=0.7.0<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,11 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity >=0.7.0<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";
import {SafeERC20,IERC20} from "../../lib/SafeERC20.sol";


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

/**
* @dev Contract module which provides a basic access control mechanism, where
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/RLPReader.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @author Hamdi Allam hamdi.allam97@gmail.com
* Please reach out with any questions or concerns
*/
pragma solidity ^0.8.0;
pragma solidity >=0.7.0<0.8.0;

library RLPReader {
uint8 constant STRING_SHORT_START = 0x80;
Expand Down
77 changes: 77 additions & 0 deletions contracts/lib/SafeERC20.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// SPDX-License-Identifier: MIT

pragma solidity >=0.7.0<0.8.0;

import "./IERC20.sol";
import "./SafeMath.sol";
import "./Address.sol";

/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;

function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}

function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}

function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}

function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}

function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}

/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.

// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
require(address(token).isContract(), "SafeERC20: call to non-contract");

// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");

if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
2 changes: 1 addition & 1 deletion contracts/lib/SafeMath.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.7.0<0.8.0;

/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/Strings.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.7.0<0.8.0;

/**
* @dev String operations.
Expand Down
2 changes: 1 addition & 1 deletion contracts/tokens/FxERC1155.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.7.0<0.8.0;
import {ERC1155} from "../lib/ERC1155.sol";
import {IFxERC1155} from "./IFxERC1155.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/tokens/FxERC20.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.7.0<0.8.0;

import { ERC20 } from "../lib/ERC20.sol";
import { IFxERC20 } from "./IFxERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/tokens/FxERC721.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.7.0<0.8.0;

import { ERC721 } from "../lib/ERC721.sol";
import { IFxERC721 } from "./IFxERC721.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/tokens/IFxERC1155.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.7.0<0.8.0;

interface IFxERC1155 {
function fxManager() external returns(address);
Expand Down
2 changes: 1 addition & 1 deletion contracts/tokens/IFxERC20.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.7.0<0.8.0;

interface IFxERC20 {
function fxManager() external returns(address);
Expand Down
2 changes: 1 addition & 1 deletion contracts/tokens/IFxERC721.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.7.0<0.8.0;

interface IFxERC721 {
function fxManager() external returns(address);
Expand Down
Loading

0 comments on commit 268325b

Please sign in to comment.