Skip to content

Add FireHorsePriceConsumer Chainlink ETH/USD feed consumer (Sepolia)#3

Open
jpbpari-sys wants to merge 1 commit intomainfrom
codex/add-off-chain-signal-integration-logic
Open

Add FireHorsePriceConsumer Chainlink ETH/USD feed consumer (Sepolia)#3
jpbpari-sys wants to merge 1 commit intomainfrom
codex/add-off-chain-signal-integration-logic

Conversation

@jpbpari-sys
Copy link
Copy Markdown
Owner

Motivation

  • Provide a simple on-chain Chainlink price consumer for ETH/USD to be used by oracles or strategy checks.
  • Offer a convenience checkSignal() helper that maps price into a simple LONG/SHORT decision for downstream logic.

Description

  • Add FireHorsePriceConsumer.sol which imports AggregatorV3Interface and initializes the Sepolia ETH/USD feed at 0x694AA1769357215DE4FAC081bf1f309aDC325306 in the constructor.
  • Implement getLatestPrice() to return the latest answer from latestRoundData() (price is returned scaled by 10^8).
  • Implement checkSignal() which returns "LONG" if price > 3000 * 10**8 and "SHORT" otherwise.
  • Commit the new file and open a PR with the added contract.

Testing

  • Ran solc --version to attempt compilation, but this failed because solc is not installed in the environment (failed).
  • Verified repository status with git status --short which listed the new file (succeeded).
  • Displayed the new file contents with nl -ba FireHorsePriceConsumer.sol to confirm the source (succeeded).

Codex Task

Copy link
Copy Markdown

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

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: cecb0a73b6

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

function getLatestPrice() public view returns (int) {
(, int price,,,) = priceFeed.latestRoundData(); // Returns price * 10^8
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate round freshness before using Chainlink answer

getLatestPrice() ignores the metadata returned by latestRoundData(), so checkSignal() can make LONG/SHORT decisions from stale or incomplete rounds when the feed is delayed or recovering. In those scenarios the contract returns a seemingly valid signal from outdated data, which can corrupt downstream strategy logic; add round-validity checks (for example updatedAt != 0 and answeredInRound >= roundId, plus an optional staleness window) before accepting price.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant