Skip to content

Commit

Permalink
fix: low funds alert
Browse files Browse the repository at this point in the history
  • Loading branch information
mvayngrib committed Jul 30, 2018
1 parent e3518f2 commit 83b504c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/blockchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export default class Blockchain {
const lowFunds:LowFundsInput = {
blockchain: this.blockchain,
networkName: this.networkName,
address,
address: await this.getMyChainAddress(),
balance,
minBalance,
}
Expand Down Expand Up @@ -270,9 +270,7 @@ export default class Blockchain {
address = await this.getMyChainAddress()
}

const balance = await this.addressesAPI.balance(address)
this.logger.debug(`balance: ${balance}`)
return balance
return await this.addressesAPI.balance(address)
}

private createAdapter = (opts:{ privateKey?: string }={}) => {
Expand Down
9 changes: 6 additions & 3 deletions src/in-house-bot/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ export class Alerts {
}

public lowFunds = async ({
balance,
blockchain,
networkName,
address,
balance,
minBalance=this.bot.blockchain.minBalance
}: LowFundsInput) => {
const { minBalance } = this.bot.blockchain
await this._emailAdmin({
subject: 'MyCloud blockchain balance low',
subject: `${this.org.name} MyCloud blockchain balance low`,
body: `Dude,
This is your MyCloud. Fill me up regular please:
Expand All @@ -68,6 +68,9 @@ Minimum Balance for happiness: ${minBalance}
Blockchain: ${blockchain}
Network: ${networkName}
Address: ${address}
Grumpily,
Your MyCloud
`,
})
}
Expand Down

0 comments on commit 83b504c

Please sign in to comment.