diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-12-12 07:16:05 +0800 |
---|---|---|
committer | Fred Carlsen <fred@sjelfull.no> | 2018-12-13 01:19:40 +0800 |
commit | 8f911206f7d9475d040e41458f28898604b79e62 (patch) | |
tree | 0eede93454b4ae266be968681fd6295b0629911f /packages/pipeline/test/entities | |
parent | 3496725db659e69df8394510b86d564105acac4e (diff) | |
download | dexon-sol-tools-8f911206f7d9475d040e41458f28898604b79e62.tar dexon-sol-tools-8f911206f7d9475d040e41458f28898604b79e62.tar.gz dexon-sol-tools-8f911206f7d9475d040e41458f28898604b79e62.tar.bz2 dexon-sol-tools-8f911206f7d9475d040e41458f28898604b79e62.tar.lz dexon-sol-tools-8f911206f7d9475d040e41458f28898604b79e62.tar.xz dexon-sol-tools-8f911206f7d9475d040e41458f28898604b79e62.tar.zst dexon-sol-tools-8f911206f7d9475d040e41458f28898604b79e62.zip |
Refactor event scraping and add support for scraping ERC20 approval events (#1401)
* Refactor event scraping and add support for scraping ERC20 approval events
* Add tests for data_sources/contract-wrappers/utils
Diffstat (limited to 'packages/pipeline/test/entities')
-rw-r--r-- | packages/pipeline/test/entities/erc20_approval_events_test.ts | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/packages/pipeline/test/entities/erc20_approval_events_test.ts b/packages/pipeline/test/entities/erc20_approval_events_test.ts new file mode 100644 index 000000000..1ecf41ee5 --- /dev/null +++ b/packages/pipeline/test/entities/erc20_approval_events_test.ts @@ -0,0 +1,29 @@ +import { BigNumber } from '@0x/utils'; +import 'mocha'; +import 'reflect-metadata'; + +import { ERC20ApprovalEvent } from '../../src/entities'; +import { createDbConnectionOnceAsync } from '../db_setup'; +import { chaiSetup } from '../utils/chai_setup'; + +import { testSaveAndFindEntityAsync } from './util'; + +chaiSetup.configure(); + +// tslint:disable:custom-no-magic-numbers +describe('ERC20ApprovalEvent entity', () => { + it('save/find', async () => { + const connection = await createDbConnectionOnceAsync(); + const event = new ERC20ApprovalEvent(); + event.tokenAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'; + event.blockNumber = 6281577; + event.rawData = '0x000000000000000000000000000000000000000000000002b9cba5ee21ad3df9'; + event.logIndex = 43; + event.transactionHash = '0xcb46b19c786376a0a0140d51e3e606a4c4f926d8ca5434e96d2f69d04d8d9c7f'; + event.ownerAddress = '0x0b65c5f6f3a05d6be5588a72b603360773b3fe04'; + event.spenderAddress = '0x448a5065aebb8e423f0896e6c5d525c040f59af3'; + event.amount = new BigNumber('50281464906893835769'); + const blocksRepository = connection.getRepository(ERC20ApprovalEvent); + await testSaveAndFindEntityAsync(blocksRepository, event); + }); +}); |