Skip to content

Add FireHorseConsumer Chainlink signal consumer contract#4

Open
jpbpari-sys wants to merge 1 commit intomainfrom
codex/add-trading-logic-to-autotrade
Open

Add FireHorseConsumer Chainlink signal consumer contract#4
jpbpari-sys wants to merge 1 commit intomainfrom
codex/add-trading-logic-to-autotrade

Conversation

@jpbpari-sys
Copy link
Copy Markdown
Owner

Motivation

  • Provide a minimal on-chain Chainlink consumer that decodes an oracle-encoded trading signal into LONG/SHORT and expose an owner-gated hook for future DEX execution.

Description

  • Add FireHorseConsumer.sol which includes SPDX and pragma, imports AggregatorV3Interface, stores oracle and owner, implements getSignal() mapping answer == 1 to "LONG" and otherwise "SHORT", and provides an autoTrade() owner-only stub for integrating DEX logic.

Testing

  • No Solidity toolchain is configured in this repository, so no compilation or automated Solidity tests were executed.

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: 16daaa4d08

ℹ️ 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 getSignal() public view returns (string memory) {
(, int256 answer, , , ) = oracle.latestRoundData();
return answer == 1 ? "LONG" : "SHORT";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Validate oracle answers instead of defaulting to SHORT

getSignal() maps every non-1 response to "SHORT", so any unexpected oracle value (for example 0, 2, or a temporary bad payload) is treated as an active short signal. In contexts where autoTrade() will execute positions, this can flip strategy decisions on invalid data rather than failing safely; handle only explicitly supported encodings and revert/hold for anything else.

Useful? React with 👍 / 👎.

address public owner;

constructor(address _oracle) {
oracle = AggregatorV3Interface(_oracle);
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 Reject invalid oracle address at deployment

The constructor accepts _oracle without validation, so a misconfigured deployment (e.g., address(0) or a non-aggregator address) will leave the contract unable to return a signal because latestRoundData() cannot be decoded as expected. Failing fast in the constructor with an address/code check prevents shipping a permanently broken consumer.

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