From 76d228a6034d83643ed95a3b18b78b6bdaa89af3 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Wed, 13 Feb 2019 09:32:46 -0800 Subject: [PATCH] Bump solidity version --- .../contracts/src/MixinSignatureValidator.sol | 2 +- .../src/MixinTECApprovalVerifier.sol | 2 +- contracts/tec/contracts/src/MixinTECCore.sol | 2 +- contracts/tec/contracts/src/TEC.sol | 3 +- .../contracts/src/interfaces/IExchange.sol | 2 +- .../tec/contracts/src/interfaces/ITECCore.sol | 2 +- .../tec/contracts/src/libs/LibConstants.sol | 2 +- .../contracts/src/libs/LibEIP712Domain.sol | 2 +- .../tec/contracts/src/libs/LibTECApproval.sol | 2 +- .../src/libs/LibZeroExTransaction.sol | 2 +- .../src/mixins/MSignatureValidator.sol | 2 +- .../src/mixins/MTECApprovalVerifier.sol | 2 +- .../tec/contracts/test/TestInternals.sol | 121 ++++++++++++++++++ contracts/tec/contracts/test/TestLibs.sol | 2 +- 14 files changed, 135 insertions(+), 13 deletions(-) create mode 100644 contracts/tec/contracts/test/TestInternals.sol diff --git a/contracts/tec/contracts/src/MixinSignatureValidator.sol b/contracts/tec/contracts/src/MixinSignatureValidator.sol index add1387ad8..b66e3eca9f 100644 --- a/contracts/tec/contracts/src/MixinSignatureValidator.sol +++ b/contracts/tec/contracts/src/MixinSignatureValidator.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.5.2; +pragma solidity ^0.5.3; import "@0x/contract-utils/contracts/src/LibBytes.sol"; diff --git a/contracts/tec/contracts/src/MixinTECApprovalVerifier.sol b/contracts/tec/contracts/src/MixinTECApprovalVerifier.sol index b8eab181c2..71315ccefc 100644 --- a/contracts/tec/contracts/src/MixinTECApprovalVerifier.sol +++ b/contracts/tec/contracts/src/MixinTECApprovalVerifier.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.5.2; +pragma solidity ^0.5.3; pragma experimental "ABIEncoderV2"; import "@0x/contracts-exchange-libs/contracts/src/LibExchangeSelectors.sol"; diff --git a/contracts/tec/contracts/src/MixinTECCore.sol b/contracts/tec/contracts/src/MixinTECCore.sol index 801857c459..d02e2df6e2 100644 --- a/contracts/tec/contracts/src/MixinTECCore.sol +++ b/contracts/tec/contracts/src/MixinTECCore.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.5.2; +pragma solidity ^0.5.3; pragma experimental "ABIEncoderV2"; import "./libs/LibZeroExTransaction.sol"; diff --git a/contracts/tec/contracts/src/TEC.sol b/contracts/tec/contracts/src/TEC.sol index 479d001f54..509735af65 100644 --- a/contracts/tec/contracts/src/TEC.sol +++ b/contracts/tec/contracts/src/TEC.sol @@ -16,7 +16,8 @@ */ -pragma solidity 0.5.2; +pragma solidity 0.5.3; +pragma experimental "ABIEncoderV2"; import "./libs/LibConstants.sol"; import "./MixinTECApprovalVerifier.sol"; diff --git a/contracts/tec/contracts/src/interfaces/IExchange.sol b/contracts/tec/contracts/src/interfaces/IExchange.sol index abc5d492f2..b038a119b6 100644 --- a/contracts/tec/contracts/src/interfaces/IExchange.sol +++ b/contracts/tec/contracts/src/interfaces/IExchange.sol @@ -15,7 +15,7 @@ limitations under the License. */ -pragma solidity ^0.5.2; +pragma solidity ^0.5.3; contract IExchange { diff --git a/contracts/tec/contracts/src/interfaces/ITECCore.sol b/contracts/tec/contracts/src/interfaces/ITECCore.sol index 6e18b968f2..90e48f1427 100644 --- a/contracts/tec/contracts/src/interfaces/ITECCore.sol +++ b/contracts/tec/contracts/src/interfaces/ITECCore.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.5.2; +pragma solidity ^0.5.3; pragma experimental "ABIEncoderV2"; import "../libs/LibZeroExTransaction.sol"; diff --git a/contracts/tec/contracts/src/libs/LibConstants.sol b/contracts/tec/contracts/src/libs/LibConstants.sol index 58442c570d..84119c75c5 100644 --- a/contracts/tec/contracts/src/libs/LibConstants.sol +++ b/contracts/tec/contracts/src/libs/LibConstants.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.5.2; +pragma solidity ^0.5.3; import "../interfaces/IExchange.sol"; diff --git a/contracts/tec/contracts/src/libs/LibEIP712Domain.sol b/contracts/tec/contracts/src/libs/LibEIP712Domain.sol index e36af24811..7fcf6ff655 100644 --- a/contracts/tec/contracts/src/libs/LibEIP712Domain.sol +++ b/contracts/tec/contracts/src/libs/LibEIP712Domain.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.5.2; +pragma solidity ^0.5.3; contract LibEIP712Domain { diff --git a/contracts/tec/contracts/src/libs/LibTECApproval.sol b/contracts/tec/contracts/src/libs/LibTECApproval.sol index 87c5f52476..cfb1ee0ece 100644 --- a/contracts/tec/contracts/src/libs/LibTECApproval.sol +++ b/contracts/tec/contracts/src/libs/LibTECApproval.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.5.2; +pragma solidity ^0.5.3; import "./LibEIP712Domain.sol"; diff --git a/contracts/tec/contracts/src/libs/LibZeroExTransaction.sol b/contracts/tec/contracts/src/libs/LibZeroExTransaction.sol index 7f03aa60dc..12ab17714b 100644 --- a/contracts/tec/contracts/src/libs/LibZeroExTransaction.sol +++ b/contracts/tec/contracts/src/libs/LibZeroExTransaction.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.5.2; +pragma solidity ^0.5.3; import "./LibEIP712Domain.sol"; diff --git a/contracts/tec/contracts/src/mixins/MSignatureValidator.sol b/contracts/tec/contracts/src/mixins/MSignatureValidator.sol index bbc7dd3952..f37cf81b08 100644 --- a/contracts/tec/contracts/src/mixins/MSignatureValidator.sol +++ b/contracts/tec/contracts/src/mixins/MSignatureValidator.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.5.2; +pragma solidity ^0.5.3; contract MSignatureValidator { diff --git a/contracts/tec/contracts/src/mixins/MTECApprovalVerifier.sol b/contracts/tec/contracts/src/mixins/MTECApprovalVerifier.sol index 88cd8b883a..6dbb07785f 100644 --- a/contracts/tec/contracts/src/mixins/MTECApprovalVerifier.sol +++ b/contracts/tec/contracts/src/mixins/MTECApprovalVerifier.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.5.2; +pragma solidity ^0.5.3; pragma experimental "ABIEncoderV2"; import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol"; diff --git a/contracts/tec/contracts/test/TestInternals.sol b/contracts/tec/contracts/test/TestInternals.sol new file mode 100644 index 0000000000..1f3b6448c1 --- /dev/null +++ b/contracts/tec/contracts/test/TestInternals.sol @@ -0,0 +1,121 @@ +/* + + 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.5.3; +pragma experimental "ABIEncoderV2"; + +import "../src/MixinSignatureValidator.sol"; +import "../src/MixinTECApprovalVerifier.sol"; + + +contract TestInternals is + MixinSignatureValidator, + MixinTECApprovalVerifier +{ + /// @dev Recovers the address of a signer given a hash and signature. + /// @param hash Any 32 byte hash. + /// @param signature Proof that the hash has been signed by signer. + function publicGetSignerAddress(bytes32 hash, bytes memory signature) + public + pure + returns (address signerAddress) + { + signerAddress = getSignerAddress(hash, signature); + return signerAddress; + } + + /// @dev Validates that the 0x transaction has been approved by all of the feeRecipients + /// that correspond to each order in the transaction's Exchange calldata. + /// @param transaction 0x transaction containing salt, signerAddress, and data. + /// @param transactionSignature Proof that the transaction has been signed by the signer. + /// @param approvalExpirationTimeSeconds Array of expiration times in seconds for which each corresponding approval signature expires. + /// @param approvalSignatures Array of signatures that correspond to the feeRecipients of each order in the transaction's Exchange calldata. + function publicAssertValidTECApproval( + LibZeroExTransaction.ZeroExTransaction memory transaction, + bytes memory transactionSignature, + uint256[] memory approvalExpirationTimeSeconds, + bytes[] memory approvalSignatures + ) + public + view + returns (bool) + { + assertValidTECApproval( + transaction, + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ); + return true; + } + + + /// @dev Validates that the feeRecipient of a single order has approved a 0x transaction. + /// @param order Order struct containing order specifications. + /// @param transactionHash EIP712 hash of the 0x transaction. + /// @param transactionSignature Proof that the transaction has been signed by the signer. + /// @param approvalExpirationTimeSeconds Expiration times in seconds for which the approval signature expires. + /// @param approvalSignature Signatures that corresponds to the feeRecipient of the order. + function publicAssertValidSingleOrderApproval( + LibOrder.Order memory order, + bytes32 transactionHash, + bytes memory transactionSignature, + uint256 approvalExpirationTimeSeconds, + bytes memory approvalSignature + ) + public + view + returns (bool) + { + assertValidSingleOrderApproval( + order, + transactionHash, + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignature + ); + return true; + } + + /// @dev Validates that the feeRecipient of a single order has approved a 0x transaction. + /// @param orders Array of order structs containing order specifications. + /// @param transactionHash EIP712 hash of the 0x transaction. + /// @param transactionSignature Proof that the transaction has been signed by the signer. + /// @param approvalExpirationTimeSeconds Array of expiration times in seconds for which each corresponding approval signature expires. + /// @param approvalSignatures Array of signatures that correspond to the feeRecipients of each order. + function publicAssertValidBatchOrderApproval( + LibOrder.Order[] memory orders, + bytes32 transactionHash, + bytes memory transactionSignature, + uint256[] memory approvalExpirationTimeSeconds, + bytes[] memory approvalSignatures + ) + public + view + returns (bool) + { + assertValidBatchOrderApproval( + orders, + transactionHash, + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ); + return true; + } +} \ No newline at end of file diff --git a/contracts/tec/contracts/test/TestLibs.sol b/contracts/tec/contracts/test/TestLibs.sol index 8c0ba095bc..574b586740 100644 --- a/contracts/tec/contracts/test/TestLibs.sol +++ b/contracts/tec/contracts/test/TestLibs.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.5.2; +pragma solidity ^0.5.3; pragma experimental "ABIEncoderV2"; import "../src/libs/LibTECApproval.sol";