-
Notifications
You must be signed in to change notification settings - Fork 69
/
index.js
39 lines (32 loc) · 1 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const Web3Implementation = require('../Web3Implementation');
const path = require('path');
const axios = require('axios');
const coinGeckoLink = 'https://api.coingecko.com/api/v3/simple/price?ids=origintrail&vs_currencies=usd';
class XDai extends Web3Implementation {
/**
* Initializing XDai blockchain connector
*/
constructor({ config, emitter, logger }, configuration) {
super({
config,
emitter,
logger,
contractPath: path.join(__dirname, 'abi'),
}, configuration);
this.logger.info(`[${this.getBlockchainId()}] Selected blockchain: xDai`);
}
async getRelativeTracPrice() {
const response = await axios.get(coinGeckoLink);
if (response) {
return response.data.origintrail.usd;
}
return undefined;
}
async calculateGasPrice() {
return this.config.gas_price;
}
async getGasPrice() {
return this.config.gas_price;
}
}
module.exports = XDai;