diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-09-26 05:41:45 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-12-05 06:24:06 +0800 |
commit | 2207f09ce2c8b595f75fce6387256a64c64b23c3 (patch) | |
tree | 2bd5eb25bf57576ec9ba731b666ae3f2d8a5ca0c /packages/pipeline/src/index.ts | |
parent | fe523e1f3f765077bdaf4dfc345c9dca67693668 (diff) | |
download | dexon-sol-tools-2207f09ce2c8b595f75fce6387256a64c64b23c3.tar dexon-sol-tools-2207f09ce2c8b595f75fce6387256a64c64b23c3.tar.gz dexon-sol-tools-2207f09ce2c8b595f75fce6387256a64c64b23c3.tar.bz2 dexon-sol-tools-2207f09ce2c8b595f75fce6387256a64c64b23c3.tar.lz dexon-sol-tools-2207f09ce2c8b595f75fce6387256a64c64b23c3.tar.xz dexon-sol-tools-2207f09ce2c8b595f75fce6387256a64c64b23c3.tar.zst dexon-sol-tools-2207f09ce2c8b595f75fce6387256a64c64b23c3.zip |
Make event parsing more functional and less class-based
Diffstat (limited to 'packages/pipeline/src/index.ts')
-rw-r--r-- | packages/pipeline/src/index.ts | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/packages/pipeline/src/index.ts b/packages/pipeline/src/index.ts index e71a6ae4c..c01ff57b4 100644 --- a/packages/pipeline/src/index.ts +++ b/packages/pipeline/src/index.ts @@ -1,12 +1,11 @@ import 'reflect-metadata'; import { createConnection } from 'typeorm'; -import { artifacts } from './artifacts'; 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'; +import { parseExchangeEvents } from './data_types/events/exchange_events'; const etherscan = new Etherscan(process.env.ETHERSCAN_API_KEY as string); const EXCHANGE_ADDRESS = '0x4f833a24e1f95d70f028921e27040ca56e09ab0b'; @@ -15,18 +14,10 @@ const EXCHANGE_ADDRESS = '0x4f833a24e1f95d70f028921e27040ca56e09ab0b'; const connection = await createConnection(config); const repository = connection.getRepository(ExchangeFillEvent); console.log(`found ${await repository.count()} existing fill events`); - const exchangeEventHandler = new ExchangeEventHandler( - artifacts.Exchange.compilerOutput.abi, - EXCHANGE_ADDRESS, - etherscan, - ); - const events = await exchangeEventHandler.getEventsAsync(); - console.log(JSON.stringify(events, null, 2)); + const rawEvents = await etherscan.getContractEventsAsync(EXCHANGE_ADDRESS); + const events = parseExchangeEvents(rawEvents); for (const event of events) { - // TODO(albrow): remove this check once we can parse all Exchange events - if (event.address != null) { - await event.save(); - } + await event.save(); } console.log(`now ${await repository.count()} total fill events`); })(); |