Removed MixinSettlement. Moved settleOrder into MixinExchangeCore and settleMatchedOrders into MixinMatchOrders
This commit is contained in:
@@ -19,9 +19,9 @@
|
|||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
|
import "./libs/LibConstants.sol";
|
||||||
import "./MixinExchangeCore.sol";
|
import "./MixinExchangeCore.sol";
|
||||||
import "./MixinSignatureValidator.sol";
|
import "./MixinSignatureValidator.sol";
|
||||||
import "./MixinSettlement.sol";
|
|
||||||
import "./MixinWrapperFunctions.sol";
|
import "./MixinWrapperFunctions.sol";
|
||||||
import "./MixinAssetProxyDispatcher.sol";
|
import "./MixinAssetProxyDispatcher.sol";
|
||||||
import "./MixinTransactions.sol";
|
import "./MixinTransactions.sol";
|
||||||
@@ -30,7 +30,6 @@ import "./MixinMatchOrders.sol";
|
|||||||
contract Exchange is
|
contract Exchange is
|
||||||
MixinExchangeCore,
|
MixinExchangeCore,
|
||||||
MixinMatchOrders,
|
MixinMatchOrders,
|
||||||
MixinSettlement,
|
|
||||||
MixinSignatureValidator,
|
MixinSignatureValidator,
|
||||||
MixinTransactions,
|
MixinTransactions,
|
||||||
MixinAssetProxyDispatcher,
|
MixinAssetProxyDispatcher,
|
||||||
@@ -42,9 +41,9 @@ contract Exchange is
|
|||||||
// Mixins are instantiated in the order they are inherited
|
// Mixins are instantiated in the order they are inherited
|
||||||
constructor (bytes memory _zrxAssetData)
|
constructor (bytes memory _zrxAssetData)
|
||||||
public
|
public
|
||||||
|
LibConstants(_zrxAssetData) // @TODO: Remove when we deploy.
|
||||||
MixinExchangeCore()
|
MixinExchangeCore()
|
||||||
MixinMatchOrders()
|
MixinMatchOrders()
|
||||||
MixinSettlement(_zrxAssetData)
|
|
||||||
MixinSignatureValidator()
|
MixinSignatureValidator()
|
||||||
MixinTransactions()
|
MixinTransactions()
|
||||||
MixinAssetProxyDispatcher()
|
MixinAssetProxyDispatcher()
|
||||||
|
|||||||
@@ -19,22 +19,26 @@
|
|||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
|
import "./libs/LibConstants.sol";
|
||||||
|
import "../../utils/LibBytes/LibBytes.sol";
|
||||||
import "./libs/LibFillResults.sol";
|
import "./libs/LibFillResults.sol";
|
||||||
import "./libs/LibOrder.sol";
|
import "./libs/LibOrder.sol";
|
||||||
import "./libs/LibMath.sol";
|
import "./libs/LibMath.sol";
|
||||||
import "./libs/LibExchangeErrors.sol";
|
import "./libs/LibExchangeErrors.sol";
|
||||||
import "./mixins/MExchangeCore.sol";
|
import "./mixins/MExchangeCore.sol";
|
||||||
import "./mixins/MSettlement.sol";
|
|
||||||
import "./mixins/MSignatureValidator.sol";
|
import "./mixins/MSignatureValidator.sol";
|
||||||
import "./mixins/MTransactions.sol";
|
import "./mixins/MTransactions.sol";
|
||||||
|
import "./mixins/MAssetProxyDispatcher.sol";
|
||||||
|
|
||||||
contract MixinExchangeCore is
|
contract MixinExchangeCore is
|
||||||
|
LibConstants,
|
||||||
|
LibBytes,
|
||||||
LibMath,
|
LibMath,
|
||||||
LibOrder,
|
LibOrder,
|
||||||
LibFillResults,
|
LibFillResults,
|
||||||
LibExchangeErrors,
|
LibExchangeErrors,
|
||||||
|
MAssetProxyDispatcher,
|
||||||
MExchangeCore,
|
MExchangeCore,
|
||||||
MSettlement,
|
|
||||||
MSignatureValidator,
|
MSignatureValidator,
|
||||||
MTransactions
|
MTransactions
|
||||||
{
|
{
|
||||||
@@ -389,4 +393,48 @@ contract MixinExchangeCore is
|
|||||||
|
|
||||||
return fillResults;
|
return fillResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @dev Settles an order by transferring assets between counterparties.
|
||||||
|
/// @param order Order struct containing order specifications.
|
||||||
|
/// @param takerAddress Address selling takerAsset and buying makerAsset.
|
||||||
|
/// @param fillResults Amounts to be filled and fees paid by maker and taker.
|
||||||
|
function settleOrder(
|
||||||
|
LibOrder.Order memory order,
|
||||||
|
address takerAddress,
|
||||||
|
LibFillResults.FillResults memory fillResults
|
||||||
|
)
|
||||||
|
internal
|
||||||
|
{
|
||||||
|
uint8 makerAssetProxyId = uint8(popLastByte(order.makerAssetData));
|
||||||
|
uint8 takerAssetProxyId = uint8(popLastByte(order.takerAssetData));
|
||||||
|
bytes memory zrxAssetData = ZRX_ASSET_DATA;
|
||||||
|
dispatchTransferFrom(
|
||||||
|
order.makerAssetData,
|
||||||
|
makerAssetProxyId,
|
||||||
|
order.makerAddress,
|
||||||
|
takerAddress,
|
||||||
|
fillResults.makerAssetFilledAmount
|
||||||
|
);
|
||||||
|
dispatchTransferFrom(
|
||||||
|
order.takerAssetData,
|
||||||
|
takerAssetProxyId,
|
||||||
|
takerAddress,
|
||||||
|
order.makerAddress,
|
||||||
|
fillResults.takerAssetFilledAmount
|
||||||
|
);
|
||||||
|
dispatchTransferFrom(
|
||||||
|
zrxAssetData,
|
||||||
|
ZRX_PROXY_ID,
|
||||||
|
order.makerAddress,
|
||||||
|
order.feeRecipientAddress,
|
||||||
|
fillResults.makerFeePaid
|
||||||
|
);
|
||||||
|
dispatchTransferFrom(
|
||||||
|
zrxAssetData,
|
||||||
|
ZRX_PROXY_ID,
|
||||||
|
takerAddress,
|
||||||
|
order.feeRecipientAddress,
|
||||||
|
fillResults.takerFeePaid
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,21 +14,25 @@
|
|||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
|
import "./libs/LibConstants.sol";
|
||||||
|
import "../../utils/LibBytes/LibBytes.sol";
|
||||||
import "./libs/LibMath.sol";
|
import "./libs/LibMath.sol";
|
||||||
import "./libs/LibOrder.sol";
|
import "./libs/LibOrder.sol";
|
||||||
import "./libs/LibFillResults.sol";
|
import "./libs/LibFillResults.sol";
|
||||||
import "./libs/LibExchangeErrors.sol";
|
import "./libs/LibExchangeErrors.sol";
|
||||||
import "./mixins/MExchangeCore.sol";
|
import "./mixins/MExchangeCore.sol";
|
||||||
import "./mixins/MMatchOrders.sol";
|
import "./mixins/MMatchOrders.sol";
|
||||||
import "./mixins/MSettlement.sol";
|
|
||||||
import "./mixins/MTransactions.sol";
|
import "./mixins/MTransactions.sol";
|
||||||
|
import "./mixins/MAssetProxyDispatcher.sol";
|
||||||
|
|
||||||
contract MixinMatchOrders is
|
contract MixinMatchOrders is
|
||||||
|
LibConstants,
|
||||||
|
LibBytes,
|
||||||
LibMath,
|
LibMath,
|
||||||
LibExchangeErrors,
|
LibExchangeErrors,
|
||||||
|
MAssetProxyDispatcher,
|
||||||
MExchangeCore,
|
MExchangeCore,
|
||||||
MMatchOrders,
|
MMatchOrders,
|
||||||
MSettlement,
|
|
||||||
MTransactions
|
MTransactions
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -224,4 +228,89 @@ contract MixinMatchOrders is
|
|||||||
// Return fill results
|
// Return fill results
|
||||||
return matchedFillResults;
|
return matchedFillResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @dev Settles matched order by transferring appropriate funds between order makers, taker, and fee recipient.
|
||||||
|
/// @param leftOrder First matched order.
|
||||||
|
/// @param rightOrder Second matched order.
|
||||||
|
/// @param takerAddress Address that matched the orders. The taker receives the spread between orders as profit.
|
||||||
|
/// @param matchedFillResults Struct holding amounts to transfer between makers, taker, and fee recipients.
|
||||||
|
function settleMatchedOrders(
|
||||||
|
LibOrder.Order memory leftOrder,
|
||||||
|
LibOrder.Order memory rightOrder,
|
||||||
|
address takerAddress,
|
||||||
|
LibFillResults.MatchedFillResults memory matchedFillResults
|
||||||
|
)
|
||||||
|
internal
|
||||||
|
{
|
||||||
|
uint8 leftMakerAssetProxyId = uint8(popLastByte(leftOrder.makerAssetData));
|
||||||
|
uint8 rightMakerAssetProxyId = uint8(popLastByte(rightOrder.makerAssetData));
|
||||||
|
bytes memory zrxAssetData = ZRX_ASSET_DATA;
|
||||||
|
// Order makers and taker
|
||||||
|
dispatchTransferFrom(
|
||||||
|
leftOrder.makerAssetData,
|
||||||
|
leftMakerAssetProxyId,
|
||||||
|
leftOrder.makerAddress,
|
||||||
|
rightOrder.makerAddress,
|
||||||
|
matchedFillResults.right.takerAssetFilledAmount
|
||||||
|
);
|
||||||
|
dispatchTransferFrom(
|
||||||
|
rightOrder.makerAssetData,
|
||||||
|
rightMakerAssetProxyId,
|
||||||
|
rightOrder.makerAddress,
|
||||||
|
leftOrder.makerAddress,
|
||||||
|
matchedFillResults.left.takerAssetFilledAmount
|
||||||
|
);
|
||||||
|
dispatchTransferFrom(
|
||||||
|
leftOrder.makerAssetData,
|
||||||
|
leftMakerAssetProxyId,
|
||||||
|
leftOrder.makerAddress,
|
||||||
|
takerAddress,
|
||||||
|
matchedFillResults.leftMakerAssetSpreadAmount
|
||||||
|
);
|
||||||
|
|
||||||
|
// Maker fees
|
||||||
|
dispatchTransferFrom(
|
||||||
|
zrxAssetData,
|
||||||
|
ZRX_PROXY_ID,
|
||||||
|
leftOrder.makerAddress,
|
||||||
|
leftOrder.feeRecipientAddress,
|
||||||
|
matchedFillResults.left.makerFeePaid
|
||||||
|
);
|
||||||
|
dispatchTransferFrom(
|
||||||
|
zrxAssetData,
|
||||||
|
ZRX_PROXY_ID,
|
||||||
|
rightOrder.makerAddress,
|
||||||
|
rightOrder.feeRecipientAddress,
|
||||||
|
matchedFillResults.right.makerFeePaid
|
||||||
|
);
|
||||||
|
|
||||||
|
// Taker fees
|
||||||
|
if (leftOrder.feeRecipientAddress == rightOrder.feeRecipientAddress) {
|
||||||
|
dispatchTransferFrom(
|
||||||
|
zrxAssetData,
|
||||||
|
ZRX_PROXY_ID,
|
||||||
|
takerAddress,
|
||||||
|
leftOrder.feeRecipientAddress,
|
||||||
|
safeAdd(
|
||||||
|
matchedFillResults.left.takerFeePaid,
|
||||||
|
matchedFillResults.right.takerFeePaid
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
dispatchTransferFrom(
|
||||||
|
zrxAssetData,
|
||||||
|
ZRX_PROXY_ID,
|
||||||
|
takerAddress,
|
||||||
|
leftOrder.feeRecipientAddress,
|
||||||
|
matchedFillResults.left.takerFeePaid
|
||||||
|
);
|
||||||
|
dispatchTransferFrom(
|
||||||
|
zrxAssetData,
|
||||||
|
ZRX_PROXY_ID,
|
||||||
|
takerAddress,
|
||||||
|
rightOrder.feeRecipientAddress,
|
||||||
|
matchedFillResults.right.takerFeePaid
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,182 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
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.4.24;
|
|
||||||
pragma experimental ABIEncoderV2;
|
|
||||||
|
|
||||||
import "../../utils/LibBytes/LibBytes.sol";
|
|
||||||
import "./libs/LibMath.sol";
|
|
||||||
import "./libs/LibFillResults.sol";
|
|
||||||
import "./libs/LibOrder.sol";
|
|
||||||
import "./libs/LibExchangeErrors.sol";
|
|
||||||
import "./mixins/MMatchOrders.sol";
|
|
||||||
import "./mixins/MSettlement.sol";
|
|
||||||
import "./mixins/MAssetProxyDispatcher.sol";
|
|
||||||
|
|
||||||
contract MixinSettlement is
|
|
||||||
LibBytes,
|
|
||||||
LibMath,
|
|
||||||
LibExchangeErrors,
|
|
||||||
MMatchOrders,
|
|
||||||
MSettlement,
|
|
||||||
MAssetProxyDispatcher
|
|
||||||
{
|
|
||||||
// ZRX address encoded as a byte array.
|
|
||||||
// This will be constant throughout the life of the Exchange contract,
|
|
||||||
// since ZRX will always be transferred via the ERC20 AssetProxy.
|
|
||||||
bytes internal ZRX_ASSET_DATA;
|
|
||||||
uint8 constant ZRX_PROXY_ID = 1;
|
|
||||||
|
|
||||||
/// TODO: _zrxAssetData should be a constant in production.
|
|
||||||
/// @dev Constructor sets the metadata that will be used for paying ZRX fees.
|
|
||||||
/// @param _zrxAssetData Byte array containing ERC20 proxy id concatenated with address of ZRX.
|
|
||||||
constructor (bytes memory _zrxAssetData)
|
|
||||||
public
|
|
||||||
{
|
|
||||||
ZRX_ASSET_DATA = _zrxAssetData;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @dev Settles an order by transferring assets between counterparties.
|
|
||||||
/// @param order Order struct containing order specifications.
|
|
||||||
/// @param takerAddress Address selling takerAsset and buying makerAsset.
|
|
||||||
/// @param fillResults Amounts to be filled and fees paid by maker and taker.
|
|
||||||
function settleOrder(
|
|
||||||
LibOrder.Order memory order,
|
|
||||||
address takerAddress,
|
|
||||||
LibFillResults.FillResults memory fillResults
|
|
||||||
)
|
|
||||||
internal
|
|
||||||
{
|
|
||||||
uint8 makerAssetProxyId = uint8(popLastByte(order.makerAssetData));
|
|
||||||
uint8 takerAssetProxyId = uint8(popLastByte(order.takerAssetData));
|
|
||||||
bytes memory zrxAssetData = ZRX_ASSET_DATA;
|
|
||||||
dispatchTransferFrom(
|
|
||||||
order.makerAssetData,
|
|
||||||
makerAssetProxyId,
|
|
||||||
order.makerAddress,
|
|
||||||
takerAddress,
|
|
||||||
fillResults.makerAssetFilledAmount
|
|
||||||
);
|
|
||||||
dispatchTransferFrom(
|
|
||||||
order.takerAssetData,
|
|
||||||
takerAssetProxyId,
|
|
||||||
takerAddress,
|
|
||||||
order.makerAddress,
|
|
||||||
fillResults.takerAssetFilledAmount
|
|
||||||
);
|
|
||||||
dispatchTransferFrom(
|
|
||||||
zrxAssetData,
|
|
||||||
ZRX_PROXY_ID,
|
|
||||||
order.makerAddress,
|
|
||||||
order.feeRecipientAddress,
|
|
||||||
fillResults.makerFeePaid
|
|
||||||
);
|
|
||||||
dispatchTransferFrom(
|
|
||||||
zrxAssetData,
|
|
||||||
ZRX_PROXY_ID,
|
|
||||||
takerAddress,
|
|
||||||
order.feeRecipientAddress,
|
|
||||||
fillResults.takerFeePaid
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @dev Settles matched order by transferring appropriate funds between order makers, taker, and fee recipient.
|
|
||||||
/// @param leftOrder First matched order.
|
|
||||||
/// @param rightOrder Second matched order.
|
|
||||||
/// @param takerAddress Address that matched the orders. The taker receives the spread between orders as profit.
|
|
||||||
/// @param matchedFillResults Struct holding amounts to transfer between makers, taker, and fee recipients.
|
|
||||||
function settleMatchedOrders(
|
|
||||||
LibOrder.Order memory leftOrder,
|
|
||||||
LibOrder.Order memory rightOrder,
|
|
||||||
address takerAddress,
|
|
||||||
LibFillResults.MatchedFillResults memory matchedFillResults
|
|
||||||
)
|
|
||||||
internal
|
|
||||||
{
|
|
||||||
uint8 leftMakerAssetProxyId = uint8(popLastByte(leftOrder.makerAssetData));
|
|
||||||
uint8 rightMakerAssetProxyId = uint8(popLastByte(rightOrder.makerAssetData));
|
|
||||||
bytes memory zrxAssetData = ZRX_ASSET_DATA;
|
|
||||||
// Order makers and taker
|
|
||||||
dispatchTransferFrom(
|
|
||||||
leftOrder.makerAssetData,
|
|
||||||
leftMakerAssetProxyId,
|
|
||||||
leftOrder.makerAddress,
|
|
||||||
rightOrder.makerAddress,
|
|
||||||
matchedFillResults.right.takerAssetFilledAmount
|
|
||||||
);
|
|
||||||
dispatchTransferFrom(
|
|
||||||
rightOrder.makerAssetData,
|
|
||||||
rightMakerAssetProxyId,
|
|
||||||
rightOrder.makerAddress,
|
|
||||||
leftOrder.makerAddress,
|
|
||||||
matchedFillResults.left.takerAssetFilledAmount
|
|
||||||
);
|
|
||||||
dispatchTransferFrom(
|
|
||||||
leftOrder.makerAssetData,
|
|
||||||
leftMakerAssetProxyId,
|
|
||||||
leftOrder.makerAddress,
|
|
||||||
takerAddress,
|
|
||||||
matchedFillResults.leftMakerAssetSpreadAmount
|
|
||||||
);
|
|
||||||
|
|
||||||
// Maker fees
|
|
||||||
dispatchTransferFrom(
|
|
||||||
zrxAssetData,
|
|
||||||
ZRX_PROXY_ID,
|
|
||||||
leftOrder.makerAddress,
|
|
||||||
leftOrder.feeRecipientAddress,
|
|
||||||
matchedFillResults.left.makerFeePaid
|
|
||||||
);
|
|
||||||
dispatchTransferFrom(
|
|
||||||
zrxAssetData,
|
|
||||||
ZRX_PROXY_ID,
|
|
||||||
rightOrder.makerAddress,
|
|
||||||
rightOrder.feeRecipientAddress,
|
|
||||||
matchedFillResults.right.makerFeePaid
|
|
||||||
);
|
|
||||||
|
|
||||||
// Taker fees
|
|
||||||
if (leftOrder.feeRecipientAddress == rightOrder.feeRecipientAddress) {
|
|
||||||
dispatchTransferFrom(
|
|
||||||
zrxAssetData,
|
|
||||||
ZRX_PROXY_ID,
|
|
||||||
takerAddress,
|
|
||||||
leftOrder.feeRecipientAddress,
|
|
||||||
safeAdd(
|
|
||||||
matchedFillResults.left.takerFeePaid,
|
|
||||||
matchedFillResults.right.takerFeePaid
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
dispatchTransferFrom(
|
|
||||||
zrxAssetData,
|
|
||||||
ZRX_PROXY_ID,
|
|
||||||
takerAddress,
|
|
||||||
leftOrder.feeRecipientAddress,
|
|
||||||
matchedFillResults.left.takerFeePaid
|
|
||||||
);
|
|
||||||
dispatchTransferFrom(
|
|
||||||
zrxAssetData,
|
|
||||||
ZRX_PROXY_ID,
|
|
||||||
takerAddress,
|
|
||||||
rightOrder.feeRecipientAddress,
|
|
||||||
matchedFillResults.right.takerFeePaid
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
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.4.24;
|
||||||
|
|
||||||
|
contract LibConstants {
|
||||||
|
|
||||||
|
// Asset data for ZRX token. Used for fee transfers.
|
||||||
|
// @TODO: Hardcode constant when we deploy. Currently
|
||||||
|
// not constant to make testing easier.
|
||||||
|
bytes public ZRX_ASSET_DATA;
|
||||||
|
|
||||||
|
// Proxy Id for ZRX token.
|
||||||
|
uint8 constant ZRX_PROXY_ID = 1;
|
||||||
|
|
||||||
|
// @TODO: Remove when we deploy.
|
||||||
|
constructor (bytes memory zrxAssetData)
|
||||||
|
public
|
||||||
|
{
|
||||||
|
ZRX_ASSET_DATA = zrxAssetData;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -121,4 +121,16 @@ contract MExchangeCore is
|
|||||||
internal
|
internal
|
||||||
pure
|
pure
|
||||||
returns (LibFillResults.FillResults memory fillResults);
|
returns (LibFillResults.FillResults memory fillResults);
|
||||||
|
|
||||||
|
/// @dev Settles an order by transferring assets between counterparties.
|
||||||
|
/// @param order Order struct containing order specifications.
|
||||||
|
/// @param takerAddress Address selling takerAsset and buying makerAsset.
|
||||||
|
/// @param fillResults Amounts to be filled and fees paid by maker and taker.
|
||||||
|
function settleOrder(
|
||||||
|
LibOrder.Order memory order,
|
||||||
|
address takerAddress,
|
||||||
|
LibFillResults.FillResults memory fillResults
|
||||||
|
)
|
||||||
|
internal;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,4 +54,17 @@ contract MMatchOrders is
|
|||||||
internal
|
internal
|
||||||
pure
|
pure
|
||||||
returns (LibFillResults.MatchedFillResults memory matchedFillResults);
|
returns (LibFillResults.MatchedFillResults memory matchedFillResults);
|
||||||
|
|
||||||
|
/// @dev Settles matched order by transferring appropriate funds between order makers, taker, and fee recipient.
|
||||||
|
/// @param leftOrder First matched order.
|
||||||
|
/// @param rightOrder Second matched order.
|
||||||
|
/// @param takerAddress Address that matched the orders. The taker receives the spread between orders as profit.
|
||||||
|
/// @param matchedFillResults Struct holding amounts to transfer between makers, taker, and fee recipients.
|
||||||
|
function settleMatchedOrders(
|
||||||
|
LibOrder.Order memory leftOrder,
|
||||||
|
LibOrder.Order memory rightOrder,
|
||||||
|
address takerAddress,
|
||||||
|
LibFillResults.MatchedFillResults memory matchedFillResults
|
||||||
|
)
|
||||||
|
internal;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
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.4.24;
|
|
||||||
|
|
||||||
import "../libs/LibOrder.sol";
|
|
||||||
import "../libs/LibFillResults.sol";
|
|
||||||
|
|
||||||
contract MSettlement {
|
|
||||||
|
|
||||||
/// @dev Settles an order by transferring assets between counterparties.
|
|
||||||
/// @param order Order struct containing order specifications.
|
|
||||||
/// @param takerAddress Address selling takerAsset and buying makerAsset.
|
|
||||||
/// @param fillResults Amounts to be filled and fees paid by maker and taker.
|
|
||||||
function settleOrder(
|
|
||||||
LibOrder.Order memory order,
|
|
||||||
address takerAddress,
|
|
||||||
LibFillResults.FillResults memory fillResults
|
|
||||||
)
|
|
||||||
internal;
|
|
||||||
|
|
||||||
/// @dev Settles matched order by transferring appropriate funds between order makers, taker, and fee recipient.
|
|
||||||
/// @param leftOrder First matched order.
|
|
||||||
/// @param rightOrder Second matched order.
|
|
||||||
/// @param takerAddress Address that matched the orders. The taker receives the spread between orders as profit.
|
|
||||||
/// @param matchedFillResults Struct holding amounts to transfer between makers, taker, and fee recipients.
|
|
||||||
function settleMatchedOrders(
|
|
||||||
LibOrder.Order memory leftOrder,
|
|
||||||
LibOrder.Order memory rightOrder,
|
|
||||||
address takerAddress,
|
|
||||||
LibFillResults.MatchedFillResults memory matchedFillResults
|
|
||||||
)
|
|
||||||
internal;
|
|
||||||
}
|
|
||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user