/
CurrentPoolMetrics.entity.ts
46 lines (34 loc) · 1.25 KB
/
CurrentPoolMetrics.entity.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { BigIntColumnOptions, DeleteCascadeRelationOptions } from './util';
import { Cardano } from '@cardano-sdk/core';
import { Column, Entity, JoinColumn, OneToOne, PrimaryColumn } from 'typeorm';
import { StakePoolEntity } from './StakePool.entity';
import { float } from './transformers';
@Entity()
export class CurrentPoolMetricsEntity {
// Using the same column for both primary and foreign key
@PrimaryColumn({ length: 56, type: 'char' })
stakePoolId?: Cardano.PoolId;
@Column()
slot: Cardano.Slot;
@OneToOne(() => StakePoolEntity, DeleteCascadeRelationOptions)
@JoinColumn()
stakePool?: StakePoolEntity;
@Column({ type: 'integer' })
mintedBlocks?: number;
@Column({ type: 'integer' })
liveDelegators?: number;
@Column(BigIntColumnOptions)
activeStake?: Cardano.Lovelace;
@Column(BigIntColumnOptions)
liveStake?: Cardano.Lovelace;
@Column(BigIntColumnOptions)
livePledge?: Cardano.Lovelace;
@Column({ transformer: float, type: 'numeric' })
liveSaturation?: Cardano.Percent;
@Column({ transformer: float, type: 'numeric' })
activeSize?: Cardano.Percent;
@Column({ transformer: float, type: 'numeric' })
liveSize?: Cardano.Percent;
@Column({ transformer: float, type: 'numeric' })
apy?: Cardano.Percent;
}