瀏覽代碼

修复数据库问题

skyfffire 3 年之前
父節點
當前提交
b64229da3a
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      scripts/lp/lpGenerateFromDb.ts

+ 5 - 5
scripts/lp/lpGenerateFromDb.ts

@@ -87,11 +87,11 @@ export class LpGenerate {
     } catch (e) {}
   }
 
-  async saveLp(lp: any, type='0') {
+  async saveLp(lp: any, hash: string, type='0') {
     // 本地lp实例存档
-    this.lpInstance[lp.LP.toLowerCase()] = lp
+    this.lpInstance[hash] = lp
 
-    await History.appendOrUpdate(type, lp.LP, lp)
+    await History.appendOrUpdate(type, hash, lp)
   }
 
   parseFactory(router: any, factoryAbi: any, factoryAddress: string) {
@@ -106,13 +106,13 @@ export class LpGenerate {
     if (lp) {
       logger.debug(`new lp: ${hash}.    ${now}/${max}`)
       // 2. 保存Lp信息
-      await this.saveLp(lp, 'lp')
+      await this.saveLp(lp, hash, 'lp')
       // 3. 保存Lp的Token到Token表
       await this.saveToken(lp, 'token')
     } else {
       logger.debug(`not lp: ${hash}.    ${now}/${max}`)
       // 4. 非lp放到非lp类型
-      await this.saveLp(lp, 'notLp')
+      await this.saveLp(lp, hash, 'notLp')
     }
   }