1
This commit is contained in:
parent
be2919251c
commit
e5de8ecccc
@ -1,5 +1,6 @@
|
||||
const app = require('j7/app');
|
||||
const utils = require('j7/utils');
|
||||
const bcutils = require('j7/bcutils');
|
||||
const log = require('j7/log');
|
||||
|
||||
const metaClassList = [];
|
||||
@ -116,12 +117,24 @@ async function init() {
|
||||
item['nets'].forEach((net) => {
|
||||
const netId = net['net_id'];
|
||||
const netDir = configDir + 'nets/' + netId + '/';
|
||||
web3ConfHash[netId] = {
|
||||
const netObj = {
|
||||
'net_id': netId,
|
||||
'netId': netId,
|
||||
'Web3': utils.readJsonFromFile(netDir + 'web3.json'),
|
||||
'Contract': utils.readJsonFromFile(netDir + 'contract.json'),
|
||||
};
|
||||
netObj.getContractAddressByName = (name) => {
|
||||
let address = '';
|
||||
netObj.Contract.forEach(
|
||||
(item) => {
|
||||
if (item['name'] == name) {
|
||||
address = bcutils.toNormalAddress(item['address']);
|
||||
}
|
||||
}
|
||||
);
|
||||
return address;
|
||||
};
|
||||
web3ConfHash[netId] = netObj;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -22,6 +22,7 @@ class PullDbEvent extends BaseService {
|
||||
this.lastIdx = BigInt(0);
|
||||
this.eventConf = this.event['eventConf'];
|
||||
this.progInfo = this.event['progressInfo'];
|
||||
this.contractAddress = this.net.getContractAddressByName(this.getContractName());
|
||||
await this.start();
|
||||
}
|
||||
|
||||
@ -79,12 +80,16 @@ class PullDbEvent extends BaseService {
|
||||
return maxIdx;
|
||||
}
|
||||
|
||||
getNetId() {
|
||||
return this.net['net_id'];
|
||||
}
|
||||
|
||||
getEventName() {
|
||||
return this.eventConf['event_name'];
|
||||
}
|
||||
|
||||
getContractAddress() {
|
||||
//return this.bc.getContractAddressByName(this.getContractName());
|
||||
return this.contractAddress;
|
||||
}
|
||||
|
||||
getContractName() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user