feat: st0x-fixed-spread-v6 asserts the signed vault NAV ratio (RAI-1721) - #54
Merged
Merged
Conversation
hardyjosh
force-pushed
the
2026-08-13-st0x-fixed-spread-v6
branch
from
August 13, 2026 11:03
be54c72 to
a08b253
Compare
hardyjosh
force-pushed
the
2026-08-13-st0x-fixed-spread-v6
branch
from
August 20, 2026 13:29
a08b253 to
8a425c5
Compare
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TQ3QV1QrwmaS7ACSf7cds7
v6 of the ST0x fixed-spread strategy consumes /context/v6, which signs the vault NAV ratio at slot 9 as the lossless Rain Float packing (18 decimals) of the wt vault's raw convertToAssets(1e18). At settlement the strategy reads the vault's live value via erc4626-convert-to-assets (rainlanguage/rain.erc4626.words, 0xd69dC3d58a7C875117f9c7cecF4F1A7f3CA47254 on Base) and requires numeric equality - exact, since lossless packing at fixed decimals is injective on values - so a fill can never straddle a NAV step. The assertion is unconditional: this strategy only deploys on wt pairs, a real vault NAV ratio is never zero, so a zero signed ratio (upstream not publishing) fails the equality and halts fills rather than settling unprotected. Two deployments (sell shares / buy shares) wire the vault address from the order's own IO tokens per scenario, dia-limit style. v5 remains live alongside. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TQ3QV1QrwmaS7ACSf7cds7
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TQ3QV1QrwmaS7ACSf7cds7
hardyjosh
force-pushed
the
2026-08-13-st0x-fixed-spread-v6
branch
from
August 22, 2026 11:05
8a425c5 to
3e4f44e
Compare
Adds a workflow that checks out rainlanguage/raindex (feat/st0x-v6-nav-fork-test) and runs RaindexV6St0xNavForkTest using PRIVATE_BASE_RPC_URLS. Covers the quote+take happy path and NAV-step revert for RAI-1721 / PR #54. Co-authored-by: Cursor <cursoragent@cursor.com>
Collaborator
NAV fork validation (RAI-1721)Added CI so this PR’s vault NAV bind can be exercised on a Base fork without bolting Foundry into the registry itself. What runs
How to re-run
Local equivalent: BASE_MAINNET_RPC_URL=<rpc> forge test --match-contract RaindexV6St0xNavForkTest -vvv(from a raindex checkout on that branch) |
PRIVATE_BASE_RPC_URLS may include non-eth endpoints; pick the first candidate that answers eth_blockNumber, falling back to mainnet.base.org. Co-authored-by: Cursor <cursoragent@cursor.com>
Collaborator
✅ NAV fork CI greenLatest run: https://github.com/ST0x-Technology/st0x.registry/actions/runs/32760813301 Both |
Collaborator
Fork test sourceThe Foundry harness lives in raindex (not this registry repo): Branch: |
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.
What
Adds
src/st0x-fixed-spread-v6.rain(+ companionsrc/st0x-fixed-spread-v6.md) — v6 of the ST0x fixed-spread strategy, implementing the strategy half of RAI-1721 (RAI-1479: vault NAV ratio asserted at settlement). The v5 strategy is untouched and remains live until v6 deploys; versions live side by side.How it works
oracle-urlmoves tohttps://oracle.t0trade.com/context/v6andoracle-schema-versionto 6. Slots 0–8 are identical to v5; slot 9 carries the vault NAV ratio as the lossless Rain Float packing, at 18 decimals, of the vault's rawconvertToAssets(1e18)— the exact value the pricing model priced the quote against.erc4626-convert-to-assetsfrom rainlanguage/rain.erc4626.words, deployed on Base at0xd69dC3d58a7C875117f9c7cecF4F1A7f3CA47254and bound aserc4626-subparserin both scenarios. The share amount is the Float literal1(one whole share), which at the vault's 18 share decimals converts losslessly to the raw1e18probe; the word returns the vault's answer Float-packed at the underlying asset's 18 decimals.equal-to, and that is exact: lossless packing of the same raw value at the same decimals is injective on values, so numeric equality of the two Floats is equivalent to bit-for-bit equality of the raw ratios — while staying robust to any normalization difference between the server's Rust packing and Solidity'sLibDecimalFloat. A fill can therefore never straddle a NAV step (e.g. a dividend deposit).convertToAssetsis never zero, so a zero signed ratio fails the equality and the fill reverts. An upstream that stops publishing ratios halts fills on this strategy rather than letting them settle unprotected — that is intended. v5 covers pairs without a vault side (documented in the strat and the .md).wt-vault: ${order.outputs.0.token.address}) and buy shares (wt-vault: ${order.inputs.0.token.address}). No manually-entered vault address.st0x-fixed-spread-v6line added, matching the pin convention of Point st0x fixed-spread and oracle-limit at 0trade v5 oracle #52/Add SFT HyperEVM subgraph URL #53.Dependencies
Deploy sequencing: RAI-1754 + RAI-1755 before RAI-1757. This strategy is only viable once both upstreams are live:
/context/v6(Mirror the 14 Base-only tokens onto the Ethereum and HyperEVM token lists #64, branchfeat/context-v6-nav-ratio, signing slot 9 as the lossless 18-decimal Float packing). Until then the oracle URL serves nothing.Only then does RAI-1757 (deploying this strategy) go ahead.
Validation
erc4626-subparserbound to the deployed address in both scenarios.LibERC4626.convertToAssets: shares Float →toFixedDecimalLosslessat share decimals; outputfromFixedDecimalLosslessPackedat asset decimals) and its parse tests, which callerc4626-convert-to-assets(<vault> 1)for one share; on-chain code confirmed at the Base address.scripts/build-public-registry-data-uri.shandscripts/build-private-registry-artifact.shboth build green with the new registry line (the repo has no PR-triggered CI; both workflows areworkflow_dispatch).🤖 Generated with Claude Code
https://claude.ai/code/session_01TQ3QV1QrwmaS7ACSf7cds7
Closes RAI-1721