Skip to content

feat(stablecoin): add StabilityFeeAccumulator account type - #302

Merged
gravityblast merged 2 commits into
mainfrom
stablecoin-plan1-159-stability-fee-accumulator
Aug 19, 2026
Merged

feat(stablecoin): add StabilityFeeAccumulator account type#302
gravityblast merged 2 commits into
mainfrom
stablecoin-plan1-159-stability-fee-accumulator

Conversation

@gravityblast

Copy link
Copy Markdown
Collaborator

Single-instance PDA holding the global stability-fee multiplier as (accumulated_rate_at_last_accrual, last_accrued_at). Lazy form — the current value is projected on read; the anchor only moves on accrual.

Type + PDA helpers only, no instruction wiring yet.

closes #159

@gravityblast
gravityblast force-pushed the stablecoin-plan1-159-stability-fee-accumulator branch from 72200ea to 9d534b6 Compare August 18, 2026 15:33
@gravityblast
gravityblast force-pushed the stablecoin-plan1-159-stability-fee-accumulator branch from 9d534b6 to 1b892bd Compare August 18, 2026 15:40
@gravityblast
gravityblast requested a lite review from Copilot August 18, 2026 15:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds the core “global singleton” account type for the Stablecoin program’s lazy stability-fee accumulator, including deterministic single-instance PDA derivation helpers and IDL exposure. This fits the stablecoin core crate’s pattern for program-owned singleton accounts (e.g., ProtocolParameters) and enables future instructions to read/advance the accumulator without wiring instruction logic yet.

Changes:

  • Introduces StabilityFeeAccumulator account type with Borsh/serde support and Data conversions.
  • Adds PDA seed + PDA computation helpers for a single-instance accumulator account.
  • Re-exports the new type/helpers from stablecoin_core and updates the stablecoin IDL artifact.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
programs/stablecoin/core/src/stability_fee_accumulator.rs New singleton accumulator account type, Data conversions, PDA helpers, and unit tests.
programs/stablecoin/core/src/lib.rs Exposes the new module and re-exports its public API from the crate root.
artifacts/stablecoin-idl.json Adds the StabilityFeeAccumulator struct definition to the generated IDL types.
Suppressed comments (1)

programs/stablecoin/core/src/stability_fee_accumulator.rs:94

  • last_accrued_at is documented as Unix milliseconds, but this test uses a seconds-scale value. Consider using a milliseconds-scale timestamp here as well to keep unit expectations consistent.
            last_accrued_at: 2_000_000_000,

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread programs/stablecoin/core/src/stability_fee_accumulator.rs
Comment thread programs/stablecoin/core/src/stability_fee_accumulator.rs Outdated
@gravityblast
gravityblast force-pushed the stablecoin-plan1-159-stability-fee-accumulator branch from e28617f to d9fa178 Compare August 19, 2026 09:37
@gravityblast
gravityblast merged commit d9b7366 into main Aug 19, 2026
7 checks passed
@gravityblast
gravityblast deleted the stablecoin-plan1-159-stability-fee-accumulator branch August 19, 2026 09:50
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.

[Plan 1 · 03] StabilityFeeAccumulator account type

3 participants