aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorRemco Bloemen <remco@wicked.ventures>2018-02-14 08:30:27 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-04-21 04:56:16 +0800
commit0f720223a90204b6c29b80a986f790fd549e93db (patch)
treef98196522b6150f6bab1aa133d4906da1f8f3866 /packages
parent6bb93b817085cd3d4d2828933801ab88789f3963 (diff)
downloaddexon-sol-tools-0f720223a90204b6c29b80a986f790fd549e93db.tar
dexon-sol-tools-0f720223a90204b6c29b80a986f790fd549e93db.tar.gz
dexon-sol-tools-0f720223a90204b6c29b80a986f790fd549e93db.tar.bz2
dexon-sol-tools-0f720223a90204b6c29b80a986f790fd549e93db.tar.lz
dexon-sol-tools-0f720223a90204b6c29b80a986f790fd549e93db.tar.xz
dexon-sol-tools-0f720223a90204b6c29b80a986f790fd549e93db.tar.zst
dexon-sol-tools-0f720223a90204b6c29b80a986f790fd549e93db.zip
Add external contract call signatures (relates to ZEIP 1 and 7)
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