Add SV2 DATUM payout hardening

This commit is contained in:
Ben
2026-06-12 23:54:50 -04:00
parent bcd6bb0aa7
commit a33c530268
59 changed files with 7852 additions and 81 deletions
@@ -0,0 +1,54 @@
import { Column, Entity, Index, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { PayoutSnapshotEntity } from './payout-snapshot.entity';
@Entity({ name: 'payout_snapshot_entry' })
@Index('IDX_payout_snapshot_entry_snapshot_rank', ['snapshotId', 'rank'])
@Index('IDX_payout_snapshot_entry_address', ['address'])
export class PayoutSnapshotEntryEntity {
@PrimaryGeneratedColumn({ type: 'bigint' })
id: string;
@Column({ type: 'bigint' })
snapshotId: string;
@ManyToOne(() => PayoutSnapshotEntity, snapshot => snapshot.entries, { onDelete: 'CASCADE' })
@JoinColumn({ name: 'snapshotId' })
snapshot: PayoutSnapshotEntity;
@Column({ length: 62, type: 'varchar' })
address: string;
@Column({ type: 'decimal' })
creditedDifficulty: number;
@Column({ type: 'bigint' })
acceptedShareCount: string;
@Column({ type: 'decimal' })
payoutWeight: number;
@Column({ type: 'bigint' })
grossPayoutSats: string;
@Column({ type: 'bigint' })
payoutSats: string;
@Column({ type: 'bigint', default: 0 })
balanceBeforeSats: string;
@Column({ type: 'bigint', default: 0 })
balanceAfterSats: string;
@Column({ type: 'boolean', default: true })
includedInCoinbase: boolean;
@Column({ length: 16, type: 'varchar', default: 'coinbase' })
rowType: 'coinbase' | 'pending';
@Column({ type: 'integer' })
rank: number;
@Column({ type: 'timestamptz', default: () => 'CURRENT_TIMESTAMP' })
createdAt: Date;
}