Added a reentrancy test for matchOrdersWithMaximalFill

This commit is contained in:
James Towle
2019-07-02 21:53:50 -05:00
committed by Amir Bandeali
parent 0df68a6e06
commit 5a64759c83
2 changed files with 22 additions and 0 deletions

View File

@@ -47,6 +47,7 @@ contract ReentrantERC20Token is
MARKET_BUY_ORDERS,
MARKET_SELL_ORDERS,
MATCH_ORDERS,
MATCH_ORDERS_WITH_MAXIMAL_FILL,
CANCEL_ORDER,
BATCH_CANCEL_ORDERS,
CANCEL_ORDERS_UP_TO,
@@ -147,6 +148,26 @@ contract ReentrantERC20Token is
signatures[0],
signatures[1]
);
} else if (currentFunctionId == uint8(ExchangeFunction.MATCH_ORDERS)) {
LibOrder.Order[2] memory orders = _createMatchedOrders();
bytes[] memory signatures = _createWalletSignatures(2);
callData = abi.encodeWithSelector(
exchange.matchOrders.selector,
orders[0],
orders[1],
signatures[0],
signatures[1]
);
} else if (currentFunctionId == uint8(ExchangeFunction.MATCH_ORDERS_WITH_MAXIMAL_FILL)) {
LibOrder.Order[2] memory orders = _createMatchedOrders();
bytes[] memory signatures = _createWalletSignatures(2);
callData = abi.encodeWithSelector(
exchange.matchOrdersWithMaximalFill.selector,
orders[0],
orders[1],
signatures[0],
signatures[1]
);
} else if (currentFunctionId == uint8(ExchangeFunction.CANCEL_ORDER)) {
callData = abi.encodeWithSelector(
exchange.cancelOrder.selector,

View File

@@ -9,6 +9,7 @@ export const constants = {
'MARKET_BUY_ORDERS',
'MARKET_SELL_ORDERS',
'MATCH_ORDERS',
'MATCH_ORDERS_WITH_MAXIMAL_FILL',
'CANCEL_ORDER',
'BATCH_CANCEL_ORDERS',
'CANCEL_ORDERS_UP_TO',