aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/ISigner.sol28
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol9
2 files changed, 36 insertions, 1 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/ISigner.sol b/packages/contracts/src/contracts/current/protocol/Exchange/ISigner.sol
new file mode 100644
index 000000000..7f8284c14
--- /dev/null
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/ISigner.sol
@@ -0,0 +1,28 @@
+/*
+
+ Copyright 2017 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.19;
+
+contract ISigner {
+
+ function isValidSignature(
+ bytes32 hash,
+ bytes signature)
+ public view
+ returns (bool isValid);
+}
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol
index 8e5fbb22e..7edb5a372 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol
@@ -19,6 +19,7 @@
pragma solidity ^0.4.19;
import "./mixins/MSignatureValidator.sol";
+import "./ISigner.sol";
/// @dev Provides MSignatureValidator
contract MixinSignatureValidator is
@@ -27,7 +28,8 @@ contract MixinSignatureValidator is
enum SignatureType {
Invalid,
Caller,
- Ecrecover
+ Ecrecover,
+ Contract
}
function isValidSignature(
@@ -68,6 +70,11 @@ contract MixinSignatureValidator is
);
isValid = signer == recovered;
return;
+
+ // Signature verified by signer contract
+ } else if (signatureType == SignatureType.Contract) {
+ isValid = ISigner(signer).isValidSignature(hash, signature);
+ return;
}
// Anything else is illegal (We do not return false because