mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-11-29 00:34:06 +00:00
* Create Swap entity. * Update day and hour interval data in Swap event handler. Co-authored-by: nabarun <nabarun@deepstacksoft.com>
74 lines
1.8 KiB
TypeScript
74 lines
1.8 KiB
TypeScript
import Decimal from 'decimal.js';
|
|
import { Entity, PrimaryColumn, Column, ManyToOne } from 'typeorm';
|
|
import { decimalTransformer } from '@vulcanize/util';
|
|
|
|
import { Pool } from './Pool';
|
|
|
|
@Entity()
|
|
export class PoolDayData {
|
|
@PrimaryColumn('varchar')
|
|
id!: string;
|
|
|
|
@PrimaryColumn('integer')
|
|
blockNumber!: number;
|
|
|
|
@Column('integer')
|
|
date!: number;
|
|
|
|
@ManyToOne(() => Pool)
|
|
pool!: Pool;
|
|
|
|
@Column('numeric', { transformer: decimalTransformer })
|
|
high!: Decimal;
|
|
|
|
@Column('numeric', { transformer: decimalTransformer })
|
|
low!: Decimal;
|
|
|
|
@Column('numeric', { transformer: decimalTransformer })
|
|
open!: Decimal;
|
|
|
|
@Column('numeric', { transformer: decimalTransformer })
|
|
close!: Decimal;
|
|
|
|
@Column('numeric', { default: BigInt(0) })
|
|
sqrtPrice!: bigint
|
|
|
|
@Column('bigint', { nullable: true })
|
|
tick!: bigint | null
|
|
|
|
@Column('numeric', { default: BigInt(0) })
|
|
liquidity!: bigint
|
|
|
|
@Column('numeric', { default: BigInt(0) })
|
|
feeGrowthGlobal0X128!: bigint
|
|
|
|
@Column('numeric', { default: BigInt(0) })
|
|
feeGrowthGlobal1X128!: bigint
|
|
|
|
@Column('numeric', { default: 0, transformer: decimalTransformer })
|
|
token0Price!: Decimal
|
|
|
|
@Column('numeric', { default: 0, transformer: decimalTransformer })
|
|
token1Price!: Decimal
|
|
|
|
@Column('numeric', { default: 0, transformer: decimalTransformer })
|
|
tvlUSD!: Decimal
|
|
|
|
@Column('numeric', { default: BigInt(0) })
|
|
txCount!: bigint
|
|
|
|
@Column('numeric', { default: 0, transformer: decimalTransformer })
|
|
volumeToken0!: Decimal
|
|
|
|
@Column('numeric', { default: 0, transformer: decimalTransformer })
|
|
volumeToken1!: Decimal
|
|
|
|
@Column('numeric', { default: 0, transformer: decimalTransformer })
|
|
volumeUSD!: Decimal
|
|
|
|
@Column('numeric', { default: 0, transformer: decimalTransformer })
|
|
feesUSD!: Decimal
|
|
|
|
// TODO: Add remaining fields when they are used.
|
|
}
|