Skip to content

Commit

Permalink
Add resampled obligation entities
Browse files Browse the repository at this point in the history
  • Loading branch information
peroxy committed Dec 22, 2023
1 parent 877f16e commit 0670d80
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/hubble-db/src/models/KLendObligationStateEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,13 @@ export interface KlendObligationStateEntity {
created_on: Date;
}

export interface ResampledObligationStateEntity {
id: BigInt;
klend_obligation_id: number;
raw_json: string;
metrics: string;
created_on: Date;
resampled_on: Date;
}

export default KlendObligationStateEntity;
9 changes: 9 additions & 0 deletions packages/hubble-db/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,13 @@ export const FARM_STATE_TABLE = 'farm_state';
export const FARM_USER_TABLE = 'farm_user';
export const FARM_USER_STATE_TABLE = 'farm_user_state';
export const FARM_REWARD_TABLE = 'farm_reward_state';
export type RESAMPLE_FREQUENCY = 'hour' | 'day';
export const HOURLY_FREQUENCY = 'hour';
export const DAILY_FREQUENCY = 'day';
export const GET_OBLIGATION_STATE_RESAMPLED_TABLE = (frequency: RESAMPLE_FREQUENCY) => {
if (frequency !== HOURLY_FREQUENCY && frequency !== DAILY_FREQUENCY) {
throw Error(`Frequency ${frequency} not supported`);
}
return `klend_obligation_state_resampled_${frequency}`;
};
export const API_SCHEMA: string = 'api';

0 comments on commit 0670d80

Please sign in to comment.