-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters