Skip to content

Conversation

@Siddharth2207
Copy link
Contributor

@Siddharth2207 Siddharth2207 commented Oct 29, 2025

Motivation

IAU Price Feed

Checks

By submitting this for review, I'm confirming I've done the following:

  • made this PR as small as possible
  • unit-tested any new functionality
  • linked any relevant issues or PRs
  • included screenshots (if this involves a front-end change)

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for iShares Gold Trust (IAU) as an available price feed source.
  • Tests

    • Extended test coverage to validate the new IAU price feed integration and price retrieval functionality.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 29, 2025

Walkthrough

This PR adds support for a new iShares Gold Trust (IAU) price feed in the Pyth library by introducing IAU price feed constants and integrating them into the lookup functions, accompanied by test coverage.

Changes

Cohort / File(s) Summary
Core price feed addition
src/lib/pyth/LibPyth.sol
Added two new constants: PRICE_FEED_ID_EQUITY_US_IAU_USD (bytes32) and PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_IAU_USD (uint256). Extended getPriceFeedId function with a new branch to handle IAU symbol lookup.
Test coverage for constants
test/src/lib/pyth/LibPyth.constants.t.sol
Added assertion verifying string-to-IntOrAString conversion for Equity.US.IAU/USD.
Test coverage for price feed lookup
test/src/lib/pyth/LibPyth.getPriceFeedId.t.sol
Added test case mapping IAU symbol to its price feed ID. Updated unknown mappings test to exclude IAU from unknown symbols.
Test coverage for price data retrieval
test/src/lib/pyth/LibPyth.getPriceNoOlderThan.t.sol
Added test case for IAU with price (71.99028e5) and confidence (0.07147e5) values at 24-hour max age.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Changes follow a consistent pattern of adding a new price feed constant and corresponding test coverage.
  • No complex logic modifications; primarily additive changes.
  • All modifications are straightforward and homogeneous across test files.

Possibly related PRs

Suggested reviewers

  • hardyjosh
  • thedavidmeister

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "IAU Price Feed" directly and accurately describes the main change in the changeset. The PR adds support for the iShares Gold Trust (IAU) price feed to the Pyth library by introducing new constants and integrating IAU into the price feed lookup mechanism. The title is concise, specific, and avoids vague or generic terminology. A teammate scanning the repository history would immediately understand that this PR adds IAU price feed support without needing additional context.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 2025-10-29-iau

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71ea980 and 8e0404b.

📒 Files selected for processing (4)
  • src/lib/pyth/LibPyth.sol (2 hunks)
  • test/src/lib/pyth/LibPyth.constants.t.sol (1 hunks)
  • test/src/lib/pyth/LibPyth.getPriceFeedId.t.sol (2 hunks)
  • test/src/lib/pyth/LibPyth.getPriceNoOlderThan.t.sol (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: git-clean
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-static)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-legal)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-test)
🔇 Additional comments (6)
test/src/lib/pyth/LibPyth.getPriceNoOlderThan.t.sol (1)

154-159: LGTM!

The test case for IAU follows the established pattern and is consistent with other equity price feed tests in the Base fork context.

test/src/lib/pyth/LibPyth.constants.t.sol (1)

60-63: LGTM!

The constant verification test for IAU is consistent with the existing pattern and properly validates the string-to-IntOrAString conversion.

test/src/lib/pyth/LibPyth.getPriceFeedId.t.sol (2)

60-63: LGTM!

The assertion correctly verifies the IAU price feed ID mapping, maintaining consistency with existing test patterns.


79-79: LGTM!

The exclusion of IAU from the unknown symbols fuzz test is correct and maintains the test's integrity.

src/lib/pyth/LibPyth.sol (2)

133-134: LGTM!

The new branch for IAU in getPriceFeedId follows the established pattern and correctly returns the IAU price feed ID when the symbol matches.


90-95: Verify the IAU price feed ID with Pyth Network documentation before deploying.

Price feeds and their IDs can be fetched via Hermes API, and the complete list of feed IDs is available at https://pyth.network/developers/price-feed-ids. While the constant definitions follow the established pattern and the hex encoding for "Equity.US.IAU/USD" is correct, confirm that the price feed ID 0xf703fbded84f7da4bd9ff4661b5d1ffefa8a9c90b7fa12f247edc8251efac914 exists as a published Pyth feed and matches the official IAU feed before merging.


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.

@Siddharth2207 Siddharth2207 self-assigned this Oct 29, 2025
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.

2 participants