aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/2.0.0/test
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/src/2.0.0/test')
-rw-r--r--packages/contracts/src/2.0.0/test/DummyERC20Token/DummyERC20Token.sol77
-rw-r--r--packages/contracts/src/2.0.0/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol69
-rw-r--r--packages/contracts/src/2.0.0/test/DummyERC20Token/DummyNoReturnERC20Token.sol115
-rw-r--r--packages/contracts/src/2.0.0/test/DummyERC721Receiver/DummyERC721Receiver.sol67
-rw-r--r--packages/contracts/src/2.0.0/test/DummyERC721Receiver/InvalidERC721Receiver.sol66
-rw-r--r--packages/contracts/src/2.0.0/test/DummyERC721Token/DummyERC721Token.sol63
-rw-r--r--packages/contracts/src/2.0.0/test/ReentrantERC20Token/ReentrantERC20Token.sol188
-rw-r--r--packages/contracts/src/2.0.0/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol37
-rw-r--r--packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol58
-rw-r--r--packages/contracts/src/2.0.0/test/TestConstants/TestConstants.sol57
-rw-r--r--packages/contracts/src/2.0.0/test/TestExchangeInternals/TestExchangeInternals.sol191
-rw-r--r--packages/contracts/src/2.0.0/test/TestLibBytes/TestLibBytes.sol269
-rw-r--r--packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol152
-rw-r--r--packages/contracts/src/2.0.0/test/TestSignatureValidator/TestSignatureValidator.sol45
-rw-r--r--packages/contracts/src/2.0.0/test/TestStaticCallReceiver/TestStaticCallReceiver.sol81
15 files changed, 0 insertions, 1535 deletions
diff --git a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyERC20Token.sol b/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyERC20Token.sol
deleted file mode 100644
index 412c5d1ad..000000000
--- a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyERC20Token.sol
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity 0.4.24;
-
-import "../../utils/Ownable/Ownable.sol";
-import "../../tokens/ERC20Token/MintableERC20Token.sol";
-
-
-contract DummyERC20Token is
- Ownable,
- MintableERC20Token
-{
- string public name;
- string public symbol;
- uint256 public decimals;
- uint256 public constant MAX_MINT_AMOUNT = 10000000000000000000000;
-
- constructor (
- string _name,
- string _symbol,
- uint256 _decimals,
- uint256 _totalSupply
- )
- public
- {
- name = _name;
- symbol = _symbol;
- decimals = _decimals;
- _totalSupply = _totalSupply;
- balances[msg.sender] = _totalSupply;
- }
-
- /// @dev Sets the balance of target address
- /// @param _target Address or which balance will be updated
- /// @param _value New balance of target address
- function setBalance(address _target, uint256 _value)
- external
- onlyOwner
- {
- uint256 currBalance = balances[_target];
- if (_value < currBalance) {
- _totalSupply = safeSub(_totalSupply, safeSub(currBalance, _value));
- } else {
- _totalSupply = safeAdd(_totalSupply, safeSub(_value, currBalance));
- }
- balances[_target] = _value;
- }
-
- /// @dev Mints new tokens for sender
- /// @param _value Amount of tokens to mint
- function mint(uint256 _value)
- external
- {
- require(
- _value <= MAX_MINT_AMOUNT,
- "VALUE_TOO_LARGE"
- );
-
- _mint(msg.sender, _value);
- }
-}
diff --git a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol b/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol
deleted file mode 100644
index 733d4437e..000000000
--- a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity 0.4.24;
-
-import "./DummyERC20Token.sol";
-
-
-// solhint-disable no-empty-blocks
-contract DummyMultipleReturnERC20Token is
- DummyERC20Token
-{
- constructor (
- string _name,
- string _symbol,
- uint256 _decimals,
- uint256 _totalSupply
- )
- public
- DummyERC20Token(
- _name,
- _symbol,
- _decimals,
- _totalSupply
- )
- {}
-
- /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`
- /// @param _from The address of the sender
- /// @param _to The address of the recipient
- /// @param _value The amount of token to be transferred
- function transferFrom(
- address _from,
- address _to,
- uint256 _value
- )
- external
- returns (bool)
- {
- emit Transfer(
- _from,
- _to,
- _value
- );
-
- // HACK: This contract will not compile if we remove `returns (bool)`, so we manually return 64 bytes (equiavalent to true, true)
- assembly {
- mstore(0, 1)
- mstore(32, 1)
- return(0, 64)
- }
- }
-}
-
diff --git a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyNoReturnERC20Token.sol b/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyNoReturnERC20Token.sol
deleted file mode 100644
index e16825a16..000000000
--- a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyNoReturnERC20Token.sol
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity 0.4.24;
-
-import "./DummyERC20Token.sol";
-
-
-// solhint-disable no-empty-blocks
-contract DummyNoReturnERC20Token is
- DummyERC20Token
-{
- constructor (
- string _name,
- string _symbol,
- uint256 _decimals,
- uint256 _totalSupply
- )
- public
- DummyERC20Token(
- _name,
- _symbol,
- _decimals,
- _totalSupply
- )
- {}
-
- /// @dev send `value` token to `to` from `msg.sender`
- /// @param _to The address of the recipient
- /// @param _value The amount of token to be transferred
- function transfer(address _to, uint256 _value)
- external
- returns (bool)
- {
- require(
- balances[msg.sender] >= _value,
- "ERC20_INSUFFICIENT_BALANCE"
- );
- require(
- balances[_to] + _value >= balances[_to],
- "UINT256_OVERFLOW"
- );
-
- balances[msg.sender] -= _value;
- balances[_to] += _value;
-
- emit Transfer(
- msg.sender,
- _to,
- _value
- );
-
- // HACK: This contract will not compile if we remove `returns (bool)`, so we manually return no data
- assembly {
- return(0, 0)
- }
- }
-
- /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`
- /// @param _from The address of the sender
- /// @param _to The address of the recipient
- /// @param _value The amount of token to be transferred
- function transferFrom(
- address _from,
- address _to,
- uint256 _value
- )
- external
- returns (bool)
- {
- require(
- balances[_from] >= _value,
- "ERC20_INSUFFICIENT_BALANCE"
- );
- require(
- allowed[_from][msg.sender] >= _value,
- "ERC20_INSUFFICIENT_ALLOWANCE"
- );
- require(
- balances[_to] + _value >= balances[_to],
- "UINT256_OVERFLOW"
- );
-
- balances[_to] += _value;
- balances[_from] -= _value;
- allowed[_from][msg.sender] -= _value;
-
- emit Transfer(
- _from,
- _to,
- _value
- );
-
- // HACK: This contract will not compile if we remove `returns (bool)`, so we manually return no data
- assembly {
- return(0, 0)
- }
- }
-}
-
diff --git a/packages/contracts/src/2.0.0/test/DummyERC721Receiver/DummyERC721Receiver.sol b/packages/contracts/src/2.0.0/test/DummyERC721Receiver/DummyERC721Receiver.sol
deleted file mode 100644
index 6c8371559..000000000
--- a/packages/contracts/src/2.0.0/test/DummyERC721Receiver/DummyERC721Receiver.sol
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity 0.4.24;
-
-import "../../tokens/ERC721Token/IERC721Receiver.sol";
-
-
-contract DummyERC721Receiver is
- IERC721Receiver
-{
- // Function selector for ERC721Receiver.onERC721Received
- // 0x150b7a02
- bytes4 constant internal ERC721_RECEIVED = bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
-
- event TokenReceived(
- address operator,
- address from,
- uint256 tokenId,
- bytes data
- );
-
- /// @notice Handle the receipt of an NFT
- /// @dev The ERC721 smart contract calls this function on the recipient
- /// after a `transfer`. This function MAY throw to revert and reject the
- /// transfer. Return of other than the magic value MUST result in the
- /// transaction being reverted.
- /// Note: the contract address is always the message sender.
- /// @param _operator The address which called `safeTransferFrom` function
- /// @param _from The address which previously owned the token
- /// @param _tokenId The NFT identifier which is being transferred
- /// @param _data Additional data with no specified format
- /// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
- /// unless throwing
- function onERC721Received(
- address _operator,
- address _from,
- uint256 _tokenId,
- bytes _data
- )
- external
- returns (bytes4)
- {
- emit TokenReceived(
- _operator,
- _from,
- _tokenId,
- _data
- );
- return ERC721_RECEIVED;
- }
-}
diff --git a/packages/contracts/src/2.0.0/test/DummyERC721Receiver/InvalidERC721Receiver.sol b/packages/contracts/src/2.0.0/test/DummyERC721Receiver/InvalidERC721Receiver.sol
deleted file mode 100644
index 309633bf5..000000000
--- a/packages/contracts/src/2.0.0/test/DummyERC721Receiver/InvalidERC721Receiver.sol
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity 0.4.24;
-
-import "../../tokens/ERC721Token/IERC721Receiver.sol";
-
-
-contract InvalidERC721Receiver is
- IERC721Receiver
-{
- // Actual function signature is `onERC721Received(address,address,uint256,bytes)`
- bytes4 constant internal INVALID_ERC721_RECEIVED = bytes4(keccak256("onERC721Received(address,uint256,bytes)"));
-
- event TokenReceived(
- address operator,
- address from,
- uint256 tokenId,
- bytes data
- );
-
- /// @notice Handle the receipt of an NFT
- /// @dev The ERC721 smart contract calls this function on the recipient
- /// after a `transfer`. This function MAY throw to revert and reject the
- /// transfer. Return of other than the magic value MUST result in the
- /// transaction being reverted.
- /// Note: the contract address is always the message sender.
- /// @param _operator The address which called `safeTransferFrom` function
- /// @param _from The address which previously owned the token
- /// @param _tokenId The NFT identifier which is being transferred
- /// @param _data Additional data with no specified format
- /// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
- /// unless throwing
- function onERC721Received(
- address _operator,
- address _from,
- uint256 _tokenId,
- bytes _data
- )
- external
- returns (bytes4)
- {
- emit TokenReceived(
- _operator,
- _from,
- _tokenId,
- _data
- );
- return INVALID_ERC721_RECEIVED;
- }
-}
diff --git a/packages/contracts/src/2.0.0/test/DummyERC721Token/DummyERC721Token.sol b/packages/contracts/src/2.0.0/test/DummyERC721Token/DummyERC721Token.sol
deleted file mode 100644
index ac9068d1d..000000000
--- a/packages/contracts/src/2.0.0/test/DummyERC721Token/DummyERC721Token.sol
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity 0.4.24;
-
-import "../../tokens/ERC721Token/MintableERC721Token.sol";
-import "../../utils/Ownable/Ownable.sol";
-
-
-// solhint-disable no-empty-blocks
-contract DummyERC721Token is
- Ownable,
- MintableERC721Token
-{
- string public name;
- string public symbol;
-
- constructor (
- string _name,
- string _symbol
- )
- public
- {
- name = _name;
- symbol = _symbol;
- }
-
- /// @dev Function to mint a new token
- /// Reverts if the given token ID already exists
- /// @param _to Address of the beneficiary that will own the minted token
- /// @param _tokenId ID of the token to be minted by the msg.sender
- function mint(address _to, uint256 _tokenId)
- external
- {
- _mint(_to, _tokenId);
- }
-
- /// @dev Function to burn a token
- /// Reverts if the given token ID doesn't exist or not called by contract owner
- /// @param _owner Owner of token with given token ID
- /// @param _tokenId ID of the token to be burned by the msg.sender
- function burn(address _owner, uint256 _tokenId)
- external
- onlyOwner
- {
- _burn(_owner, _tokenId);
- }
-}
diff --git a/packages/contracts/src/2.0.0/test/ReentrantERC20Token/ReentrantERC20Token.sol b/packages/contracts/src/2.0.0/test/ReentrantERC20Token/ReentrantERC20Token.sol
deleted file mode 100644
index 99dd47a78..000000000
--- a/packages/contracts/src/2.0.0/test/ReentrantERC20Token/ReentrantERC20Token.sol
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity 0.4.24;
-pragma experimental ABIEncoderV2;
-
-import "../../utils/LibBytes/LibBytes.sol";
-import "../../tokens/ERC20Token/ERC20Token.sol";
-import "../../protocol/Exchange/interfaces/IExchange.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
-
-
-// solhint-disable no-unused-vars
-contract ReentrantERC20Token is
- ERC20Token
-{
- using LibBytes for bytes;
-
- // solhint-disable-next-line var-name-mixedcase
- IExchange internal EXCHANGE;
-
- bytes internal constant REENTRANCY_ILLEGAL_REVERT_REASON = abi.encodeWithSelector(
- bytes4(keccak256("Error(string)")),
- "REENTRANCY_ILLEGAL"
- );
-
- // All of these functions are potentially vulnerable to reentrancy
- // We do not test any "noThrow" functions because `fillOrderNoThrow` makes a delegatecall to `fillOrder`
- enum ExchangeFunction {
- FILL_ORDER,
- FILL_OR_KILL_ORDER,
- BATCH_FILL_ORDERS,
- BATCH_FILL_OR_KILL_ORDERS,
- MARKET_BUY_ORDERS,
- MARKET_SELL_ORDERS,
- MATCH_ORDERS,
- CANCEL_ORDER,
- BATCH_CANCEL_ORDERS,
- CANCEL_ORDERS_UP_TO,
- SET_SIGNATURE_VALIDATOR_APPROVAL
- }
-
- uint8 internal currentFunctionId = 0;
-
- constructor (address _exchange)
- public
- {
- EXCHANGE = IExchange(_exchange);
- }
-
- /// @dev Set the current function that will be called when `transferFrom` is called.
- /// @param _currentFunctionId Id that corresponds to function name.
- function setCurrentFunction(uint8 _currentFunctionId)
- external
- {
- currentFunctionId = _currentFunctionId;
- }
-
- /// @dev A version of `transferFrom` that attempts to reenter the Exchange contract.
- /// @param _from The address of the sender
- /// @param _to The address of the recipient
- /// @param _value The amount of token to be transferred
- function transferFrom(
- address _from,
- address _to,
- uint256 _value
- )
- external
- returns (bool)
- {
- // This order would normally be invalid, but it will be used strictly for testing reentrnacy.
- // Any reentrancy checks will happen before any other checks that invalidate the order.
- LibOrder.Order memory order;
-
- // Initialize remaining null parameters
- bytes memory signature;
- LibOrder.Order[] memory orders;
- uint256[] memory takerAssetFillAmounts;
- bytes[] memory signatures;
- bytes memory calldata;
-
- // Create calldata for function that corresponds to currentFunctionId
- if (currentFunctionId == uint8(ExchangeFunction.FILL_ORDER)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.fillOrder.selector,
- order,
- 0,
- signature
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.FILL_OR_KILL_ORDER)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.fillOrKillOrder.selector,
- order,
- 0,
- signature
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.BATCH_FILL_ORDERS)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.batchFillOrders.selector,
- orders,
- takerAssetFillAmounts,
- signatures
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.BATCH_FILL_OR_KILL_ORDERS)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.batchFillOrKillOrders.selector,
- orders,
- takerAssetFillAmounts,
- signatures
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.MARKET_BUY_ORDERS)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.marketBuyOrders.selector,
- orders,
- 0,
- signatures
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.MARKET_SELL_ORDERS)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.marketSellOrders.selector,
- orders,
- 0,
- signatures
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.MATCH_ORDERS)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.matchOrders.selector,
- order,
- order,
- signature,
- signature
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.CANCEL_ORDER)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.cancelOrder.selector,
- order
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.BATCH_CANCEL_ORDERS)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.batchCancelOrders.selector,
- orders
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.CANCEL_ORDERS_UP_TO)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.cancelOrdersUpTo.selector,
- 0
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.SET_SIGNATURE_VALIDATOR_APPROVAL)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.setSignatureValidatorApproval.selector,
- address(0),
- false
- );
- }
-
- // Call Exchange function, swallow error
- address(EXCHANGE).call(calldata);
-
- // Revert reason is 100 bytes
- bytes memory returnData = new bytes(100);
-
- // Copy return data
- assembly {
- returndatacopy(add(returnData, 32), 0, 100)
- }
-
- // Revert if function reverted with REENTRANCY_ILLEGAL error
- require(!REENTRANCY_ILLEGAL_REVERT_REASON.equals(returnData));
-
- // Transfer will return true if function failed for any other reason
- return true;
- }
-} \ No newline at end of file
diff --git a/packages/contracts/src/2.0.0/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol b/packages/contracts/src/2.0.0/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol
deleted file mode 100644
index ad71fc9a1..000000000
--- a/packages/contracts/src/2.0.0/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity 0.4.24;
-
-import "../../protocol/Exchange/MixinAssetProxyDispatcher.sol";
-
-
-contract TestAssetProxyDispatcher is
- MixinAssetProxyDispatcher
-{
- function publicDispatchTransferFrom(
- bytes memory assetData,
- address from,
- address to,
- uint256 amount
- )
- public
- {
- dispatchTransferFrom(assetData, from, to, amount);
- }
-}
diff --git a/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol b/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol
deleted file mode 100644
index 52c66cb56..000000000
--- a/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity 0.4.24;
-
-import "../../protocol/AssetProxyOwner/AssetProxyOwner.sol";
-
-
-// solhint-disable no-empty-blocks
-contract TestAssetProxyOwner is
- AssetProxyOwner
-{
- constructor (
- address[] memory _owners,
- address[] memory _assetProxyContracts,
- uint256 _required,
- uint256 _secondsTimeLocked
- )
- public
- AssetProxyOwner(_owners, _assetProxyContracts, _required, _secondsTimeLocked)
- {}
-
- function testValidRemoveAuthorizedAddressAtIndexTx(uint256 id)
- public
- view
- validRemoveAuthorizedAddressAtIndexTx(id)
- returns (bool)
- {
- // Do nothing. We expect reverts through the modifier
- return true;
- }
-
- /// @dev Compares first 4 bytes of byte array to `removeAuthorizedAddressAtIndex` function selector.
- /// @param data Transaction data.
- /// @return Successful if data is a call to `removeAuthorizedAddressAtIndex`.
- function isFunctionRemoveAuthorizedAddressAtIndex(bytes memory data)
- public
- pure
- returns (bool)
- {
- return data.readBytes4(0) == REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR;
- }
-}
diff --git a/packages/contracts/src/2.0.0/test/TestConstants/TestConstants.sol b/packages/contracts/src/2.0.0/test/TestConstants/TestConstants.sol
deleted file mode 100644
index 1275d007b..000000000
--- a/packages/contracts/src/2.0.0/test/TestConstants/TestConstants.sol
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity 0.4.24;
-
-import "../../utils/LibBytes/LibBytes.sol";
-
-
-// solhint-disable max-line-length
-contract TestConstants {
-
- using LibBytes for bytes;
-
- bytes4 constant internal ERC20_PROXY_ID = bytes4(keccak256("ERC20Token(address)"));
-
- address constant internal KOVAN_ZRX_ADDRESS = 0x6Ff6C0Ff1d68b964901F986d4C9FA3ac68346570;
- bytes constant internal KOVAN_ZRX_ASSET_DATA = "\xf4\x72\x61\xb0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6f\xf6\xc0\xff\x1d\x68\xb9\x64\x90\x1f\x98\x6d\x4c\x9f\xa3\xac\x68\x34\x65\x70";
-
- address constant internal MAINNET_ZRX_ADDRESS = 0xE41d2489571d322189246DaFA5ebDe1F4699F498;
- bytes constant public MAINNET_ZRX_ASSET_DATA = "\xf4\x72\x61\xb0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe4\x1d\x24\x89\x57\x1d\x32\x21\x89\x24\x6d\xaf\xa5\xeb\xde\x1f\x46\x99\xf4\x98";
-
- function assertValidZrxAssetData()
- public
- pure
- returns (bool)
- {
- bytes memory kovanZrxAssetData = abi.encodeWithSelector(ERC20_PROXY_ID, KOVAN_ZRX_ADDRESS);
- require(
- kovanZrxAssetData.equals(KOVAN_ZRX_ASSET_DATA),
- "INVALID_KOVAN_ZRX_ASSET_DATA"
- );
-
- bytes memory mainetZrxAssetData = abi.encodeWithSelector(ERC20_PROXY_ID, MAINNET_ZRX_ADDRESS);
- require(
- mainetZrxAssetData.equals(MAINNET_ZRX_ASSET_DATA),
- "INVALID_MAINNET_ZRX_ASSET_DATA"
- );
-
- return true;
- }
-}
-// solhint-enable max-line-length \ No newline at end of file
diff --git a/packages/contracts/src/2.0.0/test/TestExchangeInternals/TestExchangeInternals.sol b/packages/contracts/src/2.0.0/test/TestExchangeInternals/TestExchangeInternals.sol
deleted file mode 100644
index 27187f8f8..000000000
--- a/packages/contracts/src/2.0.0/test/TestExchangeInternals/TestExchangeInternals.sol
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity 0.4.24;
-pragma experimental ABIEncoderV2;
-
-import "../../protocol/Exchange/Exchange.sol";
-
-
-// solhint-disable no-empty-blocks
-contract TestExchangeInternals is
- Exchange
-{
- constructor ()
- public
- Exchange("")
- {}
-
- /// @dev Adds properties of both FillResults instances.
- /// Modifies the first FillResults instance specified.
- /// Note that this function has been modified from the original
- // internal version to return the FillResults.
- /// @param totalFillResults Fill results instance that will be added onto.
- /// @param singleFillResults Fill results instance that will be added to totalFillResults.
- /// @return newTotalFillResults The result of adding singleFillResults to totalFilResults.
- function publicAddFillResults(FillResults memory totalFillResults, FillResults memory singleFillResults)
- public
- pure
- returns (FillResults memory)
- {
- addFillResults(totalFillResults, singleFillResults);
- return totalFillResults;
- }
-
- /// @dev Calculates amounts filled and fees paid by maker and taker.
- /// @param order to be filled.
- /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.
- /// @return fillResults Amounts filled and fees paid by maker and taker.
- function publicCalculateFillResults(
- Order memory order,
- uint256 takerAssetFilledAmount
- )
- public
- pure
- returns (FillResults memory fillResults)
- {
- return calculateFillResults(order, takerAssetFilledAmount);
- }
-
- /// @dev Calculates partial value given a numerator and denominator.
- /// Reverts if rounding error is >= 0.1%
- /// @param numerator Numerator.
- /// @param denominator Denominator.
- /// @param target Value to calculate partial of.
- /// @return Partial value of target.
- function publicSafeGetPartialAmountFloor(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- public
- pure
- returns (uint256 partialAmount)
- {
- return safeGetPartialAmountFloor(numerator, denominator, target);
- }
-
- /// @dev Calculates partial value given a numerator and denominator.
- /// Reverts if rounding error is >= 0.1%
- /// @param numerator Numerator.
- /// @param denominator Denominator.
- /// @param target Value to calculate partial of.
- /// @return Partial value of target.
- function publicSafeGetPartialAmountCeil(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- public
- pure
- returns (uint256 partialAmount)
- {
- return safeGetPartialAmountCeil(numerator, denominator, target);
- }
-
- /// @dev Calculates partial value given a numerator and denominator.
- /// @param numerator Numerator.
- /// @param denominator Denominator.
- /// @param target Value to calculate partial of.
- /// @return Partial value of target.
- function publicGetPartialAmountFloor(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- public
- pure
- returns (uint256 partialAmount)
- {
- return getPartialAmountFloor(numerator, denominator, target);
- }
-
- /// @dev Calculates partial value given a numerator and denominator.
- /// @param numerator Numerator.
- /// @param denominator Denominator.
- /// @param target Value to calculate partial of.
- /// @return Partial value of target.
- function publicGetPartialAmountCeil(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- public
- pure
- returns (uint256 partialAmount)
- {
- return getPartialAmountCeil(numerator, denominator, target);
- }
-
- /// @dev Checks if rounding error >= 0.1%.
- /// @param numerator Numerator.
- /// @param denominator Denominator.
- /// @param target Value to multiply with numerator/denominator.
- /// @return Rounding error is present.
- function publicIsRoundingErrorFloor(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- public
- pure
- returns (bool isError)
- {
- return isRoundingErrorFloor(numerator, denominator, target);
- }
-
- /// @dev Checks if rounding error >= 0.1%.
- /// @param numerator Numerator.
- /// @param denominator Denominator.
- /// @param target Value to multiply with numerator/denominator.
- /// @return Rounding error is present.
- function publicIsRoundingErrorCeil(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- public
- pure
- returns (bool isError)
- {
- return isRoundingErrorCeil(numerator, denominator, target);
- }
-
- /// @dev Updates state with results of a fill order.
- /// @param order that was filled.
- /// @param takerAddress Address of taker who filled the order.
- /// @param orderTakerAssetFilledAmount Amount of order already filled.
- /// @return fillResults Amounts filled and fees paid by maker and taker.
- function publicUpdateFilledState(
- Order memory order,
- address takerAddress,
- bytes32 orderHash,
- uint256 orderTakerAssetFilledAmount,
- FillResults memory fillResults
- )
- public
- {
- updateFilledState(
- order,
- takerAddress,
- orderHash,
- orderTakerAssetFilledAmount,
- fillResults
- );
- }
-}
diff --git a/packages/contracts/src/2.0.0/test/TestLibBytes/TestLibBytes.sol b/packages/contracts/src/2.0.0/test/TestLibBytes/TestLibBytes.sol
deleted file mode 100644
index 00d861e61..000000000
--- a/packages/contracts/src/2.0.0/test/TestLibBytes/TestLibBytes.sol
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity 0.4.24;
-
-import "../../utils/LibBytes/LibBytes.sol";
-
-
-contract TestLibBytes {
-
- using LibBytes for bytes;
-
- /// @dev Pops the last byte off of a byte array by modifying its length.
- /// @param b Byte array that will be modified.
- /// @return The byte that was popped off.
- function publicPopLastByte(bytes memory b)
- public
- pure
- returns (bytes memory, bytes1 result)
- {
- result = b.popLastByte();
- return (b, result);
- }
-
- /// @dev Pops the last 20 bytes off of a byte array by modifying its length.
- /// @param b Byte array that will be modified.
- /// @return The 20 byte address that was popped off.
- function publicPopLast20Bytes(bytes memory b)
- public
- pure
- returns (bytes memory, address result)
- {
- result = b.popLast20Bytes();
- return (b, result);
- }
-
- /// @dev Tests equality of two byte arrays.
- /// @param lhs First byte array to compare.
- /// @param rhs Second byte array to compare.
- /// @return True if arrays are the same. False otherwise.
- function publicEquals(bytes memory lhs, bytes memory rhs)
- public
- pure
- returns (bool equal)
- {
- equal = lhs.equals(rhs);
- return equal;
- }
-
- function publicEqualsPop1(bytes memory lhs, bytes memory rhs)
- public
- pure
- returns (bool equal)
- {
- lhs.popLastByte();
- rhs.popLastByte();
- equal = lhs.equals(rhs);
- return equal;
- }
-
- /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.
- /// @param dest Byte array that will be overwritten with source bytes.
- /// @param source Byte array to copy onto dest bytes.
- function publicDeepCopyBytes(
- bytes memory dest,
- bytes memory source
- )
- public
- pure
- returns (bytes memory)
- {
- LibBytes.deepCopyBytes(dest, source);
- return dest;
- }
-
- /// @dev Reads an address from a position in a byte array.
- /// @param b Byte array containing an address.
- /// @param index Index in byte array of address.
- /// @return address from byte array.
- function publicReadAddress(
- bytes memory b,
- uint256 index
- )
- public
- pure
- returns (address result)
- {
- result = b.readAddress(index);
- return result;
- }
-
- /// @dev Writes an address into a specific position in a byte array.
- /// @param b Byte array to insert address into.
- /// @param index Index in byte array of address.
- /// @param input Address to put into byte array.
- function publicWriteAddress(
- bytes memory b,
- uint256 index,
- address input
- )
- public
- pure
- returns (bytes memory)
- {
- b.writeAddress(index, input);
- return b;
- }
-
- /// @dev Reads a bytes32 value from a position in a byte array.
- /// @param b Byte array containing a bytes32 value.
- /// @param index Index in byte array of bytes32 value.
- /// @return bytes32 value from byte array.
- function publicReadBytes32(
- bytes memory b,
- uint256 index
- )
- public
- pure
- returns (bytes32 result)
- {
- result = b.readBytes32(index);
- return result;
- }
-
- /// @dev Writes a bytes32 into a specific position in a byte array.
- /// @param b Byte array to insert <input> into.
- /// @param index Index in byte array of <input>.
- /// @param input bytes32 to put into byte array.
- function publicWriteBytes32(
- bytes memory b,
- uint256 index,
- bytes32 input
- )
- public
- pure
- returns (bytes memory)
- {
- b.writeBytes32(index, input);
- return b;
- }
-
- /// @dev Reads a uint256 value from a position in a byte array.
- /// @param b Byte array containing a uint256 value.
- /// @param index Index in byte array of uint256 value.
- /// @return uint256 value from byte array.
- function publicReadUint256(
- bytes memory b,
- uint256 index
- )
- public
- pure
- returns (uint256 result)
- {
- result = b.readUint256(index);
- return result;
- }
-
- /// @dev Writes a uint256 into a specific position in a byte array.
- /// @param b Byte array to insert <input> into.
- /// @param index Index in byte array of <input>.
- /// @param input uint256 to put into byte array.
- function publicWriteUint256(
- bytes memory b,
- uint256 index,
- uint256 input
- )
- public
- pure
- returns (bytes memory)
- {
- b.writeUint256(index, input);
- return b;
- }
-
- /// @dev Reads an unpadded bytes4 value from a position in a byte array.
- /// @param b Byte array containing a bytes4 value.
- /// @param index Index in byte array of bytes4 value.
- /// @return bytes4 value from byte array.
- function publicReadBytes4(
- bytes memory b,
- uint256 index
- )
- public
- pure
- returns (bytes4 result)
- {
- result = b.readBytes4(index);
- return result;
- }
-
- /// @dev Reads nested bytes from a specific position.
- /// @param b Byte array containing nested bytes.
- /// @param index Index of nested bytes.
- /// @return result Nested bytes.
- function publicReadBytesWithLength(
- bytes memory b,
- uint256 index
- )
- public
- pure
- returns (bytes memory result)
- {
- result = b.readBytesWithLength(index);
- return result;
- }
-
- /// @dev Inserts bytes at a specific position in a byte array.
- /// @param b Byte array to insert <input> into.
- /// @param index Index in byte array of <input>.
- /// @param input bytes to insert.
- /// @return b Updated input byte array
- function publicWriteBytesWithLength(
- bytes memory b,
- uint256 index,
- bytes memory input
- )
- public
- pure
- returns (bytes memory)
- {
- b.writeBytesWithLength(index, input);
- return b;
- }
-
- /// @dev Copies a block of memory from one location to another.
- /// @param mem Memory contents we want to apply memCopy to
- /// @param dest Destination offset into <mem>.
- /// @param source Source offset into <mem>.
- /// @param length Length of bytes to copy from <source> to <dest>
- /// @return mem Memory contents after calling memCopy.
- function testMemcpy(
- bytes mem,
- uint256 dest,
- uint256 source,
- uint256 length
- )
- public // not external, we need input in memory
- pure
- returns (bytes)
- {
- // Sanity check. Overflows are not checked.
- require(source + length <= mem.length);
- require(dest + length <= mem.length);
-
- // Get pointer to memory contents
- uint256 offset = mem.contentAddress();
-
- // Execute memCopy adjusted for memory array location
- LibBytes.memCopy(offset + dest, offset + source, length);
-
- // Return modified memory contents
- return mem;
- }
-}
diff --git a/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol b/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol
deleted file mode 100644
index a10f981fc..000000000
--- a/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity 0.4.24;
-pragma experimental ABIEncoderV2;
-
-import "../../protocol/Exchange/libs/LibMath.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
-import "../../protocol/Exchange/libs/LibFillResults.sol";
-import "../../protocol/Exchange/libs/LibAbiEncoder.sol";
-
-
-contract TestLibs is
- LibMath,
- LibOrder,
- LibFillResults,
- LibAbiEncoder
-{
- function publicAbiEncodeFillOrder(
- Order memory order,
- uint256 takerAssetFillAmount,
- bytes memory signature
- )
- public
- pure
- returns (bytes memory fillOrderCalldata)
- {
- fillOrderCalldata = abiEncodeFillOrder(
- order,
- takerAssetFillAmount,
- signature
- );
- return fillOrderCalldata;
- }
-
- function publicGetPartialAmountFloor(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- public
- pure
- returns (uint256 partialAmount)
- {
- partialAmount = getPartialAmountFloor(
- numerator,
- denominator,
- target
- );
- return partialAmount;
- }
-
- function publicGetPartialAmountCeil(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- public
- pure
- returns (uint256 partialAmount)
- {
- partialAmount = getPartialAmountCeil(
- numerator,
- denominator,
- target
- );
- return partialAmount;
- }
-
- function publicIsRoundingErrorFloor(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- public
- pure
- returns (bool isError)
- {
- isError = isRoundingErrorFloor(
- numerator,
- denominator,
- target
- );
- return isError;
- }
-
- function publicIsRoundingErrorCeil(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- public
- pure
- returns (bool isError)
- {
- isError = isRoundingErrorCeil(
- numerator,
- denominator,
- target
- );
- return isError;
- }
-
- function publicGetOrderHash(Order memory order)
- public
- view
- returns (bytes32 orderHash)
- {
- orderHash = getOrderHash(order);
- return orderHash;
- }
-
- function getOrderSchemaHash()
- public
- pure
- returns (bytes32)
- {
- return EIP712_ORDER_SCHEMA_HASH;
- }
-
- function getDomainSeparatorSchemaHash()
- public
- pure
- returns (bytes32)
- {
- return EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH;
- }
-
- function publicAddFillResults(FillResults memory totalFillResults, FillResults memory singleFillResults)
- public
- pure
- returns (FillResults memory)
- {
- addFillResults(totalFillResults, singleFillResults);
- return totalFillResults;
- }
-}
diff --git a/packages/contracts/src/2.0.0/test/TestSignatureValidator/TestSignatureValidator.sol b/packages/contracts/src/2.0.0/test/TestSignatureValidator/TestSignatureValidator.sol
deleted file mode 100644
index ea3e2de59..000000000
--- a/packages/contracts/src/2.0.0/test/TestSignatureValidator/TestSignatureValidator.sol
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity 0.4.24;
-
-import "../../protocol/Exchange/MixinSignatureValidator.sol";
-import "../../protocol/Exchange/MixinTransactions.sol";
-
-
-contract TestSignatureValidator is
- MixinSignatureValidator,
- MixinTransactions
-{
- function publicIsValidSignature(
- bytes32 hash,
- address signer,
- bytes memory signature
- )
- public
- view
- returns (bool isValid)
- {
- isValid = isValidSignature(
- hash,
- signer,
- signature
- );
- return isValid;
- }
-}
diff --git a/packages/contracts/src/2.0.0/test/TestStaticCallReceiver/TestStaticCallReceiver.sol b/packages/contracts/src/2.0.0/test/TestStaticCallReceiver/TestStaticCallReceiver.sol
deleted file mode 100644
index 41aab01c8..000000000
--- a/packages/contracts/src/2.0.0/test/TestStaticCallReceiver/TestStaticCallReceiver.sol
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity 0.4.24;
-
-import "../../tokens/ERC20Token/IERC20Token.sol";
-
-
-// solhint-disable no-unused-vars
-contract TestStaticCallReceiver {
-
- uint256 internal state = 1;
-
- /// @dev Updates state and returns true. Intended to be used with `Validator` signature type.
- /// @param hash Message hash that is signed.
- /// @param signerAddress Address that should have signed the given hash.
- /// @param signature Proof of signing.
- /// @return Validity of order signature.
- function isValidSignature(
- bytes32 hash,
- address signerAddress,
- bytes signature
- )
- external
- returns (bool isValid)
- {
- updateState();
- return true;
- }
-
- /// @dev Updates state and returns true. Intended to be used with `Wallet` signature type.
- /// @param hash Message hash that is signed.
- /// @param signature Proof of signing.
- /// @return Validity of order signature.
- function isValidSignature(
- bytes32 hash,
- bytes signature
- )
- external
- returns (bool isValid)
- {
- updateState();
- return true;
- }
-
- /// @dev Approves an ERC20 token to spend tokens from this address.
- /// @param token Address of ERC20 token.
- /// @param spender Address that will spend tokens.
- /// @param value Amount of tokens spender is approved to spend.
- function approveERC20(
- address token,
- address spender,
- uint256 value
- )
- external
- {
- IERC20Token(token).approve(spender, value);
- }
-
- /// @dev Increments state variable.
- function updateState()
- internal
- {
- state++;
- }
-}