Skip to content

Comments

Add funding record accumulator#431

Merged
pileks merged 4 commits intodevelopfrom
pileks/met-177-program-accumulator-system
Feb 23, 2026
Merged

Add funding record accumulator#431
pileks merged 4 commits intodevelopfrom
pileks/met-177-program-accumulator-system

Conversation

@pileks
Copy link
Contributor

@pileks pileks commented Feb 22, 2026

TODO:

  • Release SDK once merged
  • Add migration script for funding records
  • Migrate funding records

Track a time-weighted accumulator on FundingRecord that computes the integral of committed_amount over time. This captures not just how much a funder committed, but how long they've had funds committed — rewarding early and sustained commitment.

Concept

The accumulator is a discrete integral:

accumulator += committed_amount * (current_timestamp - last_update_timestamp)

Each time committed_amount changes, we "flush" the accumulated value before applying the change. The result is a running sum of committed_amount * seconds — a value that grows faster for larger and longer-held commitments.

Configurable delay

A per-launch setting accumulator_activation_delay_seconds (in seconds) defines a grace period after launch start during which the accumulator does not grow for anyone. During this window, funders can commit freely, but no time-weighted advantage accrues. Once the delay elapses, accumulation begins simultaneously for all existing commitments based on their current committed_amount.

committed_amount
      ^
      │
  500 │     ┌ ─ ─ ─┌─────────────────────┐
      │     │      |                     │ accumulation
  300 │ ┌─ ─┤ - - -|- - accumulation - - │ still active
      │ │ no acc.  |       active        │ but not recorded -
      │ │          |                     │ needs offchain calculation
      └─┴───┴──────┬─────────────────────┴────> time
      t0 t1  t2    t_act                 t3

  t0 = launch_start
  t_act = launch_start + accumulator_activation_delay_seconds

  accumulator at t3:
    funder A (300 from t1): 300 * (t3 - t_act)
    funder B (500 from t2): 500 * (t3 - t_act)

  Both start accumulating from t_act, regardless of when they funded.

@pileks pileks self-assigned this Feb 22, 2026
@pileks pileks merged commit 3538990 into develop Feb 23, 2026
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.

1 participant