* In `@0x/contracts-exchange`: Add `SignatureType.OrderValidator` support to contracts and refactor signature validation functions. * In `@0x/types`: Add `SignatureType.OrderValidator` and `RevertReason.InappropriateSignature`. * In `@0x/contracts-exchange`: Fix contracts and update tests for `SignatureType.OrderValidator`. * Ran prettier/linter * Update changelogs * In `@0x/order-utils`: Add `SignatureOrderValidatorError` to `ExchangeRevertErrors`. * In `@0x/contracts-exchange`: Add `SignatureOrderValidatorError` rich revert. Fix rebase issues. Rename `IValidator.isValidOrder` to `IValidator.isValidOrderSignature`. * In `@0x/contracts-exchange`: Add revert test cases for `OrderValidator` signature type. * In `@0x/order-utils`: Update changelog. * In `@0x/contracts-exchange`: Split off `SignatureType.OrderValidator` scheme into its own interface and registry. * In `@0x/types`: Add `SignatureType.WalletOrderValidator`. * In `@0x/order-utils`: Add `SignatureWalletOrderValidatorError`. * In `@0x/contracts-exchange`: Add `SignatureType.WalletOrderValidator` support. * Ran prettier * In `@0x/types`: Remove `RevertReason.WalletOrderValidator`. * Update/fix changelogs in `@0x/contracts-exchange`, `@0x/order-utils`, and `@0x/types`. * In `@0x/contracts-exchange`: Make `isValidOrderSignature` `external` instead of `public`. * In `@0x/contracts-exchange`: Change `isValidOrderSignature` back to `public` because passing `calldata` to internal functions isn't supported.
77 lines
2.3 KiB
Solidity
77 lines
2.3 KiB
Solidity
/*
|
|
|
|
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.5;
|
|
pragma experimental ABIEncoderV2;
|
|
|
|
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
|
|
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
|
|
|
|
|
|
// solhint-disable no-unused-vars
|
|
contract TestRevertReceiver {
|
|
|
|
string constant public REVERT_REASON = "you shall not pass";
|
|
|
|
/// @dev Reverts with `REVERT_REASON`. 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 calldata signature
|
|
)
|
|
external
|
|
returns (bool isValid)
|
|
{
|
|
revert(REVERT_REASON);
|
|
}
|
|
|
|
/// @dev Reverts with `REVERT_REASON`. 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 calldata signature
|
|
)
|
|
external
|
|
returns (bool isValid)
|
|
{
|
|
revert(REVERT_REASON);
|
|
}
|
|
|
|
/// @dev Reverts with `REVERT_REASON`. Intended to be used with `OrderValidator` signature type.
|
|
/// @param order The order.
|
|
/// @param hash Message hash that is signed.
|
|
/// @param signature Proof of signing.
|
|
/// @return Validity of order signature.
|
|
function isValidOrderSignature(
|
|
LibOrder.Order calldata order,
|
|
bytes32 hash,
|
|
bytes calldata signature
|
|
)
|
|
external
|
|
returns (bool isValid)
|
|
{
|
|
revert(REVERT_REASON);
|
|
}
|
|
}
|