Skip to content

feat: multi-asset treasury, price oracle adapter and resource hint injector (Closes #541, #542, #543) - #657

Merged
Mikey-222 merged 8 commits into
Hel-Phone:mainfrom
precious-akpan:feat/541-542-543-treasury-hints-oracle
Sep 25, 2026
Merged

Mikey-222 merged 8 commits into
Hel-Phone:mainfrom
precious-akpan:feat/541-542-543-treasury-hints-oracle

Conversation

@precious-akpan

Copy link
Copy Markdown
Contributor

Closes #541
Closes #542
Closes #543

#541 Aegis Vault multi-asset treasury

  • contracts/aegis_vault was a one-line stub, so it is rebuilt to match the existing tests and frontend ABI (fund_zone still takes the 160-byte public-inputs prefix).
  • New treasury.rs: per-asset reserves, daily disbursement caps (UTC day) enforced in claim_aid and treasury_withdraw, target weights, and a read-only rebalance_plan(prices). The vault never swaps; execution is off-chain or via a DEX adapter.
  • A claim over the cap fails with DailyLimitExceeded before the nullifier is burned or funds move.
  • Dashboard: TreasuryPanel in VaultDashboard.jsx shows live reserves and cap usage (15 s refresh); getTreasurySnapshot, getTreasuryRebalancePlan, setTreasuryDailyLimit in contract.ts; types in src/types/index.ts.

#543 Price feed oracle adapter

  • New contracts/helphone_dao/src/oracle.rs for SEP-40 feeds (Reflector): quote_conversion (e.g. XLM/USDC) and disburse_aid.
  • Stale guard: a price older than 1 hour aborts with StalePrice; one stale leg rejects the conversion. Missing, non-positive and future-dated prices are rejected too.
  • Frontend: getOracleQuote maps contract error codes to friendly messages; dashboard quote form. Needs VITE_HELPHONE_DAO_ID.
  • The DAO crate did not compile on main (syntax errors, no total_supply client, non-Copy error enum). Fixed here so the oracle is testable, with new governance tests.

#542 Resource hint injector & module preloading

  • src/lib/resourceHints.ts: deduplicated dns-prefetch / preconnect / modulepreload injection (same-origin only for modulepreload) and hover/focus/touch intent prefetch of route chunks, skipped on save-data / 2g.
  • index.html static hints; vite.config.ts drops heavy mapbox/zk chunks from the entry HTML preload list for FCP; main.tsx wires it up. App.tsx needed no change because the listener is delegated.
  • Docs: docs/performance-optimization.md.

Other

  • Root Cargo.toml was a stray comment; now a valid workspace of aegis_vault and helphone_dao. New contracts CI job runs cargo test --workspace --locked.
  • soroban-contract.md documents the treasury and oracle.

Test evidence

  • cargo test --workspace --locked: aegis_vault 27 passed, helphone_dao 19 passed
  • npx vitest run test/resource-hints.test.js test/treasury-vault.test.js test/price-oracle.test.js: 55 passed
  • Coverage: resourceHints.ts 100% lines / 94% branches; treasury.ts and TreasuryPanel.jsx 100% lines / 98% branches. Rust paths are covered by the new tests, including stale boundary (exactly 3600 s ok, 3601 s rejected) and daily-cap reset.

Notes: I could not run the full JS suite or the wasm build locally (the @creit-tech/stellar-wallets-kit dependency does not resolve from npm here). The wasm release build and stellar contract build are unverified. #540 is in a separate PR (#648) and both append jobs to ci.yml, so whichever merges second needs a trivial rebase.

@drips-wave

drips-wave Bot commented Sep 24, 2026

Copy link
Copy Markdown

@precious-akpan Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@precious-akpan
precious-akpan force-pushed the feat/541-542-543-treasury-hints-oracle branch from acc3bcc to 16a17b3 Compare September 24, 2026 22:32
Root Cargo.toml was a stray comment, so no contract crate could build. Declare aegis_vault and helphone_dao as members and move the release profile to the workspace root.

Signed-off-by: Precious Akpan <49040483+precious-akpan@users.noreply.github.com>
Closes Hel-Phone#541)

Rebuild aegis_vault and add treasury.rs: per-asset reserves, daily caps enforced in claim_aid and treasury_withdraw, target weights and a read-only rebalance plan.

Signed-off-by: Precious Akpan <49040483+precious-akpan@users.noreply.github.com>
…el-Phone#543)

Add oracle.rs, quote_conversion and disburse_aid. Prices older than 1 hour abort with StalePrice. Also fixes compile errors in the DAO crate and adds governance tests.

Signed-off-by: Precious Akpan <49040483+precious-akpan@users.noreply.github.com>
…one#541, Hel-Phone#543)

Add treasury and oracle client reads, error mapping, TreasuryPanel and a live quote form on VaultDashboard.

Signed-off-by: Precious Akpan <49040483+precious-akpan@users.noreply.github.com>
…Closes Hel-Phone#542)

Inject dns-prefetch/preconnect/modulepreload at runtime, prefetch route chunks on hover/focus/touch, and drop heavy chunks from the entry HTML preload list.

Signed-off-by: Precious Akpan <49040483+precious-akpan@users.noreply.github.com>
Covers Hel-Phone#541, Hel-Phone#542 and Hel-Phone#543.

Signed-off-by: Precious Akpan <49040483+precious-akpan@users.noreply.github.com>
Signed-off-by: Precious Akpan <49040483+precious-akpan@users.noreply.github.com>
@precious-akpan
precious-akpan force-pushed the feat/541-542-543-treasury-hints-oracle branch from 16a17b3 to 1e8b614 Compare September 25, 2026 08:42
@Mikey-222
Mikey-222 merged commit 0c1213a into Hel-Phone:main Sep 25, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants