Skip to content

feat: store share prices at 14 decimals - #471

Open
hpmaxi wants to merge 3 commits into
fix/448-harness-run-orderfrom
feat/431-price-14-decimals
Open

hpmaxi wants to merge 3 commits into
fix/448-harness-run-orderfrom
feat/431-price-14-decimals

Conversation

@hpmaxi

@hpmaxi hpmaxi commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #470; merge that one first. Top of the stack.

Summary

Closes #431

The oracle and the vault kept the share price in WAD (18 decimals), while Stellar price feeds and the kit's SEP-40 feed use 14, so the feed had to convert. This must land before the first mainnet deployment: after that, stored reports and epoch prices would need a migration.

Changes

  • The oracle and the vault keep the share price at 14 decimals, set once in the bindings crate all three contracts use.
  • MIN_ANSWER and MAX_ANSWER keep the same real bounds.
  • The SEP-40 feed answers the stored price unchanged.
  • The app and the harness read 14 decimals, each with one PRICE_SCALE: neither can import the Rust constant.
  • Fixtures, the deploy config and the docs use the new scale; a new test pins it.

Deviations

  • The feed still shifts the price for unequal asset and share decimals, which the vault's setup refuses.
  • Test values finer than 10^-14 now use the 14-decimal value or one unit at the new scale. No assertion changed.
  • The oracle's attest doc loses two words to fit the 1,024-byte spec limit.

Acceptance criteria

  • No WAD or _000_000_000_000_000_000 price literal remains in contracts, tests, app or harness, except where a value is not a price
  • The vault's rounding and dust bounds are unchanged (the existing conversion and dust tests pass with 14-decimal values)
  • The SEP-40 feed publishes the stored price without a scale conversion when the asset and the share have the same decimals
  • Testnet is redeployed and the README points at it (one testnet redeploy once Tranche 3's contract work lands: Redeploy testnet with every Tranche 3 change #472)

Test plan

Automated tests

  1. cargo test --locked: all pass, including the new test that one share at a price of 1.0 is one asset unit, and the conversion, dust and rounding tests with their bounds unchanged.
  2. cargo fmt --all -- --check and cargo clippy --locked --workspace --all-targets -- -D warnings: clean.
  3. Build the contracts and the upgrade probes as CI does, then cargo test --locked -p async-vault -p nav-oracle -p sep40-feed --features upgrade_wasm with_wasm: all pass.
  4. stellar contract build, npm run build:clients, then npm run lint, npm run format:check, npm run typecheck and npm run test: all pass.

Manual verification

None until the testnet redeploy.

Breaking changes

Oracle and epoch prices move from 10^18 to 10^14. A deployment holding WAD prices, such as today's testnet, needs a redeploy.

Checklist

  • Self-reviewed my own diff
  • Tests added or updated
  • Docs updated (if applicable)
  • No unrelated changes bundled in

Screenshots

None.

🤖 Generated with Claude Code

The oracle, the vault and the SEP-40 feed share one price scale,
PRICE_SCALE = 10^14, defined in strata-bindings. MIN_ANSWER and
MAX_ANSWER keep the same real bounds. The feed answers the stored
price unchanged when the asset and the share have the same decimals.
The app and the harness each keep one PRICE_SCALE at 10^14, matching
the contracts, and every price fixture is the same real price at the
new scale.
@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
strata-vault-kit-app Ready Ready Preview Nov 18, 2026 5:31pm UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — 2bf48db3 Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant