@node-dlc/core
Version:
53 lines (52 loc) • 1.92 kB
TypeScript
import { PayoutFunction, PolynomialPayoutCurvePiece, RoundingIntervals } from '@node-dlc/messaging';
import BigNumber from 'bignumber.js';
import { CETPayout } from './CETCalculator';
interface DlcPoint {
outcome: BigNumber;
payout: BigNumber;
}
export declare class PolynomialPayoutCurve {
private readonly points;
private readonly slope;
private readonly left;
private readonly right;
constructor(points: DlcPoint[]);
/**
* Get the payout for a given outcome
* @param outcome The outcome to get the payout for
* @returns The payout for the outcome
*/
getPayout(outcome: bigint): BigNumber;
/**
* Get the outcome for a given payout
* @param payout The payout to get the outcome for
* @returns The outcome for the payout
*/
getOutcomeForPayout(payout: BigNumber): bigint;
/**
* Serializes PolynomialPayoutCurve to a PolynomialPayoutCurvePiece (for transport)
* @returns A PolynomialPayoutCurvePiece
*/
toPayoutCurvePiece(): PolynomialPayoutCurvePiece;
/**
* Determine if the payout curve is equal to another
* @param curve A PolynomialPayoutCurve
* @returns True if the curves are the same
*/
equals(curve: PolynomialPayoutCurve): boolean;
/**
* Creates a PolynomialPayoutCurve from a PolynomialPayoutCurvePiece
* @param piece
* @returns A PolynomialPayoutCurve
*/
static fromPayoutCurvePiece(piece: PolynomialPayoutCurvePiece): PolynomialPayoutCurve;
/**
* Computes all CETs for a given payout curve
* @param payoutFunction The payout function
* @param totalCollateral The total collateral
* @param roundingIntervals The rounding intervals
* @returns A list of CETs
*/
static computePayouts(payoutFunction: PayoutFunction, totalCollateral: bigint, roundingIntervals: RoundingIntervals): CETPayout[];
}
export {};