minor edits

This commit is contained in:
Chris Troutner
2025-09-14 08:31:29 -07:00
parent 59e2bb473b
commit 8d43192a1c
3 changed files with 9 additions and 6 deletions
+3
View File
@@ -1,6 +1,9 @@
/*
Entry Entity
TODO: Explain what an entry is and how it works.
*/
class Entry {
validate ({
entry,
+5
View File
@@ -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'
+1 -6
View File
@@ -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