Skip to content

docs: more detailed oracle docs#115

Open
bguiz wants to merge 1 commit intomainfrom
docs/oracles-2
Open

docs: more detailed oracle docs#115
bguiz wants to merge 1 commit intomainfrom
docs/oracles-2

Conversation

@bguiz
Copy link
Collaborator

@bguiz bguiz commented Mar 25, 2026

Summary by CodeRabbit

  • Documentation
    • Enhanced Oracle Precompile documentation with expanded content covering three distinct oracle query approaches: native module querying, off-chain Pyth HTTP API usage, and on-chain Pyth integration via Injective EVM.
    • Added supported feeds information and improved documentation structure for enhanced clarity.

@bguiz bguiz requested a review from bangjelkoski March 25, 2026 14:29
@mintlify
Copy link
Contributor

mintlify bot commented Mar 25, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
injective_docs 🟢 Ready View Preview Mar 25, 2026, 2:30 PM

@coderabbitai
Copy link

coderabbitai bot commented Mar 25, 2026

📝 Walkthrough

Walkthrough

Documentation update for the Oracle Precompile guide that restructures price-query approaches into three distinct strategies, adds availability clarifications via updated component blocks, expands content with new sections including supported feeds guidance, and improves overall narrative flow around oracle interactions.

Changes

Cohort / File(s) Summary
Documentation Updates
.gitbook/developers-evm/oracle-precompile.mdx
Added description field to frontmatter, restructured price-query content into three labeled approaches (native oracle module, off-chain Pyth HTTP API, on-chain Pyth via Injective EVM), replaced React Callout components with Info and Warning blocks, added supported feeds section, and expanded guidance on contract address sourcing and price feed ID lookup.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 Three paths to prices, now so clear,
Oracle wisdom gathered here,
Info blocks and warnings bright,
Documentation shining right,
A rabbit's guide to EVM delight!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: expanding and improving documentation for oracle functionality with more detailed content and structure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/oracles-2

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: Brendan Graetz <bguiz@users.noreply.github.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
.gitbook/developers-evm/oracle-precompile.mdx (2)

150-156: ⚠️ Potential issue | 🟠 Major

Unsafe example should use the production-safe method instead.

Line 155 uses getPriceUnsafe while the warning at lines 173–177 recommends getPriceNoOlderThan for production. The pattern of showing unsafe code first, then warning about it, creates unnecessary confusion. Replace the example with the recommended safe method:

Suggested fix
-    const price = await pyth.getPriceUnsafe(priceFeedId);
+    const maxAge = 60; // seconds
+    const price = await pyth.getPriceNoOlderThan(priceFeedId, maxAge);

This aligns with Pyth's documented production pull-model flow and eliminates reader confusion.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.gitbook/developers-evm/oracle-precompile.mdx around lines 150 - 156, The
example uses pyth.getPriceUnsafe (with priceFeedId) which conflicts with the
later recommendation; replace the unsafe call with the production-safe pull
method pyth.getPriceNoOlderThan using the same priceFeedId and passing an
appropriate maxAge (e.g., a timestamp window or seconds) so the snippet
demonstrates the recommended production flow—update the variable usage (price)
and any downstream references to rely on pyth.getPriceNoOlderThan instead of
getPriceUnsafe.

159-161: ⚠️ Potential issue | 🟡 Minor

Fix inverted exponent scaling for positive Pyth exponents.

The code incorrectly handles positive exponents. Since toHumanReadable divides by 10^decimals, passing price.expo when expo > 0 produces price / 10^expo instead of the correct price * 10^expo. The negative exponent branch (negating to (-price.expo)) is correct by coincidence. The positive branch requires a different approach to multiply by the exponent rather than divide.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.gitbook/developers-evm/oracle-precompile.mdx around lines 159 - 161, The
positive-exponent branch is inverted: toHumanReadable(price.price.toString(),
price.expo.toString()) divides by 10^expo but for expo>0 we need to multiply by
10^expo. Change the logic so when price.expo > 0 you pass the negated exponent
to toHumanReadable (e.g., (-price.expo).toString()) and keep the current
negation behavior for non-positive exponents; update the ternary so
toHumanReadable is called with (-price.expo).toString() for the positive branch
while preserving the .toFixed(2)/.toFixed(4) formatting choices.
🧹 Nitpick comments (1)
.gitbook/developers-evm/oracle-precompile.mdx (1)

