Skip to content

Add Stork Oracle Adapter #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

harryrackmil
Copy link

@harryrackmil harryrackmil commented Apr 10, 2025

Change

Adding a Euler Oracle Adapter for Stork's EVM Contract.

The code borrows from the existing Chainlink and Pyth adapters, as well as from the Chainlink and Pyth adapter tests.

Testing

  • All Stork adapter tests passing locally
  • The fork test pointing at the live Stork contract on Ethereum Mainnet is also passing

Happy to add anything else needed to meet the standards of this repo!

@@ -94,6 +94,7 @@ An adapter's parameters and acceptance logic are easily observed on-chain.
| ------------------------------------------------------------------- | -------- | ------ | ----------------------- | -------------------------------------------- |
| [ChainlinkOracle](src/adapter/chainlink/ChainlinkOracle.sol) | External | Push | Provider feeds | feed, max staleness |
| [ChronicleOracle](src/adapter/chainlink/ChronicleOracle.sol) | External | Push | Provider feeds | feed, max staleness |
| [StorkOracle](src/adapter/stork/StorkOracle.sol) | External | Pull | Provider feeds | feed, max staleness |
Copy link
Author

Choose a reason for hiding this comment

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

grouped the Stork Oracle with the other External Pull oracles

@@ -0,0 +1,14 @@
pragma solidity ^0.8.0;

interface IStorkTemporalNumericValueUnsafeGetter {
Copy link
Author

Choose a reason for hiding this comment

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

The minimal required interface to get prices from our contract

/// @custom:security-contact [email protected]
/// @author Stork Labs (https://www.stork.network/)
/// @notice PriceOracle adapter for Stork price feeds.
contract StorkOracle is BaseAdapter {
Copy link
Author

Choose a reason for hiding this comment

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

Modeled on the existing PythOracle adapter.

Slightly simplified since Stork doesn't have a concept of confidence intervals, and doesn't have different exponents for different feeds (every value is multiplied by 10**18)

StorkOracle oracle;

address storkContractAddress = 0x035B5438444f26e6Aab81E91d475b7B1Ac4Fb22b;
bytes32 feedId = 0x7404e3d104ea7841c3d9e6fd20adfe99b4ad586bc08d8f3bd3afef894cf184de; // BTCUSD
Copy link
Author

Choose a reason for hiding this comment

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

I'm just hardcoding this value here since feed IDs aren't used in any other tests.

Would it be helpful if we added a StorkFeeds.sol file in the test directory with all of our feeds like you have for other oracles? Or is that just used for testing?

vm.warp(s.timestamp);
}

function setUpOracle(FuzzableState memory s) internal {
Copy link
Author

Choose a reason for hiding this comment

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

separated this out from SetUpState to get the test_Constructor_RevertsWhen_MaxStalenessTooHigh unit test to pass - when the oracle was constructed at the end of setUpState (as it was for PythOracleHelper) vm.expectRevert() wasn't catching the revert correctly.

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