63 lines
1.4 KiB
TypeScript
63 lines
1.4 KiB
TypeScript
|
//
|
||
|
// Copyright 2021 Vulcanize, Inc.
|
||
|
//
|
||
|
|
||
|
import { Entity, PrimaryColumn, Column, Index } from 'typeorm';
|
||
|
import { decimalTransformer, bigintTransformer } from '@cerc-io/util';
|
||
|
import { Decimal } from 'decimal.js';
|
||
|
|
||
|
@Entity()
|
||
|
@Index(['blockNumber'])
|
||
|
export class Swap {
|
||
|
@PrimaryColumn('varchar')
|
||
|
id!: string;
|
||
|
|
||
|
@PrimaryColumn('varchar', { length: 66 })
|
||
|
blockHash!: string;
|
||
|
|
||
|
@Column('integer')
|
||
|
blockNumber!: number;
|
||
|
|
||
|
@Column('varchar')
|
||
|
transaction!: string;
|
||
|
|
||
|
@Column('numeric', { transformer: bigintTransformer })
|
||
|
timestamp!: bigint;
|
||
|
|
||
|
@Column('varchar')
|
||
|
pair!: string;
|
||
|
|
||
|
@Column('varchar')
|
||
|
sender!: string;
|
||
|
|
||
|
@Column('varchar')
|
||
|
from!: string;
|
||
|
|
||
|
@Column('numeric', { transformer: decimalTransformer })
|
||
|
amount0In!: Decimal;
|
||
|
|
||
|
@Column('numeric', { transformer: decimalTransformer })
|
||
|
amount1In!: Decimal;
|
||
|
|
||
|
@Column('numeric', { transformer: decimalTransformer })
|
||
|
amount0Out!: Decimal;
|
||
|
|
||
|
@Column('numeric', { transformer: decimalTransformer })
|
||
|
amount1Out!: Decimal;
|
||
|
|
||
|
@Column('varchar')
|
||
|
to!: string;
|
||
|
|
||
|
@Column('numeric', { nullable: true, transformer: bigintTransformer })
|
||
|
logIndex!: bigint | null;
|
||
|
|
||
|
@Column('numeric', { transformer: decimalTransformer })
|
||
|
amountUSD!: Decimal;
|
||
|
|
||
|
@Column('boolean', { default: false })
|
||
|
isPruned!: boolean;
|
||
|
|
||
|
@Column('boolean', { default: false })
|
||
|
isRemoved!: boolean;
|
||
|
}
|