@node-dlc/core
Advanced tools
Comparing version 0.22.4 to 0.22.5
@@ -225,2 +225,70 @@ import { Value } from '@node-dlc/bitcoin'; | ||
it('should get correct ContractInfo with smaller max gain', () => { | ||
const eventDescriptor = new DigitDecompositionEventDescriptorV0(); | ||
eventDescriptor.base = 2; | ||
eventDescriptor.isSigned = false; | ||
eventDescriptor.unit = 'bits'; | ||
eventDescriptor.precision = 0; | ||
eventDescriptor.nbDigits = oracleDigits; | ||
const oracleEvent = new OracleEventV0(); | ||
oracleEvent.eventMaturityEpoch = Math.floor(expiry.getTime() / 1000); | ||
oracleEvent.eventDescriptor = eventDescriptor; | ||
const oracleAnnouncement = new OracleAnnouncementV0(); | ||
oracleAnnouncement.oracleEvent = oracleEvent; | ||
const contractSize = Value.fromBitcoin(1); | ||
const maxLoss = Value.fromBitcoin(0.95); | ||
const maxGain = Value.fromBitcoin(0.005); | ||
const feeRate = 10n; | ||
const highestPrecisionRounding = Value.fromSats(10000); | ||
const highPrecisionRounding = Value.fromSats(25000); | ||
const mediumPrecisionRounding = Value.fromSats(100000); | ||
const lowPrecisionRounding = Value.fromSats(200000); | ||
const roundingIntervals = buildRoundingIntervalsFromIntervals( | ||
contractSize, | ||
[ | ||
{ beginInterval: 0n, rounding: lowPrecisionRounding }, | ||
{ beginInterval: 750000n, rounding: mediumPrecisionRounding }, | ||
{ beginInterval: 850000n, rounding: highPrecisionRounding }, | ||
{ beginInterval: 950000n, rounding: highestPrecisionRounding }, | ||
], | ||
); | ||
const network = BitcoinNetworks.bitcoin; | ||
const shiftForFees: DlcParty = 'offeror'; | ||
const fees = Value.fromSats(10000); | ||
const csoOrderOffer = buildCustomStrategyOrderOffer( | ||
oracleAnnouncement, | ||
contractSize, | ||
maxLoss, | ||
maxGain, | ||
feeRate, | ||
roundingIntervals, | ||
network, | ||
shiftForFees, | ||
fees, | ||
); | ||
const csoInfoFromContractInfo = getCsoInfoFromContractInfo( | ||
csoOrderOffer.contractInfo, | ||
shiftForFees, | ||
fees, | ||
); | ||
const csoInfoFromOffer = getCsoInfoFromOffer(csoOrderOffer); | ||
expect(csoInfoFromContractInfo.maxGain.sats).to.equal(maxGain.sats); | ||
expect(csoInfoFromContractInfo.maxLoss.sats).to.equal(maxLoss.sats); | ||
expect(csoInfoFromOffer.maxGain.sats).to.equal(maxGain.sats); | ||
expect(csoInfoFromOffer.maxLoss.sats).to.equal(maxLoss.sats); | ||
}); | ||
it('should get correct CsoInfo from ContractInfo with fees shifted contract size 0.01', () => { | ||
@@ -227,0 +295,0 @@ const eventDescriptor = new DigitDecompositionEventDescriptorV0(); |
@@ -1,1 +0,1 @@ | ||
{"processes":{"7ed6d316-db60-4180-8ef0-8fe0110999d3":{"parent":null,"children":[]}},"files":{"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/CETCalculator.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/utils/BigIntUtils.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/finance/CoveredCall.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/HyperbolaPayoutCurve.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/utils/Precision.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/finance/ShortPut.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/index.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/finance/Builder.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/finance/LinearPayout.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/PolynomialPayoutCurve.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/finance/LongCall.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/finance/LongPut.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/finance/CsoInfo.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/finance/OptionInfo.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/PayoutCurve.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/TxBuilder.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/TxFinalizer.ts":["7ed6d316-db60-4180-8ef0-8fe0110999d3"]},"externalIds":{}} | ||
{"processes":{"f3c3a08a-b8a0-46fd-8d0d-0062da22028e":{"parent":null,"children":[]}},"files":{"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/CETCalculator.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/utils/BigIntUtils.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/finance/CoveredCall.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/HyperbolaPayoutCurve.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/utils/Precision.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/finance/ShortPut.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/index.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/finance/Builder.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/finance/LinearPayout.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/PolynomialPayoutCurve.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/finance/LongCall.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/finance/LongPut.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/finance/CsoInfo.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/finance/OptionInfo.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/PayoutCurve.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/TxBuilder.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"],"/Users/matthewblack/code/github.com/AtomicFinance/node-dlc/packages/core/lib/dlc/TxFinalizer.ts":["f3c3a08a-b8a0-46fd-8d0d-0062da22028e"]},"externalIds":{}} |
{ | ||
"name": "@node-dlc/core", | ||
"version": "0.22.4", | ||
"version": "0.22.5", | ||
"description": "DLC Core", | ||
@@ -26,4 +26,4 @@ "scripts": { | ||
"dependencies": { | ||
"@node-dlc/bitcoin": "^0.22.4", | ||
"@node-dlc/messaging": "^0.22.4", | ||
"@node-dlc/bitcoin": "^0.22.5", | ||
"@node-dlc/messaging": "^0.22.5", | ||
"@node-lightning/core": "0.26.1", | ||
@@ -39,3 +39,3 @@ "bignumber.js": "^9.0.1", | ||
}, | ||
"gitHead": "842490776ac615d6761caffca12e04b31e8b2309" | ||
"gitHead": "dabb41a64b0f5fab1a0cda5ca6f6d8128dca9065" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1228635
7256
Updated@node-dlc/bitcoin@^0.22.5
Updated@node-dlc/messaging@^0.22.5