aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-11-15 07:58:36 +0800
committerFred Carlsen <fred@sjelfull.no>2018-12-13 01:16:21 +0800
commit829b7cb7125aafeed763d6215bbb21d63ebf58cd (patch)
treee7a8f93c123b56fcc5c027d49b0382add6ec6042 /packages/pipeline
parentfb8267d85ecaafc0967095548592a9c7aad23257 (diff)
downloaddexon-sol-tools-829b7cb7125aafeed763d6215bbb21d63ebf58cd.tar
dexon-sol-tools-829b7cb7125aafeed763d6215bbb21d63ebf58cd.tar.gz
dexon-sol-tools-829b7cb7125aafeed763d6215bbb21d63ebf58cd.tar.bz2
dexon-sol-tools-829b7cb7125aafeed763d6215bbb21d63ebf58cd.tar.lz
dexon-sol-tools-829b7cb7125aafeed763d6215bbb21d63ebf58cd.tar.xz
dexon-sol-tools-829b7cb7125aafeed763d6215bbb21d63ebf58cd.tar.zst
dexon-sol-tools-829b7cb7125aafeed763d6215bbb21d63ebf58cd.zip
Change some column types from varchar to numeric
Diffstat (limited to 'packages/pipeline')
-rw-r--r--packages/pipeline/src/entities/exchange_cancel_up_to_event.ts7
-rw-r--r--packages/pipeline/src/entities/exchange_fill_event.ts18
-rw-r--r--packages/pipeline/src/entities/sra_order.ts26
-rw-r--r--packages/pipeline/src/parsers/events/index.ts10
-rw-r--r--packages/pipeline/src/parsers/sra_orders/index.ts12
-rw-r--r--packages/pipeline/test/parsers/events/index_test.ts10
-rw-r--r--packages/pipeline/test/parsers/sra_orders/index_test.ts12
7 files changed, 51 insertions, 44 deletions
diff --git a/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts b/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts
index 7306a1a87..752631b85 100644
--- a/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts
+++ b/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts
@@ -1,5 +1,8 @@
+import { BigNumber } from '@0x/utils';
import { Column, Entity, PrimaryColumn } from 'typeorm';
+import { bigNumberTransformer } from '../utils';
+
@Entity({ name: 'exchange_cancel_up_to_events', schema: 'raw' })
export class ExchangeCancelUpToEvent {
@PrimaryColumn({ name: 'contract_address' })
@@ -17,7 +20,7 @@ export class ExchangeCancelUpToEvent {
public makerAddress!: string;
@Column({ name: 'sender_address' })
public senderAddress!: string;
- @Column({ name: 'order_epoch' })
- public orderEpoch!: string;
+ @Column({ name: 'order_epoch', type: 'numeric', transformer: bigNumberTransformer })
+ public orderEpoch!: BigNumber;
// TODO(albrow): Include topics?
}
diff --git a/packages/pipeline/src/entities/exchange_fill_event.ts b/packages/pipeline/src/entities/exchange_fill_event.ts
index 6202e558b..aa082436b 100644
--- a/packages/pipeline/src/entities/exchange_fill_event.ts
+++ b/packages/pipeline/src/entities/exchange_fill_event.ts
@@ -1,6 +1,8 @@
+import { BigNumber } from '@0x/utils';
import { Column, Entity, PrimaryColumn } from 'typeorm';
import { AssetType } from '../types';
+import { bigNumberTransformer } from '../utils';
@Entity({ name: 'exchange_fill_events', schema: 'raw' })
export class ExchangeFillEvent {
@@ -24,14 +26,14 @@ export class ExchangeFillEvent {
public feeRecipientAddress!: string;
@Column({ name: 'sender_address' })
public senderAddress!: string;
- @Column({ name: 'maker_asset_filled_amount' })
- public makerAssetFilledAmount!: string;
- @Column({ name: 'taker_asset_filled_amount' })
- public takerAssetFilledAmount!: string;
- @Column({ name: 'maker_fee_paid' })
- public makerFeePaid!: string;
- @Column({ name: 'taker_fee_paid' })
- public takerFeePaid!: string;
+ @Column({ name: 'maker_asset_filled_amount', type: 'numeric', transformer: bigNumberTransformer })
+ public makerAssetFilledAmount!: BigNumber;
+ @Column({ name: 'taker_asset_filled_amount', type: 'numeric', transformer: bigNumberTransformer })
+ public takerAssetFilledAmount!: BigNumber;
+ @Column({ name: 'maker_fee_paid', type: 'numeric', transformer: bigNumberTransformer })
+ public makerFeePaid!: BigNumber;
+ @Column({ name: 'taker_fee_paid', type: 'numeric', transformer: bigNumberTransformer })
+ public takerFeePaid!: BigNumber;
@Column({ name: 'order_hash' })
public orderHash!: string;
diff --git a/packages/pipeline/src/entities/sra_order.ts b/packages/pipeline/src/entities/sra_order.ts
index 4b7f652d3..9c730a0bb 100644
--- a/packages/pipeline/src/entities/sra_order.ts
+++ b/packages/pipeline/src/entities/sra_order.ts
@@ -1,6 +1,8 @@
+import { BigNumber } from '@0x/utils';
import { Column, Entity, PrimaryColumn } from 'typeorm';
import { AssetType } from '../types';
+import { bigNumberTransformer } from '../utils';
@Entity({ name: 'sra_orders', schema: 'raw' })
export class SraOrder {
@@ -19,18 +21,18 @@ export class SraOrder {
public feeRecipientAddress!: string;
@Column({ name: 'sender_address' })
public senderAddress!: string;
- @Column({ name: 'maker_asset_amount' })
- public makerAssetAmount!: string;
- @Column({ name: 'taker_asset_amount' })
- public takerAssetAmount!: string;
- @Column({ name: 'maker_fee' })
- public makerFee!: string;
- @Column({ name: 'taker_fee' })
- public takerFee!: string;
- @Column({ name: 'expiration_time_seconds' })
- public expirationTimeSeconds!: string;
- @Column({ name: 'salt' })
- public salt!: string;
+ @Column({ name: 'maker_asset_amount', type: 'numeric', transformer: bigNumberTransformer })
+ public makerAssetAmount!: BigNumber;
+ @Column({ name: 'taker_asset_amount', type: 'numeric', transformer: bigNumberTransformer })
+ public takerAssetAmount!: BigNumber;
+ @Column({ name: 'maker_fee', type: 'numeric', transformer: bigNumberTransformer })
+ public makerFee!: BigNumber;
+ @Column({ name: 'taker_fee', type: 'numeric', transformer: bigNumberTransformer })
+ public takerFee!: BigNumber;
+ @Column({ name: 'expiration_time_seconds', type: 'numeric', transformer: bigNumberTransformer })
+ public expirationTimeSeconds!: BigNumber;
+ @Column({ name: 'salt', type: 'numeric', transformer: bigNumberTransformer })
+ public salt!: BigNumber;
@Column({ name: 'signature' })
public signature!: string;
diff --git a/packages/pipeline/src/parsers/events/index.ts b/packages/pipeline/src/parsers/events/index.ts
index d56dc7080..27e192d7b 100644
--- a/packages/pipeline/src/parsers/events/index.ts
+++ b/packages/pipeline/src/parsers/events/index.ts
@@ -65,10 +65,10 @@ export function _convertToExchangeFillEvent(eventLog: LogWithDecodedArgs<Exchang
exchangeFillEvent.takerAddress = eventLog.args.takerAddress.toString();
exchangeFillEvent.feeRecipientAddress = eventLog.args.feeRecipientAddress;
exchangeFillEvent.senderAddress = eventLog.args.senderAddress;
- exchangeFillEvent.makerAssetFilledAmount = eventLog.args.makerAssetFilledAmount.toString();
- exchangeFillEvent.takerAssetFilledAmount = eventLog.args.takerAssetFilledAmount.toString();
- exchangeFillEvent.makerFeePaid = eventLog.args.makerFeePaid.toString();
- exchangeFillEvent.takerFeePaid = eventLog.args.takerFeePaid.toString();
+ exchangeFillEvent.makerAssetFilledAmount = eventLog.args.makerAssetFilledAmount;
+ exchangeFillEvent.takerAssetFilledAmount = eventLog.args.takerAssetFilledAmount;
+ exchangeFillEvent.makerFeePaid = eventLog.args.makerFeePaid;
+ exchangeFillEvent.takerFeePaid = eventLog.args.takerFeePaid;
exchangeFillEvent.orderHash = eventLog.args.orderHash;
exchangeFillEvent.rawMakerAssetData = eventLog.args.makerAssetData;
exchangeFillEvent.makerAssetType = makerAssetType;
@@ -139,6 +139,6 @@ export function _convertToExchangeCancelUpToEvent(
exchangeCancelUpToEvent.rawData = eventLog.data as string;
exchangeCancelUpToEvent.makerAddress = eventLog.args.makerAddress.toString();
exchangeCancelUpToEvent.senderAddress = eventLog.args.senderAddress.toString();
- exchangeCancelUpToEvent.orderEpoch = eventLog.args.orderEpoch.toString();
+ exchangeCancelUpToEvent.orderEpoch = eventLog.args.orderEpoch;
return exchangeCancelUpToEvent;
}
diff --git a/packages/pipeline/src/parsers/sra_orders/index.ts b/packages/pipeline/src/parsers/sra_orders/index.ts
index 800521955..ef8901e40 100644
--- a/packages/pipeline/src/parsers/sra_orders/index.ts
+++ b/packages/pipeline/src/parsers/sra_orders/index.ts
@@ -34,12 +34,12 @@ export function _convertToEntity(apiOrder: APIOrder): SraOrder {
sraOrder.takerAddress = apiOrder.order.takerAddress;
sraOrder.feeRecipientAddress = apiOrder.order.feeRecipientAddress;
sraOrder.senderAddress = apiOrder.order.senderAddress;
- sraOrder.makerAssetAmount = apiOrder.order.makerAssetAmount.toString();
- sraOrder.takerAssetAmount = apiOrder.order.takerAssetAmount.toString();
- sraOrder.makerFee = apiOrder.order.makerFee.toString();
- sraOrder.takerFee = apiOrder.order.takerFee.toString();
- sraOrder.expirationTimeSeconds = apiOrder.order.expirationTimeSeconds.toString();
- sraOrder.salt = apiOrder.order.salt.toString();
+ sraOrder.makerAssetAmount = apiOrder.order.makerAssetAmount;
+ sraOrder.takerAssetAmount = apiOrder.order.takerAssetAmount;
+ sraOrder.makerFee = apiOrder.order.makerFee;
+ sraOrder.takerFee = apiOrder.order.takerFee;
+ sraOrder.expirationTimeSeconds = apiOrder.order.expirationTimeSeconds;
+ sraOrder.salt = apiOrder.order.salt;
sraOrder.signature = apiOrder.order.signature;
sraOrder.rawMakerAssetData = apiOrder.order.makerAssetData;
diff --git a/packages/pipeline/test/parsers/events/index_test.ts b/packages/pipeline/test/parsers/events/index_test.ts
index fdd07f246..63e080edc 100644
--- a/packages/pipeline/test/parsers/events/index_test.ts
+++ b/packages/pipeline/test/parsers/events/index_test.ts
@@ -39,7 +39,7 @@ describe('exchange_events', () => {
makerAssetFilledAmount: new BigNumber('10000000000000000'),
takerAssetFilledAmount: new BigNumber('100000000000000000'),
makerFeePaid: new BigNumber('0'),
- takerFeePaid: new BigNumber('0'),
+ takerFeePaid: new BigNumber('12345'),
orderHash: '0xab12ed2cbaa5615ab690b9da75a46e53ddfcf3f1a68655b5fe0d94c75a1aac4a',
makerAssetData: '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
takerAssetData: '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498',
@@ -56,10 +56,10 @@ describe('exchange_events', () => {
expected.takerAddress = '0xf6da68519f78b0d0bc93c701e86affcb75c92428';
expected.feeRecipientAddress = '0xc370d2a5920344aa6b7d8d11250e3e861434cbdd';
expected.senderAddress = '0xf6da68519f78b0d0bc93c701e86affcb75c92428';
- expected.makerAssetFilledAmount = '10000000000000000';
- expected.takerAssetFilledAmount = '100000000000000000';
- expected.makerFeePaid = '0';
- expected.takerFeePaid = '0';
+ expected.makerAssetFilledAmount = new BigNumber('10000000000000000');
+ expected.takerAssetFilledAmount = new BigNumber('100000000000000000');
+ expected.makerFeePaid = new BigNumber('0');
+ expected.takerFeePaid = new BigNumber('12345');
expected.orderHash = '0xab12ed2cbaa5615ab690b9da75a46e53ddfcf3f1a68655b5fe0d94c75a1aac4a';
expected.rawMakerAssetData = '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
expected.makerAssetType = 'erc20';
diff --git a/packages/pipeline/test/parsers/sra_orders/index_test.ts b/packages/pipeline/test/parsers/sra_orders/index_test.ts
index 534d84ab3..ee2842ef3 100644
--- a/packages/pipeline/test/parsers/sra_orders/index_test.ts
+++ b/packages/pipeline/test/parsers/sra_orders/index_test.ts
@@ -41,12 +41,12 @@ describe('sra_orders', () => {
expected.takerAddress = '0x0000000000000000000000000000000000000000';
expected.feeRecipientAddress = '0xa258b39954cef5cb142fd567a46cddb31a670124';
expected.senderAddress = '0x0000000000000000000000000000000000000000';
- expected.makerAssetAmount = '1619310371000000000';
- expected.takerAssetAmount = '8178335207070707070707';
- expected.makerFee = '0';
- expected.takerFee = '0';
- expected.expirationTimeSeconds = '1538529488';
- expected.salt = '1537924688891';
+ expected.makerAssetAmount = new BigNumber('1619310371000000000');
+ expected.takerAssetAmount = new BigNumber('8178335207070707070707');
+ expected.makerFee = new BigNumber('0');
+ expected.takerFee = new BigNumber('0');
+ expected.expirationTimeSeconds = new BigNumber('1538529488');
+ expected.salt = new BigNumber('1537924688891');
expected.signature =
'0x1b5a5d672b0d647b5797387ccbb89d822d5d2e873346b014f4ff816ff0783f2a7a0d2824d2d7042ec8ea375bc7f870963e1cb8248f1db03ddf125e27b5963aa11f03';
expected.rawMakerAssetData = '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';