-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathbsc.js
More file actions
44 lines (33 loc) · 1 KB
/
bsc.js
File metadata and controls
44 lines (33 loc) · 1 KB
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
40
41
42
43
44
"use strict";
const conf = require('ocore/conf.js');
const EvmChain = require('./evm-chain.js');
const { getProvider } = require("./evm/provider.js");
const { getAddressBlocks } = require("./moralis.js");
let bCreated = false;
class BSC extends EvmChain {
constructor() {
if (bCreated)
throw Error("BSC class already created, must be a singleton");
bCreated = true;
const provider = getProvider('BSC');
super('BSC', conf.bsc_factory_contract_addresses, conf.bsc_assistant_factory_contract_addresses, provider);
}
forget() {
console.log(`removing ${this.getProvider().listenerCount()} listeners on ${this.network}`);
this.getProvider().removeAllListeners();
bCreated = false;
}
getNativeSymbol() {
return 'BNB';
}
getMaxBlockRange() {
return 500;
}
getStaticGasPrice() {
return process.env.testnet ? 5 : 0; // in gwei
}
async getAddressBlocks(address, startblock, startts) {
return await getAddressBlocks({ chainid: 56, address, startblock, startts });
}
}
module.exports = BSC;