Repository navigation
Add query tokenizer contract - #43
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new “Query Tokenizer” protocol surface to let users prepay oracle query fees by minting/burning per-universe ERC20 query-right tokens, and wires the Multiverse + deploy flow to support tokenizer-priced query creation.
Changes:
- Introduces
QueryTokenizer+ per-universeQueryTokencontracts, along withIQueryTokenizer/IQueryTokenand anIMultiversesubset contract. - Extends
Multiversewith tokenizer-specific query creation (createQueryFromTokenizer) and one-call mint pricing (getMintPricing), plus refactors volume cache rolling. - Adds comprehensive unit + fuzz tests and updates existing test suites/fixtures to account for the new constructor arg and fork-threshold unit conversions.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/QueryTokenizer.t.sol | New unit tests for QueryTokenizer mint pricing, mint, redeem, and token ownership behaviors. |
| test/unit/QueryTokenizer.fixtures.sol | New fixtures wiring QueryTokenizer ↔ Multiverse and providing mint/redeem helpers. |
| test/unit/Multiverse.tokenizer.t.sol | New tests for Multiverse’s tokenizer-facing surfaces. |
| test/unit/Multiverse.report.t.sol | Updates fork-threshold assertions to use wREP-converted threshold helper. |
| test/unit/Multiverse.queryFee.t.sol | Updates cap/threshold assertions to use wREP-converted cap helper. |
| test/unit/Multiverse.profits.t.sol | Updates Multiverse harness deployment for new constructor arg. |
| test/unit/Multiverse.fixtures.sol | Adds tokenizer stub + wREP threshold/cap helpers; updates Multiverse deployment signature. |
| test/unit/Multiverse.constructor.t.sol | Updates constructor tests for new QUERY_TOKENIZER immutable and zero-address check. |
| test/invariant/Multiverse.invariant.t.sol | Updates invariant fork-threshold logic to use wREP-converted threshold helper. |
| test/fuzz/QueryTokenizer.fuzz.t.sol | New fuzz properties for pool accounting and mint price formula/cap. |
| test/fuzz/Multiverse.resolve.fuzz.t.sol | Updates fuzz bounds to use wREP cap helper. |
| test/fuzz/Multiverse.createQuery.fuzz.t.sol | Updates fuzz cap computation to use wREP cap helper. |
| src/QueryTokenizer.sol | New core tokenizer contract implementing mint/redeem and pricing via Multiverse. |
| src/QueryToken.sol | New per-universe ERC20 controlled by the tokenizer (owner-only mint/burn). |
| src/Multiverse.sol | Implements IMultiverse, adds tokenizer query creation + mint pricing surface, adjusts fee cap units, refactors volume-cache logic, and clamps first-report bond behavior. |
| src/interfaces/IQueryTokenizer.sol | New tokenizer interface. |
| src/interfaces/IQueryToken.sol | New per-universe query token interface. |
| src/interfaces/IMultiverse.sol | New Multiverse subset interface needed by tokenizer + deploy script. |
| script/Deploy.s.sol | Updates deploy order to include QueryTokenizer and wires it to Multiverse. |
Suppressed comments (1)
src/QueryTokenizer.sol:109
_mintPricewill perform an external call onmultiverse_even when the tokenizer hasn’t been wired yet, which currently results in a low-level revert against address(0). Add an explicit guard so callers get a deterministic, self-explanatory revert.
function _mintPrice(IMultiverse multiverse_, uint248 universeId) internal view returns (uint256, ILituusRep) {
(uint256 uncappedFee, uint256 cap, ILituusRep repToken) = multiverse_.getMintPricing(universeId);
uint256 price = uncappedFee * PREMIUM_NUMERATOR / PREMIUM_DENOMINATOR;
return (price > cap ? cap : price, repToken);
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
viatrix
marked this pull request as ready for review
September 1, 2026 15:00
Xaleee
approved these changes
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #16