-
Notifications
You must be signed in to change notification settings - Fork 18
feat: oracle signed context - full stack (Phases 3-7) #2504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Re-export oracle types and functions from the quote crate. | ||
| // This maintains backward compatibility for code in common that uses oracle functionality. | ||
| pub use rain_orderbook_quote::oracle::*; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,7 @@ pub fn build_candidate_from_quote( | |
| output_io_index, | ||
| max_output: data.max_output, | ||
| ratio: data.ratio, | ||
| signed_context: vec![], | ||
| })) | ||
| } | ||
|
|
||
|
|
@@ -102,6 +103,7 @@ pub fn estimate_take_order( | |
| )) | ||
| } | ||
|
|
||
| #[allow(clippy::too_many_arguments)] | ||
| pub async fn execute_single_take( | ||
| candidate: TakeOrderCandidate, | ||
| mode: ParsedTakeOrdersMode, | ||
|
|
@@ -110,7 +112,25 @@ pub async fn execute_single_take( | |
| rpc_urls: &[Url], | ||
| block_number: Option<u64>, | ||
| sell_token: Address, | ||
| oracle_url: Option<String>, | ||
| ) -> Result<TakeOrdersCalldataResult, RaindexError> { | ||
| // Fetch signed context from oracle if URL provided | ||
| let mut candidate = candidate; | ||
| if let Some(url) = oracle_url { | ||
| let body = crate::oracle::encode_oracle_body( | ||
| &candidate.order, | ||
| candidate.input_io_index, | ||
| candidate.output_io_index, | ||
| taker, | ||
| ); | ||
| match crate::oracle::fetch_signed_context(&url, body).await { | ||
| Ok(ctx) => candidate.signed_context = vec![ctx], | ||
| Err(e) => { | ||
| tracing::warn!("Failed to fetch oracle data from {}: {}", url, e); | ||
| } | ||
| } | ||
| } | ||
|
Comment on lines
+117
to
+132
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Recompute the quote-derived limits after fetching the taker-bound oracle context. Line 124 sends the real Also applies to: 136-179 🤖 Prompt for AI Agents |
||
|
|
||
| let zero = Float::zero()?; | ||
|
|
||
| if candidate.ratio.gt(price_cap)? { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.