@covenance/dlc
Version:
Crypto and Bitcoin functions for Covenance DLC implementation
46 lines (45 loc) • 1.11 kB
TypeScript
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;
}