Skip to content

Commit

Permalink
04-get-liquidation-dates
Browse files Browse the repository at this point in the history
  • Loading branch information
sanbir committed May 17, 2024
1 parent 87f6d68 commit 94b96bf
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
34 changes: 34 additions & 0 deletions 04-get-liquidation-dates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import 'dotenv/config'
import { logger } from './scripts/common/helpers/logger'
import { getAllClusterStates } from './scripts/ssv/reads/getAllClusterStates'
import { getDaysToLiquidation } from './scripts/ssv/reads/getDaysToLiquidation'
import process from 'process'

async function main() {
logger.info('04-get-liquidation-dates')

const clusterStates = await getAllClusterStates()

const clusterLiquidationDates = []
for (const clusterState of clusterStates) {
const { daysToLiquidation } =
await getDaysToLiquidation(clusterState)

clusterLiquidationDates.push({id: clusterState.clusterId, days: daysToLiquidation})
}

clusterLiquidationDates.sort((a, b) => Number(a.days - b.days))

for (const date of clusterLiquidationDates) {
console.log(date.id + ',' + date.days)
}

logger.info('04-get-liquidation-dates')
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error)
process.exitCode = 1
})
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"01-transfer-ssv-tokens-from-factory-to-clusters": "ts-node 01-transfer-ssv-tokens-from-factory-to-clusters.ts",
"02-remove-exited-validators-from-clusters": "ts-node 02-remove-exited-validators-from-clusters.ts",
"03-withdraw-excess-tokens-from-clusters": "ts-node 03-withdraw-excess-tokens-from-clusters.ts",
"04-get-liquidation-dates": "ts-node 04-get-liquidation-dates.ts",
"97-test": "ts-node 97-test.ts",
"start": "ts-node index.ts"
}
Expand Down

0 comments on commit 94b96bf

Please sign in to comment.