Przeglądaj źródła

流程抽到面向过程,与面向对象隔离开

skyfffire 2 lat temu
rodzic
commit
1b951293df
2 zmienionych plików z 9 dodań i 13 usunięć
  1. 0 12
      scripts/lib/lp-lib.js
  2. 9 1
      scripts/maintenance/index.js

+ 0 - 12
scripts/lib/lp-lib.js

@@ -175,18 +175,6 @@ module.exports = class LpLib {
 
   }
 
-  async perfectLpInfo(lpList) {
-    // 1. 更新所有lp的r0,r1
-    await this.putR0AndR1(lpList)
-    // 2. 获取每种交易对的最佳兑换池子(最佳:池子价值最高)
-    // 按相同交易对分组的对象,通过token0+token1的字符串串联方式索引
-    this.maxValueLpMap = this.getMaxValueLpMap()
-    // 3. 计算token0与token1的相对价格(需要decimals0,decimals1)
-    this.calcSwapPrice(lpList)
-    // 4. 获取池子兑基本币价值
-    this.calcLpValue(lpList)
-  }
-
   async getLpList(version) {
     let requestRst = undefined
 

+ 9 - 1
scripts/maintenance/index.js

@@ -19,7 +19,15 @@ class LpMaintenance {
 
     const lpList = v2LpList.concat(v3LpList)
     // 完善lp信息
-    await this.lpLib.perfectLpInfo(lpList)
+    // 1. 更新所有lp的r0,r1
+    await this.lpLib.putR0AndR1(lpList)
+    // 2. 获取每种交易对的最佳兑换池子(最佳:池子价值最高)
+    // 按相同交易对分组的对象,通过token0+token1的字符串串联方式索引
+    const maxValueLpMap = this.lpLib.getMaxValueLpMap()
+    // 3. 计算token0与token1的相对价格(需要decimals0,decimals1)
+    this.lpLib.calcSwapPrice(lpList)
+    // 4. 获取池子兑基本币价值
+    this.lpLib.calcLpValue(lpList)
   }
 
   async run() {