Skip to content

feat: support flexible pricing via pricing trait - #153

Merged
hpmaxi merged 2 commits into
mainfrom
feat/72-pricing-trait
Sep 25, 2026
Merged

hpmaxi merged 2 commits into
mainfrom
feat/72-pricing-trait

Conversation

@hpmaxi

@hpmaxi hpmaxi commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #72

Epoch pricing read nav_per_share() directly in the settlement code. A pricing trait puts share-price resolution and the two conversions behind one interface, so a vault variant can change the scheme without touching the epoch state machine.

Changes

  • Pricing trait for resolving the share price and for the deposit and redeem conversions, both rounding down.
  • The attested unit price is the only scheme, selected in one place.
  • Fulfilment and both claims convert only through the trait.

Deviations

Acceptance criteria

  • Define a clear pricing trait/interface for epoch share price resolution.
  • Support direct unit NAV attestation (off-chain unit share price) as the standard default scheme.
  • Support or specify derived net-asset NAV calculation (attested_assets + balance - liabilities) / supply via the abstraction. (Not implemented; see Deviations.)
  • The async-vault epoch lifecycle interacts only through the pricing abstraction.
  • Conversions round in the vault's favour across all supported schemes.
  • Invariant tests verify price preservation and precision boundaries.

Test plan

Automated tests

  1. nix develop -c cargo test -p async-vault — 207 passed.
  2. nix develop -c cargo clippy -p async-vault --all-targets -- -D warnings — clean.

Manual verification

None.

Breaking changes

None.

Checklist

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

Screenshots

None.

@vercel

vercel Bot commented Sep 23, 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 Sep 25, 2026 3:17pm UTC

Request Review

@luchobonatti luchobonatti left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DirectUnitPricing matches today's behaviour and everything is green (212 tests, clippy, fmt, wasm). My doubt is the derived scheme: §8.1 says NAV is attested, not derived, and nothing wires it yet. Thoughts inline. Would you also fill in the PR template?

Comment thread contracts/async-vault/src/pricing.rs Outdated
Comment thread contracts/async-vault/src/pricing.rs Outdated
Comment thread contracts/async-vault/src/epoch.rs Outdated
@hpmaxi

hpmaxi commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

Template filled in.

@hpmaxi
hpmaxi requested a review from luchobonatti September 25, 2026 13:33

@luchobonatti luchobonatti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Derived scheme dropped, one Pricing alias, §8.1 stands. 207 tests, clippy and fmt clean on c660900. Branch is behind main; a rebase before merge.

Extract epoch share price resolution and conversion arithmetic
into the PricingScheme trait.

Provide DirectUnitPricing (default off-chain NAV) and
DerivedNetAssetPricing ((attested + balance - liabilities) / supply).
Conversions round in the vault's favour.

Closes #72
The design attests the share price itself; the derived scheme was unused and read a per-share price as total assets.
@hpmaxi
hpmaxi force-pushed the feat/72-pricing-trait branch from eacb1ae to 1231c14 Compare September 25, 2026 15:17
@hpmaxi
hpmaxi merged commit 142f2d6 into main Sep 25, 2026
3 checks passed
@hpmaxi
hpmaxi deleted the feat/72-pricing-trait branch September 25, 2026 15:31

This branch was successfully deployed

1 active deployment
Preview — 1231c14b Deployed Sep 25, 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.

Support flexible pricing schemes via pricing trait

2 participants