Skip to content

Expose current stablecoin global projections #326

Description

@3esmit

Goal

Expose current, clock-projected stablecoin global values through
stablecoin_module, using the projection helpers merged in #311.

Scope

  • Add a pure stablecoin_ffi projection operation backed directly by
    compute_current_accumulated_rate and
    compute_current_redemption_price.
  • Add currentGlobalState() to StablecoinModuleImpl.
  • Read and validate ProtocolParameters, StabilityFeeAccumulator,
    RedemptionPriceState, and the canonical CLOCK_01 account through
    logos_execution_zone.
  • Use the clock account's Unix-millisecond timestamp. Do not accept a
    caller-supplied wall clock for the live operation.
  • Return raw anchors and timestamps together with currentAccumulatedRate,
    currentRedemptionPrice, and projectedAt, all as exact decimal strings.
  • Preserve the on-chain semantics: saturating timestamp subtraction and the
    MAXIMUM_COMPOUNDING_WINDOW_MILLISECONDS seven-day clamp.
  • Surface invalid global ownership/PDA/data and invalid clock reads through
    stable error codes.

Acceptance criteria

  • Projection output matches the Rust helpers byte-for-byte for identity,
    growth, decay, zero elapsed time, inverted timestamps, exactly-at-clamp, and
    beyond-clamp cases.
  • The live module method reads each required singleton and the canonical clock;
    it never projects from process wall time.
  • Maximum fixed-point values supported by the helpers remain exact across the
    API boundary; JSON floats are rejected.
  • Tests prove now < last_updated_at and now < last_accrued_at collapse to
    the stored anchors without underflow.
  • nix build .#stablecoin-module and relevant Rust/module tests pass.

Dependencies

Depends on the scaffold, raw accumulator-state, and raw
redemption-price-state sub-issues under #321.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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