mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex.git
synced 2026-09-21 16:52:00 -07:00
minor edits
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
Entry Entity
|
Entry Entity
|
||||||
|
|
||||||
|
TODO: Explain what an entry is and how it works.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Entry {
|
class Entry {
|
||||||
validate ({
|
validate ({
|
||||||
entry,
|
entry,
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
/*
|
||||||
|
Entry use-case library.
|
||||||
|
|
||||||
|
TODO: Explain what an entry is and how it works.
|
||||||
|
*/
|
||||||
|
|
||||||
// local libraries
|
// local libraries
|
||||||
import wlogger from '../adapters/wlogger.js'
|
import wlogger from '../adapters/wlogger.js'
|
||||||
|
|||||||
@@ -627,6 +627,7 @@ class OfferUseCases {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the 4th output (vout=3) is going to the operator address specified in the Offer.
|
// 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 operatorAddr = orderData.operatorAddress
|
||||||
|
|
||||||
const hasCorrectOperatorAddr = operatorAddr === txObj.vout[3].scriptPubKey.addresses[0]
|
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.`)
|
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.
|
// 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)
|
const operatorSatsOut = this.adapters.wallet.bchWallet.bchjs.BitcoinCash.toSatoshi(txObj.vout[3].value)
|
||||||
let estimatedOperatorFee = Math.floor(txObj.vout[3].value * orderData.operatorPercentage / 100)
|
let estimatedOperatorFee = Math.floor(txObj.vout[3].value * orderData.operatorPercentage / 100)
|
||||||
if (estimatedOperatorFee < 546) estimatedOperatorFee = 546
|
if (estimatedOperatorFee < 546) estimatedOperatorFee = 546
|
||||||
|
|||||||
Reference in New Issue
Block a user