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