fix 0 cash-out commission bug
This commit is contained in:
parent
bcf72a0285
commit
b6fce47069
4 changed files with 28 additions and 12 deletions
|
|
@ -43,13 +43,16 @@ function plugins (settings, deviceId) {
|
||||||
const rateRec = tickers[i]
|
const rateRec = tickers[i]
|
||||||
|
|
||||||
const cashInCommission = BN(1).add(BN(cryptoConfig.cashInCommission).div(100))
|
const cashInCommission = BN(1).add(BN(cryptoConfig.cashInCommission).div(100))
|
||||||
const cashOutCommission = cryptoConfig.cashOutCommission && BN(1).add(BN(cryptoConfig.cashOutCommission).div(100))
|
|
||||||
|
const cashOutCommission = _.isNil(cryptoConfig.cashOutCommission)
|
||||||
|
? null
|
||||||
|
: BN(1).add(BN(cryptoConfig.cashOutCommission).div(100))
|
||||||
|
|
||||||
if (Date.now() - rateRec.timestamp > STALE_TICKER) return logger.warn('Stale rate for ' + cryptoCode)
|
if (Date.now() - rateRec.timestamp > STALE_TICKER) return logger.warn('Stale rate for ' + cryptoCode)
|
||||||
const rate = rateRec.rates
|
const rate = rateRec.rates
|
||||||
rates[cryptoCode] = {
|
rates[cryptoCode] = {
|
||||||
cashIn: rate.ask.mul(cashInCommission),
|
cashIn: rate.ask.mul(cashInCommission),
|
||||||
cashOut: cryptoConfig.cashOutCommission && rate.bid.div(cashOutCommission)
|
cashOut: cashOutCommission && rate.bid.div(cashOutCommission)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -472,7 +475,6 @@ function plugins (settings, deviceId) {
|
||||||
const cryptoCodes = config.cryptoCurrencies
|
const cryptoCodes = config.cryptoCurrencies
|
||||||
const fiatCode = config.fiatCurrency
|
const fiatCode = config.fiatCurrency
|
||||||
|
|
||||||
console.log('DEBUG103: %j', cryptoCodes)
|
|
||||||
const fiatBalancePromises = cryptoCodes.map(c => fiatBalance(fiatCode, c))
|
const fiatBalancePromises = cryptoCodes.map(c => fiatBalance(fiatCode, c))
|
||||||
|
|
||||||
return Promise.all(fiatBalancePromises)
|
return Promise.all(fiatBalancePromises)
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ function computeSeed (masterSeed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchWallet (settings, cryptoCode) {
|
function fetchWallet (settings, cryptoCode) {
|
||||||
console.log('DEBUG102')
|
|
||||||
return fs.readFile(options.seedPath, 'utf8')
|
return fs.readFile(options.seedPath, 'utf8')
|
||||||
.then(hex => {
|
.then(hex => {
|
||||||
const masterSeed = Buffer.from(hex.trim(), 'hex')
|
const masterSeed = Buffer.from(hex.trim(), 'hex')
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -21,6 +21,7 @@
|
||||||
"display": "From number",
|
"display": "From number",
|
||||||
"fieldType": "string",
|
"fieldType": "string",
|
||||||
"required": true,
|
"required": true,
|
||||||
|
"placeholder": "+14155552671",
|
||||||
"value": ""
|
"value": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue