RFQ order with 0 txOrigin is INVALID (#50)
This commit is contained in:
parent
ad337271d3
commit
9653eb9e70
@ -41,6 +41,10 @@
|
|||||||
{
|
{
|
||||||
"note": "Remove protocol fees from all RFQ orders and add `taker` field to RFQ orders",
|
"note": "Remove protocol fees from all RFQ orders and add `taker` field to RFQ orders",
|
||||||
"pr": 45
|
"pr": 45
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Fix getRfqOrderInfo() to return status INVALID when missing txOrigin",
|
||||||
|
"pr": 50
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -651,6 +651,11 @@ contract NativeOrdersFeature is
|
|||||||
order.salt,
|
order.salt,
|
||||||
minValidSalt
|
minValidSalt
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Check for missing txOrigin.
|
||||||
|
if (order.txOrigin == address(0)) {
|
||||||
|
orderInfo.status = LibNativeOrder.OrderStatus.INVALID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Get the canonical hash of a limit order.
|
/// @dev Get the canonical hash of a limit order.
|
||||||
|
@ -365,6 +365,16 @@ blockchainTests.resets('NativeOrdersFeature', env => {
|
|||||||
takerTokenFilledAmount: fillAmount,
|
takerTokenFilledAmount: fillAmount,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('invalid origin', async () => {
|
||||||
|
const order = getTestRfqOrder({ txOrigin: NULL_ADDRESS });
|
||||||
|
const info = await zeroEx.getRfqOrderInfo(order).callAsync();
|
||||||
|
assertOrderInfoEquals(info, {
|
||||||
|
status: OrderStatus.Invalid,
|
||||||
|
orderHash: order.getHash(),
|
||||||
|
takerTokenFilledAmount: ZERO_AMOUNT,
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('cancelLimitOrder()', async () => {
|
describe('cancelLimitOrder()', async () => {
|
||||||
@ -1216,7 +1226,7 @@ blockchainTests.resets('NativeOrdersFeature', env => {
|
|||||||
const order = getTestRfqOrder({ txOrigin: NULL_ADDRESS });
|
const order = getTestRfqOrder({ txOrigin: NULL_ADDRESS });
|
||||||
const tx = fillRfqOrderAsync(order, order.takerAmount, notTaker);
|
const tx = fillRfqOrderAsync(order, order.takerAmount, notTaker);
|
||||||
return expect(tx).to.revertWith(
|
return expect(tx).to.revertWith(
|
||||||
new RevertErrors.OrderNotFillableByOriginError(order.getHash(), notTaker, order.txOrigin),
|
new RevertErrors.OrderNotFillableError(order.getHash(), OrderStatus.Invalid),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user