You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expose a deterministic, read-only position-health quote through stablecoin_module, using the collateralization invariant added by #336 and
live fee/redemption projections.
Scope
Add a pure stablecoin_ffi quote operation that evaluates a decoded Position with the current stability-fee accumulator, redemption price, and
minimum collateralization ratio.
Add positionHealth(request) to StablecoinModuleImpl, accepting ownerId
and exact decimal-string positionNonce.
Read ProtocolParameters for minimum_collateralization_ratio and reuse the
current global projections from Expose current stablecoin global projections #326. Callers must not supply trusted
protocol values.
the Position is collateralized when collateral_value >= required_collateral_value
Return Position/Vault IDs, source Position amounts, projected protocol
operands, nominalDebt, collateralValue, requiredCollateralValue, and isCollateralized. Encode every integer as an exact decimal string.
Use checked wide-integer arithmetic and return stable errors for overflow,
missing accounts, malformed state, ownership/PDA mismatches, and projection
failures.
Share a non-panicking calculation/predicate with the program invariant where
practical. Do not catch the assertion helper's panic as normal quote flow.
Acceptance criteria
Quote results match the program invariant for zero debt, comfortable surplus,
exact equality, one unit below the boundary, and accumulator-driven health
deterioration.
Goal
Expose a deterministic, read-only position-health quote through
stablecoin_module, using the collateralization invariant added by #336 andlive fee/redemption projections.
Scope
Add a pure
stablecoin_ffiquote operation that evaluates a decodedPositionwith the current stability-fee accumulator, redemption price, andminimum collateralization ratio.
Add
positionHealth(request)toStablecoinModuleImpl, acceptingownerIdand exact decimal-string
positionNonce.Reuse the Position and Vault derivation/validation from Expose stablecoin position resolution and decoding #325.
Read
ProtocolParametersforminimum_collateralization_ratioand reuse thecurrent global projections from Expose current stablecoin global projections #326. Callers must not supply trusted
protocol values.
Preserve the exact feat(stablecoin): add collateralization-check helper #336 calculation:
nominal_debt = normalized_debt_amount * current_accumulator / FIXED_POINT_ONEcollateral_value = collateral_amount * FIXED_POINT_ONE^2required_collateral_value = nominal_debt * current_redemption_price * minimum_collateralization_ratiocollateral_value >= required_collateral_valueReturn Position/Vault IDs, source Position amounts, projected protocol
operands,
nominalDebt,collateralValue,requiredCollateralValue, andisCollateralized. Encode every integer as an exact decimal string.Treat zero debt as collateralized, matching feat(stablecoin): add collateralization-check helper #336.
Use checked wide-integer arithmetic and return stable errors for overflow,
missing accounts, malformed state, ownership/PDA mismatches, and projection
failures.
Share a non-panicking calculation/predicate with the program invariant where
practical. Do not catch the assertion helper's panic as normal quote flow.
Acceptance criteria
exact equality, one unit below the boundary, and accumulator-driven health
deterioration.
precision loss; checked
U256overflow becomes a stable error.and stored owner/nonce/vault mismatches.
redemption-state, and clock accounts.
nix build .#stablecoin-modulepass.