o

# CETCalculator

#### objectCETCalculator

Linear Supertypes
Ordering
1. Alphabetic
2. By Inheritance
Inherited
1. CETCalculator
2. AnyRef
3. Any
1. Hide All
2. Show All
Visibility
1. Public
2. Protected

### Type Members

1. case class CETOutcome(digits: Digits, payout: Satoshis) extends Product with Serializable

A Vector of digits and the payout corresponding to this result

2. 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.

3. 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.

4. 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)

5. type MultiOracleDigits = Vector[Digits]

A Vector of Digits corresponding to each oracle in order

6. case class MultiOracleOutcome(multiOracleDigits: MultiOracleDigits, payout: Satoshis) extends Product with Serializable

A Vector of MultiOracleDigits and the payout corresponding to this result

7. case class SingletonPayoutRange(index: Long) extends CETRange with Product with Serializable

A CETRange with a single element range

8. 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

1. final def !=(arg0: Any)
Definition Classes
AnyRef → Any
2. final def ##: Int
Definition Classes
AnyRef → Any
3. final def ==(arg0: Any)
Definition Classes
AnyRef → Any
4. final def asInstanceOf[T0]: T0
Definition Classes
Any
5. 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), end].

digits

The unique digits of the range's end

base

The base the digits are represented in

6. def clone()
Attributes
protected[lang]
Definition Classes
AnyRef
Annotations
@throws(classOf[java.lang.CloneNotSupportedException]) @native()
7. def combinations[T](oracles: Vector[T], threshold: Int): Vector[Vector[T]]

Computes all combinations of threshold oracles, preserving order.

8. def computeCETIntervalBinary(cet: Digits, numDigits: Int): (Long, Long)

Given binary digits corresponding to a CET, returns the CET's support bounds

9. def computeCETs(base: Int, numDigits: Int, function: DLCPayoutCurve, totalCollateral: Satoshis, rounding: RoundingIntervals)

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.

10. def computeCETs(base: Int, numDigits: Int, function: DLCPayoutCurve, totalCollateral: Satoshis, rounding: RoundingIntervals, min: Long, max: Long)

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].

11. def computeCoveringCETsBinary(numDigits: Int, cetDigits: Digits, maxErrorExp: Int, minFailExp: Int, maximizeCoverage: Boolean, numOracles: Int)

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

12. def computeMultiOracleCETsBinary(numDigits: Int, function: DLCPayoutCurve, totalCollateral: Satoshis, rounding: RoundingIntervals, maxErrorExp: Int, minFailExp: Int, maximizeCoverage: Boolean, numOracles: Int)

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

13. def computeMultiOracleCETsBinary(numDigits: Int, primaryCETs: Vector[CETOutcome], maxErrorExp: Int, minFailExp: Int, maximizeCoverage: Boolean, numOracles: Int)

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

14. final def eq(arg0: AnyRef)
Definition Classes
AnyRef
15. def equals(arg0: AnyRef)
Definition Classes
AnyRef → Any
16. def finalize(): Unit
Attributes
protected[lang]
Definition Classes
AnyRef
Annotations
@throws(classOf[java.lang.Throwable])
17. 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, base-1, ..., base-1)].

digits

The unique digits of the range's start

base

The base the digits are represented in

18. final def getClass(): Class[_ <: AnyRef]
Definition Classes
AnyRef → Any
Annotations
@native()
19. 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.

20. def hashCode(): Int
Definition Classes
AnyRef → Any
Annotations
@native()
21. final def isInstanceOf[T0]
Definition Classes
Any
22. def lineApprox(func: (Long) => Long, numDigits: Int, interval: Int)
23. 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

24. final def ne(arg0: AnyRef)
Definition Classes
AnyRef
25. final def notify(): Unit
Definition Classes
AnyRef
Annotations
@native()
26. final def notifyAll(): Unit
Definition Classes
AnyRef
Annotations
@native()
27. def numToVec(num: Long, numDigits: Int, ignoredDigits: Int)

Given the left endpoint of a CET and the number of ignored digits, computes the binary digits for the CET.

28. def payoutSample(func: (Long) => Long, numDigits: Int, numPoints: Long)
29. def payoutSampleByInterval(func: (Long) => Long, numDigits: Int, interval: Int)
30. def searchForNumericOutcome(digits: Digits, outcomes: Vector[DLCOutcomeType])

Searches for an UnsignedNumericOutcome corresponding to (prefixing) digits.

Searches for an UnsignedNumericOutcome corresponding to (prefixing) digits. Assumes outcomes is ordered.

31. def searchForPrefix[Outcome](digits: Digits, outcomes: Vector[Outcome])(outcomeToPrefix: (Outcome) => Digits): Option[Outcome]

Searches for an outcome which contains a prefix of digits

32. 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.

33. def splitIntoRanges(from: Long, to: Long, totalCollateral: Satoshis, function: DLCPayoutCurve, rounding: RoundingIntervals)

Goes between from and to (inclusive) and evaluates function to split the interval [to, from] into CETRanges.

34. final def synchronized[T0](arg0: => T0): T0
Definition Classes
AnyRef
35. def toString()
Definition Classes
AnyRef → Any
36. final def wait(): Unit
Definition Classes
AnyRef
Annotations
@throws(classOf[java.lang.InterruptedException])
37. final def wait(arg0: Long, arg1: Int): Unit
Definition Classes
AnyRef
Annotations
@throws(classOf[java.lang.InterruptedException])
38. final def wait(arg0: Long): Unit
Definition Classes
AnyRef
Annotations
@throws(classOf[java.lang.InterruptedException]) @native()