-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yijing
authored and
Yijing
committed
Jun 26, 2023
1 parent
dd9c052
commit 392063c
Showing
11 changed files
with
171 additions
and
9 deletions.
There are no files selected for viewing
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
36 changes: 36 additions & 0 deletions
36
migrations/ethereum/1687800088000-CreateUniswapV3PoolCreatedEventTable.ts
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,36 @@ | ||
import { MigrationInterface, QueryRunner, getConnection } from 'typeorm'; | ||
|
||
export class CreateUniswapV3PoolCreatedEventTable1687800088000 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
const connection = getConnection(); | ||
const { schema } = connection.options as any; | ||
await queryRunner.query(` | ||
CREATE TABLE ${schema}.uniswap_v3_pool_created_events ( | ||
observed_timestamp NUMERIC NOT NULL, | ||
contract_address VARCHAR NOT NULL, | ||
transaction_hash VARCHAR NOT NULL, | ||
transaction_index NUMERIC NOT NULL, | ||
log_index NUMERIC NOT NULL, | ||
block_hash VARCHAR NOT NULL, | ||
block_number NUMERIC NOT NULL, | ||
token0 VARCHAR NOT NULL, | ||
token1 VARCHAR NOT NULL, | ||
fee INTEGER NOT NULL, | ||
tickSpacing INTEGER NOT NULL, | ||
pool VARCHAR NOT NULL, | ||
PRIMARY KEY (transaction_hash, log_index) | ||
); | ||
CREATE INDEX uniswap_v3_pool_created_events_block_number_idx ON ${schema}.uniswap_v3_pool_created_events (block_number); | ||
CREATE INDEX uniswap_v3_pool_created_events_token0_idx ON ${schema}.uniswap_v3_pool_created_events (token0); | ||
CREATE INDEX uniswap_v3_pool_created_events_token1_idx ON ${schema}.uniswap_v3_pool_created_events (token1); | ||
CREATE INDEX uniswap_v3_pool_created_events_pool_idx ON ${schema}.uniswap_v3_pool_created_events (pool); | ||
`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
const connection = getConnection(); | ||
const { schema } = connection.options as any; | ||
await queryRunner.query(`DROP TABLE ${schema}.uniswap_v3_pool_created_events;`); | ||
} | ||
} |
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
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,25 @@ | ||
import { BigNumber } from '@0x/utils'; | ||
import { Column, Entity } from 'typeorm'; | ||
|
||
import { Event } from './event'; | ||
import { bigNumberTransformer } from '../transformers'; | ||
|
||
// These events come directly from the Exchange contract and are fired whenever | ||
// someone fills an order. | ||
@Entity({ name: 'uniswap_v3_pool_created_events' }) | ||
export class UniswapV3PoolCreatedEvent extends Event { | ||
// The address of token0 | ||
@Column({ name: 'token0', type: 'varchar' }) | ||
public token0!: string; | ||
// The address of token1 | ||
@Column({ name: 'token1', type: 'varchar' }) | ||
public token1!: string; | ||
// The fee collected upon every swap in the pool, denominated in hundredths of a bip | ||
@Column({ name: 'fee', type: 'integer' }) | ||
public fee!: number; | ||
@Column({ name: 'tickSpacing', type: 'integer' }) | ||
public tickSpacing!: number; | ||
// The address of the pool | ||
@Column({ name: 'pool', type: 'varchar' }) | ||
public pool!: string; | ||
} |
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