-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deleted: db/migrations/1693282513188-Data.js new file: db/migrations/1693492520799-Data.js modified: schema.graphql modified: src/main.ts new file: src/model/generated/blockStats.model.ts modified: src/model/generated/index.ts new file: src/model/generated/subject.model.ts deleted: src/model/generated/volumeByBlock.model.ts
- Loading branch information
1 parent
6da95b8
commit 254c459
Showing
8 changed files
with
216 additions
and
56 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module.exports = class Data1693492520799 { | ||
name = 'Data1693492520799' | ||
|
||
async up(db) { | ||
await db.query(`CREATE TABLE "trade" ("id" character varying NOT NULL, "block" integer NOT NULL, "trader" text NOT NULL, "subject" text NOT NULL, "is_buy" boolean NOT NULL, "share_amount" numeric NOT NULL, "eth_amount" numeric NOT NULL, "protocol_eth_amount" numeric NOT NULL, "subject_eth_amount" numeric NOT NULL, "supply" numeric NOT NULL, "txn_hash" text NOT NULL, CONSTRAINT "PK_d4097908741dc408f8274ebdc53" PRIMARY KEY ("id"))`) | ||
await db.query(`CREATE INDEX "IDX_c4d177ef22a72a103adb206ab7" ON "trade" ("block") `) | ||
await db.query(`CREATE INDEX "IDX_8782e523050ad117640677be17" ON "trade" ("trader") `) | ||
await db.query(`CREATE INDEX "IDX_9e00c3c01798dce17b45421f76" ON "trade" ("subject") `) | ||
await db.query(`CREATE INDEX "IDX_d2201e8e0ddcb79dc9df0b7380" ON "trade" ("txn_hash") `) | ||
await db.query(`CREATE TABLE "subject" ("id" character varying NOT NULL, "address" text NOT NULL, "first_trade_block" integer NOT NULL, "supply" numeric NOT NULL, "total_trades" integer NOT NULL, "total_eth_volume" numeric NOT NULL, "total_eth_buy_volume" numeric NOT NULL, "total_eth_sell_volume" numeric NOT NULL, "total_share_volume" numeric NOT NULL, "total_share_buy_volume" numeric NOT NULL, "total_share_sell_volume" numeric NOT NULL, "subject_eth_total" numeric NOT NULL, CONSTRAINT "PK_12eee115462e38d62e5455fc054" PRIMARY KEY ("id"))`) | ||
await db.query(`CREATE INDEX "IDX_24a18e0dc5d06d8b516d99688f" ON "subject" ("address") `) | ||
await db.query(`CREATE INDEX "IDX_36e946cd07407f62c658f2669d" ON "subject" ("first_trade_block") `) | ||
await db.query(`CREATE TABLE "block_stats" ("id" character varying NOT NULL, "block" integer NOT NULL, "trades" integer NOT NULL, "num_involved_subjects" integer NOT NULL, "eth_volume" numeric NOT NULL, "eth_buy_volume" numeric NOT NULL, "eth_sell_volume" numeric NOT NULL, "share_volume" numeric NOT NULL, "share_buy_volume" numeric NOT NULL, "share_sell_volume" numeric NOT NULL, "subject_eth_total" numeric NOT NULL, "protocol_eth_total" numeric NOT NULL, CONSTRAINT "PK_2e5ab1b4d3ee438a1ce2b7cbba3" PRIMARY KEY ("id"))`) | ||
await db.query(`CREATE INDEX "IDX_f16be6bd07f58fbf10d88d91cf" ON "block_stats" ("block") `) | ||
} | ||
|
||
async down(db) { | ||
await db.query(`DROP TABLE "trade"`) | ||
await db.query(`DROP INDEX "public"."IDX_c4d177ef22a72a103adb206ab7"`) | ||
await db.query(`DROP INDEX "public"."IDX_8782e523050ad117640677be17"`) | ||
await db.query(`DROP INDEX "public"."IDX_9e00c3c01798dce17b45421f76"`) | ||
await db.query(`DROP INDEX "public"."IDX_d2201e8e0ddcb79dc9df0b7380"`) | ||
await db.query(`DROP TABLE "subject"`) | ||
await db.query(`DROP INDEX "public"."IDX_24a18e0dc5d06d8b516d99688f"`) | ||
await db.query(`DROP INDEX "public"."IDX_36e946cd07407f62c658f2669d"`) | ||
await db.query(`DROP TABLE "block_stats"`) | ||
await db.query(`DROP INDEX "public"."IDX_f16be6bd07f58fbf10d88d91cf"`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_} from "typeorm" | ||
import * as marshal from "./marshal" | ||
|
||
@Entity_() | ||
export class BlockStats { | ||
constructor(props?: Partial<BlockStats>) { | ||
Object.assign(this, props) | ||
} | ||
|
||
@PrimaryColumn_() | ||
id!: string | ||
|
||
@Index_() | ||
@Column_("int4", {nullable: false}) | ||
block!: number | ||
|
||
@Column_("int4", {nullable: false}) | ||
trades!: number | ||
|
||
@Column_("int4", {nullable: false}) | ||
numInvolvedSubjects!: number | ||
|
||
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) | ||
ethVolume!: bigint | ||
|
||
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) | ||
ethBuyVolume!: bigint | ||
|
||
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) | ||
ethSellVolume!: bigint | ||
|
||
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) | ||
shareVolume!: bigint | ||
|
||
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) | ||
shareBuyVolume!: bigint | ||
|
||
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) | ||
shareSellVolume!: bigint | ||
|
||
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) | ||
subjectEthTotal!: bigint | ||
|
||
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) | ||
protocolEthTotal!: bigint | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./trade.model" | ||
export * from "./volumeByBlock.model" | ||
export * from "./subject.model" | ||
export * from "./blockStats.model" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_} from "typeorm" | ||
import * as marshal from "./marshal" | ||
|
||
@Entity_() | ||
export class Subject { | ||
constructor(props?: Partial<Subject>) { | ||
Object.assign(this, props) | ||
} | ||
|
||
@PrimaryColumn_() | ||
id!: string | ||
|
||
@Index_() | ||
@Column_("text", {nullable: false}) | ||
address!: string | ||
|
||
@Index_() | ||
@Column_("int4", {nullable: false}) | ||
firstTradeBlock!: number | ||
|
||
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) | ||
supply!: bigint | ||
|
||
@Column_("int4", {nullable: false}) | ||
totalTrades!: number | ||
|
||
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) | ||
totalEthVolume!: bigint | ||
|
||
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) | ||
totalEthBuyVolume!: bigint | ||
|
||
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) | ||
totalEthSellVolume!: bigint | ||
|
||
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) | ||
totalShareVolume!: bigint | ||
|
||
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) | ||
totalShareBuyVolume!: bigint | ||
|
||
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) | ||
totalShareSellVolume!: bigint | ||
|
||
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false}) | ||
subjectEthTotal!: bigint | ||
} |
This file was deleted.
Oops, something went wrong.