Skip to content

Conversation

@0xSero
Copy link
Collaborator

@0xSero 0xSero commented Feb 12, 2025

Calculator Component

Overview

This PR implements a modular calculator component for monitoring delegatee score events and determining deposit bumpability.

Key Changes

  • Created calculator component with strategy pattern support
  • Implemented base calculator strategy with score event processing
  • Added database support for score events (create, update, delete, query)
  • Migrated numeric handling from BigNumber to native bigint
  • Added block range processing with checkpoint tracking

Technical Details

  • Uses native bigint for all numeric calculations
  • Handles type conversion between database (string) and calculator (bigint) score representations
  • Implements caching layer for score lookups
  • Supports batch processing of score events
  • Maintains processing checkpoints for resumability

Database Changes

Added new table and functionality:

CREATE TABLE score_events (
  delegatee TEXT NOT NULL,
  score NUMERIC NOT NULL,
  block_number BIGINT NOT NULL,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (delegatee, block_number)
);

Related Issues

Closes #4

@0xSero 0xSero merged commit ccccbfb into main Feb 16, 2025
1 check passed
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.

Implement Base Calculator Strategy

2 participants