Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m27s
CI/CD Pipeline / Security Scanning (push) Successful in 2m37s
CI/CD Pipeline / Lint and Format (push) Failing after 53s
CI/CD Pipeline / Terraform Validation (push) Failing after 31s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 29s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 37s
Validation / validate-genesis (push) Successful in 34s
Validation / validate-terraform (push) Failing after 33s
Validation / validate-kubernetes (push) Failing after 13s
Validation / validate-smart-contracts (push) Failing after 11s
Validation / validate-security (push) Failing after 1m26s
Validation / validate-documentation (push) Failing after 19s
Refreshes ho-liquidity-snapshot every 30 minutes with aggregate supplyNostroMatch and reserve alerts; embeds nostro/reserve KPIs in the OMNL compliance console; includes payout journal routes needed for token-aggregation build. Co-authored-by: Cursor <cursoragent@cursor.com>
58 lines
2.0 KiB
TypeScript
58 lines
2.0 KiB
TypeScript
import * as dotenv from 'dotenv';
|
|
import path from 'path';
|
|
import { existsSync } from 'fs';
|
|
import { ApiServer } from './api/server';
|
|
import { closeDatabasePool } from './database/client';
|
|
import { logger } from './utils/logger';
|
|
import { startRouteMatrixScheduler } from './services/route-matrix-scheduler';
|
|
import { startGruReserveCapacityScheduler } from './services/gru-reserve-capacity-scheduler';
|
|
import { startOmnlHoLiquidityScheduler } from './services/omnl-ho-liquidity-scheduler';
|
|
import { startIso4217FxScheduler } from './services/iso4217-fx-refresh';
|
|
|
|
// Load smom-dbis-138 root .env first (single source); works from dist/ or src/
|
|
const rootEnvCandidates = [
|
|
path.resolve(__dirname, '../../.env'), // from dist/
|
|
path.resolve(__dirname, '../../../.env'), // from src/
|
|
];
|
|
for (const p of rootEnvCandidates) {
|
|
if (existsSync(p)) {
|
|
dotenv.config({ path: p });
|
|
break;
|
|
}
|
|
}
|
|
dotenv.config();
|
|
// Fill contract/token addresses from config/smart-contracts-master.json when not set (e.g. CUSDC_ADDRESS_138, CUSDT_ADDRESS_138)
|
|
try {
|
|
const loaderPath = path.resolve(__dirname, '../../../../config/contracts-loader.cjs');
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
const { loadContractsIntoProcessEnv } = require(loaderPath);
|
|
if (typeof loadContractsIntoProcessEnv === 'function') loadContractsIntoProcessEnv([138, 1]);
|
|
} catch (_) { /* optional when run outside proxmox repo */ }
|
|
|
|
const server = new ApiServer();
|
|
startRouteMatrixScheduler();
|
|
startGruReserveCapacityScheduler();
|
|
startOmnlHoLiquidityScheduler();
|
|
startIso4217FxScheduler();
|
|
|
|
// Start server
|
|
server.start().catch((error) => {
|
|
logger.error('Failed to start server:', error);
|
|
process.exit(1);
|
|
});
|
|
|
|
// Graceful shutdown
|
|
process.on('SIGTERM', async () => {
|
|
logger.info('SIGTERM received, shutting down gracefully...');
|
|
await server.stop();
|
|
await closeDatabasePool();
|
|
process.exit(0);
|
|
});
|
|
|
|
process.on('SIGINT', async () => {
|
|
logger.info('SIGINT received, shutting down gracefully...');
|
|
await server.stop();
|
|
await closeDatabasePool();
|
|
process.exit(0);
|
|
});
|