Skip to content

Commit

Permalink
Merge pull request #2887 from OriginTrail/improvement/set-default-gas…
Browse files Browse the repository at this point in the history
…-price

Set Gnosis default gas price to 2 Gwei
  • Loading branch information
NZT48 authored Jan 16, 2024
2 parents c6b7234 + 87e4dfa commit 68145c2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ export const COMMAND_TX_GAS_INCREASE_FACTORS = {
SUBMIT_PROOFS: 1.2,
};

export const GNOSIS_DEFAULT_GAS_PRICE = 2;

export const WEBSOCKET_PROVIDER_OPTIONS = {
reconnect: {
auto: true,
Expand Down
18 changes: 16 additions & 2 deletions src/modules/blockchain/implementation/gnosis/gnosis-service.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from 'axios';
import Web3Service from '../web3-service.js';
import { BLOCK_TIME_MILLIS } from '../../../../constants/constants.js';
import { BLOCK_TIME_MILLIS, GNOSIS_DEFAULT_GAS_PRICE } from '../../../../constants/constants.js';

class GnosisService extends Web3Service {
constructor(ctx) {
Expand All @@ -26,9 +26,23 @@ class GnosisService extends Web3Service {
this.logger.debug(`Gas price on Gnosis: ${gasPrice}`);
return gasPrice;
} catch (error) {
return undefined;
this.logger.warn(
`Failed to fetch the gas price from the Gnosis: ${error}. Using default value: ${GNOSIS_DEFAULT_GAS_PRICE} Gwei.`,
);
this.convertToWei(GNOSIS_DEFAULT_GAS_PRICE, 'gwei');
}
}

async healthCheck() {
try {
const blockNumber = await this.getBlockNumber();
if (blockNumber) return true;
} catch (e) {
this.logger.error(`Error on checking Gnosis blockchain. ${e}`);
return false;
}
return false;
}
}

export default GnosisService;

0 comments on commit 68145c2

Please sign in to comment.