feat(stablecoin): add StabilityFeeAccumulator account type - #302
Merged
gravityblast merged 2 commits intoAug 19, 2026
Conversation
gravityblast
force-pushed
the
stablecoin-plan1-159-stability-fee-accumulator
branch
from
August 18, 2026 15:33
72200ea to
9d534b6
Compare
gravityblast
force-pushed
the
stablecoin-plan1-159-stability-fee-accumulator
branch
from
August 18, 2026 15:40
9d534b6 to
1b892bd
Compare
There was a problem hiding this comment.
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
StabilityFeeAccumulatoraccount type with Borsh/serde support andDataconversions. - Adds PDA seed + PDA computation helpers for a single-instance accumulator account.
- Re-exports the new type/helpers from
stablecoin_coreand 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_atis 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.
0x-r4bbit
approved these changes
Aug 19, 2026
gravityblast
force-pushed
the
stablecoin-plan1-159-stability-fee-accumulator
branch
from
August 19, 2026 09:37
e28617f to
d9fa178
Compare
gravityblast
deleted the
stablecoin-plan1-159-stability-fee-accumulator
branch
August 19, 2026 09:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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