Skip to content

feat: integrate Chainlink and Pyth price feeds for ynETHx:ETH #92

Open
matthiasmatt wants to merge 3 commits intomainfrom
mat/ynETH
Open

feat: integrate Chainlink and Pyth price feeds for ynETHx:ETH #92
matthiasmatt wants to merge 3 commits intomainfrom
mat/ynETH

Conversation

@matthiasmatt
Copy link

This pull request introduces support for Chainlink and Pyth price feeds for the ynETHx:ETH pair and enables aggregation of ynETH:USD pricing by combining these feeds. It also adds the Pyth Network as a new data source, updates the configuration and documentation to reflect these changes, and enhances testing to ensure the new features work as expected.

New Data Sources and Feed Integrations:

  • Added support for Chainlink and Pyth feeds for ynETHx:ETH, including configuration for the Base network and contract address in chainlink.go and symbol mapping in config.go. [1] [2] [3]
  • Introduced the Pyth Network as a new price source, with a full implementation (pyth.go), integration into the source registry (sources.go), and symbol mapping for ynethx:eth and eth:usd. [1] [2] [3]

Aggregate Price Calculation:

  • Implemented logic in AggregatePriceProvider to compute the yneth:usd price by multiplying ynethx:eth with the best available eth:usd (or fallback to ueth:uusd), ensuring robust aggregation.

Configuration and Documentation Updates:

  • Updated README.md to document the new Pyth data source, its configuration, and the new environment variables for the Base network.
  • Updated CHANGELOG.md to reflect the addition of Chainlink and Pyth feeds and the aggregate ynETH:USD pricing.

Testing Enhancements:

  • Added comprehensive tests for the new Pyth source (pyth_test.go), extended aggregate price provider tests to cover the new aggregation logic and fallbacks, and updated Chainlink tests to include the new ynETHx/ETH feed. [1] [2] [3]
  • Added a stub price provider for easier testing of aggregation logic and improved test robustness by skipping unavailable prices instead of failing. [1] [2]

Ethereum Network Support:

  • Added support for the Base network in Ethereum connection utilities, including configuration, connection logic, and tests. [1] [2] [3]

These changes collectively enhance the system’s ability to source and aggregate prices for new assets, improve configurability, and ensure reliability through robust testing.

@matthiasmatt matthiasmatt requested a review from a team as a code owner November 12, 2025 13:46
@matthiasmatt
Copy link
Author

Tested on localnet:

❯ nibid q oracle exchange-rates| jq .
{
  "exchange_rates": [
    {
      "pair": "b2btc:btc",
      "exchange_rate": "1.000000000000000000"
    },
    {
      "pair": "eth:usd",
      "exchange_rate": "3202.390000000000000000"
    },
    {
      "pair": "susda:usda",
      "exchange_rate": "1.091440110782436700"
    },
    {
      "pair": "uatom:uusd",
      "exchange_rate": "2.845000000000000000"
    },
    {
      "pair": "ubtc:uusd",
      "exchange_rate": "95759.100000000000000000"
    },
    {
      "pair": "ueth:uusd",
      "exchange_rate": "3204.240000000000000000"
    },
    {
      "pair": "unibi:uusd",
      "exchange_rate": "0.013624000000000000"
    },
    {
      "pair": "usda:usd",
      "exchange_rate": "0.990928816247482200"
    },
    {
      "pair": "usol:uusd",
      "exchange_rate": "142.130000000000000000"
    },
    {
      "pair": "ustnibi:unibi",
      "exchange_rate": "1.384400431535055300"
    },
    {
      "pair": "uusdc:uusd",
      "exchange_rate": "1.000600000000000000"
    },
    {
      "pair": "uusdt:uusd",
      "exchange_rate": "1.001700000000000000"
    },
    {
      "pair": "ynethx:eth",
      "exchange_rate": "1.062980920000000000"
    }
  ]
}

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