Skip to content

Commit 268325b

Browse files
committed
Solidity version 0.7.0
1 parent 1abe18c commit 268325b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+124
-54
lines changed

contracts/FxChild.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
// IStateReceiver represents interface to receive state
55
interface IStateReceiver {

contracts/FxRoot.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44

55
interface IStateSender {

contracts/examples/erc1155-transfer/FxERC1155ChildTunnel.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
import {IFxERC1155} from "../../tokens/IFxERC1155.sol";
55
import {ERC1155Holder} from "../../lib/ERC1155Holder.sol" ;

contracts/examples/erc1155-transfer/FxERC1155RootTunnel.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
import {ERC1155} from "../../lib/ERC1155.sol";
55
import {ERC1155Holder} from "../../lib/ERC1155Holder.sol" ;

contracts/examples/erc20-transfer/FxERC20ChildTunnel.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
import { FxBaseChildTunnel } from '../../tunnel/FxBaseChildTunnel.sol';
55
import { Create2 } from '../../lib/Create2.sol';

contracts/examples/erc20-transfer/FxERC20RootTunnel.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
import { ERC20 } from "../../lib/ERC20.sol";
55
import { Create2 } from "../../lib/Create2.sol";
66
import { FxBaseRootTunnel } from "../../tunnel/FxBaseRootTunnel.sol";
7-
import {SafeERC20,IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
7+
import {SafeERC20,IERC20} from "../../lib/SafeERC20.sol";
88

99
/**
1010
* @title FxERC20RootTunnel

contracts/examples/erc721-transfer/FxERC721ChildTunnel.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
import { FxBaseChildTunnel } from '../../tunnel/FxBaseChildTunnel.sol';
55
import { Create2 } from '../../lib/Create2.sol';

contracts/examples/erc721-transfer/FxERC721RootTunnel.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
import { ERC721 } from "../../lib/ERC721.sol";
55
import { Create2 } from "../../lib/Create2.sol";

contracts/examples/mintable-erc20-transfer/FxMintableERC20ChildTunnel.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
import { FxBaseChildTunnel } from '../../tunnel/FxBaseChildTunnel.sol';
55
import { Create2 } from '../../lib/Create2.sol';

contracts/examples/mintable-erc20-transfer/FxMintableERC20RootTunnel.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
import { Create2 } from "../../lib/Create2.sol";
55
import { SafeMath } from "../../lib/SafeMath.sol";
66
import { FxERC20 } from "../../tokens/FxERC20.sol";
77
import { FxBaseRootTunnel } from "../../tunnel/FxBaseRootTunnel.sol";
8-
import {SafeERC20,IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
8+
import {SafeERC20,IERC20} from "../../lib/SafeERC20.sol";
99

1010

1111
/**

contracts/examples/state-transfer/FxStateChildTunnel.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

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

contracts/examples/state-transfer/FxStateRootTunnel.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

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

contracts/lib/Address.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.0;
3+
pragma solidity >=0.7.0<0.8.0;
44

55
/**
66
* @dev Collection of functions related to the address type

contracts/lib/Context.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.0;
3+
pragma solidity >=0.7.0<0.8.0;
44

55
/*
66
* @dev Provides information about the current execution context, including the

contracts/lib/Create2.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44

55
// Create2 adds common methods for minimal proxy with create2

contracts/lib/ERC1155.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.0;
3+
pragma solidity >=0.7.0<0.8.0;
44

55
import "./IERC1155.sol";
66
import "./IERC1155Receiver.sol";

contracts/lib/ERC1155Holder.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.0;
3+
pragma solidity >=0.7.0<0.8.0;
44

55
import "./ERC1155Receiver.sol";
66

contracts/lib/ERC1155Receiver.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.0;
3+
pragma solidity >=0.7.0<0.8.0;
44

55
import "./IERC1155Receiver.sol";
66
import "./ERC165.sol";

contracts/lib/ERC165.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.0;
3+
pragma solidity >=0.7.0<0.8.0;
44

55
import "./IERC165.sol";
66

contracts/lib/ERC20.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
import { IERC20 } from './IERC20.sol';
55
import { SafeMath } from './SafeMath.sol';

contracts/lib/ERC721.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.0;
3+
pragma solidity >=0.7.0<0.8.0;
44

55
import "./IERC721.sol";
66
import "./IERC721Receiver.sol";

contracts/lib/IERC1155.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.0;
3+
pragma solidity >=0.7.0<0.8.0;
44

55
import "./IERC165.sol";
66

contracts/lib/IERC1155MetadataURI.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.0;
3+
pragma solidity >=0.7.0<0.8.0;
44

55
import "./IERC1155.sol";
66

contracts/lib/IERC1155Receiver.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.0;
3+
pragma solidity >=0.7.0<0.8.0;
44

55
import "./IERC165.sol";
66

contracts/lib/IERC165.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.0;
3+
pragma solidity >=0.7.0<0.8.0;
44

55
/**
66
* @dev Interface of the ERC165 standard, as defined in the

contracts/lib/IERC20.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
/**
55
* @dev Interface of the ERC20 standard as defined in the EIP.

contracts/lib/IERC721.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.0;
3+
pragma solidity >=0.7.0<0.8.0;
44

55
import "./IERC165.sol";
66

contracts/lib/IERC721Metadata.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.0;
3+
pragma solidity >=0.7.0<0.8.0;
44

55
import "./IERC721.sol";
66

contracts/lib/IERC721Receiver.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.0;
3+
pragma solidity >=0.7.0<0.8.0;
44

55
/**
66
* @title ERC721 token receiver interface

contracts/lib/Merkle.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
library Merkle {
55
function checkMembership(

contracts/lib/MerklePatriciaProof.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

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

contracts/lib/Ownable.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
/**
55
* @dev Contract module which provides a basic access control mechanism, where

contracts/lib/RLPReader.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @author Hamdi Allam [email protected]
33
* Please reach out with any questions or concerns
44
*/
5-
pragma solidity ^0.8.0;
5+
pragma solidity >=0.7.0<0.8.0;
66

77
library RLPReader {
88
uint8 constant STRING_SHORT_START = 0x80;

contracts/lib/SafeERC20.sol

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
pragma solidity >=0.7.0<0.8.0;
4+
5+
import "./IERC20.sol";
6+
import "./SafeMath.sol";
7+
import "./Address.sol";
8+
9+
/**
10+
* @title SafeERC20
11+
* @dev Wrappers around ERC20 operations that throw on failure (when the token
12+
* contract returns false). Tokens that return no value (and instead revert or
13+
* throw on failure) are also supported, non-reverting calls are assumed to be
14+
* successful.
15+
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
16+
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
17+
*/
18+
library SafeERC20 {
19+
using SafeMath for uint256;
20+
using Address for address;
21+
22+
function safeTransfer(IERC20 token, address to, uint256 value) internal {
23+
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
24+
}
25+
26+
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
27+
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
28+
}
29+
30+
function safeApprove(IERC20 token, address spender, uint256 value) internal {
31+
// safeApprove should only be called when setting an initial allowance,
32+
// or when resetting it to zero. To increase and decrease it, use
33+
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
34+
// solhint-disable-next-line max-line-length
35+
require((value == 0) || (token.allowance(address(this), spender) == 0),
36+
"SafeERC20: approve from non-zero to non-zero allowance"
37+
);
38+
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
39+
}
40+
41+
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
42+
uint256 newAllowance = token.allowance(address(this), spender).add(value);
43+
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
44+
}
45+
46+
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
47+
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
48+
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
49+
}
50+
51+
/**
52+
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
53+
* on the return value: the return value is optional (but if data is returned, it must not be false).
54+
* @param token The token targeted by the call.
55+
* @param data The call data (encoded using abi.encode or one of its variants).
56+
*/
57+
function _callOptionalReturn(IERC20 token, bytes memory data) private {
58+
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
59+
// we're implementing it ourselves.
60+
61+
// A Solidity high level call has three parts:
62+
// 1. The target address is checked to verify it contains contract code
63+
// 2. The call itself is made, and success asserted
64+
// 3. The return value is decoded, which in turn checks the size of the returned data.
65+
// solhint-disable-next-line max-line-length
66+
require(address(token).isContract(), "SafeERC20: call to non-contract");
67+
68+
// solhint-disable-next-line avoid-low-level-calls
69+
(bool success, bytes memory returndata) = address(token).call(data);
70+
require(success, "SafeERC20: low-level call failed");
71+
72+
if (returndata.length > 0) { // Return data is optional
73+
// solhint-disable-next-line max-line-length
74+
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
75+
}
76+
}
77+
}

contracts/lib/SafeMath.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
/**
55
* @dev Wrappers over Solidity's arithmetic operations with added overflow

contracts/lib/Strings.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.0;
3+
pragma solidity >=0.7.0<0.8.0;
44

55
/**
66
* @dev String operations.

contracts/tokens/FxERC1155.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33
import {ERC1155} from "../lib/ERC1155.sol";
44
import {IFxERC1155} from "./IFxERC1155.sol";
55

contracts/tokens/FxERC20.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
import { ERC20 } from "../lib/ERC20.sol";
55
import { IFxERC20 } from "./IFxERC20.sol";

contracts/tokens/FxERC721.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
import { ERC721 } from "../lib/ERC721.sol";
55
import { IFxERC721 } from "./IFxERC721.sol";

contracts/tokens/IFxERC1155.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
interface IFxERC1155 {
55
function fxManager() external returns(address);

contracts/tokens/IFxERC20.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
interface IFxERC20 {
55
function fxManager() external returns(address);

contracts/tokens/IFxERC721.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
2+
pragma solidity >=0.7.0<0.8.0;
33

44
interface IFxERC721 {
55
function fxManager() external returns(address);

0 commit comments

Comments
 (0)