new admin structure
This commit is contained in:
parent
7d82874916
commit
c2282e61b4
17 changed files with 5768 additions and 1204 deletions
|
|
@ -16,6 +16,7 @@ const exchange = require('./exchange')
|
|||
const sms = require('./sms')
|
||||
const email = require('./email')
|
||||
const cashOutHelper = require('./cash-out-helper')
|
||||
const machineLoader = require('./machine-loader')
|
||||
|
||||
const mapValuesWithKey = _.mapValues.convert({cap: false})
|
||||
|
||||
|
|
@ -252,9 +253,7 @@ function plugins (settings, deviceId) {
|
|||
|
||||
const rate = rawRate.div(cashInCommission)
|
||||
|
||||
// `lowBalanceMargin` is our safety net. It's a number > 1, and we divide
|
||||
// all our balances by it to provide a safety margin.
|
||||
const lowBalanceMargin = (BN(config.lowBalanceMargin).div(100)).plus(1)
|
||||
const lowBalanceMargin = BN(1)
|
||||
|
||||
const unitScale = BN(10).pow(coins[cryptoCode].unitScale)
|
||||
const fiatTransferBalance = balance.mul(rate.div(unitScale)).div(lowBalanceMargin)
|
||||
|
|
@ -372,9 +371,9 @@ function plugins (settings, deviceId) {
|
|||
}
|
||||
|
||||
function executeTrades () {
|
||||
return dbm.devices()
|
||||
return machineLoader.getMachines()
|
||||
.then(devices => {
|
||||
const deviceIds = devices.map(device => device.device_id)
|
||||
const deviceIds = devices.map(device => device.deviceId)
|
||||
const lists = deviceIds.map(deviceId => {
|
||||
const config = configManager.machineScoped(deviceId, settings.config)
|
||||
const fiatCode = config.fiatCurrency
|
||||
|
|
@ -481,9 +480,9 @@ function plugins (settings, deviceId) {
|
|||
}
|
||||
|
||||
function checkBalances () {
|
||||
return dbm.devices()
|
||||
return machineLoader.getMachines()
|
||||
.then(devices => {
|
||||
const deviceIds = devices.map(r => r.device_id)
|
||||
const deviceIds = devices.map(r => r.deviceId)
|
||||
const deviceBalancePromises = deviceIds.map(deviceId => checkDeviceBalances(deviceId))
|
||||
|
||||
return Promise.all(deviceBalancePromises)
|
||||
|
|
@ -544,6 +543,10 @@ function plugins (settings, deviceId) {
|
|||
.catch(err => logger.error(err))
|
||||
}
|
||||
|
||||
function getMachineNames () {
|
||||
return machineLoader.getMachineNames(settings.config)
|
||||
}
|
||||
|
||||
return {
|
||||
pollQueries,
|
||||
sendCoins,
|
||||
|
|
@ -560,6 +563,7 @@ function plugins (settings, deviceId) {
|
|||
sweepHd,
|
||||
sendMessage,
|
||||
checkBalances,
|
||||
getMachineNames,
|
||||
buildAvailableCassettes,
|
||||
buy,
|
||||
sell
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue