aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/src')
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol19
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IWrapperFunctions.sol14
-rw-r--r--packages/contracts/src/contracts/current/test/Whitelist/Whitelist.sol10
3 files changed, 24 insertions, 19 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol
index 1022b1fe7..1fb87c148 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol
@@ -112,10 +112,13 @@ contract MixinSignatureValidator is
// Signature using EIP712
} else if (signatureType == SignatureType.EIP712) {
- require(signature.length == 66);
+ require(
+ signature.length == 66,
+ INVALID_SIGNATURE_LENGTH
+ );
v = uint8(signature[1]);
- r = get32(signature, 2);
- s = get32(signature, 34);
+ r = readBytes32(signature, 2);
+ s = readBytes32(signature, 34);
recovered = ecrecover(hash, v, r, s);
isValid = signer == recovered;
return isValid;
@@ -146,7 +149,10 @@ contract MixinSignatureValidator is
// and a 0x transaction. By using the TxOrigin signature type, the signature
// for the Ethereum transaction will encompass both signatures.
} else if (signatureType == SignatureType.TxOrigin) {
- require(signature.length == 1);
+ require(
+ signature.length == 1,
+ INVALID_SIGNATURE_LENGTH
+ );
isValid = signer == tx.origin;
return isValid;
@@ -159,7 +165,10 @@ contract MixinSignatureValidator is
// `Caller` for his own signature. Or A and C can sign and B can
// submit using `Caller`. Having `Caller` allows this flexibility.
} else if (signatureType == SignatureType.Caller) {
- require(signature.length == 1);
+ require(
+ signature.length == 1,
+ INVALID_SIGNATURE_LENGTH
+ );
isValid = signer == msg.sender;
return isValid;
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IWrapperFunctions.sol b/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IWrapperFunctions.sol
index 1eb1233ed..8682b394a 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IWrapperFunctions.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IWrapperFunctions.sol
@@ -19,27 +19,23 @@
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
-import "./libs/LibOrder.sol";
-import "./libs/LibFillResults.sol";
+import "../libs/LibOrder.sol";
+import "../libs/LibFillResults.sol";
contract IWrapperFunctions is
- LibBytes,
- LibMath,
LibOrder,
- LibFillResults,
- LibExchangeErrors,
- MExchangeCore
+ LibFillResults
{
/// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.
/// @param order LibOrder.Order struct containing order specifications.
/// @param takerAssetFillAmount Desired amount of takerAsset to sell.
/// @param signature Proof that order has been created by maker.
function fillOrKillOrder(
- LibOrder.LibOrder.Order memory order,
+ LibOrder.Order memory order,
uint256 takerAssetFillAmount,
bytes memory signature)
public
- returns (LibFillResults.LibFillResults.FillResults memory fillResults);
+ returns (LibFillResults.FillResults memory fillResults);
/// @dev Fills an order with specified parameters and ECDSA signature.
/// Returns false if the transaction would otherwise revert.
diff --git a/packages/contracts/src/contracts/current/test/Whitelist/Whitelist.sol b/packages/contracts/src/contracts/current/test/Whitelist/Whitelist.sol
index 6955b6d96..c53856602 100644
--- a/packages/contracts/src/contracts/current/test/Whitelist/Whitelist.sol
+++ b/packages/contracts/src/contracts/current/test/Whitelist/Whitelist.sol
@@ -16,17 +16,17 @@
*/
-pragma solidity ^0.4.21;
+pragma solidity ^0.4.23;
pragma experimental ABIEncoderV2;
-import "../../protocol/Exchange/Exchange.sol";
-import "../../protocol/Exchange/LibOrder.sol";
+import "../../protocol/Exchange/interfaces/IExchange.sol";
+import "../../protocol/Exchange/libs/LibOrder.sol";
import "../../utils/Ownable/Ownable.sol";
contract Whitelist is Ownable {
mapping (address => bool) public isWhitelisted;
- Exchange EXCHANGE;
+ IExchange EXCHANGE;
bytes txOriginSignature = new bytes(1);
bytes4 fillOrderFunctionSelector;
@@ -34,7 +34,7 @@ contract Whitelist is Ownable {
function Whitelist(address _exchange)
public
{
- EXCHANGE = Exchange(_exchange);
+ EXCHANGE = IExchange(_exchange);
txOriginSignature[0] = 0x04;
fillOrderFunctionSelector = EXCHANGE.fillOrder.selector;
}