From 8d43192a1cfa4329f7578e0ddd9ec4cb07e738ea Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Sun, 14 Sep 2025 08:31:29 -0700 Subject: [PATCH] minor edits --- src/entities/entry.js | 3 +++ src/use-cases/entry.js | 5 +++++ src/use-cases/offer/index.js | 7 +------ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/entities/entry.js b/src/entities/entry.js index adb5ebb..a732a04 100644 --- a/src/entities/entry.js +++ b/src/entities/entry.js @@ -1,6 +1,9 @@ /* Entry Entity + + TODO: Explain what an entry is and how it works. */ + class Entry { validate ({ entry, diff --git a/src/use-cases/entry.js b/src/use-cases/entry.js index 2d7a3b4..5968836 100644 --- a/src/use-cases/entry.js +++ b/src/use-cases/entry.js @@ -1,3 +1,8 @@ +/* + Entry use-case library. + + TODO: Explain what an entry is and how it works. +*/ // local libraries import wlogger from '../adapters/wlogger.js' diff --git a/src/use-cases/offer/index.js b/src/use-cases/offer/index.js index a9272f8..2929f32 100644 --- a/src/use-cases/offer/index.js +++ b/src/use-cases/offer/index.js @@ -627,6 +627,7 @@ class OfferUseCases { } // Ensure the 4th output (vout=3) is going to the operator address specified in the Offer. + // NOTE: This is the operator of the bch-dex intance, NOT the seller of the token. const operatorAddr = orderData.operatorAddress const hasCorrectOperatorAddr = operatorAddr === txObj.vout[3].scriptPubKey.addresses[0] @@ -634,13 +635,7 @@ class OfferUseCases { throw new Error(`The Counter Offer has an output address of ${txObj.vout[3].scriptPubKey.addresses[0]}, which does not match the Operator address of ${operatorAddr} in the Offer.`) } - /* - NOTE: Condition already validated above at line 597 // Ensure the 4th output (vout=3) contains the required amount of BCH. - const operatorSatsToReceive = Math.ceil(orderData.numTokens * parseInt(orderData.rateInBaseUnit)) - if (isNaN(operatorSatsToReceive)) { - throw new Error('Could not calculate the amount of BCH offered in the Counter Offer') - } */ const operatorSatsOut = this.adapters.wallet.bchWallet.bchjs.BitcoinCash.toSatoshi(txObj.vout[3].value) let estimatedOperatorFee = Math.floor(txObj.vout[3].value * orderData.operatorPercentage / 100) if (estimatedOperatorFee < 546) estimatedOperatorFee = 546