UNPKG

@covenance/dlc

Version:

Crypto and Bitcoin functions for Covenance DLC implementation

52 lines (51 loc) 1.24 kB
import { Address, Script, Transaction } from '../btc'; import { Point } from '../crypto/secp256k1'; import { EventOutcomeHash } from '../crypto/types'; export type UTXO = { txId: string; outputIndex: number; satoshis: number; script: Script; address?: Address; }; export type DlcInitTx = { tx: Transaction; dlcUtxo: UTXO; witnessScript: Script; cBlock: string; tPubKey: string; }; export type P2trOutputScript = { scriptPubKey: Script; tPubKey: string; cBlock: string; }; export interface OracleEvent { id: string; outcomeSignaturePoints: Point[]; outcomePrices: number[]; outcomeHashes: EventOutcomeHash[]; timestamp: number; nonce?: bigint; } export interface OracleCET { cetTx: Transaction; eventId: string; outcomeSignaturePoint: Point; outcomeLiquidationPrice: number; lenderAmount: number; borrowerAmount: number; } export interface LoanConfig { collateralAmount: number; annualInterestRate: number; liquidationThreshold: number; borrowedAmount: number; penaltyPercentage: number; } export interface LiquidationOutcome { timestamp: number; price: number; signaturePoint: Point; eventId: string; }