-
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.
Fix/uniswap v3 events DENG-25 (#132)
* add pool created events * add changes * minor adjustments * add trailing line * add ; * add uni v3 create pool address * prettier * Cleanup --------- Co-authored-by: Yijing <[email protected]> Co-authored-by: Jorge Pérez <[email protected]>
- Loading branch information
1 parent
668bd50
commit a6c379a
Showing
10 changed files
with
174 additions
and
33 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
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, | ||
tick_spacing 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,21 @@ | ||
import { Column, Entity } from 'typeorm'; | ||
|
||
import { Event } from './event'; | ||
|
||
@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: 'tick_spacing', 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