@atomicfinance/bitcoin-wallet-provider 4.2.8 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint$colon$fix.log +4 -0
- package/.turbo/turbo-lint.log +5 -0
- package/.turbo/turbo-test.log +0 -0
- package/.yalc/@node-dlc/core/.nyc_output/687a3c14-9765-45fd-a1fe-f7db3d56fee4.json +1 -0
- package/.yalc/@node-dlc/core/.nyc_output/processinfo/687a3c14-9765-45fd-a1fe-f7db3d56fee4.json +1 -0
- package/.yalc/@node-dlc/core/.nyc_output/processinfo/index.json +1 -0
- package/.yalc/@node-dlc/core/README.md +11 -0
- package/.yalc/@node-dlc/core/__tests__/core.spec.ts +7 -0
- package/.yalc/@node-dlc/core/__tests__/dlc/CETCalculator.spec.ts +1029 -0
- package/.yalc/@node-dlc/core/__tests__/dlc/CoinSelect.spec.ts +179 -0
- package/.yalc/@node-dlc/core/__tests__/dlc/PolynomialPayoutCurve.spec.ts +345 -0
- package/.yalc/@node-dlc/core/__tests__/dlc/TxBuilder.spec.ts +424 -0
- package/.yalc/@node-dlc/core/__tests__/dlc/finance/Builder.spec.ts +492 -0
- package/.yalc/@node-dlc/core/__tests__/dlc/finance/CoveredCall.spec.ts +112 -0
- package/.yalc/@node-dlc/core/__tests__/dlc/finance/CsoInfo.spec.ts +1124 -0
- package/.yalc/@node-dlc/core/__tests__/dlc/finance/LongCall.spec.ts +55 -0
- package/.yalc/@node-dlc/core/__tests__/dlc/finance/LongPut.spec.ts +55 -0
- package/.yalc/@node-dlc/core/__tests__/dlc/finance/OptionInfo.spec.ts +226 -0
- package/.yalc/@node-dlc/core/__tests__/dlc/finance/ShortPut.spec.ts +62 -0
- package/.yalc/@node-dlc/core/__tests__/tsconfig.json +8 -0
- package/.yalc/@node-dlc/core/__tests__/utils/precision.spec.ts +40 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/base.css +224 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/block-navigation.js +79 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/favicon.png +0 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/index.html +171 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/AsyncProcessingQueue.ts.html +269 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/Base32.ts.html +86 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/BigIntUtils.ts.html +86 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/BitField.ts.html +86 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/ChannelId.ts.html +86 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/LinkedList.ts.html +413 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/LinkedListNode.ts.html +122 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/Queue.ts.html +188 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/ShortChannelId.ts.html +86 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/ShortChannelIdUtils.ts.html +107 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/CETCalculator.ts.html +1430 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/CoinSelect.ts.html +431 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/HyperbolaPayoutCurve.ts.html +644 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/PolynomialPayoutCurve.ts.html +878 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/TxBuilder.ts.html +1088 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/TxFinalizer.ts.html +731 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/Builder.ts.html +2270 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/CoveredCall.ts.html +410 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/CsoInfo.ts.html +1574 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/LinearPayout.ts.html +362 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/LongCall.ts.html +302 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/LongPut.ts.html +302 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/OptionInfo.ts.html +626 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/ShortPut.ts.html +305 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/index.html +216 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/index.html +186 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/index.html +261 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/index.ts.html +278 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/ChannelId.ts.html +242 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/ChannelKeys.ts.html +407 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/CommitmentNumber.ts.html +362 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/CommitmentSecret.ts.html +203 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/CommitmentSecretStore.ts.html +332 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/Htlc.ts.html +236 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/HtlcDirection.ts.html +131 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/ScriptFactory.ts.html +530 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/TxFactory.ts.html +1094 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/index.html +231 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/utils/BigIntUtils.ts.html +272 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/utils/Precision.ts.html +149 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/lib/utils/index.html +126 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/prettify.css +1 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/prettify.js +2 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/.yalc/@node-dlc/core/coverage/lcov-report/sorter.js +170 -0
- package/.yalc/@node-dlc/core/coverage/lcov.info +2426 -0
- package/.yalc/@node-dlc/core/dist/AsyncProcessingQueue.d.ts +22 -0
- package/.yalc/@node-dlc/core/dist/AsyncProcessingQueue.js +55 -0
- package/.yalc/@node-dlc/core/dist/AsyncProcessingQueue.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/Base32.d.ts +1 -0
- package/.yalc/@node-dlc/core/dist/Base32.js +7 -0
- package/.yalc/@node-dlc/core/dist/Base32.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/BigIntUtils.d.ts +1 -0
- package/.yalc/@node-dlc/core/dist/BigIntUtils.js +8 -0
- package/.yalc/@node-dlc/core/dist/BigIntUtils.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/BitField.d.ts +1 -0
- package/.yalc/@node-dlc/core/dist/BitField.js +7 -0
- package/.yalc/@node-dlc/core/dist/BitField.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/ChannelId.d.ts +1 -0
- package/.yalc/@node-dlc/core/dist/ChannelId.js +7 -0
- package/.yalc/@node-dlc/core/dist/ChannelId.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/LinkedList.d.ts +30 -0
- package/.yalc/@node-dlc/core/dist/LinkedList.js +104 -0
- package/.yalc/@node-dlc/core/dist/LinkedList.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/LinkedListNode.d.ts +9 -0
- package/.yalc/@node-dlc/core/dist/LinkedListNode.js +15 -0
- package/.yalc/@node-dlc/core/dist/LinkedListNode.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/Queue.d.ts +22 -0
- package/.yalc/@node-dlc/core/dist/Queue.js +38 -0
- package/.yalc/@node-dlc/core/dist/Queue.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/ShortChannelId.d.ts +1 -0
- package/.yalc/@node-dlc/core/dist/ShortChannelId.js +7 -0
- package/.yalc/@node-dlc/core/dist/ShortChannelId.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/ShortChannelIdUtils.d.ts +1 -0
- package/.yalc/@node-dlc/core/dist/ShortChannelIdUtils.js +12 -0
- package/.yalc/@node-dlc/core/dist/ShortChannelIdUtils.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/dlc/CETCalculator.d.ts +50 -0
- package/.yalc/@node-dlc/core/dist/dlc/CETCalculator.js +332 -0
- package/.yalc/@node-dlc/core/dist/dlc/CETCalculator.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/dlc/CoinSelect.d.ts +23 -0
- package/.yalc/@node-dlc/core/dist/dlc/CoinSelect.js +77 -0
- package/.yalc/@node-dlc/core/dist/dlc/CoinSelect.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/dlc/HyperbolaPayoutCurve.d.ts +20 -0
- package/.yalc/@node-dlc/core/dist/dlc/HyperbolaPayoutCurve.js +117 -0
- package/.yalc/@node-dlc/core/dist/dlc/HyperbolaPayoutCurve.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/dlc/PayoutCurve.d.ts +5 -0
- package/.yalc/@node-dlc/core/dist/dlc/PayoutCurve.js +3 -0
- package/.yalc/@node-dlc/core/dist/dlc/PayoutCurve.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/dlc/PolynomialPayoutCurve.d.ts +52 -0
- package/.yalc/@node-dlc/core/dist/dlc/PolynomialPayoutCurve.js +173 -0
- package/.yalc/@node-dlc/core/dist/dlc/PolynomialPayoutCurve.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/dlc/TxBuilder.d.ts +55 -0
- package/.yalc/@node-dlc/core/dist/dlc/TxBuilder.js +217 -0
- package/.yalc/@node-dlc/core/dist/dlc/TxBuilder.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/dlc/TxFinalizer.d.ts +40 -0
- package/.yalc/@node-dlc/core/dist/dlc/TxFinalizer.js +146 -0
- package/.yalc/@node-dlc/core/dist/dlc/TxFinalizer.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/Builder.d.ts +193 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/Builder.js +422 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/Builder.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/CoveredCall.d.ts +13 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/CoveredCall.js +67 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/CoveredCall.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/CsoInfo.d.ts +114 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/CsoInfo.js +290 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/CsoInfo.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/LinearPayout.d.ts +6 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/LinearPayout.js +79 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/LinearPayout.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/LongCall.d.ts +13 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/LongCall.js +47 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/LongCall.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/LongPut.d.ts +13 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/LongPut.js +47 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/LongPut.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/OptionInfo.d.ts +20 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/OptionInfo.js +101 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/OptionInfo.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/ShortPut.d.ts +12 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/ShortPut.js +46 -0
- package/.yalc/@node-dlc/core/dist/dlc/finance/ShortPut.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/index.d.ts +39 -0
- package/.yalc/@node-dlc/core/dist/index.js +78 -0
- package/.yalc/@node-dlc/core/dist/index.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/lightning/ChannelId.d.ts +31 -0
- package/.yalc/@node-dlc/core/dist/lightning/ChannelId.js +52 -0
- package/.yalc/@node-dlc/core/dist/lightning/ChannelId.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/lightning/ChannelKeys.d.ts +55 -0
- package/.yalc/@node-dlc/core/dist/lightning/ChannelKeys.js +105 -0
- package/.yalc/@node-dlc/core/dist/lightning/ChannelKeys.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/lightning/CommitmentNumber.d.ts +55 -0
- package/.yalc/@node-dlc/core/dist/lightning/CommitmentNumber.js +76 -0
- package/.yalc/@node-dlc/core/dist/lightning/CommitmentNumber.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/lightning/CommitmentSecret.d.ts +26 -0
- package/.yalc/@node-dlc/core/dist/lightning/CommitmentSecret.js +44 -0
- package/.yalc/@node-dlc/core/dist/lightning/CommitmentSecret.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/lightning/CommitmentSecretStore.d.ts +41 -0
- package/.yalc/@node-dlc/core/dist/lightning/CommitmentSecretStore.js +79 -0
- package/.yalc/@node-dlc/core/dist/lightning/CommitmentSecretStore.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/lightning/Htlc.d.ts +46 -0
- package/.yalc/@node-dlc/core/dist/lightning/Htlc.js +46 -0
- package/.yalc/@node-dlc/core/dist/lightning/Htlc.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/lightning/HtlcDirection.d.ts +16 -0
- package/.yalc/@node-dlc/core/dist/lightning/HtlcDirection.js +21 -0
- package/.yalc/@node-dlc/core/dist/lightning/HtlcDirection.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/lightning/ScriptFactory.d.ts +76 -0
- package/.yalc/@node-dlc/core/dist/lightning/ScriptFactory.js +102 -0
- package/.yalc/@node-dlc/core/dist/lightning/ScriptFactory.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/lightning/TxFactory.d.ts +83 -0
- package/.yalc/@node-dlc/core/dist/lightning/TxFactory.js +222 -0
- package/.yalc/@node-dlc/core/dist/lightning/TxFactory.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/utils/BigIntUtils.d.ts +9 -0
- package/.yalc/@node-dlc/core/dist/utils/BigIntUtils.js +59 -0
- package/.yalc/@node-dlc/core/dist/utils/BigIntUtils.js.map +1 -0
- package/.yalc/@node-dlc/core/dist/utils/Precision.d.ts +13 -0
- package/.yalc/@node-dlc/core/dist/utils/Precision.js +28 -0
- package/.yalc/@node-dlc/core/dist/utils/Precision.js.map +1 -0
- package/.yalc/@node-dlc/core/lib/AsyncProcessingQueue.ts +63 -0
- package/.yalc/@node-dlc/core/lib/Base32.ts +2 -0
- package/.yalc/@node-dlc/core/lib/BigIntUtils.ts +2 -0
- package/.yalc/@node-dlc/core/lib/BitField.ts +2 -0
- package/.yalc/@node-dlc/core/lib/ChannelId.ts +2 -0
- package/.yalc/@node-dlc/core/lib/LinkedList.ts +111 -0
- package/.yalc/@node-dlc/core/lib/LinkedListNode.ts +14 -0
- package/.yalc/@node-dlc/core/lib/Queue.ts +36 -0
- package/.yalc/@node-dlc/core/lib/ShortChannelId.ts +2 -0
- package/.yalc/@node-dlc/core/lib/ShortChannelIdUtils.ts +9 -0
- package/.yalc/@node-dlc/core/lib/dlc/CETCalculator.ts +450 -0
- package/.yalc/@node-dlc/core/lib/dlc/CoinSelect.ts +117 -0
- package/.yalc/@node-dlc/core/lib/dlc/HyperbolaPayoutCurve.ts +188 -0
- package/.yalc/@node-dlc/core/lib/dlc/PayoutCurve.ts +6 -0
- package/.yalc/@node-dlc/core/lib/dlc/PolynomialPayoutCurve.ts +266 -0
- package/.yalc/@node-dlc/core/lib/dlc/TxBuilder.ts +336 -0
- package/.yalc/@node-dlc/core/lib/dlc/TxFinalizer.ts +217 -0
- package/.yalc/@node-dlc/core/lib/dlc/finance/Builder.ts +730 -0
- package/.yalc/@node-dlc/core/lib/dlc/finance/CoveredCall.ts +110 -0
- package/.yalc/@node-dlc/core/lib/dlc/finance/CsoInfo.ts +498 -0
- package/.yalc/@node-dlc/core/lib/dlc/finance/LinearPayout.ts +94 -0
- package/.yalc/@node-dlc/core/lib/dlc/finance/LongCall.ts +74 -0
- package/.yalc/@node-dlc/core/lib/dlc/finance/LongPut.ts +74 -0
- package/.yalc/@node-dlc/core/lib/dlc/finance/OptionInfo.ts +182 -0
- package/.yalc/@node-dlc/core/lib/dlc/finance/ShortPut.ts +75 -0
- package/.yalc/@node-dlc/core/lib/index.ts +66 -0
- package/.yalc/@node-dlc/core/lib/lightning/ChannelId.ts +54 -0
- package/.yalc/@node-dlc/core/lib/lightning/ChannelKeys.ts +109 -0
- package/.yalc/@node-dlc/core/lib/lightning/CommitmentNumber.ts +94 -0
- package/.yalc/@node-dlc/core/lib/lightning/CommitmentSecret.ts +41 -0
- package/.yalc/@node-dlc/core/lib/lightning/CommitmentSecretStore.ts +84 -0
- package/.yalc/@node-dlc/core/lib/lightning/Htlc.ts +52 -0
- package/.yalc/@node-dlc/core/lib/lightning/HtlcDirection.ts +17 -0
- package/.yalc/@node-dlc/core/lib/lightning/ScriptFactory.ts +150 -0
- package/.yalc/@node-dlc/core/lib/lightning/TxFactory.ts +338 -0
- package/.yalc/@node-dlc/core/lib/utils/BigIntUtils.ts +64 -0
- package/.yalc/@node-dlc/core/lib/utils/Precision.ts +23 -0
- package/.yalc/@node-dlc/core/package.json +38 -0
- package/.yalc/@node-dlc/core/tsconfig.json +8 -0
- package/.yalc/@node-dlc/core/yalc.sig +1 -0
- package/CHANGELOG.md +23 -0
- package/package.json +7 -7
- package/yalc.lock +10 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { HyperbolaPayoutCurvePiece } from '@node-dlc/messaging';
|
|
2
|
+
import { expect } from 'chai';
|
|
3
|
+
|
|
4
|
+
import { LongCall } from '../../../lib/dlc/finance/LongCall';
|
|
5
|
+
import { HyperbolaPayoutCurve } from '../../../lib/dlc/HyperbolaPayoutCurve';
|
|
6
|
+
|
|
7
|
+
describe('LongCall', () => {
|
|
8
|
+
describe('1BTC-50k-base2-18digit curve', () => {
|
|
9
|
+
const strikePrice = BigInt(50000);
|
|
10
|
+
const contractSize = BigInt(10) ** BigInt(8);
|
|
11
|
+
const oracleBase = 2;
|
|
12
|
+
const oracleDigits = 18;
|
|
13
|
+
|
|
14
|
+
const { payoutCurve } = LongCall.buildCurve(
|
|
15
|
+
strikePrice,
|
|
16
|
+
contractSize,
|
|
17
|
+
oracleBase,
|
|
18
|
+
oracleDigits,
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
describe('payout', () => {
|
|
22
|
+
const priceIncrease = BigInt(1000);
|
|
23
|
+
|
|
24
|
+
it('should be positive as the position goes ITM', () => {
|
|
25
|
+
expect(
|
|
26
|
+
payoutCurve
|
|
27
|
+
.getPayout(strikePrice + priceIncrease)
|
|
28
|
+
.integerValue()
|
|
29
|
+
.toNumber(),
|
|
30
|
+
).to.equal(
|
|
31
|
+
Number(
|
|
32
|
+
(contractSize * priceIncrease) / (strikePrice + priceIncrease),
|
|
33
|
+
),
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should be zero at strike price', () => {
|
|
38
|
+
expect(payoutCurve.getPayout(strikePrice).toNumber()).to.equal(0);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should serialize and deserialize properly', () => {
|
|
43
|
+
const payout = payoutCurve.getPayout(strikePrice);
|
|
44
|
+
|
|
45
|
+
const _tlv = payoutCurve.toPayoutCurvePiece().serialize();
|
|
46
|
+
const pf = HyperbolaPayoutCurvePiece.deserialize(_tlv);
|
|
47
|
+
|
|
48
|
+
const deserializedCurve = HyperbolaPayoutCurve.fromPayoutCurvePiece(pf);
|
|
49
|
+
|
|
50
|
+
expect(payout.toNumber()).to.be.eq(
|
|
51
|
+
deserializedCurve.getPayout(strikePrice).toNumber(),
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { HyperbolaPayoutCurvePiece } from '@node-dlc/messaging';
|
|
2
|
+
import { expect } from 'chai';
|
|
3
|
+
|
|
4
|
+
import { LongPut } from '../../../lib';
|
|
5
|
+
import { HyperbolaPayoutCurve } from '../../../lib/dlc/HyperbolaPayoutCurve';
|
|
6
|
+
|
|
7
|
+
describe('LongPut', () => {
|
|
8
|
+
describe('1BTC-50k-base2-18digit curve', () => {
|
|
9
|
+
const strikePrice = BigInt(50000);
|
|
10
|
+
const contractSize = BigInt(10) ** BigInt(8);
|
|
11
|
+
const oracleBase = 2;
|
|
12
|
+
const oracleDigits = 18;
|
|
13
|
+
|
|
14
|
+
const { payoutCurve } = LongPut.buildCurve(
|
|
15
|
+
strikePrice,
|
|
16
|
+
contractSize,
|
|
17
|
+
oracleBase,
|
|
18
|
+
oracleDigits,
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
describe('payout', () => {
|
|
22
|
+
const priceDecrease = BigInt(1000);
|
|
23
|
+
|
|
24
|
+
it('should be positive as the position goes ITM', () => {
|
|
25
|
+
expect(
|
|
26
|
+
payoutCurve
|
|
27
|
+
.getPayout(strikePrice - priceDecrease)
|
|
28
|
+
.integerValue()
|
|
29
|
+
.toNumber(),
|
|
30
|
+
).to.equal(
|
|
31
|
+
Number(
|
|
32
|
+
(contractSize * priceDecrease) / (strikePrice - priceDecrease),
|
|
33
|
+
),
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should be zero at strike price', () => {
|
|
38
|
+
expect(payoutCurve.getPayout(strikePrice).toNumber()).to.equal(0);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should serialize and deserialize properly', () => {
|
|
43
|
+
const payout = payoutCurve.getPayout(strikePrice);
|
|
44
|
+
|
|
45
|
+
const _tlv = payoutCurve.toPayoutCurvePiece().serialize();
|
|
46
|
+
const pf = HyperbolaPayoutCurvePiece.deserialize(_tlv);
|
|
47
|
+
|
|
48
|
+
const deserializedCurve = HyperbolaPayoutCurve.fromPayoutCurvePiece(pf);
|
|
49
|
+
|
|
50
|
+
expect(payout.toNumber()).to.be.eq(
|
|
51
|
+
deserializedCurve.getPayout(strikePrice).toNumber(),
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { F64 } from '@node-dlc/messaging';
|
|
2
|
+
import {
|
|
3
|
+
DigitDecompositionEventDescriptorV0,
|
|
4
|
+
DlcOffer,
|
|
5
|
+
HyperbolaPayoutCurvePiece,
|
|
6
|
+
NumericalDescriptor,
|
|
7
|
+
OracleAnnouncement,
|
|
8
|
+
OracleEvent,
|
|
9
|
+
PayoutFunction,
|
|
10
|
+
SingleContractInfo,
|
|
11
|
+
SingleOracleInfo,
|
|
12
|
+
} from '@node-dlc/messaging';
|
|
13
|
+
import { expect } from 'chai';
|
|
14
|
+
|
|
15
|
+
import { CoveredCall } from '../../../lib/dlc/finance/CoveredCall';
|
|
16
|
+
import {
|
|
17
|
+
getOptionInfoFromContractInfo,
|
|
18
|
+
getOptionInfoFromOffer,
|
|
19
|
+
} from '../../../lib/dlc/finance/OptionInfo';
|
|
20
|
+
import { ShortPut } from '../../../lib/dlc/finance/ShortPut';
|
|
21
|
+
|
|
22
|
+
describe('OptionInfo', () => {
|
|
23
|
+
describe('OptionInfo from covered call messages', () => {
|
|
24
|
+
const strikePrice = BigInt(50000);
|
|
25
|
+
const contractSize = BigInt(10) ** BigInt(8);
|
|
26
|
+
const premium = BigInt(50000);
|
|
27
|
+
const expiry = new Date(1620014750000);
|
|
28
|
+
|
|
29
|
+
const oracleBase = 2;
|
|
30
|
+
const oracleDigits = 17;
|
|
31
|
+
|
|
32
|
+
const { totalCollateral, payoutFunction } = CoveredCall.buildPayoutFunction(
|
|
33
|
+
strikePrice,
|
|
34
|
+
contractSize,
|
|
35
|
+
oracleBase,
|
|
36
|
+
oracleDigits,
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const dlcOffer = buildDlcOfferFixture(
|
|
40
|
+
oracleDigits,
|
|
41
|
+
expiry,
|
|
42
|
+
payoutFunction,
|
|
43
|
+
totalCollateral,
|
|
44
|
+
premium,
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const contractInfo = dlcOffer.contractInfo;
|
|
48
|
+
|
|
49
|
+
it('should get correct OptionInfo from ContractInfo', () => {
|
|
50
|
+
const optionInfo = getOptionInfoFromContractInfo(contractInfo);
|
|
51
|
+
|
|
52
|
+
expect(optionInfo).to.deep.equal({
|
|
53
|
+
contractSize,
|
|
54
|
+
strikePrice,
|
|
55
|
+
expiry,
|
|
56
|
+
type: 'call',
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should get correct OptionInfoWithPremium from DlcOffer', () => {
|
|
61
|
+
const optionInfo = getOptionInfoFromOffer(dlcOffer);
|
|
62
|
+
|
|
63
|
+
expect(optionInfo).to.deep.equal({
|
|
64
|
+
contractSize,
|
|
65
|
+
strikePrice,
|
|
66
|
+
expiry,
|
|
67
|
+
premium,
|
|
68
|
+
type: 'call',
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('should throw on an invalid curve', () => {
|
|
73
|
+
const {
|
|
74
|
+
totalCollateral,
|
|
75
|
+
payoutFunction,
|
|
76
|
+
} = CoveredCall.buildPayoutFunction(
|
|
77
|
+
strikePrice,
|
|
78
|
+
contractSize,
|
|
79
|
+
oracleBase,
|
|
80
|
+
oracleDigits,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const invalidDlcOffer = buildDlcOfferFixture(
|
|
84
|
+
oracleDigits,
|
|
85
|
+
expiry,
|
|
86
|
+
payoutFunction,
|
|
87
|
+
totalCollateral,
|
|
88
|
+
premium,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const contractInfo = invalidDlcOffer.contractInfo as SingleContractInfo;
|
|
92
|
+
const contractDescriptor = contractInfo.contractDescriptor as NumericalDescriptor;
|
|
93
|
+
const payoutFunc = contractDescriptor.payoutFunction as PayoutFunction;
|
|
94
|
+
const hyperbolaPiece = payoutFunc.payoutFunctionPieces[0]
|
|
95
|
+
.payoutCurvePiece as HyperbolaPayoutCurvePiece;
|
|
96
|
+
|
|
97
|
+
hyperbolaPiece.translateOutcome = F64.fromNumber(4);
|
|
98
|
+
|
|
99
|
+
expect(() => {
|
|
100
|
+
getOptionInfoFromOffer(invalidDlcOffer);
|
|
101
|
+
}).to.throw();
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
describe('OptionInfo from short call messages', () => {
|
|
106
|
+
const strikePrice = BigInt(50000);
|
|
107
|
+
const contractSize = BigInt(10) ** BigInt(8);
|
|
108
|
+
const totalCollateral = BigInt(9) ** BigInt(8);
|
|
109
|
+
|
|
110
|
+
const premium = BigInt(50000);
|
|
111
|
+
const expiry = new Date(1620014750000);
|
|
112
|
+
|
|
113
|
+
const oracleBase = 2;
|
|
114
|
+
const oracleDigits = 17;
|
|
115
|
+
|
|
116
|
+
const { payoutFunction } = ShortPut.buildPayoutFunction(
|
|
117
|
+
strikePrice,
|
|
118
|
+
contractSize,
|
|
119
|
+
totalCollateral,
|
|
120
|
+
oracleBase,
|
|
121
|
+
oracleDigits,
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const dlcOffer = buildDlcOfferFixture(
|
|
125
|
+
oracleDigits,
|
|
126
|
+
expiry,
|
|
127
|
+
payoutFunction,
|
|
128
|
+
totalCollateral,
|
|
129
|
+
premium,
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const contractInfo = dlcOffer.contractInfo;
|
|
133
|
+
|
|
134
|
+
it('should get correct OptionInfo from ContractInfo', () => {
|
|
135
|
+
const optionInfo = getOptionInfoFromContractInfo(contractInfo);
|
|
136
|
+
|
|
137
|
+
expect(optionInfo).to.deep.equal({
|
|
138
|
+
contractSize,
|
|
139
|
+
strikePrice,
|
|
140
|
+
expiry,
|
|
141
|
+
type: 'put',
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('should get correct OptionInfoWithPremium from DlcOffer', () => {
|
|
146
|
+
const optionInfo = getOptionInfoFromOffer(dlcOffer);
|
|
147
|
+
|
|
148
|
+
expect(optionInfo).to.deep.equal({
|
|
149
|
+
contractSize,
|
|
150
|
+
strikePrice,
|
|
151
|
+
expiry,
|
|
152
|
+
premium,
|
|
153
|
+
type: 'put',
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('should throw on an invalid curve', () => {
|
|
158
|
+
const { payoutFunction } = ShortPut.buildPayoutFunction(
|
|
159
|
+
strikePrice,
|
|
160
|
+
contractSize,
|
|
161
|
+
totalCollateral,
|
|
162
|
+
oracleBase,
|
|
163
|
+
oracleDigits,
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
const invalidDlcOffer = buildDlcOfferFixture(
|
|
167
|
+
oracleDigits,
|
|
168
|
+
expiry,
|
|
169
|
+
payoutFunction,
|
|
170
|
+
totalCollateral,
|
|
171
|
+
premium,
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
const contractInfo = invalidDlcOffer.contractInfo as SingleContractInfo;
|
|
175
|
+
const contractDescriptor = contractInfo.contractDescriptor as NumericalDescriptor;
|
|
176
|
+
const payoutFunc = contractDescriptor.payoutFunction as PayoutFunction;
|
|
177
|
+
const hyperbolaPiece = payoutFunc.payoutFunctionPieces[0]
|
|
178
|
+
.payoutCurvePiece as HyperbolaPayoutCurvePiece;
|
|
179
|
+
|
|
180
|
+
hyperbolaPiece.translateOutcome = F64.fromNumber(4);
|
|
181
|
+
|
|
182
|
+
expect(() => {
|
|
183
|
+
getOptionInfoFromOffer(invalidDlcOffer);
|
|
184
|
+
}).to.throw();
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
function buildDlcOfferFixture(
|
|
190
|
+
oracleDigits: number,
|
|
191
|
+
expiry: Date,
|
|
192
|
+
payoutFunction: PayoutFunction,
|
|
193
|
+
totalCollateral: bigint,
|
|
194
|
+
premium: bigint,
|
|
195
|
+
) {
|
|
196
|
+
const eventDescriptor = new DigitDecompositionEventDescriptorV0();
|
|
197
|
+
eventDescriptor.base = 2;
|
|
198
|
+
eventDescriptor.isSigned = false;
|
|
199
|
+
eventDescriptor.unit = 'BTC-USD';
|
|
200
|
+
eventDescriptor.precision = 0;
|
|
201
|
+
eventDescriptor.nbDigits = oracleDigits;
|
|
202
|
+
|
|
203
|
+
const oracleEvent = new OracleEvent();
|
|
204
|
+
oracleEvent.eventMaturityEpoch = Math.floor(expiry.getTime() / 1000);
|
|
205
|
+
oracleEvent.eventDescriptor = eventDescriptor;
|
|
206
|
+
|
|
207
|
+
const oracleAnnouncement = new OracleAnnouncement();
|
|
208
|
+
oracleAnnouncement.oracleEvent = oracleEvent;
|
|
209
|
+
|
|
210
|
+
const oracleInfo = new SingleOracleInfo();
|
|
211
|
+
oracleInfo.announcement = oracleAnnouncement;
|
|
212
|
+
|
|
213
|
+
const contractDescriptor = new NumericalDescriptor();
|
|
214
|
+
contractDescriptor.numDigits = oracleDigits;
|
|
215
|
+
contractDescriptor.payoutFunction = payoutFunction;
|
|
216
|
+
|
|
217
|
+
const contractInfo = new SingleContractInfo();
|
|
218
|
+
contractInfo.totalCollateral = totalCollateral;
|
|
219
|
+
contractInfo.contractDescriptor = contractDescriptor;
|
|
220
|
+
contractInfo.oracleInfo = oracleInfo;
|
|
221
|
+
|
|
222
|
+
const dlcOffer = new DlcOffer();
|
|
223
|
+
dlcOffer.contractInfo = contractInfo;
|
|
224
|
+
dlcOffer.offerCollateral = totalCollateral - premium;
|
|
225
|
+
return dlcOffer;
|
|
226
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { HyperbolaPayoutCurvePiece } from '@node-dlc/messaging';
|
|
2
|
+
import { expect } from 'chai';
|
|
3
|
+
|
|
4
|
+
import { ShortPut } from '../../../lib/dlc/finance/ShortPut';
|
|
5
|
+
import { HyperbolaPayoutCurve } from '../../../lib/dlc/HyperbolaPayoutCurve';
|
|
6
|
+
|
|
7
|
+
describe('ShortPut', () => {
|
|
8
|
+
describe('1BTC-50k-base2-20digit curve', () => {
|
|
9
|
+
const strikePrice = BigInt(50000);
|
|
10
|
+
const contractSize = BigInt(10) ** BigInt(8);
|
|
11
|
+
const totalCollateral = contractSize;
|
|
12
|
+
const oracleBase = 2;
|
|
13
|
+
const oracleDigits = 20;
|
|
14
|
+
|
|
15
|
+
const { payoutCurve } = ShortPut.buildCurve(
|
|
16
|
+
strikePrice,
|
|
17
|
+
contractSize,
|
|
18
|
+
totalCollateral,
|
|
19
|
+
oracleBase,
|
|
20
|
+
oracleDigits,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
describe('payout', () => {
|
|
24
|
+
it('should be zero at half of strike price', () => {
|
|
25
|
+
expect(
|
|
26
|
+
payoutCurve.getPayout(strikePrice / BigInt(2)).toNumber(),
|
|
27
|
+
).to.be.equal(0);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should be correct at $30,000 settlement price', () => {
|
|
31
|
+
const settlementPrice = BigInt(30000);
|
|
32
|
+
|
|
33
|
+
expect(payoutCurve.getPayout(settlementPrice).toFixed(3)).to.be.eq(
|
|
34
|
+
(
|
|
35
|
+
2 * Number(contractSize) -
|
|
36
|
+
(Number(contractSize) * Number(strikePrice)) /
|
|
37
|
+
Number(settlementPrice)
|
|
38
|
+
).toFixed(3),
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should be equal to totalCollateral at strike price', () => {
|
|
43
|
+
expect(payoutCurve.getPayout(strikePrice).toNumber()).to.equal(
|
|
44
|
+
Number(totalCollateral),
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should serialize and deserialize properly', () => {
|
|
50
|
+
const payout = payoutCurve.getPayout(strikePrice);
|
|
51
|
+
|
|
52
|
+
const _tlv = payoutCurve.toPayoutCurvePiece().serialize();
|
|
53
|
+
const pf = HyperbolaPayoutCurvePiece.deserialize(_tlv);
|
|
54
|
+
|
|
55
|
+
const deserializedCurve = HyperbolaPayoutCurve.fromPayoutCurvePiece(pf);
|
|
56
|
+
|
|
57
|
+
expect(payout.toNumber()).to.be.eq(
|
|
58
|
+
deserializedCurve.getPayout(strikePrice).toNumber(),
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// write tests for getPrecision and fromPrecision
|
|
2
|
+
|
|
3
|
+
import BigNumber from 'bignumber.js';
|
|
4
|
+
import { expect } from 'chai';
|
|
5
|
+
|
|
6
|
+
import { fromPrecision, getPrecision } from '../../lib/utils/Precision';
|
|
7
|
+
|
|
8
|
+
describe('getPrecision', () => {
|
|
9
|
+
it('should get correct precision for integers', () => {
|
|
10
|
+
const num = new BigNumber(1);
|
|
11
|
+
expect(getPrecision(num)).eq(0);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should get correct precision for multiple decimal points', () => {
|
|
15
|
+
const num = new BigNumber(1.123456789);
|
|
16
|
+
expect(getPrecision(num)).eq(1234567890000000);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should get correct precision for max decimal points', () => {
|
|
20
|
+
const num = new BigNumber('1.112233445566778899');
|
|
21
|
+
expect(getPrecision(num)).eq(1122334455667789);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe('fromPrecision', () => {
|
|
26
|
+
it('should create correct number from precision', () => {
|
|
27
|
+
const num = 12345;
|
|
28
|
+
expect(fromPrecision(num).toFormat()).eq('0.0000000000012345');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should create correct number from precision for max precision', () => {
|
|
32
|
+
const num = 1122334455667788;
|
|
33
|
+
expect(fromPrecision(num).toFormat()).eq('0.1122334455667788');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should throw error if precision is too large', () => {
|
|
37
|
+
const num = Number('11223344556677889');
|
|
38
|
+
expect(() => fromPrecision(num)).to.throw(Error);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
body, html {
|
|
2
|
+
margin:0; padding: 0;
|
|
3
|
+
height: 100%;
|
|
4
|
+
}
|
|
5
|
+
body {
|
|
6
|
+
font-family: Helvetica Neue, Helvetica, Arial;
|
|
7
|
+
font-size: 14px;
|
|
8
|
+
color:#333;
|
|
9
|
+
}
|
|
10
|
+
.small { font-size: 12px; }
|
|
11
|
+
*, *:after, *:before {
|
|
12
|
+
-webkit-box-sizing:border-box;
|
|
13
|
+
-moz-box-sizing:border-box;
|
|
14
|
+
box-sizing:border-box;
|
|
15
|
+
}
|
|
16
|
+
h1 { font-size: 20px; margin: 0;}
|
|
17
|
+
h2 { font-size: 14px; }
|
|
18
|
+
pre {
|
|
19
|
+
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
-moz-tab-size: 2;
|
|
23
|
+
-o-tab-size: 2;
|
|
24
|
+
tab-size: 2;
|
|
25
|
+
}
|
|
26
|
+
a { color:#0074D9; text-decoration:none; }
|
|
27
|
+
a:hover { text-decoration:underline; }
|
|
28
|
+
.strong { font-weight: bold; }
|
|
29
|
+
.space-top1 { padding: 10px 0 0 0; }
|
|
30
|
+
.pad2y { padding: 20px 0; }
|
|
31
|
+
.pad1y { padding: 10px 0; }
|
|
32
|
+
.pad2x { padding: 0 20px; }
|
|
33
|
+
.pad2 { padding: 20px; }
|
|
34
|
+
.pad1 { padding: 10px; }
|
|
35
|
+
.space-left2 { padding-left:55px; }
|
|
36
|
+
.space-right2 { padding-right:20px; }
|
|
37
|
+
.center { text-align:center; }
|
|
38
|
+
.clearfix { display:block; }
|
|
39
|
+
.clearfix:after {
|
|
40
|
+
content:'';
|
|
41
|
+
display:block;
|
|
42
|
+
height:0;
|
|
43
|
+
clear:both;
|
|
44
|
+
visibility:hidden;
|
|
45
|
+
}
|
|
46
|
+
.fl { float: left; }
|
|
47
|
+
@media only screen and (max-width:640px) {
|
|
48
|
+
.col3 { width:100%; max-width:100%; }
|
|
49
|
+
.hide-mobile { display:none!important; }
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.quiet {
|
|
53
|
+
color: #7f7f7f;
|
|
54
|
+
color: rgba(0,0,0,0.5);
|
|
55
|
+
}
|
|
56
|
+
.quiet a { opacity: 0.7; }
|
|
57
|
+
|
|
58
|
+
.fraction {
|
|
59
|
+
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
|
60
|
+
font-size: 10px;
|
|
61
|
+
color: #555;
|
|
62
|
+
background: #E8E8E8;
|
|
63
|
+
padding: 4px 5px;
|
|
64
|
+
border-radius: 3px;
|
|
65
|
+
vertical-align: middle;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
div.path a:link, div.path a:visited { color: #333; }
|
|
69
|
+
table.coverage {
|
|
70
|
+
border-collapse: collapse;
|
|
71
|
+
margin: 10px 0 0 0;
|
|
72
|
+
padding: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
table.coverage td {
|
|
76
|
+
margin: 0;
|
|
77
|
+
padding: 0;
|
|
78
|
+
vertical-align: top;
|
|
79
|
+
}
|
|
80
|
+
table.coverage td.line-count {
|
|
81
|
+
text-align: right;
|
|
82
|
+
padding: 0 5px 0 20px;
|
|
83
|
+
}
|
|
84
|
+
table.coverage td.line-coverage {
|
|
85
|
+
text-align: right;
|
|
86
|
+
padding-right: 10px;
|
|
87
|
+
min-width:20px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
table.coverage td span.cline-any {
|
|
91
|
+
display: inline-block;
|
|
92
|
+
padding: 0 5px;
|
|
93
|
+
width: 100%;
|
|
94
|
+
}
|
|
95
|
+
.missing-if-branch {
|
|
96
|
+
display: inline-block;
|
|
97
|
+
margin-right: 5px;
|
|
98
|
+
border-radius: 3px;
|
|
99
|
+
position: relative;
|
|
100
|
+
padding: 0 4px;
|
|
101
|
+
background: #333;
|
|
102
|
+
color: yellow;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.skip-if-branch {
|
|
106
|
+
display: none;
|
|
107
|
+
margin-right: 10px;
|
|
108
|
+
position: relative;
|
|
109
|
+
padding: 0 4px;
|
|
110
|
+
background: #ccc;
|
|
111
|
+
color: white;
|
|
112
|
+
}
|
|
113
|
+
.missing-if-branch .typ, .skip-if-branch .typ {
|
|
114
|
+
color: inherit !important;
|
|
115
|
+
}
|
|
116
|
+
.coverage-summary {
|
|
117
|
+
border-collapse: collapse;
|
|
118
|
+
width: 100%;
|
|
119
|
+
}
|
|
120
|
+
.coverage-summary tr { border-bottom: 1px solid #bbb; }
|
|
121
|
+
.keyline-all { border: 1px solid #ddd; }
|
|
122
|
+
.coverage-summary td, .coverage-summary th { padding: 10px; }
|
|
123
|
+
.coverage-summary tbody { border: 1px solid #bbb; }
|
|
124
|
+
.coverage-summary td { border-right: 1px solid #bbb; }
|
|
125
|
+
.coverage-summary td:last-child { border-right: none; }
|
|
126
|
+
.coverage-summary th {
|
|
127
|
+
text-align: left;
|
|
128
|
+
font-weight: normal;
|
|
129
|
+
white-space: nowrap;
|
|
130
|
+
}
|
|
131
|
+
.coverage-summary th.file { border-right: none !important; }
|
|
132
|
+
.coverage-summary th.pct { }
|
|
133
|
+
.coverage-summary th.pic,
|
|
134
|
+
.coverage-summary th.abs,
|
|
135
|
+
.coverage-summary td.pct,
|
|
136
|
+
.coverage-summary td.abs { text-align: right; }
|
|
137
|
+
.coverage-summary td.file { white-space: nowrap; }
|
|
138
|
+
.coverage-summary td.pic { min-width: 120px !important; }
|
|
139
|
+
.coverage-summary tfoot td { }
|
|
140
|
+
|
|
141
|
+
.coverage-summary .sorter {
|
|
142
|
+
height: 10px;
|
|
143
|
+
width: 7px;
|
|
144
|
+
display: inline-block;
|
|
145
|
+
margin-left: 0.5em;
|
|
146
|
+
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
|
|
147
|
+
}
|
|
148
|
+
.coverage-summary .sorted .sorter {
|
|
149
|
+
background-position: 0 -20px;
|
|
150
|
+
}
|
|
151
|
+
.coverage-summary .sorted-desc .sorter {
|
|
152
|
+
background-position: 0 -10px;
|
|
153
|
+
}
|
|
154
|
+
.status-line { height: 10px; }
|
|
155
|
+
/* yellow */
|
|
156
|
+
.cbranch-no { background: yellow !important; color: #111; }
|
|
157
|
+
/* dark red */
|
|
158
|
+
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
|
|
159
|
+
.low .chart { border:1px solid #C21F39 }
|
|
160
|
+
.highlighted,
|
|
161
|
+
.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{
|
|
162
|
+
background: #C21F39 !important;
|
|
163
|
+
}
|
|
164
|
+
/* medium red */
|
|
165
|
+
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
|
|
166
|
+
/* light red */
|
|
167
|
+
.low, .cline-no { background:#FCE1E5 }
|
|
168
|
+
/* light green */
|
|
169
|
+
.high, .cline-yes { background:rgb(230,245,208) }
|
|
170
|
+
/* medium green */
|
|
171
|
+
.cstat-yes { background:rgb(161,215,106) }
|
|
172
|
+
/* dark green */
|
|
173
|
+
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
|
|
174
|
+
.high .chart { border:1px solid rgb(77,146,33) }
|
|
175
|
+
/* dark yellow (gold) */
|
|
176
|
+
.status-line.medium, .medium .cover-fill { background: #f9cd0b; }
|
|
177
|
+
.medium .chart { border:1px solid #f9cd0b; }
|
|
178
|
+
/* light yellow */
|
|
179
|
+
.medium { background: #fff4c2; }
|
|
180
|
+
|
|
181
|
+
.cstat-skip { background: #ddd; color: #111; }
|
|
182
|
+
.fstat-skip { background: #ddd; color: #111 !important; }
|
|
183
|
+
.cbranch-skip { background: #ddd !important; color: #111; }
|
|
184
|
+
|
|
185
|
+
span.cline-neutral { background: #eaeaea; }
|
|
186
|
+
|
|
187
|
+
.coverage-summary td.empty {
|
|
188
|
+
opacity: .5;
|
|
189
|
+
padding-top: 4px;
|
|
190
|
+
padding-bottom: 4px;
|
|
191
|
+
line-height: 1;
|
|
192
|
+
color: #888;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.cover-fill, .cover-empty {
|
|
196
|
+
display:inline-block;
|
|
197
|
+
height: 12px;
|
|
198
|
+
}
|
|
199
|
+
.chart {
|
|
200
|
+
line-height: 0;
|
|
201
|
+
}
|
|
202
|
+
.cover-empty {
|
|
203
|
+
background: white;
|
|
204
|
+
}
|
|
205
|
+
.cover-full {
|
|
206
|
+
border-right: none !important;
|
|
207
|
+
}
|
|
208
|
+
pre.prettyprint {
|
|
209
|
+
border: none !important;
|
|
210
|
+
padding: 0 !important;
|
|
211
|
+
margin: 0 !important;
|
|
212
|
+
}
|
|
213
|
+
.com { color: #999 !important; }
|
|
214
|
+
.ignore-none { color: #999; font-weight: normal; }
|
|
215
|
+
|
|
216
|
+
.wrapper {
|
|
217
|
+
min-height: 100%;
|
|
218
|
+
height: auto !important;
|
|
219
|
+
height: 100%;
|
|
220
|
+
margin: 0 auto -48px;
|
|
221
|
+
}
|
|
222
|
+
.footer, .push {
|
|
223
|
+
height: 48px;
|
|
224
|
+
}
|