aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/test/entities
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-12-12 07:16:05 +0800
committerGitHub <noreply@github.com>2018-12-12 07:16:05 +0800
commitb4cdb14b9b79589d7b24fd7655406c15b6bb00f6 (patch)
treeea004984d12ff2337387356f4b14ad087740adc2 /packages/pipeline/test/entities
parentd37680610b772d7bb585203047bef0af0439df0a (diff)
downloaddexon-sol-tools-b4cdb14b9b79589d7b24fd7655406c15b6bb00f6.tar
dexon-sol-tools-b4cdb14b9b79589d7b24fd7655406c15b6bb00f6.tar.gz
dexon-sol-tools-b4cdb14b9b79589d7b24fd7655406c15b6bb00f6.tar.bz2
dexon-sol-tools-b4cdb14b9b79589d7b24fd7655406c15b6bb00f6.tar.lz
dexon-sol-tools-b4cdb14b9b79589d7b24fd7655406c15b6bb00f6.tar.xz
dexon-sol-tools-b4cdb14b9b79589d7b24fd7655406c15b6bb00f6.tar.zst
dexon-sol-tools-b4cdb14b9b79589d7b24fd7655406c15b6bb00f6.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.ts29
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);
+ });
+});