Skip to content

Commit 2f7fcba

Browse files
authored
Merge pull request #803 from eco-stake/fix-balance-gas-denom
Fix balance check to use gas denom
2 parents d923b1d + 8ee6ab0 commit 2f7fcba

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/autostake/NetworkRunner.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ export default class NetworkRunner {
8282

8383
getBalance() {
8484
let timeout = this.opts.delegationsTimeout
85-
return this.queryClient.getBalance(this.operator.botAddress, this.network.denom, { timeout })
85+
const denom = this.network.gasPriceDenom || this.network.denom
86+
return this.queryClient.getBalance(this.operator.botAddress, denom, { timeout })
8687
.then(
8788
(balance) => {
8889
this.logger.info('Fetched bot balance', balance)

src/networks.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,5 +334,9 @@
334334
{
335335
"name": "dungeon",
336336
"gasPrice": "0.05udgn"
337+
},
338+
{
339+
"name": "atomone",
340+
"gasPrice": "0.225uphoton"
337341
}
338342
]

src/utils/Network.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ class Network {
9191
this.defaultGasPrice = this.decimals && format(bignumber(multiply(0.000000025, pow(10, this.decimals))), { notation: 'fixed', precision: 4}) + this.denom
9292
this.gasPrice = this.data.gasPrice || this.defaultGasPrice
9393
if(this.gasPrice){
94-
this.gasPriceAmount = GasPrice.fromString(this.gasPrice).amount.toString()
94+
const gasPrice = GasPrice.fromString(this.gasPrice)
95+
this.gasPriceAmount = gasPrice.amount.toString()
96+
this.gasPriceDenom = gasPrice.denom
9597
this.gasPriceStep = this.data.gasPriceStep || {
9698
"low": multiply(this.gasPriceAmount, 0.5),
9799
"average": multiply(this.gasPriceAmount, 1),

0 commit comments

Comments
 (0)