hel 1 tahun lalu
induk
melakukan
8790c5f123
4 mengubah file dengan 21 tambahan dan 15 penghapusan
  1. 1 1
      src/BaseClient.ts
  2. 1 1
      src/JennieModule.ts
  3. 7 3
      src/onchain/finalTask.ts
  4. 12 10
      src/onchain/fundChecker.ts

+ 1 - 1
src/BaseClient.ts

@@ -147,7 +147,7 @@ export abstract class BaseClient {
 
       return Number(usdc.toArray()[0].amount)
     } catch (e) {
-      return 0
+      throw new Error('..')
     }
   }
 

+ 1 - 1
src/JennieModule.ts

@@ -55,7 +55,7 @@ export abstract class JennieModule extends BaseClient {
     //   [],
     // )
     const kt = Number(viewResult.update_at)
-    const now = 1717947134
+    const now = 1718354833
     // const currentStage = stageInfo.current_stage
     // const stageInternal = stageInfo.stage_interval
     // const stTimestamp = stageInfo.start_timestamp

+ 7 - 3
src/onchain/finalTask.ts

@@ -5,7 +5,7 @@ import { InitiaClient } from '../InitiaClient'
 async function startCheck(concurrency) {
   const accountsRaw = await DBClient.instance.account.findMany({
     where: {
-      status: 888,
+      status: 2,
     },
     orderBy: {
       lastRun: 'asc',
@@ -15,6 +15,9 @@ async function startCheck(concurrency) {
   await forEachAsync(accountsRaw, concurrency, async (account, index) => {
     console.log(`${index}/${accountsRaw.length}: processing ${account.address}`)
     try {
+      if (Number(account.message) < 1000000) {
+        return
+      }
       const client = new InitiaClient(account.mnemonic, true)
       const gasGot = await client.gasGot()
       if (!gasGot) {
@@ -26,12 +29,13 @@ async function startCheck(concurrency) {
         })
         return
       }
+
       const done = await client.feedJennie()
       if (done == `done`) {
         console.log(`done work`)
         await DBClient.instance.account.update({
           where: { id: account.id },
-          data: { status: 2 },
+          data: { status: 3 },
         })
       }
     } catch (e) {
@@ -40,4 +44,4 @@ async function startCheck(concurrency) {
   })
 }
 
-startCheck(4)
+startCheck(25)

+ 12 - 10
src/onchain/fundChecker.ts

@@ -6,7 +6,7 @@ async function startCheck(concurrency) {
   const accountsRaw = await DBClient.instance.account.findMany({
     where: {
       status: {
-        in: [900],
+        in: [901],
       },
     },
 
@@ -16,27 +16,29 @@ async function startCheck(concurrency) {
     console.log(`${index}/${accountsRaw.length}: processing ${account.address}`)
     try {
       // await faucetAccount(account.address)
-
+      if (account.message > 170000) {
+        return
+      }
       const client = new InitiaClient(account.mnemonic, true)
 
       const amount = await client.getGasAmount()
-      if (amount > 5 * 10000) {
+      if (amount < 170000) {
         await DBClient.instance.account.update({
           where: { id: account.id },
-          data: { status: 901, message: amount.toString() },
+          data: { status: 900, message: amount.toString() },
 
           //可能领过还没到账的
         })
       } else {
-        // await DBClient.instance.account.update({
-        //   where: { id: account.id },
-        //   data: { status: 888 },
-        //   //可能领过还没到账的
-        // })
+        await DBClient.instance.account.update({
+          where: { id: account.id },
+          data: { message: amount.toString() },
+          //可能领过还没到账的
+        })
       }
       console.log(`amount:`, amount)
     } catch (e) {}
   })
 }
 
-startCheck(20)
+startCheck(100)