aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-11-09 02:53:18 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-12-05 06:24:48 +0800
commit53cc9e9bedc6adf2247a190dbb758c9411033cab (patch)
treed7ede5521e5150ea06e1f1d8b8b7606a0c74f2e0
parentccad046eb649a60fdf7319a075fa41490d593ae8 (diff)
downloaddexon-sol-tools-53cc9e9bedc6adf2247a190dbb758c9411033cab.tar
dexon-sol-tools-53cc9e9bedc6adf2247a190dbb758c9411033cab.tar.gz
dexon-sol-tools-53cc9e9bedc6adf2247a190dbb758c9411033cab.tar.bz2
dexon-sol-tools-53cc9e9bedc6adf2247a190dbb758c9411033cab.tar.lz
dexon-sol-tools-53cc9e9bedc6adf2247a190dbb758c9411033cab.tar.xz
dexon-sol-tools-53cc9e9bedc6adf2247a190dbb758c9411033cab.tar.zst
dexon-sol-tools-53cc9e9bedc6adf2247a190dbb758c9411033cab.zip
Rename table and column names
-rw-r--r--packages/pipeline/src/entities/Block.ts5
-rw-r--r--packages/pipeline/src/entities/Relayer.ts12
-rw-r--r--packages/pipeline/src/entities/Transaction.ts15
-rw-r--r--packages/pipeline/src/entities/exchange_cancel_event.ts56
-rw-r--r--packages/pipeline/src/entities/exchange_cancel_up_to_event.ts23
-rw-r--r--packages/pipeline/src/entities/exchange_fill_event.ts72
-rw-r--r--packages/pipeline/src/entities/sra_order.ts81
-rw-r--r--packages/pipeline/src/parsers/events/index.ts2
-rw-r--r--packages/pipeline/src/parsers/sra_orders/index.ts2
-rw-r--r--packages/pipeline/test/parsers/sra_orders/index_test.ts2
10 files changed, 172 insertions, 98 deletions
diff --git a/packages/pipeline/src/entities/Block.ts b/packages/pipeline/src/entities/Block.ts
index 49e0ef840..5bd51f3d2 100644
--- a/packages/pipeline/src/entities/Block.ts
+++ b/packages/pipeline/src/entities/Block.ts
@@ -1,9 +1,10 @@
import { Column, Entity, PrimaryColumn } from 'typeorm';
-@Entity()
+@Entity({ name: 'blocks' })
export class Block {
@PrimaryColumn() public hash!: string;
@PrimaryColumn() public number!: number;
- @Column() public unixTimestampSeconds!: number;
+ @Column({ name: 'unix_timestamp_seconds' })
+ public unixTimestampSeconds!: number;
}
diff --git a/packages/pipeline/src/entities/Relayer.ts b/packages/pipeline/src/entities/Relayer.ts
index 605355fa8..94b5232a8 100644
--- a/packages/pipeline/src/entities/Relayer.ts
+++ b/packages/pipeline/src/entities/Relayer.ts
@@ -1,23 +1,23 @@
import { Column, Entity, PrimaryColumn } from 'typeorm';
-@Entity()
+@Entity({ name: 'relayers' })
export class Relayer {
@PrimaryColumn() public uuid!: string;
@Column() public name!: string;
@Column() public url!: string;
- @Column({ nullable: true, type: String })
+ @Column({ nullable: true, type: String, name: 'sra_http_endpoint' })
public sraHttpEndpoint!: string | null;
- @Column({ nullable: true, type: String })
+ @Column({ nullable: true, type: String, name: 'sra_ws_endpoint' })
public sraWsEndpoint!: string | null;
- @Column({ nullable: true, type: String })
+ @Column({ nullable: true, type: String, name: 'app_url' })
public appUrl!: string | null;
// TODO(albrow): Add exchange contract or protocol version?
// TODO(albrow): Add network ids for addresses?
- @Column({ type: 'varchar', array: true })
+ @Column({ type: 'varchar', array: true, name: 'fee_recipient_addresses' })
public feeRecipientAddresses!: string[];
- @Column({ type: 'varchar', array: true })
+ @Column({ type: 'varchar', array: true, name: 'taker_addresses' })
public takerAddresses!: string[];
}
diff --git a/packages/pipeline/src/entities/Transaction.ts b/packages/pipeline/src/entities/Transaction.ts
index 8a68da813..eb2883fda 100644
--- a/packages/pipeline/src/entities/Transaction.ts
+++ b/packages/pipeline/src/entities/Transaction.ts
@@ -1,13 +1,16 @@
import { Column, Entity, PrimaryColumn } from 'typeorm';
-@Entity()
+@Entity({ name: 'transactions' })
export class Transaction {
- @PrimaryColumn() public transactionHash!: string;
- @PrimaryColumn() public blockHash!: string;
- @PrimaryColumn() public blockNumber!: number;
+ @PrimaryColumn({ name: 'transaction_hash' })
+ public transactionHash!: string;
+ @PrimaryColumn({ name: 'block_hash' })
+ public blockHash!: string;
+ @PrimaryColumn({ name: 'block_number' })
+ public blockNumber!: number;
- @Column({ type: 'bigint' })
+ @Column({ type: 'bigint', name: 'gas_used' })
public gasUsed!: number;
- @Column({ type: 'bigint' })
+ @Column({ type: 'bigint', name: 'gas_price' })
public gasPrice!: number;
}
diff --git a/packages/pipeline/src/entities/exchange_cancel_event.ts b/packages/pipeline/src/entities/exchange_cancel_event.ts
index 698b9e2ec..6d0c3bc32 100644
--- a/packages/pipeline/src/entities/exchange_cancel_event.ts
+++ b/packages/pipeline/src/entities/exchange_cancel_event.ts
@@ -2,33 +2,49 @@ import { Column, Entity, PrimaryColumn } from 'typeorm';
import { AssetType } from '../types';
-@Entity()
+@Entity({ name: 'exchange_cancel_events' })
export class ExchangeCancelEvent {
- @PrimaryColumn() public contractAddress!: string;
- @PrimaryColumn() public logIndex!: number;
- @PrimaryColumn() public blockNumber!: number;
+ @PrimaryColumn({ name: 'contract_address' })
+ public contractAddress!: string;
+ @PrimaryColumn({ name: 'log_index' })
+ public logIndex!: number;
+ @PrimaryColumn({ name: 'block_number' })
+ public blockNumber!: number;
- @Column() public rawData!: string;
+ @Column({ name: 'raw_data' })
+ public rawData!: string;
// TODO(albrow): Include transaction hash
- @Column() public makerAddress!: string;
- @Column({ nullable: true, type: String })
+ @Column({ name: 'maker_address' })
+ public makerAddress!: string;
+ @Column({ nullable: true, type: String, name: 'taker_address' })
public takerAddress!: string;
- @Column() public feeRecepientAddress!: string;
- @Column() public senderAddress!: string;
- @Column() public orderHash!: string;
+ @Column({ name: 'fee_recipient_address' })
+ public feeRecipientAddress!: string;
+ @Column({ name: 'sender_address' })
+ public senderAddress!: string;
+ @Column({ name: 'order_hash' })
+ public orderHash!: string;
- @Column() public rawMakerAssetData!: string;
- @Column() public makerAssetType!: AssetType;
- @Column() public makerAssetProxyId!: string;
- @Column() public makerTokenAddress!: string;
- @Column({ nullable: true, type: String })
+ @Column({ name: 'raw_maker_asset_data' })
+ public rawMakerAssetData!: string;
+ @Column({ name: 'maker_asset_type' })
+ public makerAssetType!: AssetType;
+ @Column({ name: 'maker_asset_proxy_id' })
+ public makerAssetProxyId!: string;
+ @Column({ name: 'maker_token_address' })
+ public makerTokenAddress!: string;
+ @Column({ nullable: true, type: String, name: 'maker_token_id' })
public makerTokenId!: string | null;
- @Column() public rawTakerAssetData!: string;
- @Column() public takerAssetType!: AssetType;
- @Column() public takerAssetProxyId!: string;
- @Column() public takerTokenAddress!: string;
- @Column({ nullable: true, type: String })
+ @Column({ name: 'raw_taker_asset_data' })
+ public rawTakerAssetData!: string;
+ @Column({ name: 'taker_asset_type' })
+ public takerAssetType!: AssetType;
+ @Column({ name: 'taker_asset_proxy_id' })
+ public takerAssetProxyId!: string;
+ @Column({ name: 'taker_token_address' })
+ public takerTokenAddress!: string;
+ @Column({ nullable: true, type: String, name: 'taker_token_id' })
public takerTokenId!: string | null;
// TODO(albrow): Include topics?
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 3ca75ccf7..891550050 100644
--- a/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts
+++ b/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts
@@ -1,16 +1,23 @@
import { Column, Entity, PrimaryColumn } from 'typeorm';
-@Entity()
+@Entity({ name: 'exchange_cancel_up_to_event' })
export class ExchangeCancelUpToEvent {
- @PrimaryColumn() public contractAddress!: string;
- @PrimaryColumn() public logIndex!: number;
- @PrimaryColumn() public blockNumber!: number;
+ @PrimaryColumn({ name: 'contract_address' })
+ public contractAddress!: string;
+ @PrimaryColumn({ name: 'log_index' })
+ public logIndex!: number;
+ @PrimaryColumn({ name: 'block_number' })
+ public blockNumber!: number;
// TODO(albrow): Include transaction hash
- @Column() public rawData!: string;
+ @Column({ name: 'raw_data' })
+ public rawData!: string;
- @Column() public makerAddress!: string;
- @Column() public senderAddress!: string;
- @Column() public orderEpoch!: string;
+ @Column({ name: 'maker_address' })
+ public makerAddress!: string;
+ @Column({ name: 'sender_address' })
+ public senderAddress!: string;
+ @Column({ name: 'order_epoch' })
+ public orderEpoch!: string;
// 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 6e549af93..0c5546d7e 100644
--- a/packages/pipeline/src/entities/exchange_fill_event.ts
+++ b/packages/pipeline/src/entities/exchange_fill_event.ts
@@ -2,36 +2,58 @@ import { Column, Entity, PrimaryColumn } from 'typeorm';
import { AssetType } from '../types';
-@Entity()
+@Entity({ name: 'exchange_fill_events' })
export class ExchangeFillEvent {
- @PrimaryColumn() public contractAddress!: string;
- @PrimaryColumn() public logIndex!: number;
- @PrimaryColumn() public blockNumber!: number;
+ @PrimaryColumn({ name: 'contract_address' })
+ public contractAddress!: string;
+ @PrimaryColumn({ name: 'log_index' })
+ public logIndex!: number;
+ @PrimaryColumn({ name: 'block_number' })
+ public blockNumber!: number;
- @Column() public rawData!: string;
+ @Column({ name: 'raw_data' })
+ public rawData!: string;
- @Column() public transactionHash!: string;
- @Column() public makerAddress!: string;
- @Column() public takerAddress!: string;
- @Column() public feeRecipientAddress!: string;
- @Column() public senderAddress!: string;
- @Column() public makerAssetFilledAmount!: string;
- @Column() public takerAssetFilledAmount!: string;
- @Column() public makerFeePaid!: string;
- @Column() public takerFeePaid!: string;
- @Column() public orderHash!: string;
+ @Column({ name: 'transaction_hash' })
+ public transactionHash!: string;
+ @Column({ name: 'maker_address' })
+ public makerAddress!: string;
+ @Column({ name: 'taker_address' })
+ public takerAddress!: string;
+ @Column({ name: 'fee_recipient_address' })
+ 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: 'order_hash' })
+ public orderHash!: string;
- @Column() public rawMakerAssetData!: string;
- @Column() public makerAssetType!: AssetType;
- @Column() public makerAssetProxyId!: string;
- @Column() public makerTokenAddress!: string;
- @Column({ nullable: true, type: String })
+ @Column({ name: 'raw_maker_asset_data' })
+ public rawMakerAssetData!: string;
+ @Column({ name: 'maker_asset_type' })
+ public makerAssetType!: AssetType;
+ @Column({ name: 'maker_asset_proxy_id' })
+ public makerAssetProxyId!: string;
+ @Column({ name: 'maker_token_address' })
+ public makerTokenAddress!: string;
+ @Column({ nullable: true, type: String, name: 'maker_token_id' })
public makerTokenId!: string | null;
- @Column() public rawTakerAssetData!: string;
- @Column() public takerAssetType!: AssetType;
- @Column() public takerAssetProxyId!: string;
- @Column() public takerTokenAddress!: string;
- @Column({ nullable: true, type: String })
+ @Column({ name: 'raw_taker_asset_data' })
+ public rawTakerAssetData!: string;
+ @Column({ name: 'taker_asset_type' })
+ public takerAssetType!: AssetType;
+ @Column({ name: 'taker_asset_proxy_id' })
+ public takerAssetProxyId!: string;
+ @Column({ name: 'taker_token_address' })
+ public takerTokenAddress!: string;
+ @Column({ nullable: true, type: String, name: 'taker_token_id' })
public takerTokenId!: string | null;
// TODO(albrow): Include topics?
diff --git a/packages/pipeline/src/entities/sra_order.ts b/packages/pipeline/src/entities/sra_order.ts
index a22f7c4e5..f3f79852f 100644
--- a/packages/pipeline/src/entities/sra_order.ts
+++ b/packages/pipeline/src/entities/sra_order.ts
@@ -2,40 +2,65 @@ import { Column, Entity, PrimaryColumn } from 'typeorm';
import { AssetType } from '../types';
-@Entity()
+@Entity({ name: 'sra_orders' })
export class SraOrder {
- @PrimaryColumn() public exchangeAddress!: string;
- @PrimaryColumn() public orderHashHex!: string;
+ @PrimaryColumn({ name: 'exchange_address' })
+ public exchangeAddress!: string;
+ @PrimaryColumn({ name: 'order_hash_hex' })
+ public orderHashHex!: string;
- @Column() public sourceUrl!: string;
- @Column() public lastUpdatedTimestamp!: number;
- @Column() public firstSeenTimestamp!: number;
+ @Column({ name: 'source_url' })
+ public sourceUrl!: string;
+ @Column({ name: 'last_updated_timestamp' })
+ public lastUpdatedTimestamp!: number;
+ @Column({ name: 'first_seen_timestamp' })
+ public firstSeenTimestamp!: number;
- @Column() public makerAddress!: string;
- @Column() public takerAddress!: string;
- @Column() public feeRecipientAddress!: string;
- @Column() public senderAddress!: string;
- @Column() public makerAssetAmount!: string;
- @Column() public takerAssetAmount!: string;
- @Column() public makerFee!: string;
- @Column() public takerFee!: string;
- @Column() public expirationTimeSeconds!: string;
- @Column() public salt!: string;
- @Column() public signature!: string;
+ @Column({ name: 'maker_address' })
+ public makerAddress!: string;
+ @Column({ name: 'taker_address' })
+ public takerAddress!: string;
+ @Column({ name: 'fee_recipient_address' })
+ 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: 'signature' })
+ public signature!: string;
- @Column() public rawMakerAssetData!: string;
- @Column() public makerAssetType!: AssetType;
- @Column() public makerAssetProxyId!: string;
- @Column() public makerTokenAddress!: string;
- @Column({ nullable: true, type: String })
+ @Column({ name: 'raw_maker_asset_data' })
+ public rawMakerAssetData!: string;
+ @Column({ name: 'maker_asset_type' })
+ public makerAssetType!: AssetType;
+ @Column({ name: 'maker_asset_proxy_id' })
+ public makerAssetProxyId!: string;
+ @Column({ name: 'maker_token_address' })
+ public makerTokenAddress!: string;
+ @Column({ nullable: true, type: String, name: 'maker_token_id' })
public makerTokenId!: string | null;
- @Column() public rawTakerAssetData!: string;
- @Column() public takerAssetType!: AssetType;
- @Column() public takerAssetProxyId!: string;
- @Column() public takerTokenAddress!: string;
- @Column({ nullable: true, type: String })
+ @Column({ name: 'raw_taker_asset_data' })
+ public rawTakerAssetData!: string;
+ @Column({ name: 'taker_asset_type' })
+ public takerAssetType!: AssetType;
+ @Column({ name: 'taker_asset_proxy_id' })
+ public takerAssetProxyId!: string;
+ @Column({ name: 'taker_token_address' })
+ public takerTokenAddress!: string;
+ @Column({ nullable: true, type: String, name: 'taker_token_id' })
public takerTokenId!: string | null;
// TODO(albrow): Make this optional?
- @Column() public metaDataJson!: string;
+ @Column({ name: 'metadata_json' })
+ public metadataJson!: string;
}
diff --git a/packages/pipeline/src/parsers/events/index.ts b/packages/pipeline/src/parsers/events/index.ts
index 7211eed76..7a0ead0d4 100644
--- a/packages/pipeline/src/parsers/events/index.ts
+++ b/packages/pipeline/src/parsers/events/index.ts
@@ -79,7 +79,7 @@ export function _convertToExchangeCancelEvent(
exchangeCancelEvent.makerAddress = eventLog.args.makerAddress.toString();
exchangeCancelEvent.takerAddress =
eventLog.args.takerAddress == null ? null : eventLog.args.takerAddress.toString();
- exchangeCancelEvent.feeRecepientAddress = eventLog.args.feeRecipientAddress;
+ exchangeCancelEvent.feeRecipientAddress = eventLog.args.feeRecipientAddress;
exchangeCancelEvent.senderAddress = eventLog.args.senderAddress;
exchangeCancelEvent.orderHash = eventLog.args.orderHash;
exchangeCancelEvent.rawMakerAssetData = eventLog.args.makerAssetData;
diff --git a/packages/pipeline/src/parsers/sra_orders/index.ts b/packages/pipeline/src/parsers/sra_orders/index.ts
index 5cd19b08a..4e4bf12ff 100644
--- a/packages/pipeline/src/parsers/sra_orders/index.ts
+++ b/packages/pipeline/src/parsers/sra_orders/index.ts
@@ -48,7 +48,7 @@ export function _convertToEntity(apiOrder: APIOrder): SraOrder {
sraOrder.takerTokenAddress = takerAssetData.tokenAddress;
sraOrder.takerTokenId = bigNumbertoStringOrNull((takerAssetData as ERC721AssetData).tokenId);
- sraOrder.metaDataJson = JSON.stringify(apiOrder.metaData);
+ sraOrder.metadataJson = JSON.stringify(apiOrder.metaData);
return sraOrder;
}
diff --git a/packages/pipeline/test/parsers/sra_orders/index_test.ts b/packages/pipeline/test/parsers/sra_orders/index_test.ts
index fee32a0a7..4b2e7c2d0 100644
--- a/packages/pipeline/test/parsers/sra_orders/index_test.ts
+++ b/packages/pipeline/test/parsers/sra_orders/index_test.ts
@@ -61,7 +61,7 @@ describe('sra_orders', () => {
expected.takerAssetProxyId = '0xf47261b0';
expected.takerTokenAddress = '0x42d6622dece394b54999fbd73d108123806f6a18';
expected.takerTokenId = null;
- expected.metaDataJson = '{"isThisArbitraryData":true,"powerLevel":9001}';
+ expected.metadataJson = '{"isThisArbitraryData":true,"powerLevel":9001}';
const actual = _convertToEntity(input);
expect(actual).deep.equal(expected);