|
|
@@ -29,7 +29,7 @@ async function handlePosition(router: String, factory: String) {
|
|
|
return 0
|
|
|
}
|
|
|
|
|
|
-async function handleAFactory(router: String, factory: String, position: number, v2_410_tool: any) {
|
|
|
+async function handleAFactory(router: String, factory: String, position: number, pairsLength: number, v2_410_tool: any) {
|
|
|
let errorCount = 0
|
|
|
|
|
|
while (true) {
|
|
|
@@ -66,7 +66,7 @@ async function handleAFactory(router: String, factory: String, position: number,
|
|
|
token1: info['5']
|
|
|
}
|
|
|
const insertRst = await History.appendOrUpdate('0', info['0'], data)
|
|
|
- logger.debug(insertRst.msg, `, hash: ${info['0']}`)
|
|
|
+ logger.debug(insertRst.msg, `, hash: ${info['0']}, ${position} / ${pairsLength}`)
|
|
|
|
|
|
// 每十次更新一次position
|
|
|
if (position % 50 == 0) {
|
|
|
@@ -76,7 +76,7 @@ async function handleAFactory(router: String, factory: String, position: number,
|
|
|
|
|
|
errorCount = 0
|
|
|
} catch (e) {
|
|
|
- logger.error(e)
|
|
|
+ logger.error(JSON.stringify(e))
|
|
|
errorCount++
|
|
|
}
|
|
|
|
|
|
@@ -113,8 +113,8 @@ async function main() {
|
|
|
// 获取当前pull状态
|
|
|
const position = await handlePosition(v2_router_address, v2_factory_address)
|
|
|
|
|
|
- logger.debug(`factory: ${v2_factory}, ${position} / ${pairsLength}.`)
|
|
|
- await handleAFactory(v2_router_address, v2_factory_address, position, v2_410_tool)
|
|
|
+ logger.debug(`factory: ${v2_factory_address}, ${position} / ${pairsLength}.`)
|
|
|
+ await handleAFactory(v2_router_address, v2_factory_address, position, pairsLength, v2_410_tool)
|
|
|
} catch (e) {
|
|
|
logger.error(`New contract error, router: ${v2_router_address}`)
|
|
|
logger.error(e)
|