Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions api/src/controllers/debtToken.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ export const burnDebtToken = async (req: Request, res: Response, next: NextFunct
}
};

export const getDebtPosition = async (req: Request, res: Response) => {
export const getDebtPosition = async (
req: Request,
res: Response,
next: NextFunction
) => {
try {
const { tokenId } = req.query as any;

Expand Down Expand Up @@ -135,7 +139,11 @@ export const getDebtPosition = async (req: Request, res: Response) => {
}
};

export const getUserDebtTokens = async (req: Request, res: Response) => {
export const getUserDebtTokens = async (
req: Request,
res: Response,
next: NextFunction
) => {
try {
const { userAddress } = req.query as any;

Expand All @@ -158,7 +166,11 @@ export const getUserDebtTokens = async (req: Request, res: Response) => {
}
};

export const getDebtTokenTotalSupply = async (req: Request, res: Response) => {
export const getDebtTokenTotalSupply = async (
req: Request,
res: Response,
next: NextFunction
) => {
try {
logger.info('Get debt token total supply request');

Expand Down
24 changes: 20 additions & 4 deletions api/src/controllers/lending.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,11 @@ export const executeRebalancing = async (req: Request, res: Response, next: Next
}
};

export const getRebalancingConfig = async (req: Request, res: Response) => {
export const getRebalancingConfig = async (
req: Request,
res: Response,
next: NextFunction
) => {
try {
const { userAddress } = req.query as any;

Expand Down Expand Up @@ -595,7 +599,11 @@ export const burnDebtToken = async (req: Request, res: Response, next: NextFunct
}
};

export const getDebtPosition = async (req: Request, res: Response) => {
export const getDebtPosition = async (
req: Request,
res: Response,
next: NextFunction
) => {
try {
const { tokenId } = req.query as any;

Expand Down Expand Up @@ -623,7 +631,11 @@ export const getDebtPosition = async (req: Request, res: Response) => {
}
};

export const getUserDebtTokens = async (req: Request, res: Response) => {
export const getUserDebtTokens = async (
req: Request,
res: Response,
next: NextFunction
) => {
try {
const { userAddress } = req.query as any;

Expand All @@ -646,7 +658,11 @@ export const getUserDebtTokens = async (req: Request, res: Response) => {
}
};

export const getDebtTokenTotalSupply = async (req: Request, res: Response) => {
export const getDebtTokenTotalSupply = async (
req: Request,
res: Response,
next: NextFunction
) => {
try {
logger.info('Get debt token total supply request');

Expand Down
4 changes: 2 additions & 2 deletions api/src/controllers/portfolio.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
toCSV,
computeInterestAccrualProjection,
computeLiquidationPrice,
getHealthFactorMonitor,
getHealthFactorMonitor as buildHealthFactorMonitor,
} from '../services/portfolio.service';
import { PortfolioAnalyticsResponse } from '../types/portfolio';
import { redisCacheService } from '../services/redisCache.service';
Expand Down Expand Up @@ -194,7 +194,7 @@ export const getHealthFactorMonitor = async (
const stellarService = new StellarService();
const position = await stellarService.getUserPosition(userAddress);

const monitor = getHealthFactorMonitor(position);
const monitor = buildHealthFactorMonitor(position);
res.status(200).json({
userAddress,
...monitor,
Expand Down
6 changes: 5 additions & 1 deletion api/src/controllers/rebalancing.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ export const executeRebalancing = async (req: Request, res: Response, next: Next
}
};

export const getRebalancingConfig = async (req: Request, res: Response) => {
export const getRebalancingConfig = async (
req: Request,
res: Response,
next: NextFunction
) => {
try {
const { userAddress } = req.query as any;

Expand Down
19 changes: 18 additions & 1 deletion api/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,29 @@ export interface WsPingMessage {
type: 'ping';
}

export type ClientMessage = WsSubscribeMessage | WsUnsubscribeMessage | WsPingMessage;
export interface WsAnalyticsSubscribeMessage {
type: 'subscribe_analytics';
channels: ('apy' | 'utilization' | 'revenue')[];
}

export interface WsAnalyticsUnsubscribeMessage {
type: 'unsubscribe_analytics';
channels: ('apy' | 'utilization' | 'revenue')[];
}

export type ClientMessage =
| WsSubscribeMessage
| WsUnsubscribeMessage
| WsPingMessage
| WsAnalyticsSubscribeMessage
| WsAnalyticsUnsubscribeMessage;

export type ServerMessage =
| { type: 'price_update'; asset: string; price: number; timestamp: number }
| { type: 'subscribed'; assets: string[] }
| { type: 'unsubscribed'; assets: string[] }
| { type: 'subscribed_analytics'; channels: string[] }
| { type: 'unsubscribed_analytics'; channels: string[] }
| { type: 'pong' }
| { type: 'error'; message: string };

Expand Down
62 changes: 62 additions & 0 deletions oracle/dist/claims/claim-repository.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* Claim Repository
*
* In-memory store for insurance claims with LRU eviction and an
* append-only audit trail per claim.
*/
import type { InsuranceClaim, ClaimHistoryEntry, ClaimSubmissionRequest } from './types.js';
import { ClaimStatus } from './types.js';
/**
* Configuration for the repository.
*/
export interface ClaimRepositoryConfig {
/** Maximum number of claims to hold before evicting oldest. Default: 10_000 */
maxEntries: number;
}
/**
* In-memory insurance claim store.
*
* Uses a Map (insertion-order preserved) to track LRU position.
* The first key in the Map is always the oldest / least-recently touched.
*/
export declare class ClaimRepository {
private store;
private config;
constructor(config?: Partial<ClaimRepositoryConfig>);
/**
* Create a new claim from a submission request.
* Returns the persisted claim.
*/
create(request: ClaimSubmissionRequest): InsuranceClaim;
/**
* Persist (insert or update) a claim.
*/
save(claim: InsuranceClaim): void;
/**
* Append a history entry and persist.
*/
appendHistory(claimId: string, entry: ClaimHistoryEntry): InsuranceClaim | null;
/**
* Transition a claim to a new status, recording the history entry.
*/
transition(claimId: string, toStatus: ClaimStatus, actor: string, description: string, metadata?: Record<string, unknown>): InsuranceClaim | null;
findById(id: string): InsuranceClaim | null;
findByAddress(address: string): InsuranceClaim[];
findByStatus(status: ClaimStatus): InsuranceClaim[];
/**
* Return all claims submitted since a given Unix timestamp.
*/
findSince(sinceTimestamp: number): InsuranceClaim[];
/**
* Return the full audit history for a claim.
*/
getHistory(claimId: string): ClaimHistoryEntry[];
count(): number;
getAll(): InsuranceClaim[];
private persist;
}
/**
* Factory function.
*/
export declare function createClaimRepository(config?: Partial<ClaimRepositoryConfig>): ClaimRepository;
//# sourceMappingURL=claim-repository.d.ts.map
1 change: 1 addition & 0 deletions oracle/dist/claims/claim-repository.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

158 changes: 158 additions & 0 deletions oracle/dist/claims/claim-repository.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions oracle/dist/claims/claim-repository.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading