Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
out
cache
cache
.pre-commit-config.yaml
Comment thread
Siddharth2207 marked this conversation as resolved.
144 changes: 118 additions & 26 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 6 additions & 14 deletions src/abstract/PythExtern.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@ abstract contract PythExtern is BaseRainterpreterExternNPE2 {
}

function buildOpcodeFunctionPointers() external pure returns (bytes memory) {
function(OperandV2, StackItem[] memory)
internal
view
returns (StackItem[] memory)[] memory fs = new function(OperandV2, StackItem[] memory)
internal
view
returns (StackItem[] memory)[](OPCODE_FUNCTION_POINTERS_LENGTH);
function(OperandV2, StackItem[] memory) internal view returns (StackItem[] memory)[] memory fs = new function(OperandV2, StackItem[] memory)
internal
view returns (StackItem[] memory)[](OPCODE_FUNCTION_POINTERS_LENGTH);
fs[OPCODE_PYTH_PRICE] = LibOpPythPrice.run;

uint256[] memory pointers;
Expand All @@ -42,13 +38,9 @@ abstract contract PythExtern is BaseRainterpreterExternNPE2 {
}

function buildIntegrityFunctionPointers() external pure returns (bytes memory) {
function(OperandV2, uint256, uint256)
internal
pure
returns (uint256, uint256)[] memory fs = new function(OperandV2, uint256, uint256)
internal
pure
returns (uint256, uint256)[](OPCODE_FUNCTION_POINTERS_LENGTH);
function(OperandV2, uint256, uint256) internal pure returns (uint256, uint256)[] memory fs = new function(OperandV2, uint256, uint256)
internal
pure returns (uint256, uint256)[](OPCODE_FUNCTION_POINTERS_LENGTH);
fs[OPCODE_PYTH_PRICE] = LibOpPythPrice.integrity;

uint256[] memory pointers;
Expand Down
16 changes: 5 additions & 11 deletions src/abstract/PythSubParser.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ abstract contract PythSubParser is BaseRainterpreterSubParserNPE2 {
}

function buildOperandHandlerFunctionPointers() external pure returns (bytes memory) {
function(bytes32[] memory) internal pure returns (OperandV2)[] memory fs = new function(bytes32[] memory)
internal
pure
returns (OperandV2)[](SUB_PARSER_WORD_PARSERS_LENGTH);
function(bytes32[] memory) internal pure returns (OperandV2)[] memory fs =
new function(bytes32[] memory) internal pure returns (OperandV2)[](SUB_PARSER_WORD_PARSERS_LENGTH);
fs[SUB_PARSER_WORD_PYTH_PRICE] = LibParseOperand.handleOperandDisallowed;

uint256[] memory pointers;
Expand All @@ -57,13 +55,9 @@ abstract contract PythSubParser is BaseRainterpreterSubParserNPE2 {
}

function buildSubParserWordParsers() external pure returns (bytes memory) {
function(uint256, uint256, OperandV2)
internal
view
returns (bool, bytes memory, bytes32[] memory)[] memory fs = new function(uint256, uint256, OperandV2)
internal
view
returns (bool, bytes memory, bytes32[] memory)[](SUB_PARSER_WORD_PARSERS_LENGTH);
function(uint256, uint256, OperandV2) internal view returns (bool, bytes memory, bytes32[] memory)[] memory fs = new function(uint256, uint256, OperandV2)
internal
view returns (bool, bytes memory, bytes32[] memory)[](SUB_PARSER_WORD_PARSERS_LENGTH);
fs[SUB_PARSER_WORD_PYTH_PRICE] = pythPriceSubParser;

uint256[] memory pointers;
Expand Down
2 changes: 1 addition & 1 deletion src/generated/PythWords.pointers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pragma solidity ^0.8.25;
// file needs the contract to exist so that it can be compiled.

/// @dev Hash of the known bytecode.
bytes32 constant BYTECODE_HASH = bytes32(0x75f6cf625295be434800bc1143b31558b8835fe1566aaca5960b8d3058a776ff);
bytes32 constant BYTECODE_HASH = bytes32(0xfd467e959e3b5d8cdbb20330135e8de3612b3833714b30b0096e259d314b8a92);

/// @dev The hash of the meta that describes the contract.
bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0xe7bb5842b2cf1d25681a9885109fbf8943495bcebb9ec049bc3790e5db57fa80);
Expand Down
11 changes: 10 additions & 1 deletion src/lib/pyth/LibPyth.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ library LibPyth {
uint256 constant PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_WBTC_USD =
uint256(0x8F43727970746F2E574254432F55534400000000000000000000000000000000);
/// CBBTC/USD
bytes32 constant PRICE_FEED_ID_CRYPTO_CBBTC_USD = 0x2817d7bfe5c64b8ea956e9a26f573ef64e72e4d7891f2d6af9bcc93f7aff9a97;
bytes32 constant PRICE_FEED_ID_CRYPTO_CBBTC_USD =
0x2817d7bfe5c64b8ea956e9a26f573ef64e72e4d7891f2d6af9bcc93f7aff9a97;
// slither-disable-next-line too-many-digits
uint256 constant PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_CBBTC_USD =
uint256(0x9043727970746F2E43424254432F555344000000000000000000000000000000);
Expand Down Expand Up @@ -280,6 +281,12 @@ library LibPyth {
// slither-disable-next-line too-many-digits
uint256 constant PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_RKLB_USD =
uint256(0x924571756974792e55532e524b4c422f55534400000000000000000000000000);
/// SGOV/USD
bytes32 constant PRICE_FEED_ID_EQUITY_US_SGOV_USD =
0x8d6a29bb5ed522931d711bb12c4bbf92af986936e52af582032913b5ffcbf4d5;
// slither-disable-next-line too-many-digits
uint256 constant PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_SGOV_USD =
uint256(0x924571756974792e55532e53474f562f55534400000000000000000000000000);

/// TODO replace with O(1) lookup table.
function getPriceFeedContract(uint256 chainId) internal pure returns (IPyth) {
Expand Down Expand Up @@ -389,6 +396,8 @@ library LibPyth {
return PRICE_FEED_ID_EQUITY_US_BMNR_USD_POST;
} else if (feedSymbol == PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_RKLB_USD) {
return PRICE_FEED_ID_EQUITY_US_RKLB_USD;
} else if (feedSymbol == PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_SGOV_USD) {
return PRICE_FEED_ID_EQUITY_US_SGOV_USD;
} else {
revert UnsupportedFeedSymbol();
}
Expand Down
1 change: 1 addition & 0 deletions test/lib/LibFork.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ uint256 constant FORK_BLOCK_BASE_CRCL = 39622962;
uint256 constant FORK_BLOCK_BASE_PPLT = 39588538;
uint256 constant FORK_BLOCK_BASE_BMNR = 40460679;
uint256 constant FORK_BLOCK_BASE_RKLB = 40582366;
uint256 constant FORK_BLOCK_BASE_SGOV = 44912388;
4 changes: 4 additions & 0 deletions test/src/lib/pyth/LibPyth.constants.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,9 @@ contract LibPythConstantsTest is Test {
LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_RKLB_USD,
IntOrAString.unwrap(LibIntOrAString.fromString2("Equity.US.RKLB/USD"))
);
assertEq(
LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_SGOV_USD,
IntOrAString.unwrap(LibIntOrAString.fromString2("Equity.US.SGOV/USD"))
);
}
}
Loading
Loading