Point st0x fixed-spread and oracle-limit at 0trade v5 oracle - #52
Conversation
Use oracle.t0trade.com/context/v4 and signer 0xE2f3… so registry consumers of this strategy match 0trade deploys. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds the fixed-spread v5 strategy, updates v4 to use direct oracle pricing, refreshes registry entries, and pins a newer Base token-list commit. ChangesFixed-spread oracle migration
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant calculate_io
participant SignedOracleContext
participant OrderTokenPair
calculate_io->>SignedOracleContext: Read signed oracle data
calculate_io->>OrderTokenPair: Validate the signed token pair
calculate_io->>SignedOracleContext: Validate session, timestamps, expiry, and price bounds
SignedOracleContext-->>calculate_io: Return validated oracle price
calculate_io-->>calculate_io: Set the oracle price as IO
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Point all st0x-fixed-spread-v4 scenarios at the correct t0trade oracle signer. Co-authored-by: Cursor <cursoragent@cursor.com>
Remove session multipliers and ERC4626 dividends sell/buy paths so the strategy quotes the v4 oracle price with guards only. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/st0x-fixed-spread-v4.rain`:
- Around line 144-160: Update the session guard around ensure so oracle-session
must first equal "rth", "premarket", or "afterhours"; only then accept
allowed-session "all" or an exact match with allowed-session. Preserve the
existing rejection message and ensure closed or other inactive sessions cannot
pass either branch.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 12424fa5-7386-4316-ae8e-2032b42eb903
📒 Files selected for processing (3)
registrysettings.yamlsrc/st0x-fixed-spread-v4.rain
Closed or inactive sessions can no longer pass via exact match alone; oracle-session must be rth, premarket, or afterhours first. Co-authored-by: Cursor <cursoragent@cursor.com>
Reject signed oracle prices older than a deployer-configured age so stale quotes cannot be reused for the rest of the session window. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/st0x-fixed-spread-v4.rain`:
- Around line 204-210: Update the validation around the existing “Oracle price
expired” check to first require oracle-publish-time to be less than or equal to
now(), then perform the saturating-sub freshness comparison. Ensure future
publish timestamps are rejected before the age calculation can clamp them to
zero.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0dc3f8d4-debc-4f7c-8f8d-8fcd0d9dcde2
📒 Files selected for processing (3)
registrysettings.yamlsrc/st0x-fixed-spread-v4.rain
🚧 Files skipped from review as they are similar to previous changes (2)
- registry
- settings.yaml
saturating-sub clamps future timestamps to zero age; require publish-time <= now() first so those quotes cannot pass freshness. Co-authored-by: Cursor <cursoragent@cursor.com>
"Oracle publish time in the future" was 33 chars and caused StringTooLong (0x30515bda) on deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
Base interpreter lacks saturating-sub (UnknownWord 0xaedfba2f). Future publish times are already rejected, so plain sub is safe. Co-authored-by: Cursor <cursoragent@cursor.com>
Staleness via sub already rejects future timestamps. Co-authored-by: Cursor <cursoragent@cursor.com>
Point both at oracle.t0trade.com/context/v5 with schema 5 and frame expiry at signed-context slot 8. Drop max-staleness now that expiry covers freshness; rename strategy files and registry keys. Co-authored-by: Cursor <cursoragent@cursor.com>
Oracle clamps frame expiry to session end, so deployers do not choose a session. Keep hard-coded active-session and window guards plus slot-8 expiry. Co-authored-by: Cursor <cursoragent@cursor.com>
Out of scope for this PR; fixed-spread v5 only. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Migrate
st0x-fixed-spreadandst0x-oracle-limitto the 0trade v5 oracle.Strategies
src/st0x-fixed-spread-v5.rain(replaces v4)src/st0x-oracle-limit-v5.rain(replaces v4)st0x-fixed-spread-v5,st0x-oracle-limit-v5Oracle wiring
oracle-url:https://oracle.t0trade.com/context/v5oracle-signer:0xdB665B5ef8Bd04Fd977bB3A64790eaa52749ACccoracle-schema-version:5now() <= signed-context<0 8>()(oracle clamps expiry to session end)Behaviour
rth/premarket/afterhours) + session-window boundsallowed-sessionfield — no session picker; orders follow whatever active session the oracle is signingmax-staleness— superseded by absolute frame expiryChore
settings.yaml+ rootregistryURLs (token-list → settings → registry)Why
st0x.raindex-deploy0trade manifests should consume these strategies fromst0x.registry. With v5, freshness is an oracle-stamped deadline (≤ session end), so session/staleness UI choices are redundant.Test plan
st0x-fixed-spread-v5andst0x-oracle-limit-v5oracle.t0trade.com/context/v5/ signer0xdB665B5e…5; trades revert after slot-8 expirySummary by CodeRabbit
New Features
Updates