|
|
@@ -138,6 +138,14 @@ export class PullAndPush {
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
+ parseFactory(router: any, factoryAbi: any, factoryAddress: any) {
|
|
|
+ if (router.factoryObj == null) {
|
|
|
+ router.factoryObj = new web3.eth.Contract(factoryAbi, factoryAddress)
|
|
|
+ }
|
|
|
+
|
|
|
+ return router.factoryObj
|
|
|
+ }
|
|
|
+
|
|
|
async run() {
|
|
|
logger.debug('Pull v2 start.')
|
|
|
|
|
|
@@ -153,7 +161,7 @@ export class PullAndPush {
|
|
|
|
|
|
const v2FactoryAddress = routerObj.factory
|
|
|
// 获取工厂实例
|
|
|
- const v2Factory = new web3.eth.Contract(v2FactoryAbi, v2FactoryAddress)
|
|
|
+ const v2Factory = this.parseFactory(routerObj, v2FactoryAbi, v2FactoryAddress)
|
|
|
// 获取当前pull状态
|
|
|
let position = this.fromHead ? 0 : await this.handlePosition(routerObj.router, v2FactoryAddress)
|
|
|
// 获取当前pairsLength
|