-
Notifications
You must be signed in to change notification settings - Fork 18
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
base: master
Are you sure you want to change the base?
Conversation
@@ -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 | |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
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
Happy to add anything else needed to meet the standards of this repo!