aboutsummaryrefslogtreecommitdiffstats
path: root/src/order_watcher
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-11-13 02:06:25 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-13 09:06:13 +0800
commita9ae555b88cc36ff2cbd92fdd37a339702860c01 (patch)
treed42ed590c81683a3f6acd0882d31392a9a97f1ca /src/order_watcher
parentd4dc428124a210cc6b8e1c50527a08e902bfadd0 (diff)
downloaddexon-0x-contracts-a9ae555b88cc36ff2cbd92fdd37a339702860c01.tar.gz
dexon-0x-contracts-a9ae555b88cc36ff2cbd92fdd37a339702860c01.tar.zst
dexon-0x-contracts-a9ae555b88cc36ff2cbd92fdd37a339702860c01.zip
Store number of confirmations in a blockStore
Diffstat (limited to 'src/order_watcher')
-rw-r--r--src/order_watcher/event_watcher.ts7
-rw-r--r--src/order_watcher/order_state_watcher.ts8
2 files changed, 6 insertions, 9 deletions
diff --git a/src/order_watcher/event_watcher.ts b/src/order_watcher/event_watcher.ts
index 5303bb651..7e27d5e79 100644
--- a/src/order_watcher/event_watcher.ts
+++ b/src/order_watcher/event_watcher.ts
@@ -29,13 +29,10 @@ export class EventWatcher {
private _pollingIntervalMs: number;
private _intervalIdIfExists?: NodeJS.Timer;
private _lastEvents: Web3.LogEntry[] = [];
- private _numConfirmations: number;
private _blockStore: BlockStore;
- constructor(web3Wrapper: Web3Wrapper, blockStore: BlockStore, pollingIntervalMs: undefined|number,
- numConfirmations: number) {
+ constructor(web3Wrapper: Web3Wrapper, blockStore: BlockStore, pollingIntervalMs: undefined|number) {
this._web3Wrapper = web3Wrapper;
this._blockStore = blockStore;
- this._numConfirmations = numConfirmations;
this._pollingIntervalMs = _.isUndefined(pollingIntervalMs) ?
DEFAULT_EVENT_POLLING_INTERVAL :
pollingIntervalMs;
@@ -71,7 +68,7 @@ export class EventWatcher {
this._lastEvents = pendingEvents;
}
private async _getEventsAsync(): Promise<Web3.LogEntry[]> {
- const blockNumber = this._blockStore.getBlockNumberWithNConfirmations(this._numConfirmations);
+ const blockNumber = this._blockStore.getBlockNumber();
const eventFilter = {
fromBlock: blockNumber,
toBlock: blockNumber,
diff --git a/src/order_watcher/order_state_watcher.ts b/src/order_watcher/order_state_watcher.ts
index e6250cef5..0f5b5c30c 100644
--- a/src/order_watcher/order_state_watcher.ts
+++ b/src/order_watcher/order_state_watcher.ts
@@ -78,15 +78,15 @@ export class OrderStateWatcher {
const numConfirmations = (_.isUndefined(config) || _.isUndefined(config.numConfirmations)) ?
DEFAULT_NUM_CONFIRMATIONS :
config.numConfirmations;
- this._blockStore = new BlockStore(this._web3Wrapper, blockPollingIntervalMs);
+ this._blockStore = new BlockStore(numConfirmations, this._web3Wrapper, blockPollingIntervalMs);
this._eventWatcher = new EventWatcher(
- web3Wrapper, this._blockStore, eventPollingIntervalMs, numConfirmations,
+ web3Wrapper, this._blockStore, eventPollingIntervalMs,
);
this._balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(
- this._token, this._blockStore, numConfirmations,
+ this._token, this._blockStore,
);
this._orderFilledCancelledLazyStore = new OrderFilledCancelledLazyStore(
- this._exchange, this._blockStore, numConfirmations,
+ this._exchange, this._blockStore,
);
this._orderStateUtils = new OrderStateUtils(
this._balanceAndProxyAllowanceLazyStore, this._orderFilledCancelledLazyStore,