Skip to content

Conversation

g1nt0ki
Copy link
Member

@g1nt0ki g1nt0ki commented Sep 30, 2025

This PR includes a bunch of small refactors and optimizations, but major change is pulling dimension fee breakdown (by custom label) and exposing it via api:

  • add pro routes
  • add versioning and new route pattern for dimensions, should be extended to other metrics
  • added cache object structure to types.ts
  • transform records immediately after pulling from db, this way we dont repeat the transformation and the same record everytime we run the cron job, downside of this is, we need to reset cache if we change the transformation
  • removed some unused code blocks/files
  • added (simple) compression & decompression logic while writing/reading cache, and split cache by adapter type, this way, it will take longer to hit the file size limit
  • moved some parts of the code out of cron/dimensions.ts to make the file look (little) less daunting, added more comments
  • I replaced aggregated from dimensions record with aggObject, I had a good reason, but cant recall why now, think I probably tried to remove it, but realized that if record contains non dataType fields, makes bit more of of a pain to iterate, right now, we know that all keys in aggObject are dataType (like dailyFees, dailyRevenue, etc)

What is missing/needs to be fixed:

  • need to include breakdown methodology
  • derive labels from breakdown methodology matching given dataType, if not matching key in given adapter, else global breakdown dictionary
  • merge label data for parent protocol and verify that this works
  • check with mint & integrate in the UI

@g1nt0ki g1nt0ki marked this pull request as draft October 2, 2025 12:28
@g1nt0ki g1nt0ki changed the title Label Breakdown api WIP: Label Breakdown api Oct 2, 2025
@g1nt0ki g1nt0ki requested a review from 0xpeluche October 2, 2025 23:03
Comment on lines 27 to 28
const validMetricTypesSet = new Set(Object.values(AdaptorRecordType)) as Set<string>
const validRecordTypesSet = new Set(Object.values(AdaptorRecordType)) as Set<string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was some confusion here, I guess →

const validMetricTypesSet = new Set(Object.values(AdapterType)) as Set<string>
const validRecordTypesSet = new Set(Object.values(AdaptorRecordType)) as Set<string>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, good catch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants