Skip to content

✨ price-feeds: add inverse feed - #821

Open
patitonar wants to merge 1 commit into
mainfrom
inverse-price-feed
Open

patitonar wants to merge 1 commit into
mainfrom
inverse-price-feed

Conversation

@patitonar

@patitonar patitonar commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added support for inverse price feeds, which calculate prices as the inverse of an existing feed. Inverse feeds round results up and reject zero or negative source prices.
    • Markets can now be configured to use inverse price feeds.
  • Bug Fixes
    • Corrected price-feed deployment handling for inverse feed configurations.

@patitonar
patitonar requested a review from cruzdanilo as a code owner October 6, 2026 18:29
@changeset-bot

changeset-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2e0b944

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@exactly/protocol Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T18:35:44.752090Z 2e0b944 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 6f882eda-df0c-4622-8361-3dc941f9cef3
📥 Commits

Reviewing files that changed from the base of the PR and between 2e0b944 and 2e0b944.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Adds PriceFeedInverse, which returns the rounded-up inverse of a source feed’s answer. Market configuration and deployment scripts now support selecting the inverse feed and deploying it with the corresponding Inverted feed address.

Changes

Inverse Price Feed

Layer / File(s) Summary
Inverse calculation and validation
contracts/PriceFeedInverse.sol, test/PriceFeedInverse.t.sol, .gas-snapshot
Adds PriceFeedInverse and tests for its metadata, inverse results, rounding, high-price scaling, auditor pricing, and reverts for zero or negative answers. Updates recorded gas measurements, including entries for the new tests.
Inverse feed configuration and deployment
hardhat.config.ts, deploy/mocks/Assets.ts, deploy/PriceFeeds.ts, .changeset/swift-heron-flips.md
Allows "inverse" in MarketConfig.priceFeed. The mock deployment selects the Inverted feed name for inverse configuration. PriceFeeds deploys PriceFeedInverse with that feed address. Adds a patch-release Changeset for @exactly/protocol.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant PriceFeeds
  participant PriceFeedInverse
  participant tenderlify
  PriceFeeds->>PriceFeedInverse: Deploy with Inverted feed address
  PriceFeedInverse-->>PriceFeeds: Return deployed inverse feed
  PriceFeeds->>tenderlify: Pass deployed feed
Loading

Suggested reviewers: cruzdanilo

Merge Risk: 🔵 Low · up to 2e0b9

The inverse price feed is additive and not yet selected by any market. The only remaining item is aligning its math library with the project convention, which does not affect current deployments.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding an inverse price feed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: f4e1b4b9-0532-4892-a7e2-f75c74041420
📥 Commits

Reviewing files that changed from the base of the PR and between 0d1ca2a and 2e0b944.

📒 Files selected for processing (7)
  • .changeset/swift-heron-flips.md
  • .gas-snapshot
  • contracts/PriceFeedInverse.sol
  • deploy/PriceFeeds.ts
  • deploy/mocks/Assets.ts
  • hardhat.config.ts
  • test/PriceFeedInverse.t.sol

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment thread contracts/PriceFeedInverse.sol

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2e0b9442ff

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread contracts/PriceFeedInverse.sol
Comment thread deploy/mocks/Assets.ts
Comment thread deploy/mocks/Assets.ts
@patitonar
patitonar added this pull request to stack #822 October 6, 2026 18:48
@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.80%. Comparing base (0d1ca2a) to head (2e0b944).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #821      +/-   ##
==========================================
+ Coverage   94.79%   94.80%   +0.01%     
==========================================
  Files          31       32       +1     
  Lines        2745     2751       +6     
  Branches      472      368     -104     
==========================================
+ Hits         2602     2608       +6     
  Misses        142      142              
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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