object CETCalculator
- Alphabetic
- By Inheritance
- CETCalculator
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- case class CETOutcome(digits: Digits, payout: Satoshis) extends Product with Serializable
A Vector of digits and the payout corresponding to this result
- sealed trait CETRange extends AnyRef
Given a range and a payout function with which to build CETs, the first step is to split the range into sub-ranges which can be compressed or cannot be compressed, represented here as CETRanges.
Given a range and a payout function with which to build CETs, the first step is to split the range into sub-ranges which can be compressed or cannot be compressed, represented here as CETRanges.
These ranges are inclusive in both indices.
- case class ConstantPayoutRange(indexFrom: Long, indexTo: Long) extends CETRange with Product with Serializable
This range contains some constant payout between 0 and totalCollateral (exclusive).
This range contains some constant payout between 0 and totalCollateral (exclusive). To be clear, indexFrom and indexTo are still inclusive values.
- type Digits = Vector[Int]
A Vector of digits in a given base.
A Vector of digits in a given base.
For example if we are using base 2 (binary) This could look like Vector(0,1,0,1,0,1,1,1,0)
or if we are using base 16 (hex) Vector(9,8,10,11,2,3,2,4,1,15)
- type MultiOracleDigits = Vector[Digits]
A Vector of Digits corresponding to each oracle in order
- case class MultiOracleOutcome(multiOracleDigits: MultiOracleDigits, payout: Satoshis) extends Product with Serializable
A Vector of MultiOracleDigits and the payout corresponding to this result
- case class SingletonPayoutRange(index: Long) extends CETRange with Product with Serializable
A CETRange with a single element range
- case class VariablePayoutRange(indexFrom: Long, indexTo: Long) extends CETRange with Product with Serializable
This range contains payouts that all vary at every step and cannot be compressed
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def backGroupings(digits: Digits, base: Int): Vector[Digits]
Computes the back groupings in the CETCompression (with endpoint optimization but without total optimization).
Computes the back groupings in the CETCompression (with endpoint optimization but without total optimization). This means the resulting outcomes cover [(prefix, digits[0], 0, ..., 0), end].
- digits
The unique digits of the range's end
- base
The base the digits are represented in
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def combinations[T](oracles: Vector[T], threshold: Int): Vector[Vector[T]]
Computes all combinations of threshold oracles, preserving order.
- def computeCETIntervalBinary(cet: Digits, numDigits: Int): (Long, Long)
Given binary digits corresponding to a CET, returns the CET's support bounds
- def computeCETs(base: Int, numDigits: Int, function: DLCPayoutCurve, totalCollateral: Satoshis, rounding: RoundingIntervals): Vector[CETOutcome]
Computes the compressed set of outcomes and their corresponding payouts given a base, the number of digits to be signed, the payout function, and totalCollateral.
- def computeCETs(base: Int, numDigits: Int, function: DLCPayoutCurve, totalCollateral: Satoshis, rounding: RoundingIntervals, min: Long, max: Long): Vector[CETOutcome]
Computes the compressed set of outcomes and their corresponding payouts given a base, the number of digits to be signed, the payout function, totalCollateral and the range of outcomes to construct CETs for, [min, max].
- def computeCoveringCETsBinary(numDigits: Int, cetDigits: Digits, maxErrorExp: Int, minFailExp: Int, maximizeCoverage: Boolean, numOracles: Int): Vector[MultiOracleDigits]
Given the primary oracle's CET, computes the set of CETs needed for two oracles with an allowed difference (which is bounded).
Given the primary oracle's CET, computes the set of CETs needed for two oracles with an allowed difference (which is bounded).
- numDigits
The number of binary digits signed by the oracles
- cetDigits
Digits corresponding to a CET for the primary oracle
- maxErrorExp
The exponent (of 2) representing the difference at which non-support (failure) is guaranteed
- minFailExp
The exponent (of 2) representing the difference up to which support is guaranteed
- def computeMultiOracleCETsBinary(numDigits: Int, function: DLCPayoutCurve, totalCollateral: Satoshis, rounding: RoundingIntervals, maxErrorExp: Int, minFailExp: Int, maximizeCoverage: Boolean, numOracles: Int): Vector[MultiOracleOutcome]
Computes the set of CETs needed for numOracles oracles with an allowed difference (which is bounded).
Computes the set of CETs needed for numOracles oracles with an allowed difference (which is bounded).
- numDigits
The number of binary digits signed by the oracles
- function
The DLCPayoutCurve to use with primary oracles
- totalCollateral
The funding output's value (ignoring fees)
- rounding
The rounding intervals to use when computing CETs
- maxErrorExp
The exponent (of 2) representing the difference at which non-support (failure) is guaranteed
- minFailExp
The exponent (of 2) representing the difference up to which support is guaranteed
- maximizeCoverage
The flag that determines whether CETs used in the non-middle small case are maximal or minimal in size
- numOracles
The total number of oracles (including primary) needed for execution
- def computeMultiOracleCETsBinary(numDigits: Int, primaryCETs: Vector[CETOutcome], maxErrorExp: Int, minFailExp: Int, maximizeCoverage: Boolean, numOracles: Int): Vector[MultiOracleOutcome]
Given the primary oracle's CETs, computes the set of CETs needed for n oracles with an allowed difference (which is bounded).
Given the primary oracle's CETs, computes the set of CETs needed for n oracles with an allowed difference (which is bounded).
- numDigits
The number of binary digits signed by the oracles
- primaryCETs
CETs corresponding to the primary oracle
- maxErrorExp
The exponent (of 2) representing the difference at which non-support (failure) is guaranteed
- minFailExp
The exponent (of 2) representing the difference up to which support is guaranteed
- maximizeCoverage
The flag that determines whether CETs used in the non-middle small case are maximal or minimal in size
- numOracles
The total number of oracles (including primary) needed for execution
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def frontGroupings(digits: Digits, base: Int): Vector[Digits]
Computes the front groupings in the CETCompression (with endpoint optimization but without total optimization).
Computes the front groupings in the CETCompression (with endpoint optimization but without total optimization). This means the resulting outcomes cover [start, (prefix, digits[0], base-1, ..., base-1)].
- digits
The unique digits of the range's start
- base
The base the digits are represented in
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def groupByIgnoringDigits(start: Long, end: Long, base: Int, numDigits: Int): Vector[Digits]
Runs the compression algorithm with all optimizations on the interval [start, end] represented in the given base.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def lineApprox(func: (Long) => Long, numDigits: Int, interval: Int): DLCPayoutCurve
- def middleGrouping(firstDigitStart: Int, firstDigitEnd: Int): Vector[Digits]
Computes the middle groupings in the CETCompression (without total optimization).
Computes the middle groupings in the CETCompression (without total optimization). This means the resulting outcomes cover [(prefix, firstDigitStart + 1, 0, ..., 0), (prefix, firstDigitEnd-1, base-1, ..., base-1)].
- firstDigitStart
The first unique digit of the range's start
- firstDigitEnd
The first unique digit of the range's end
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def numToVec(num: Long, numDigits: Int, ignoredDigits: Int): Digits
Given the left endpoint of a CET and the number of ignored digits, computes the binary digits for the CET.
- def payoutSample(func: (Long) => Long, numDigits: Int, numPoints: Long): Vector[PiecewisePolynomialEndpoint]
- def payoutSampleByInterval(func: (Long) => Long, numDigits: Int, interval: Int): Vector[PiecewisePolynomialEndpoint]
- def searchForNumericOutcome(digits: Digits, outcomes: Vector[DLCOutcomeType]): Option[UnsignedNumericOutcome]
Searches for an UnsignedNumericOutcome corresponding to (prefixing) digits.
Searches for an UnsignedNumericOutcome corresponding to (prefixing) digits. Assumes outcomes is ordered.
- def searchForPrefix[Outcome](digits: Digits, outcomes: Vector[Outcome])(outcomeToPrefix: (Outcome) => Digits): Option[Outcome]
Searches for an outcome which contains a prefix of digits
- def separatePrefix(start: Long, end: Long, base: Int, numDigits: Int): (Digits, Digits, Digits)
Splits off the shared prefix of start and end represented in the given base and returns the shared prefix and the unique digits of start and of end.
- def splitIntoRanges(from: Long, to: Long, totalCollateral: Satoshis, function: DLCPayoutCurve, rounding: RoundingIntervals): Vector[CETRange]
Goes between from and to (inclusive) and evaluates function to split the interval [to, from] into CETRanges.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()