aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-07-06 17:10:55 +0800
committerGitHub <noreply@github.com>2018-07-06 17:10:55 +0800
commitb21f6e4d8652eb402fc1c8bbf8a13a024d945c74 (patch)
tree106a622d3b121c61fa011cd7e4134c12dd788b3a /packages/order-watcher
parentbc52303402e6ee1b3ab9d948d909d1d10ebf26e4 (diff)
parent0c8264801ac15952861724ecd6a2620dc3055e5e (diff)
downloaddexon-sol-tools-b21f6e4d8652eb402fc1c8bbf8a13a024d945c74.tar
dexon-sol-tools-b21f6e4d8652eb402fc1c8bbf8a13a024d945c74.tar.gz
dexon-sol-tools-b21f6e4d8652eb402fc1c8bbf8a13a024d945c74.tar.bz2
dexon-sol-tools-b21f6e4d8652eb402fc1c8bbf8a13a024d945c74.tar.lz
dexon-sol-tools-b21f6e4d8652eb402fc1c8bbf8a13a024d945c74.tar.xz
dexon-sol-tools-b21f6e4d8652eb402fc1c8bbf8a13a024d945c74.tar.zst
dexon-sol-tools-b21f6e4d8652eb402fc1c8bbf8a13a024d945c74.zip
Merge pull request #822 from 0xProject/v2-contract-wrappers-WIP
V2 contract wrappers
Diffstat (limited to 'packages/order-watcher')
-rw-r--r--packages/order-watcher/package.json4
-rw-r--r--packages/order-watcher/src/order_watcher/order_watcher.ts38
2 files changed, 21 insertions, 21 deletions
diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json
index 40613ea96..19ddf4358 100644
--- a/packages/order-watcher/package.json
+++ b/packages/order-watcher/package.json
@@ -77,9 +77,9 @@
"typescript": "2.7.1"
},
"dependencies": {
- "@0xproject/assert": "^0.2.12",
+ "@0xproject/assert": "0.2.12",
"@0xproject/base-contract": "^0.3.4",
- "@0xproject/contract-wrappers": "^0.0.5",
+ "@0xproject/contract-wrappers": "0.0.5",
"@0xproject/fill-scenarios": "^0.0.4",
"@0xproject/json-schemas": "0.8.1",
"@0xproject/order-utils": "^0.0.7",
diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts
index 0ee56592e..cac3a0923 100644
--- a/packages/order-watcher/src/order_watcher/order_watcher.ts
+++ b/packages/order-watcher/src/order_watcher/order_watcher.ts
@@ -1,10 +1,7 @@
import {
BalanceAndProxyAllowanceLazyStore,
ContractWrappers,
- LogCancelContractEventArgs,
- LogFillContractEventArgs,
OrderFilledCancelledLazyStore,
- WithdrawalContractEventArgs,
} from '@0xproject/contract-wrappers';
import { schemas } from '@0xproject/json-schemas';
import { getOrderHashHex, OrderStateUtils } from '@0xproject/order-utils';
@@ -23,16 +20,22 @@ import * as _ from 'lodash';
import { artifacts } from '../artifacts';
import {
- DepositContractEventArgs,
- EtherTokenContractEventArgs,
+ EtherTokenDepositEventArgs,
+ EtherTokenEventArgs,
EtherTokenEvents,
+ EtherTokenWithdrawalEventArgs,
} from '../generated_contract_wrappers/ether_token';
-import { ExchangeContractEventArgs, ExchangeEvents } from '../generated_contract_wrappers/exchange';
import {
- ApprovalContractEventArgs,
- TokenContractEventArgs,
+ ExchangeEventArgs,
+ ExchangeEvents,
+ ExchangeLogCancelEventArgs,
+ ExchangeLogFillEventArgs,
+} from '../generated_contract_wrappers/exchange';
+import {
+ TokenApprovalEventArgs,
+ TokenEventArgs,
TokenEvents,
- TransferContractEventArgs,
+ TokenTransferEventArgs,
} from '../generated_contract_wrappers/token';
import { OnOrderStateChangeCallback, OrderWatcherConfig, OrderWatcherError } from '../types';
import { assert } from '../utils/assert';
@@ -40,7 +43,7 @@ import { assert } from '../utils/assert';
import { EventWatcher } from './event_watcher';
import { ExpirationWatcher } from './expiration_watcher';
-type ContractEventArgs = EtherTokenContractEventArgs | ExchangeContractEventArgs | TokenContractEventArgs;
+type ContractEventArgs = EtherTokenEventArgs | ExchangeEventArgs | TokenEventArgs;
interface DependentOrderHashes {
[makerAddress: string]: {
@@ -249,7 +252,7 @@ export class OrderWatcher {
switch (decodedLog.event) {
case TokenEvents.Approval: {
// Invalidate cache
- const args = decodedLog.args as ApprovalContractEventArgs;
+ const args = decodedLog.args as TokenApprovalEventArgs;
this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(decodedLog.address, args._owner);
// Revalidate orders
makerToken = decodedLog.address;
@@ -265,7 +268,7 @@ export class OrderWatcher {
}
case TokenEvents.Transfer: {
// Invalidate cache
- const args = decodedLog.args as TransferContractEventArgs;
+ const args = decodedLog.args as TokenTransferEventArgs;
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._from);
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._to);
// Revalidate orders
@@ -282,7 +285,7 @@ export class OrderWatcher {
}
case EtherTokenEvents.Deposit: {
// Invalidate cache
- const args = decodedLog.args as DepositContractEventArgs;
+ const args = decodedLog.args as EtherTokenDepositEventArgs;
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._owner);
// Revalidate orders
makerToken = decodedLog.address;
@@ -298,8 +301,7 @@ export class OrderWatcher {
}
case EtherTokenEvents.Withdrawal: {
// Invalidate cache
- // tslint:disable-next-line:no-unnecessary-type-assertion
- const args = decodedLog.args as WithdrawalContractEventArgs;
+ const args = decodedLog.args as EtherTokenWithdrawalEventArgs;
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._owner);
// Revalidate orders
makerToken = decodedLog.address;
@@ -315,8 +317,7 @@ export class OrderWatcher {
}
case ExchangeEvents.LogFill: {
// Invalidate cache
- // tslint:disable-next-line:no-unnecessary-type-assertion
- const args = decodedLog.args as LogFillContractEventArgs;
+ const args = decodedLog.args as ExchangeLogFillEventArgs;
this._orderFilledCancelledLazyStore.deleteFilledTakerAmount(args.orderHash);
// Revalidate orders
const orderHash = args.orderHash;
@@ -328,8 +329,7 @@ export class OrderWatcher {
}
case ExchangeEvents.LogCancel: {
// Invalidate cache
- // tslint:disable-next-line:no-unnecessary-type-assertion
- const args = decodedLog.args as LogCancelContractEventArgs;
+ const args = decodedLog.args as ExchangeLogCancelEventArgs;
this._orderFilledCancelledLazyStore.deleteCancelledTakerAmount(args.orderHash);
// Revalidate orders
const orderHash = args.orderHash;