Skip to content

Commit

Permalink
add runtime errors for debugging and add pm2
Browse files Browse the repository at this point in the history
  • Loading branch information
admazzola committed Apr 23, 2022
1 parent 5fdba79 commit 27a3e47
Show file tree
Hide file tree
Showing 6 changed files with 23,483 additions and 57 deletions.
6 changes: 5 additions & 1 deletion lib/diagnostics-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ export default class DiagnosticsManager {
suspensionReason = 'Gas oracle stale'
}


if(!poolAccountBalances){
console.log('WARN: pool oracle data is undefined - [check DefiPulse API key] ')
return

}

await mongoInterface.upsertOne('poolStatus', {}, {
blockNumber: ethBlockNumber,
Expand Down
6 changes: 5 additions & 1 deletion lib/util/token-data-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ export default class TokenDataHelper {
static async getMineableTokenToEthPriceRatio(mongoInterface){

let priceOracleData = await TokenDataHelper.getPriceOracleData(mongoInterface)
return priceOracleData.price_ratio_eth




return priceOracleData ? priceOracleData.price_ratio_eth : undefined
}

static async getPriceOracleData(mongoInterface){
Expand Down
10 changes: 7 additions & 3 deletions lib/util/web3-api-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ export default class Web3ApiHelper {
LoggingHelper.appendLog( [ 'stored gaspriceEstimates', priceEstimates ], LoggingHelper.TYPECODES.GENERIC, mongoInterface)


}
}else{
console.error('WARN: Could not fetch data from coingecko / defipulse')
}


}catch(e){
console.log(e)
console.error('WARN: Could not fetch data from coingecko / defipulse ',e)
}


Expand Down Expand Up @@ -174,7 +176,9 @@ export default class Web3ApiHelper {
{
let gasPriceData = await Web3ApiHelper.getGasPriceData( mongoInterface )

var averageGasPriceWei = gasPriceData.average


var averageGasPriceWei = gasPriceData ? gasPriceData.average: 100

if(isNaN( averageGasPriceWei )){
averageGasPriceWei = 100
Expand Down
Loading

0 comments on commit 27a3e47

Please sign in to comment.