Skip to content

Expose stability fee accumulator state through stablecoin_module #323

Description

@3esmit

Goal

Expose the singleton StabilityFeeAccumulator account through
stablecoin_module, using the account type and PDA contract introduced by
#302.

Scope

  • Add a pure stablecoin_ffi operation that derives the accumulator PDA and
    exactly decodes stablecoin_core::StabilityFeeAccumulator from a validated
    public-account read.
  • Add stabilityFeeAccumulator() to StablecoinModuleImpl. It must derive and
    read the singleton account; callers must not supply an arbitrary account ID.
  • Return a stable map containing both base58 and hex account IDs,
    accumulatedRateAtLastAccrual, and lastAccruedAt.
  • Return all integer fields as exact decimal strings.
  • Reject an absent account, wrong PDA, wrong program owner, malformed/truncated
    data, trailing bytes, or a backend read failure with stable error codes.
  • Keep projection to the current clock time out of this raw-state operation;
    that belongs to the current-global-projections sub-issue sourced from feat(stablecoin): add current value projection helpers #311.

Acceptance criteria

  • PDA derivation matches
    compute_stability_fee_accumulator_pda(stablecoin_program_id) for fixed
    vectors and the configured deployed program.
  • Successful reads preserve full-range u128 and u64 values without
    floating-point conversion.
  • Decoder tests cover valid state, uninitialized state, wrong owner, wrong PDA,
    truncated data, trailing data, and maximum integer values.
  • Module tests prove one live read of the derived account and stable public
    response/error shapes.
  • nix build .#stablecoin-module and relevant Rust/module tests pass.

Dependencies

Depends on the stablecoin_module scaffold and initializeProgram sub-issue
under #321.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions