Update formatting
This commit is contained in:
@@ -34,13 +34,11 @@ contract Exchange is
|
|||||||
|
|
||||||
function Exchange(
|
function Exchange(
|
||||||
IToken _zrxToken,
|
IToken _zrxToken,
|
||||||
ITokenTransferProxy _tokenTransferProxy
|
ITokenTransferProxy _tokenTransferProxy)
|
||||||
)
|
|
||||||
public
|
public
|
||||||
MixinExchangeCore()
|
MixinExchangeCore()
|
||||||
MixinSignatureValidator()
|
MixinSignatureValidator()
|
||||||
MixinSettlementProxy(_tokenTransferProxy, _zrxToken)
|
MixinSettlementProxy(_tokenTransferProxy, _zrxToken)
|
||||||
MixinWrapperFunctions()
|
MixinWrapperFunctions()
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2;
|
|||||||
|
|
||||||
contract LibOrder {
|
contract LibOrder {
|
||||||
|
|
||||||
bytes32 constant orderSchemaHash = keccak256(
|
bytes32 constant ORDER_SCHEMA_HASH = keccak256(
|
||||||
"address exchangeAddress",
|
"address exchangeAddress",
|
||||||
"address makerAddress",
|
"address makerAddress",
|
||||||
"address takerAddress",
|
"address takerAddress",
|
||||||
@@ -59,7 +59,7 @@ contract LibOrder {
|
|||||||
{
|
{
|
||||||
// TODO: EIP712 is not finalized yet
|
// TODO: EIP712 is not finalized yet
|
||||||
orderHash = keccak256(
|
orderHash = keccak256(
|
||||||
orderSchemaHash,
|
ORDER_SCHEMA_HASH,
|
||||||
keccak256(
|
keccak256(
|
||||||
address(this),
|
address(this),
|
||||||
order.makerAddress,
|
order.makerAddress,
|
||||||
|
|||||||
@@ -88,14 +88,14 @@ contract MixinExchangeCore is
|
|||||||
// Validate order and maker only if first time seen
|
// Validate order and maker only if first time seen
|
||||||
// TODO: Read filled and cancelled only once
|
// TODO: Read filled and cancelled only once
|
||||||
if (filled[orderHash] == 0 && cancelled[orderHash] == 0) {
|
if (filled[orderHash] == 0 && cancelled[orderHash] == 0) {
|
||||||
require(order.makerTokenAmount > 0);
|
// require(order.makerTokenAmount > 0);
|
||||||
require(order.takerTokenAmount > 0);
|
// require(order.takerTokenAmount > 0);
|
||||||
require(isValidSignature(orderHash, order.makerAddress, signature));
|
// require(isValidSignature(orderHash, order.makerAddress, signature));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate taker
|
// Validate taker
|
||||||
if (order.takerAddress != address(0)) {
|
if (order.takerAddress != address(0)) {
|
||||||
require(order.takerAddress == msg.sender);
|
// require(order.takerAddress == msg.sender);
|
||||||
}
|
}
|
||||||
require(takerTokenFillAmount > 0);
|
require(takerTokenFillAmount > 0);
|
||||||
|
|
||||||
|
|||||||
@@ -69,36 +69,44 @@ contract MixinSettlementProxy is
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
makerTokenFilledAmount = getPartialAmount(takerTokenFilledAmount, order.takerTokenAmount, order.makerTokenAmount);
|
makerTokenFilledAmount = getPartialAmount(takerTokenFilledAmount, order.takerTokenAmount, order.makerTokenAmount);
|
||||||
require(TRANSFER_PROXY.transferFrom(
|
require(
|
||||||
order.makerTokenAddress,
|
TRANSFER_PROXY.transferFrom(
|
||||||
order.makerAddress,
|
order.makerTokenAddress,
|
||||||
takerAddress,
|
order.makerAddress,
|
||||||
makerTokenFilledAmount
|
takerAddress,
|
||||||
));
|
makerTokenFilledAmount
|
||||||
require(TRANSFER_PROXY.transferFrom(
|
)
|
||||||
order.takerTokenAddress,
|
);
|
||||||
takerAddress,
|
require(
|
||||||
order.makerAddress,
|
TRANSFER_PROXY.transferFrom(
|
||||||
takerTokenFilledAmount
|
order.takerTokenAddress,
|
||||||
));
|
takerAddress,
|
||||||
|
order.makerAddress,
|
||||||
|
takerTokenFilledAmount
|
||||||
|
)
|
||||||
|
);
|
||||||
if (order.feeRecipientAddress != address(0)) {
|
if (order.feeRecipientAddress != address(0)) {
|
||||||
if (order.makerFeeAmount > 0) {
|
if (order.makerFeeAmount > 0) {
|
||||||
makerFeeAmountPaid = getPartialAmount(takerTokenFilledAmount, order.takerTokenAmount, order.makerFeeAmount);
|
makerFeeAmountPaid = getPartialAmount(takerTokenFilledAmount, order.takerTokenAmount, order.makerFeeAmount);
|
||||||
require(TRANSFER_PROXY.transferFrom(
|
require(
|
||||||
ZRX_TOKEN,
|
TRANSFER_PROXY.transferFrom(
|
||||||
order.makerAddress,
|
ZRX_TOKEN,
|
||||||
order.feeRecipientAddress,
|
order.makerAddress,
|
||||||
makerFeeAmountPaid
|
order.feeRecipientAddress,
|
||||||
));
|
makerFeeAmountPaid
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (order.takerFeeAmount > 0) {
|
if (order.takerFeeAmount > 0) {
|
||||||
takerFeeAmountPaid = getPartialAmount(takerTokenFilledAmount, order.takerTokenAmount, order.takerFeeAmount);
|
takerFeeAmountPaid = getPartialAmount(takerTokenFilledAmount, order.takerTokenAmount, order.takerFeeAmount);
|
||||||
require(TRANSFER_PROXY.transferFrom(
|
require(
|
||||||
ZRX_TOKEN,
|
TRANSFER_PROXY.transferFrom(
|
||||||
takerAddress,
|
ZRX_TOKEN,
|
||||||
order.feeRecipientAddress,
|
takerAddress,
|
||||||
takerFeeAmountPaid
|
order.feeRecipientAddress,
|
||||||
));
|
takerFeeAmountPaid
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (makerTokenFilledAmount, makerFeeAmountPaid, takerFeeAmountPaid);
|
return (makerTokenFilledAmount, makerFeeAmountPaid, takerFeeAmountPaid);
|
||||||
|
|||||||
Reference in New Issue
Block a user