| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- const ChainLib = require("../lib/chain-lib");
- const Web3Utils = require("../../utils/web3-utils");
- const logger = require("../../utils/logger");
- const Time = require("../../utils/time");
- const LpLib = require("../lib/lp-lib");
- class LpMaintenance {
- constructor(web3, chain) {
- this.web3 = web3
- this.chain = chain
- // 初始化依赖库
- this.lpLib = new LpLib(this.web3, this.chain)
- }
- async tick() {
- }
- async run() {
- logger.debug(`${this.chain.networkName} liquidity pool maintenance is start.`)
- logger.debug(`web3 is connected, block number: ${await this.web3.eth.getBlockNumber()}.`)
- // 3. 开始处理
- while (true) {
- try {
- await this.tick()
- } catch (e) {
- logger.error(e)
- }
- await Time.delay(1000)
- }
- }
- }
- async function main() {
- const chain = await ChainLib.getChainFromCommand()
- const web3 = Web3Utils.autoCreate(chain)
- const generator = new LpMaintenance(web3, chain)
- await generator.run()
- }
- main().catch((error) => {
- console.error(error);
- process.exitCode = 1;
- })
|