Skip to content

Expose permissionless stablecoin poke transactions #328

Description

@3esmit

Goal

Expose the three permissionless global-state transactions added by #317:
accrueStabilityFee, updateRedemptionRate, and refreshGlobals.

Scope

  • Add typed stablecoin_ffi planners for
    Instruction::AccrueStabilityFee, Instruction::UpdateRedemptionRate, and
    Instruction::RefreshGlobals.

  • Add matching StablecoinModuleImpl methods. Each accepts a caller account ID;
    permissionless means any wallet-controlled public account may call, but that
    caller is still the sole signer.

  • Derive global PDAs and canonical clock internally. Read
    ProtocolParameters to obtain the configured oracle account.

  • Preserve exact IDL account order and signer flags:

    • accrue: caller, parameters, accumulator, clock
    • update: caller, parameters, redemption state, oracle, clock
    • refresh: caller, parameters, accumulator, redemption state, oracle, clock
  • Submit through logos_execution_zone.send_generic_public_transaction and
    return stable {status,error,transactionId} maps.

  • Reuse the controller quote preflight for strict updateRedemptionRate.
    refreshGlobals must retain its best-effort semantics: always accrue the fee
    half and allow the guest to skip the redemption half when the interval is not
    due or the oracle is stale/zero.

  • Do not block any poke solely because ProtocolParameters.is_frozen is true;
    all three program instructions remain available while frozen.

Acceptance criteria

  • Every planner round-trips to the intended zero-argument
    stablecoin_core::Instruction variant.
  • Planner tests pin exact account order, program ID, instruction words, and
    caller-only signer flags for all three methods.
  • Module tests cover malformed/non-wallet caller IDs, missing globals, wrong
    oracle binding, wallet transport failure, rejected transactions, successful
    transaction IDs, and frozen-protocol submission.
  • updateRedemptionRate does not submit when live preflight proves too-soon,
    stale-oracle, or zero-price failure.
  • refreshGlobals does submit under those three soft-gate conditions and does
    not reinterpret them as client-side errors.
  • nix build .#stablecoin-module, module inspection, and headless
    logoscore call smoke tests pass.
  • Repository Rust format, TOML format, Clippy, unit/integration tests, and IDL
    drift checks remain green.

Dependencies

Depends on the scaffold, raw global-state, current-projection, and controller
quote sub-issues under #321.

Out of scope

Keeper scheduling, retries, rewards, UI work, and background services.

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