aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/src/index.ts
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-09-26 03:54:10 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-12-05 06:24:06 +0800
commitfe523e1f3f765077bdaf4dfc345c9dca67693668 (patch)
tree240544ddca2ecc3e96dfd7079b3192bb3827bb97 /packages/pipeline/src/index.ts
parent9e9104578c8526ff48ecdda8b87d61ccb3d66a2d (diff)
downloaddexon-sol-tools-fe523e1f3f765077bdaf4dfc345c9dca67693668.tar
dexon-sol-tools-fe523e1f3f765077bdaf4dfc345c9dca67693668.tar.gz
dexon-sol-tools-fe523e1f3f765077bdaf4dfc345c9dca67693668.tar.bz2
dexon-sol-tools-fe523e1f3f765077bdaf4dfc345c9dca67693668.tar.lz
dexon-sol-tools-fe523e1f3f765077bdaf4dfc345c9dca67693668.tar.xz
dexon-sol-tools-fe523e1f3f765077bdaf4dfc345c9dca67693668.tar.zst
dexon-sol-tools-fe523e1f3f765077bdaf4dfc345c9dca67693668.zip
Re-organize event parsing and decoding
Diffstat (limited to 'packages/pipeline/src/index.ts')
-rw-r--r--packages/pipeline/src/index.ts20
1 files changed, 13 insertions, 7 deletions
diff --git a/packages/pipeline/src/index.ts b/packages/pipeline/src/index.ts
index db26343e0..e71a6ae4c 100644
--- a/packages/pipeline/src/index.ts
+++ b/packages/pipeline/src/index.ts
@@ -1,26 +1,32 @@
-import { ExchangeFillEventArgs } from '@0xproject/contract-wrappers';
-import { assetDataUtils } from '@0xproject/order-utils';
-import { LogWithDecodedArgs } from 'ethereum-types';
import 'reflect-metadata';
import { createConnection } from 'typeorm';
import { artifacts } from './artifacts';
-import { Etherscan } from './data-sources/etherscan';
+import { Etherscan } from './data_sources/etherscan';
import { ExchangeFillEvent } from './entities/ExchangeFillEvent';
import { config } from './ormconfig';
+import { ExchangeEventHandler } from './data_types/events/event_handlers/exchange_event_handler';
+
const etherscan = new Etherscan(process.env.ETHERSCAN_API_KEY as string);
+const EXCHANGE_ADDRESS = '0x4f833a24e1f95d70f028921e27040ca56e09ab0b';
(async () => {
const connection = await createConnection(config);
const repository = connection.getRepository(ExchangeFillEvent);
console.log(`found ${await repository.count()} existing fill events`);
- const events = await etherscan.getContractEventsAsync(
- '0x4f833a24e1f95d70f028921e27040ca56e09ab0b',
+ const exchangeEventHandler = new ExchangeEventHandler(
artifacts.Exchange.compilerOutput.abi,
+ EXCHANGE_ADDRESS,
+ etherscan,
);
+ const events = await exchangeEventHandler.getEventsAsync();
+ console.log(JSON.stringify(events, null, 2));
for (const event of events) {
- await repository.save(event);
+ // TODO(albrow): remove this check once we can parse all Exchange events
+ if (event.address != null) {
+ await event.save();
+ }
}
console.log(`now ${await repository.count()} total fill events`);
})();