Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
@0x/contracts-dev-utils: Prettier.
Browse files Browse the repository at this point in the history
`@0x/contracts-exchange`: Update reentrancy tests.
`@0x/contracts-exchange`: Add all mutator functions to
`ExchangeFunctions` type.
`@0x/contracts-tes-utils`: Remove unused import.
  • Loading branch information
dorothy-zbornak committed Aug 8, 2019
1 parent 5f772e6 commit f9814b0
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion contracts/dev-utils/test/lib_transaction_decoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('LibTransactionDecoder', () => {
});
}

for (const func of ['marketBuyOrders', 'marketSellOrders', ]) {
for (const func of ['marketBuyOrders', 'marketSellOrders']) {
const input = (exchangeInterface as any)[func].getABIEncodedTransactionData(
[order, order],
takerAssetFillAmount,
Expand Down
2 changes: 1 addition & 1 deletion contracts/exchange/test/reentrancy_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ blockchainTests.resets('Reentrancy Tests', env => {
!method.constant &&
!_.includes(['view', 'pure'], method.stateMutability)
) {
if (_.includes(TestConstants.REENTRANT_FUNCTIONS, method.name)) {
if (_.includes(TestConstants.REENTRANT_FUNCTIONS as string[], method.name)) {
reentrantFunctions.push(method);
} else {
nonReentrantFunctions.push(method);
Expand Down
10 changes: 5 additions & 5 deletions contracts/exchange/test/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ export const constants = {
// These are functions not secured by the `nonReentrant`, directly or
// indirectly (by calling a function that has the modifier).
REENTRANT_FUNCTIONS: [
'batchExecuteTransactions',
'executeTransaction',
'registerAssetProxy',
'simulateDispatchTransferFromCalls',
'transferOwnership',
ExchangeFunctionName.BatchExecuteTransactions,
ExchangeFunctionName.ExecuteTransaction,
ExchangeFunctionName.RegisterAssetProxy,
ExchangeFunctionName.SimulateDispatchTransferFromCalls,
ExchangeFunctionName.TransferOwnership,
],
SINGLE_FILL_FN_NAMES: [
ExchangeFunctionName.FillOrder,
Expand Down
22 changes: 15 additions & 7 deletions contracts/exchange/test/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,26 @@ export interface AbiDecodedFillOrderData {
}

export enum ExchangeFunctionName {
FillOrder = 'fillOrder',
FillOrKillOrder = 'fillOrKillOrder',
FillOrderNoThrow = 'fillOrderNoThrow',
BatchFillOrders = 'batchFillOrders',
BatchCancelOrders = 'batchCancelOrders',
BatchExecuteTransactions = 'batchExecuteTransactions',
BatchFillOrKillOrders = 'batchFillOrKillOrders',
BatchFillOrders = 'batchFillOrders',
BatchFillOrdersNoThrow = 'batchFillOrdersNoThrow',
BatchMatchOrders = 'batchMatchOrders',
BatchMatchordersWithMaximalFill = 'batchMatchOrdersWithMaximalFill',
CancelOrder = 'cancelOrder',
CancelOrdersUpTo = 'cancelOrdersUpTo',
ExecuteTransaction = 'executeTransaction',
FillOrKillOrder = 'fillOrKillOrder',
FillOrder = 'fillOrder',
FillOrderNoThrow = 'fillOrderNoThrow',
MarketBuyOrders = 'marketBuyOrders',
MarketSellOrders = 'marketSellOrders',
MatchOrders = 'matchOrders',
CancelOrder = 'cancelOrder',
BatchCancelOrders = 'batchCancelOrders',
CancelOrdersUpTo = 'cancelOrdersUpTo',
MatchOrdersWithMaximalfill = 'matchOrdersWithMaximalFill',
PreSign = 'preSign',
RegisterAssetProxy = 'registerAssetProxy',
SetSignatureValidatorApproval = 'setSignatureValidatorApproval',
SimulateDispatchTransferFromCalls = 'simulateDispatchTransferFromCalls',
TransferOwnership = 'transferOwnership',
}
2 changes: 0 additions & 2 deletions contracts/test-utils/src/log_decoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import {
} from 'ethereum-types';
import * as _ from 'lodash';

import { constants } from './constants';

export class LogDecoder {
private readonly _web3Wrapper: Web3Wrapper;
private readonly _abiDecoder: AbiDecoder;
Expand Down

0 comments on commit f9814b0

Please sign in to comment.