Fix LibBytes is a library

This commit is contained in:
Remco Bloemen
2018-06-13 11:36:35 +02:00
parent ba1baafca5
commit 2f8ceca2ef
6 changed files with 12 additions and 15 deletions

View File

@@ -19,14 +19,12 @@
pragma solidity ^0.4.24;
import "../../utils/Ownable/Ownable.sol";
import "../../utils/LibBytes/LibBytes.sol";
import "./libs/LibExchangeErrors.sol";
import "./mixins/MAssetProxyDispatcher.sol";
import "../AssetProxy/interfaces/IAssetProxy.sol";
contract MixinAssetProxyDispatcher is
Ownable,
LibBytes,
LibExchangeErrors,
MAssetProxyDispatcher
{

View File

@@ -32,7 +32,6 @@ import "./mixins/MAssetProxyDispatcher.sol";
contract MixinExchangeCore is
LibConstants,
LibBytes,
LibMath,
LibOrder,
LibFillResults,
@@ -42,6 +41,8 @@ contract MixinExchangeCore is
MSignatureValidator,
MTransactions
{
using LibBytes for bytes;
// Mapping of orderHash => amount of takerAsset already bought by maker
mapping (bytes32 => uint256) public filled;
@@ -411,8 +412,8 @@ contract MixinExchangeCore is
)
private
{
uint8 makerAssetProxyId = uint8(popLastByte(order.makerAssetData));
uint8 takerAssetProxyId = uint8(popLastByte(order.takerAssetData));
uint8 makerAssetProxyId = uint8(order.makerAssetData.popLastByte());
uint8 takerAssetProxyId = uint8(order.takerAssetData.popLastByte());
bytes memory zrxAssetData = ZRX_ASSET_DATA;
dispatchTransferFrom(
order.makerAssetData,

View File

@@ -27,7 +27,6 @@ import "./mixins/MAssetProxyDispatcher.sol";
contract MixinMatchOrders is
LibConstants,
LibBytes,
LibMath,
LibExchangeErrors,
MAssetProxyDispatcher,
@@ -35,6 +34,7 @@ contract MixinMatchOrders is
MMatchOrders,
MTransactions
{
using LibBytes for bytes;
/// @dev Match two complementary orders that have a profitable spread.
/// Each order is filled at their respective price point. However, the calculations are
@@ -242,8 +242,8 @@ contract MixinMatchOrders is
)
private
{
uint8 leftMakerAssetProxyId = uint8(popLastByte(leftOrder.makerAssetData));
uint8 rightMakerAssetProxyId = uint8(popLastByte(rightOrder.makerAssetData));
uint8 leftMakerAssetProxyId = uint8(leftOrder.makerAssetData.popLastByte());
uint8 rightMakerAssetProxyId = uint8(rightOrder.makerAssetData.popLastByte());
bytes memory zrxAssetData = ZRX_ASSET_DATA;
// Order makers and taker
dispatchTransferFrom(

View File

@@ -31,8 +31,6 @@ contract MixinWrapperFunctions is
LibExchangeErrors,
MExchangeCore
{
using LibBytes for bytes;
/// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.
/// @param order Order struct containing order specifications.
/// @param takerAssetFillAmount Desired amount of takerAsset to sell.

View File

@@ -84,7 +84,7 @@ contract TestLibBytes {
pure
returns (bytes memory)
{
deepCopyBytes(dest, source);
LibBytes.deepCopyBytes(dest, source);
return dest;
}

View File

@@ -22,9 +22,9 @@ import "../../protocol/Exchange/interfaces/IWallet.sol";
import "../../utils/LibBytes/LibBytes.sol";
contract TestWallet is
IWallet,
LibBytes
IWallet
{
using LibBytes for bytes;
string constant LENGTH_65_REQUIRED = "LENGTH_65_REQUIRED";
@@ -56,8 +56,8 @@ contract TestWallet is
);
uint8 v = uint8(eip712Signature[0]);
bytes32 r = readBytes32(eip712Signature, 1);
bytes32 s = readBytes32(eip712Signature, 33);
bytes32 r = eip712Signature.readBytes32(1);
bytes32 s = eip712Signature.readBytes32(33);
address recoveredAddress = ecrecover(hash, v, r, s);
isValid = WALLET_OWNER == recoveredAddress;
return isValid;