1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
import { OrderWithoutExchangeAddress } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { AbiDefinition } from 'ethereum-types';
export interface ERC20BalancesByOwner {
[ownerAddress: string]: {
[tokenAddress: string]: BigNumber;
};
}
export interface ERC721TokenIdsByOwner {
[ownerAddress: string]: {
[tokenAddress: string]: BigNumber[];
};
}
export interface SubmissionContractEventArgs {
transactionId: BigNumber;
}
export interface BatchFillOrders {
orders: OrderWithoutExchangeAddress[];
signatures: string[];
takerAssetFillAmounts: BigNumber[];
}
export interface MarketSellOrders {
orders: OrderWithoutExchangeAddress[];
signatures: string[];
takerAssetFillAmount: BigNumber;
}
export interface MarketBuyOrders {
orders: OrderWithoutExchangeAddress[];
signatures: string[];
makerAssetFillAmount: BigNumber;
}
export interface BatchCancelOrders {
orders: OrderWithoutExchangeAddress[];
}
export interface CancelOrdersBefore {
salt: BigNumber;
}
export interface TransactionDataParams {
name: string;
abi: AbiDefinition[];
args: any[];
}
export interface MultiSigConfig {
owners: string[];
confirmationsRequired: number;
secondsRequired: number;
}
export interface MultiSigConfigByNetwork {
[networkName: string]: MultiSigConfig;
}
export interface Token {
address?: string;
name: string;
symbol: string;
decimals: number;
ipfsHash: string;
swarmHash: string;
}
export enum OrderStatus {
INVALID,
INVALID_MAKER_ASSET_AMOUNT,
INVALID_TAKER_ASSET_AMOUNT,
FILLABLE,
EXPIRED,
FULLY_FILLED,
CANCELLED,
}
export enum ContractName {
TokenRegistry = 'TokenRegistry',
MultiSigWalletWithTimeLock = 'MultiSigWalletWithTimeLock',
Exchange = 'Exchange',
ZRXToken = 'ZRXToken',
YesComplianceToken = 'YesComplianceToken',
DummyERC20Token = 'DummyERC20Token',
EtherToken = 'WETH9',
DutchAuction = 'DutchAuction',
AssetProxyOwner = 'AssetProxyOwner',
AccountLevels = 'AccountLevels',
EtherDelta = 'EtherDelta',
Arbitrage = 'Arbitrage',
TestAssetDataDecoders = 'TestAssetDataDecoders',
TestAssetProxyDispatcher = 'TestAssetProxyDispatcher',
TestLibs = 'TestLibs',
TestSignatureValidator = 'TestSignatureValidator',
ERC20Proxy = 'ERC20Proxy',
ERC721Proxy = 'ERC721Proxy',
DummyERC721Receiver = 'DummyERC721Receiver',
DummyERC721Token = 'DummyERC721Token',
TestLibBytes = 'TestLibBytes',
TestWallet = 'TestWallet',
Authorizable = 'Authorizable',
Whitelist = 'Whitelist',
Forwarder = 'Forwarder',
}
export interface SignedTransaction {
exchangeAddress: string;
salt: BigNumber;
signerAddress: string;
data: string;
signature: string;
}
export interface TransferAmountsByMatchOrders {
// Left Maker
amountBoughtByLeftMaker: BigNumber;
amountSoldByLeftMaker: BigNumber;
feePaidByLeftMaker: BigNumber;
// Right Maker
amountBoughtByRightMaker: BigNumber;
amountSoldByRightMaker: BigNumber;
feePaidByRightMaker: BigNumber;
// Taker
amountReceivedByTaker: BigNumber;
feePaidByTakerLeft: BigNumber;
feePaidByTakerRight: BigNumber;
}
export interface TransferAmountsLoggedByMatchOrders {
makerAddress: string;
takerAddress: string;
makerAssetFilledAmount: string;
takerAssetFilledAmount: string;
makerFeePaid: string;
takerFeePaid: string;
}
export interface OrderInfo {
orderStatus: number;
orderHash: string;
orderTakerAssetFilledAmount: BigNumber;
}
export interface CancelOrder {
order: OrderWithoutExchangeAddress;
takerAssetCancelAmount: BigNumber;
}
export interface MatchOrder {
left: OrderWithoutExchangeAddress;
right: OrderWithoutExchangeAddress;
leftSignature: string;
rightSignature: string;
}
// Combinatorial testing types
export enum FeeRecipientAddressScenario {
BurnAddress = 'BURN_ADDRESS',
EthUserAddress = 'ETH_USER_ADDRESS',
}
export enum OrderAssetAmountScenario {
Zero = 'ZERO',
Large = 'LARGE',
Small = 'SMALL',
}
export enum TakerScenario {
CorrectlySpecified = 'CORRECTLY_SPECIFIED',
IncorrectlySpecified = 'INCORRECTLY_SPECIFIED',
Unspecified = 'UNSPECIFIED',
}
export enum ExpirationTimeSecondsScenario {
InPast = 'IN_PAST',
InFuture = 'IN_FUTURE',
}
export enum AssetDataScenario {
ERC20ZeroDecimals = 'ERC20_ZERO_DECIMALS',
ZRXFeeToken = 'ZRX_FEE_TOKEN',
ERC20FiveDecimals = 'ERC20_FIVE_DECIMALS',
ERC20NonZRXEighteenDecimals = 'ERC20_NON_ZRX_EIGHTEEN_DECIMALS',
ERC721 = 'ERC721',
}
export enum TakerAssetFillAmountScenario {
Zero = 'ZERO',
GreaterThanRemainingFillableTakerAssetAmount = 'GREATER_THAN_REMAINING_FILLABLE_TAKER_ASSET_AMOUNT',
LessThanRemainingFillableTakerAssetAmount = 'LESS_THAN_REMAINING_FILLABLE_TAKER_ASSET_AMOUNT',
ExactlyRemainingFillableTakerAssetAmount = 'EXACTLY_REMAINING_FILLABLE_TAKER_ASSET_AMOUNT',
}
export interface OrderScenario {
takerScenario: TakerScenario;
feeRecipientScenario: FeeRecipientAddressScenario;
makerAssetAmountScenario: OrderAssetAmountScenario;
takerAssetAmountScenario: OrderAssetAmountScenario;
makerFeeScenario: OrderAssetAmountScenario;
takerFeeScenario: OrderAssetAmountScenario;
expirationTimeSecondsScenario: ExpirationTimeSecondsScenario;
makerAssetDataScenario: AssetDataScenario;
takerAssetDataScenario: AssetDataScenario;
}
export enum BalanceAmountScenario {
Exact = 'EXACT',
TooLow = 'TOO_LOW',
Higher = 'HIGHER',
}
export enum AllowanceAmountScenario {
Exact = 'EXACT',
TooLow = 'TOO_LOW',
Higher = 'HIGHER',
Unlimited = 'UNLIMITED',
}
export interface TraderStateScenario {
traderAssetBalance: BalanceAmountScenario;
traderAssetAllowance: AllowanceAmountScenario;
zrxFeeBalance: BalanceAmountScenario;
zrxFeeAllowance: AllowanceAmountScenario;
}
export interface FillScenario {
orderScenario: OrderScenario;
takerAssetFillAmountScenario: TakerAssetFillAmountScenario;
makerStateScenario: TraderStateScenario;
takerStateScenario: TraderStateScenario;
}
export interface FillResults {
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
}
|