Skip to content

Add QueueForecastFacet and InterestAdminFacet - #1

Merged
vonMangoldt merged 1 commit into
mainfrom
add-queue-forecast-and-interest-admin-facets
Aug 5, 2026
Merged

Add QueueForecastFacet and InterestAdminFacet#1
vonMangoldt merged 1 commit into
mainfrom
add-queue-forecast-and-interest-admin-facets

Conversation

@vonMangoldt

Copy link
Copy Markdown
Member

Publishes the two post-launch facets that are already live and registered on all nine vaults, so the public repo matches the deployed selector surface.

What is included

  • QueueForecastFacet with solveForAmountAfterFulfill(x, y): quotes a solve for y against the queue as it would look after a solver-optimal fill of x, and returns the per-order amounts and the partial take. A UI cannot compute this from chain state that does not exist yet.
  • InterestAdminFacet with setCashedInterest(user, amount): master-only setter for the settled interest bucket (lost-key rescues, grants, write-offs). Keeps the totalCashedInterest accumulator in lockstep and sits behind the same supplyChangeByOwnerNotAllowed latch as mintSupply/burnSupply.
  • Both facets are deploy-slim: they mirror only the storage slots they touch, padded to the exact positions of the deployed diamond layout.
  • Selector library entries (queueForecastSelectors, interestAdminSelectors) and one new event.
  • check_storage_layout.sh pinned-subset phase: slim-facet entries must match the committed layout snapshot by label, slot, offset and type.
  • Full test suites for both facets, including a differential fuzz proving the forecast equals the real post-fulfill quote.

Verification

  • forge build clean on this branch
  • Both new test suites pass: 18 tests, 0 failures
  • script/check_storage_layout.sh passes: diamond + 17 facets identical, 2 slim facets pinned correctly, snapshot matches

Two deploy-slim facets for post-launch selector registration. Instead of inheriting the full declaration chain they mirror only the storage slots they touch, padded to the exact positions of the deployed diamond layout (23.2KB to 2.7KB and 13.6KB to 0.9KB deploy bytecode).

QueueForecastFacet.solveForAmountAfterFulfill(x, y) quotes a solve for y against the queue as it would look after a solver-optimal fill of x, and additionally returns the per-order amounts and the partial take, which a UI cannot read from chain state that does not exist yet. Verified by a differential fuzz: the forecast quoted before equals solveForAmount(y) quoted after a real fulfillOrderBulk(x) executed.

InterestAdminFacet.setCashedInterest(user, amount) is the master-only setter for the settled interest bucket (lost-key rescues, grants, write-offs). It keeps the totalCashedInterest accumulator in lockstep with the delta in both directions, touches only the settled bucket, and sits behind the same supplyChangeByOwnerNotAllowed latch as mintSupply and burnSupply.

check_storage_layout.sh gains a pinned-subset phase: every non-filler entry of a slim facet must match the committed layout snapshot by label, slot, offset and type, so pinning drift fails CI.

Both facets are live and registered on all nine vaults via the timelocked selector proposals.
@vonMangoldt
vonMangoldt merged commit 39ee974 into main Aug 5, 2026
2 checks passed
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