50-68: Avoid duplicating volatile oracle metadata inline.

Line 50 and Lines 58-68 hardcode values that can drift from upstream. Since you already link canonical sources, prefer framing these as examples and direct users to the source-of-truth pages to reduce doc rot.

Proposed doc tweak
-Currently, Pyth is deployed at `0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320` on Injective's EVM mainnet.
+At the time of writing, Pyth is deployed at `0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320` on Injective's EVM mainnet.
+Always verify the latest address from the official Pyth contract-addresses page above.

 ### Supported feeds
@@
-| INJ/USD  | `0x7a5bc1d2b56ad029048cd63964b3ad2776eadf812edc1a43a31406cb54bff592` |
+| INJ/USD  | `0x7a5bc1d2b56ad029048cd63964b3ad2776eadf812edc1a43a31406cb54bff592` (example; verify latest in Pyth feed registry) |

Also applies to: 145-153

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.gitbook/developers-evm/oracle-precompile.mdx around lines 50 - 68, The
document hardcodes the Pyth deployment address
(0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320) and a full table of price feed IDs
under the "Price feed IDs" / "Supported feeds" sections, which risks doc rot;
update these sections to present the address and feed IDs as illustrative
examples (e.g., label them "example" or "as of <date>") and replace the full
hardcoded table with a short example row (such as INJ/USD) plus a clear pointer
to the canonical Pyth pages you already link (Pyth price feed IDs and network
deployment docs) for the authoritative, up-to-date list; ensure similar changes
are applied to the other repeated block elsewhere in the doc (the second feeds
section).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In @.gitbook/developers-evm/oracle-precompile.mdx:
- Around line 150-156: The example uses pyth.getPriceUnsafe (with priceFeedId)
which conflicts with the later recommendation; replace the unsafe call with the
production-safe pull method pyth.getPriceNoOlderThan using the same priceFeedId
and passing an appropriate maxAge (e.g., a timestamp window or seconds) so the
snippet demonstrates the recommended production flow—update the variable usage
(price) and any downstream references to rely on pyth.getPriceNoOlderThan
instead of getPriceUnsafe.
- Around line 159-161: The positive-exponent branch is inverted:
toHumanReadable(price.price.toString(), price.expo.toString()) divides by
10^expo but for expo>0 we need to multiply by 10^expo. Change the logic so when
price.expo > 0 you pass the negated exponent to toHumanReadable (e.g.,
(-price.expo).toString()) and keep the current negation behavior for
non-positive exponents; update the ternary so toHumanReadable is called with
(-price.expo).toString() for the positive branch while preserving the
.toFixed(2)/.toFixed(4) formatting choices.

---

Nitpick comments:
In @.gitbook/developers-evm/oracle-precompile.mdx:
- Around line 50-68: The document hardcodes the Pyth deployment address
(0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320) and a full table of price feed IDs
under the "Price feed IDs" / "Supported feeds" sections, which risks doc rot;
update these sections to present the address and feed IDs as illustrative
examples (e.g., label them "example" or "as of <date>") and replace the full
hardcoded table with a short example row (such as INJ/USD) plus a clear pointer
to the canonical Pyth pages you already link (Pyth price feed IDs and network
deployment docs) for the authoritative, up-to-date list; ensure similar changes
are applied to the other repeated block elsewhere in the doc (the second feeds
section).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d136de87-aa81-4c83-8497-20f443ed05b1

📥 Commits

Reviewing files that changed from the base of the PR and between 44289a4 and f9bd9e8.

📒 Files selected for processing (1)
  • .gitbook/developers-evm/oracle-precompile.mdx

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