Update formatting

This commit is contained in:
Amir Bandeali
2018-03-08 15:57:26 -08:00
parent a35138e2b9
commit 9cc1956b4b
4 changed files with 40 additions and 34 deletions

View File

@@ -34,13 +34,11 @@ contract Exchange is
function Exchange(
IToken _zrxToken,
ITokenTransferProxy _tokenTransferProxy
)
ITokenTransferProxy _tokenTransferProxy)
public
MixinExchangeCore()
MixinSignatureValidator()
MixinSettlementProxy(_tokenTransferProxy, _zrxToken)
MixinWrapperFunctions()
{
}
{}
}

View File

@@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2;
contract LibOrder {
bytes32 constant orderSchemaHash = keccak256(
bytes32 constant ORDER_SCHEMA_HASH = keccak256(
"address exchangeAddress",
"address makerAddress",
"address takerAddress",
@@ -59,7 +59,7 @@ contract LibOrder {
{
// TODO: EIP712 is not finalized yet
orderHash = keccak256(
orderSchemaHash,
ORDER_SCHEMA_HASH,
keccak256(
address(this),
order.makerAddress,

View File

@@ -88,14 +88,14 @@ contract MixinExchangeCore is
// Validate order and maker only if first time seen
// TODO: Read filled and cancelled only once
if (filled[orderHash] == 0 && cancelled[orderHash] == 0) {
require(order.makerTokenAmount > 0);
require(order.takerTokenAmount > 0);
require(isValidSignature(orderHash, order.makerAddress, signature));
// require(order.makerTokenAmount > 0);
// require(order.takerTokenAmount > 0);
// require(isValidSignature(orderHash, order.makerAddress, signature));
}
// Validate taker
if (order.takerAddress != address(0)) {
require(order.takerAddress == msg.sender);
// require(order.takerAddress == msg.sender);
}
require(takerTokenFillAmount > 0);

View File

@@ -69,36 +69,44 @@ contract MixinSettlementProxy is
)
{
makerTokenFilledAmount = getPartialAmount(takerTokenFilledAmount, order.takerTokenAmount, order.makerTokenAmount);
require(TRANSFER_PROXY.transferFrom(
order.makerTokenAddress,
order.makerAddress,
takerAddress,
makerTokenFilledAmount
));
require(TRANSFER_PROXY.transferFrom(
order.takerTokenAddress,
takerAddress,
order.makerAddress,
takerTokenFilledAmount
));
require(
TRANSFER_PROXY.transferFrom(
order.makerTokenAddress,
order.makerAddress,
takerAddress,
makerTokenFilledAmount
)
);
require(
TRANSFER_PROXY.transferFrom(
order.takerTokenAddress,
takerAddress,
order.makerAddress,
takerTokenFilledAmount
)
);
if (order.feeRecipientAddress != address(0)) {
if (order.makerFeeAmount > 0) {
makerFeeAmountPaid = getPartialAmount(takerTokenFilledAmount, order.takerTokenAmount, order.makerFeeAmount);
require(TRANSFER_PROXY.transferFrom(
ZRX_TOKEN,
order.makerAddress,
order.feeRecipientAddress,
makerFeeAmountPaid
));
require(
TRANSFER_PROXY.transferFrom(
ZRX_TOKEN,
order.makerAddress,
order.feeRecipientAddress,
makerFeeAmountPaid
)
);
}
if (order.takerFeeAmount > 0) {
takerFeeAmountPaid = getPartialAmount(takerTokenFilledAmount, order.takerTokenAmount, order.takerFeeAmount);
require(TRANSFER_PROXY.transferFrom(
ZRX_TOKEN,
takerAddress,
order.feeRecipientAddress,
takerFeeAmountPaid
));
require(
TRANSFER_PROXY.transferFrom(
ZRX_TOKEN,
takerAddress,
order.feeRecipientAddress,
takerFeeAmountPaid
)
);
}
}
return (makerTokenFilledAmount, makerFeeAmountPaid, takerFeeAmountPaid);